# Taking Ratio of TEfficiency Distributions

Hi–

I have several TEfficiency plots and now I want to take the ratio of two of these TEfficiency distributions. These plots have asymmetric errors, and I would like to keep these when propagating error into this new ratio if possible. I need to take the ratio of TEfficiency objects because these original TEfficiency objects allow me to calculate the error using the Wilson score method.

From what I understand, I can convert TEfficiency objects into TGraphAsymmErrors objects using TEfficiency::GetPaintedGraph, but it does not look like there is a TGraphAsymmErrors method that allows me to divide one TGAE by another.

Is there a method for getting TH1’s from TEfficiency plots (getting the same bin content and errors)? From what I understand, TH1’s can only handle symmetric errors, which is an okay approximation if I just take the larger of the two errors from the TEfficiency object and use that as the error for the new TH1.

I could then take the ratio of these TH1’s with TH1::Divide, using regular error propagation, since this Data/MC quantity does not necessarily follow binomial statistics. I would not construct a new TEfficiency since Data/MC won’t necessarily be between 0 and 1.

Thanks,
Andrew

1 Like

Dear Andrew,

TEfficiency provides access to the histograms used to get the efficiency via

``````const TH1 * 	GetPassedHistogram () const
``````

and

``````const TH1 * 	GetTotalHistogram () const
``````

(see TEfficiency ).
This should allow you to get at least the efficiency ratio right.

G Ganis

Hi–

Thanks for your reply. I’m not looking to get the passed and total histograms used to make each TEfficiency; I already have access to these. Rather, I need to essentially extract the efficiency values from the resultant plot as a TH1. So,

pass+total -> TEfficiency -> TH1 that has the efficiency values from the TEfficiency calculation

The advantage of this is when I take the ratio of two TH1s (that come from two different TEfficiencies) I can hopefully use the error from the TEfficiency calculations.

Is there something like TH1::GetBinContent that I could use for TEfficiency?

Thanks,
Andrew

My mistake. I’ll answer my own question for posterity.

There exist the methods
TEfficiency::GetEfficiency
https://root.cern.ch/doc/master/TEfficiency_8cxx_source.html#l02462
and
TEfficiency::GetEfficiencyErrorLow and TEfficiency::GetEfficiencyErrorUp
https://root.cern.ch/doc/master/TEfficiency_8cxx_source.html#l02513

One can then get these values and use TH1::SetBinContent and TH1::SetBinError
https://root.cern.ch/doc/master/TH1_8cxx_source.html#l08350
taking the larger of the two efficiency errors as the TH1 error, since TH1’s can only handle symmetric error. A TEfficiency cannot be used for this ratio (Data/MC) plot, since the number of passed events may be greater than the total events (not binomial in nature). And two TGAE’s cannot be extracted and divided since there is no method to do so (?)

Regards,
Andrew

Hi,

We don’t have in ROOT any function to compute the ratio of two TWfficiency object. In this case one should compute the confidence interval using the correct method.
From google I have found this paper,
https://www.jstor.org/stable/2531405?seq=1#page_scan_tab_contents

describing some methods to compute it.
It is clear that using error propagation you will not get the correct answer, it will be just a rough approximation. This you can get by using first the binomial option in TH1::Divide and the re-dividing again the obtained histograms.
A maybe better approximation is to compute the interval from a maximum likelihood fit and compute the interval using Minos.

If you have interest in this and you want to implement one of the method for computing the errors for the ratio of binomial quantities, I could eventually include it in ROOT.

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