Hierarchical error estimates for the energy functional in obstacle problems