Get total energy from an histogram

I added some small notes about the error in the old post.