Sum of weights from histogram?

Hi everyone,

Is there a way to get the total sum of weights from a histogram filled with weighted entries? It looks like this is kept track of in the TH1 member fTsumw but how do I get it out? I know about GetSumOfWeights() but that only returns the sum of the weights in the bins ‘in range’, not the under/overflows.

Should I use the Integral(0,nBins+1) to get the total sum of weights including under/overflows?

Thanks,
Jeroen

Goeie avond Jeroen,
TH1::GetSumw2() should get you there.
Cheers, Axel.

Hi Axel,

Isn’t that the sum of the squares of the weights? According to the documentation (and the code) it is :wink:

But you indeed picked the point where I got a bit confused. Looking at TH1::Fill(Double_t x, Double_t w), I can see that fSumw2 and fTsumw2 seem to do the same thing but only fSumw2 can be accessed from outside. And there seems to be no equivalent like that for fTsumw.

Cheers,
Jeroen

Hi Jeroen,

Yes, this is the right call if you want to include under/overflows

Rene