ROOT » HIST » HIST » TBinomialEfficiencyFitter

class TBinomialEfficiencyFitter: public TObject


 Binomial fitter for the division of two histograms.
 Use when you need to calculate a selection's efficiency from two histograms,
 one containing all entries, and one containing the subset of these entries
 that pass the selection, and when you have a parametrization available for
 the efficiency as a function of the variable(s) under consideration.

 A very common problem when estimating efficiencies is that of error estimation:
 when no other information is available than the total number of events N and
 the selected number n, the best estimate for the selection efficiency p is n/N.
 Standard binomial statistics dictates that the uncertainty (this presupposes
 sufficiently high statistics that an approximation by a normal distribution is
 reasonable) on p, given N, is

 However, when p is estimated as n/N, fluctuations from the true p to its
 estimate become important, especially for low numbers of events, and giving
 rise to biased results.

 When fitting a parametrized efficiency, these problems can largely be overcome,
 as a hypothesized true efficiency is available by construction. Even so, simply
 using the corresponding uncertainty still presupposes that Gaussian errors
 yields a reasonable approximation. When using, instead of binned efficiency
 histograms, the original numerator and denominator histograms, a binned maximum
 likelihood can be constructed as the product of bin-by-bin binomial probabilities
 to select n out of N events. Assuming that a correct parametrization of the
 efficiency is provided, this construction in general yields less biased results
 (and is much less sensitive to binning details).

 A generic use of this method is given below (note that the method works for 2D
 and 3D histograms as well):

   TH1* denominator;              // denominator histogram
   TH1* numerator;                // corresponding numerator histogram
   TF1* eff;                      // efficiency parametrization
   ....                           // set step sizes and initial parameter
   ....                           //   values for the fit function
   ....                           // possibly also set ranges, see TF1::SetRange()
   TBinomialEfficiencyFitter* f = new TBinomialEfficiencyFitter(
                                      numerator, denominator);
   Int_t status = f->Fit(eff, "I");
   if (status == 0) {
      // if the fit was successful, display bin-by-bin efficiencies
      // as well as the result of the fit
      TH1* hEff = dynamic_cast<TH1*>(numerator->Clone("heff"));
      hEff->Divide(hEff, denominator, 1.0, 1.0, "B");

 Note that this method cannot be expected to yield reliable results when using
 weighted histograms (because the likelihood computation will be incorrect).

Function Members (Methods)

voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
Double_tEvaluateFCN(const Double_t* par)
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
TFitResultPtrFit(TF1* f1, Option_t* option = "")
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual const char*TObject::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TBinomialEfficiencyFitter&operator=(const TBinomialEfficiencyFitter&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidSet(const TH1* numerator, const TH1* denominator)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
static voidTObject::SetObjectStat(Bool_t stat)
voidSetPrecision(Double_t epsilon)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp) const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
TBinomialEfficiencyFitter(const TBinomialEfficiencyFitter&)
TBinomialEfficiencyFitter(const TH1* numerator, const TH1* denominator)
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidComputeFCN(Double_t& f, const Double_t* par)

Data Members

static TObject::(anonymous)TObject::kBitMask
static TObject::EStatusBitsTObject::kCanDelete
static TObject::EStatusBitsTObject::kCannotPick
static TObject::EStatusBitsTObject::kHasUUID
static TObject::EStatusBitsTObject::kInvalidObject
static TObject::(anonymous)TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static TObject::EStatusBitsTObject::kMustCleanup
static TObject::EStatusBitsTObject::kNoContextMenu
static TObject::(anonymous)TObject::kNotDeleted
static TObject::EStatusBitsTObject::kObjInCanvas
static TObject::(anonymous)TObject::kOverwrite
static TObject::(anonymous)TObject::kSingleKey
static TObject::(anonymous)TObject::kWriteDelete
static TObject::(anonymous)TObject::kZombie
Bool_tfAverageTrue if the fit function must be averaged over the bin
TH1*fDenominatorDenominator histogram
Double_tfEpsilonPrecision required for function integration (option "I")
Bool_tfFitDoneSet to kTRUE when the fit has been done
ROOT::Fit::Fitter*fFitterpointer to the real fitter
TF1*fFunctionFunction to fit
TH1*fNumeratorNumerator histogram
Bool_tfRangeTrue if the fit range must be taken from the function range

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

 default constructor
TBinomialEfficiencyFitter(const TH1* numerator, const TH1* denominator)

 Note that no objects are copied, so it is up to the user to ensure that the
 histogram pointers remain valid.

 Both histograms need to be "consistent". This is not checked here, but in
void Set(const TH1* numerator, const TH1* denominator)
 Initialize with a new set of inputs.
void SetPrecision(Double_t epsilon)
 Set the required integration precision, see TF1::Integral()
ROOT::Fit::Fitter* GetFitter()
 Provide access to the underlying fitter object.
 This may be useful e.g. for the retrieval of additional information (such
 as the output covariance matrix of the fit).
TFitResultPtr Fit(TF1* f1, Option_t* option = "")
 Carry out the fit of the given function to the given histograms.

 If option "I" is used, the fit function will be averaged over the
 bin (the default is to evaluate it simply at the bin center).

 If option "R" is used, the fit range will be taken from the fit
 function (the default is to use the entire histogram).

 If option "S" a TFitResult object is returned and it can be used to obtain
  additional fit information, like covariance or correlation matrix.

 Note that all parameter values, limits, and step sizes are copied
 from the input fit function f1 (so they should be set before calling
 this method. This is particularly relevant for the step sizes, taken
 to be the "error" set on input, as a null step size usually fixes the
 corresponding parameter. That is protected against, but in such cases
 an arbitrary starting step size will be used, and the reliability of
 the fit should be questioned). If parameters are to be fixed, this
 should be done by specifying non-null parameter limits, with lower
 limits larger than upper limits.

 On output, f1 contains the fitted parameters and errors, as well as
 the number of degrees of freedom, and the goodness-of-fit estimator
 as given by S. Baker and R. Cousins, Nucl. Instr. Meth. A221 (1984) 437.
void ComputeFCN(Double_t& f, const Double_t* par)
 Compute the likelihood.
Double_t EvaluateFCN(const Double_t* par)