Difference in error between TEfficiency and Divide(TH1's)

Hi,

For my efficiency calculation using two TH1D’s, I compared TEfficiency and the function Divide(), and I noticed a difference in the error estimation. This is an example code in pyRoot:

import ROOT

h1 = ROOT.TH1D(“h1”, “h1”, 1, 0, 100)
h2 = ROOT.TH1D(“h2”,“h2”, 1, 0, 100)

r = ROOT.TRandom3()
for i in range(0, 100000):
h1.Fill(r.Gaus(50,50))
if i%10==0:
h2.Fill(r.Gaus(50,50))

hTEff = ROOT.TEfficiency(h2,h1)
hTEff.SetStatisticOption(ROOT.TEfficiency.kFNormal)

hDiv = ROOT.TH1D(“hDiv”, “hDiv”, 1, 0, 100)
hDiv.Divide(h2,h1,1,1,“B”)

canv = ROOT.TCanvas()
canv.Divide(2,2)
canv.cd(1)
h1.Draw()
canv.cd(2)
h2.Draw()
canv.cd(3)
hDiv.Draw(“pe”)
canv.cd(4)
hTEff.Draw()
canv.Print(“TEff_vs_Divide.pdf”)

Does anyone know why my errors are not the same? Since I am using the same error estimation method, I expected the same result.

Thanks!

ROOT Version: v6-10-06
Platform: macOS
Compiler: Python

Hi,

You should use option `B` (Binomial Error) for `TH1::Divide`.
The option `N` its not existing. See the TH1::Divide documentation.

Lorenzo

Sorry, I mean I used “B” instead of “N”, but still a difference in errors.

Hi,

But I obtain exactly the same error. If it is not the case for you it is maybe due to a bug in an older version of ROOT.

Lorenzo

Hi Lorenzo,

Which version of root do you have?
I have v6-10-06.

So you run this example code and it gives you the same error bars?

Many thanks for you help!

I have 6.16 and I get same result

Lorenzo

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