To figure out how ROOT calculates bin errors when filling histogram bins, I’ve made a script that fills the histogram in different ways with Sumw2() options turned on and off. (attached). Script output is below.
Couple of results are unexpected for me:
A. Fill with weight leads to set error=bin content (cases 1-2), why?
B. Fill with Sumw2(kTRUE) skip error calculations (cases 7-10), why?
Division works as expected - correct value for Sumw2(kTRUE).
root [0] .x sumw2_test.C
Info in <sumw2_test>: I. Fill histo to 100 by different methods:
Info in <sumw2_test>: 1. Sumw2 histo filled with Fill(x,100): 100 +/- 100
Info in <sumw2_test>: 2. None-sumw2 histo filled with Fill(x,100): 100 +/- 100
Info in <sumw2_test>: 3. Sumw2 histo filled 100 times with Fill(x[,1]): 100 +/- 10
Info in <sumw2_test>: 4. None-sumw2 histo filled 100 times with Fill(x[,1]): 100 +/- 10
Info in <sumw2_test>: 5. None-sumw2 histo filled with SetBinContent=100: 100 +/- 10
Info in <sumw2_test>: 6. None-sumw2 histo filled with AddBinContent=100: 100 +/- 10
Info in <sumw2_test>: 7. Sumw2 histo filled with SetBinContent=100 and zero Entries: 100 +/- 0
Info in <sumw2_test>: 8. Sumw2 histo filled with AddBinContent=100 and zero Entries: 100 +/- 0
Info in <sumw2_test>: 9. Sumw2 histo filled with SetBinContent=100 and none-zero Entries(=100): 100 +/- 0
Info in <sumw2_test>: 10.Sumw2 histo filled with AddBinContent=100 and none-zero Entries(=100): 100 +/- 0
Info in <sumw2_test>: II. Divide same histos with errors:
Info in <sumw2_test>: 11. None-sumw2 histo: 100+/-10 divide on 100+/-10: 1 +/- 1
Info in <sumw2_test>: 12. Sumw2 histo: 100+/-10 divide on 100+/-10: 1 +/- 0.141421
sumw2_test.C (4.3 KB)