Dear ROOT users,
I was using 2 TH1F histograms h_m and h_n to compute efficiency: h_\varepsilon = h_{m}/h_{n}:
TH1.SetDefaultSumw2()
# ... fill h_m and h_n
h_eff = TH1F(h_m)
h_eff.Divide(h_n)
According to the references it seems ROOT can handle errors properly by calling TH1::SetDefaultSumw2(). But when I checked the errors I found it is not equal to the value calculated by error propagation formula:
Hi, TH1::Divide use this error propagation you have above. If you use the option 'B` assumes a binomial distribution.
in your case, I cannot reproduce your problem. This gives me the correct result (sigma = 0.105805)
TH1::SetDefaultSumw2(true);
TH1D h1("h1","h1",1,0,1);
TH1D h2("h2","h2",1,0,1);
h1.SetBinContent(1,10);
h2.SetBinContent(1,34);
// need to set the bin error if you have default sumw2
h1.SetBinError(1,sqrt(10.));
h2.SetBinError(1,sqrt(34.));
TH1D h3 = h1;
h3.Divide(&h2);
std::cout << h3.GetBinError(1) << std::endl;
please share the full code, so I can see the error
When the first time I ran that notebook, I forgot to call ROOT.RH1.SetDefaultSumw2(True), so I created and ran a new cell with ROOT.RH1.SetDefaultSumw2(True). After that I ran the division cell again, thinking the ROOT.TH1F may create a new instance of h1 with correct error which actually did not.