Updating pixel hit efficiency

This is the same code to update the pixel hit efficiency as committed in PR#2621, but now including changes that were made in PR#2578.