Good evening,
I’m doing a division between two TH1F to estimate an efficiency:
h_TrigEfficiency_15->Divide(h_passedTrigger15_NUM, h_passedTrigger15_DEN, 1, 1, "B");
These are binned histograms, and each bin has the name of a trigger.
There is a problem in the cases in which the division is 1, and it gives error 0.
On ROOT site I found this:
[◆ ]Divide() [2/3]
[Bool_t]TH1::Divide ( const [TH1]* h1,const [TH1] * h2,[Double_t]c1 = 1
,[Double_t]c2 = 1
,[Option_t]* option = ""
)
Replace contents of this histogram by the division of h1 by h2.
this = c1*h1/(c2*h2)
If errors are defined (see [TH1::Sumw2]), errors are also recalculated Note that if h1 or h2 have Sumw2 set, Sumw2 is automatically called for this if not already set. The resulting errors are calculated assuming uncorrelated histograms. However, if option =“B” is specified, Binomial errors are computed. In this case c1 and c2 do not make real sense and they are ignored.
IMPORTANT NOTE: If you intend to use the errors of this histogram later you should call Sumw2 before making this operation. This is particularly important if you fit the histogram after [TH1::Divide]
Please note also that in the binomial case errors are calculated using standard binomial statistics, which means when b1 = b2, the error is zero. If you prefer to have efficiency errors not going to zero when the efficiency is 1, you must use the function [TGraphAsymmErrors::BayesDivide], which will return an asymmetric and non-zero lower error for the case b1=b2.
The function return kFALSE if the divide operation failed
Reimplemented in [TProfile], [TProfile2D], and [TProfile3D].
Definition at line [2947] of file [TH1.cxx].
So I tried to use TGraphAsymmErrors and BayesDivide. BayesDivide doesn’t exist for TH1F and I cant’ make a binned TGraphAsymmErrors as I make a TH1F. Any suggestion to fix this?