Error per bin Calculation

I have 2 histograms- One with weight 1 and the other has variable weights. I use histogram.Sumw2() for both and I normalize both.

I try to obtain the error per bin using:

for i in range(bin):
error = histo.GetBinError(i)


for i in range(bin):
data = histo.GetBinContent(i)

Now for the histogram with weight 1, the error should be sqrt(bin contents). Right?
But it isn’t so!

Am I wrong somewhere? Could someone help!


Yes the error for the histogram filled with all weights equal to 1 is the square root of the content.
If it is different is because you have either filled the histogram with weights different than one or you have set explicitly a bin error.

We can help solving your problems if you post a runnable ROOT macro (in C++ or Python) showing the issue


@moneta Thank you so much! I could find the error and correct it :slight_smile:

It works now!

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