Keeping Track of Mean Weights in Histograms

Hello,

I’m looking for the simplest way to compute the mean weight used in each bin in a histogram. I read through the TH1 class pretty closely, but I thought that maybe somebody who has more experience might have some insight.

As far as I can tell the total number of entries in each bin is not stored in a histogram, so I will need to create another histogram with the same binning to keep track of this on my own. I can just divide by this new histogram, but this will change the error bars in an undesirable way because it assumes error in the second histogram.

The best solution that I can come up with is to go through each bin in the second histogram individually and set the error to 0 before dividing. Will this have the effect that I’m hoping for? Will the error keep on working the way I want it to with Sumw2 in the new histogram?

Thank you very much for any advice!

see class TProfile

Rene