How to calculate error in ROOT

Dear expert,

I am using ROOT to draw histograms with statistics errors. I know that TH1::Sumw2() can store and calculate errors. However I don’t understand why the formula of Sumw2() is like this:
sqrt(sum of squared weight).

For example, if I fill a bin with 1 for 10 times, the error ROOT gives would be sqrt(10). However that is hard to understand, because the 10 numbers are identical and the error should be 0. Is there any reference that can answer why Sumw2() uses this formula?

Thank you very much!

Maybe you are looking for: TH1::GetStdDev

Hi, thanks for your reply. Actually my confusion is that why not use standard variation to calculate the error for each bin.
For your suggestion, it seems that TH1::GetStdDev is for the whole histogram, not for each bin. So that is not what I am concerned now.

I’m afraid you need to look into some statistics book then (search for “random / statistical errors”).

Hi, thanks for your reference. After reading it, I got to know the definition of statistics error, or random error. However, how can I relate this to Sumw2 in ROOT?

For example, if I fill a bin with weight 10, then ROOT gives that bin content is 10 and bin error is also 10 if I call Sumw2(). However, if I use the method in the book you refer to me, think about this, I measure something once, which obeys Poisson distribution, and get the number 10, then the mean is 10, and the standard error for this mean should be sqrt(10)/1 = sqrt(10), which is different from the error ROOT gives. Is this correct?

1 Like

Hi,

Actually I am plotting histograms of dN/dpT in pp and AA simulations. So the bin content represents the yield in each pT bin. So I think it is OK if ROOT also assumes Poisson distribution.

For the weighted counts, the “weight” could be energy if I want to plot dE/deta instead of dN/deta. So I really need to know how ROOT does the error analysis, i.e. how the formula of Sumw2() is derived. Could you have a look at my last post and give some comments?

Hi,

This simple blog explains why the bin error for weighted histogram is equal to the square root of their the sum of the bin weight square.

https://www-zeuthen.desy.de/~wischnew/amanda/discussion/wgterror/working.html

Another derivation is also here

http://www.hep.uiuc.edu/e687/memos/weight_err.ps

Lorenzo

Hi, these are exactly what I want. Thanks guys!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.