Calculation error in histogram using root

Dear all,

I have a histogram containing 5 bins attached in the file with the name “hist_all_bkg_4e”, this histograms comes from other histograms in the file which have in their name “4e”. The histograms are first filled with their weight, then normalized (by their cross section, lumi,…) and merged to get “hist_all_bkg_4e”. To get the error on bin 2 for instance I do:

hist_all_bkg_4e->Sumw2();
double Error_all_bkg_4e_A = hist_all_bkg_4e->GetBinError(2);

and as you can see the error is only: 2.66, while the number of events in bin 2 is 492.499, so the error 2.66 seems to be small if I compared for instance with sqrt(492.499), so I am wondering if the way I calculated the error is correct.
Could anyone help please ?summary.root (117.4 KB)
if needed I can give you the link of my git where you can find my entire code.

Best Regards,

DIallo.


ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Try:

hist_all_bkg_4e->Sumw2(kFALSE); hist_all_bkg_4e->Sumw2(kTRUE); // "regenerate"

BTW. If your histograms come from ROOT 6 and they were filled with “weights” not equal to 1 (so that “Sumw2” was automatically called for them) and “scaled” afterwards then all errors should be correct (even if you think that they are too small). If you create histograms with ROOT 5, you need to manually call “Sumw2” before you fill them.

ok got it, thanks :slight_smile:

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