TEfficiency(a,b) object does not return to same thing as a/b

The efficiencies I got from efficiency.GetEfficiency(i) does not match with what I calculate by the ratios hist_passed(i,j) / hist_all(i,j) . Does anyone know what could be the reason for this difference? It almost perfectly matches when I had 1D hists and used TEfficiency with those 1d hists.

My code:
hist_passed= ROOT.TH2F ... ( 9 bins) hist_all(=ROOT.TH2F ... (5 bins) efficiency=ROOT.TEfficiency(hist_passed,hist_all() efficiency.SetStatisticOption(ROOT.TEfficiency.kBBayesian)

and after creating the TEfficiency object I tried to reach individual information from it:

for i in range(70): efficiency.GetEfficiency(i)

None of the values matches with
hist_passed(i,j) / hist_all(i,j)

Also, not important but this prints 45 numbers that are not 0.5 and rest of them are all 0.5s ( 12 0.5s then 9 numbers, then 2 0.5s, then 9 numbers etc. ). I tried range(100) all the last numbers are 0.5s. I had 9 bins on hist a and 5 bins on hist b, so 45 numbers makes sense but what are all these 0.5s? As a solution I just ignored the numbers that are 0.5, but still wonder the reason.

Hi,
This is strange. Are you sure you are comparing the result for the correct bins. To retrieve the efficiency in each bin you need to use

efficiency.GetEfficiency( hist_passed.GetBin(i,j))

Lorenzo

Thank you for your answer. I tried the method you wrote and this helped me to get rid of 0.5s. However, I still could not get the same results.
The difference between TEfficiency and simply using passed/all gives me up to 10% difference between methods. Do you have any idea why I might be having a difference? The difference I observed in 1d case was less than 1% for all the bins.

Hi,
can you please share the ROOT file(s) with your hist_passed and hist_all?

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