Hi,
I’m interested in calculating efficiency with its errors for the case when both total
and passed
values are floats (and not integers). The issue I’m having is shown in the excerpt below. There the first bin of that histogram represents the total
values and the second one represents passed
values. After that I feed the contents of these two bins to a TEfficiency
object and calculate selection efficiency with its lower and upper errors.
TH1F myHist {TH1F("myHist", ";X;Y", 2, 0, 2)};
myHist.GetXaxis()->SetBinLabel(1, "Total");
myHist.GetXaxis()->SetBinLabel(2, "Passed");
for (unsigned short i=0; i<5; ++i)
myHist.Fill(0.5, 0.03); // "total"
for (unsigned short i=0; i<3; ++i)
myHist.Fill(1.5, 0.03); // "passed"
// myHist.Draw("hist text45");
TEfficiency myEff {TEfficiency("myEff", "my efficiency;Bins;#varepsilon", 1, 0, 1)};
myEff.SetTotalEvents(1, myHist.GetBinContent(1));
myEff.SetPassedEvents(1, myHist.GetBinContent(2));
printf("Selection efficiency is %.2f%% -%.2f%% +%.2f%%\n", myEff.GetEfficiency(1)*100, myEff.GetEfficiencyErrorLow(1)*100, myEff.GetEfficiencyErrorUp(1)*100);
– this gives me
Selection efficiency is 0.00% -0.00% +100.00%
Is there a way to properly calculate efficiency and its errors (especially the errors, as I can easily calculate the efficiency itself by myself with myHist.GetBinContent(2)/myHist.GetBinContent(1)*100
) when dealing with events with very small weights such as 0.03 as in my example?
Thanks!
ROOT Version: ROOT 6.18/04
Platform: linuxx8664gcc