class TBinomialEfficiencyFitter: public TObject


 TBinomialEfficiencyFitter

 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

#sqrt{#frac{p(1-p)}{N}}.
 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
      numerator->Sumw2();
      TH1* hEff = dynamic_cast<TH1*>(numerator->Clone("heff"));
      hEff->Divide(hEff, denominator, 1.0, 1.0, "B");
      hEff->Draw("E");
      eff->Draw("same");
   }
 }

 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)

public:
TBinomialEfficiencyFitter()
TBinomialEfficiencyFitter(const TBinomialEfficiencyFitter&)
TBinomialEfficiencyFitter(const TH1* numerator, const TH1* denominator)
virtual~TBinomialEfficiencyFitter()
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
voidComputeFCN(Int_t& npar, Double_t*, Double_t& f, Double_t* par, Int_t flag)
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
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
Int_tFit(TF1* f1, Option_t* option = "")
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
static TVirtualFitter*GetFitter()
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()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static 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(basic_ostream<char,char_traits<char> >& 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, char* parent)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
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
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

public:
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
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
TF1*fFunctionFunction to fit
TH1*fNumeratorNumerator histogram
Bool_tfRangeTrue if the fit range must be taken from the function range
static TVirtualFitter*fgFitterpointer to the real fitter

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TBinomialEfficiencyFitter(const TBinomialEfficiencyFitter& )
 default constructor
TBinomialEfficiencyFitter(const TH1* numerator, const TH1* denominator)
 Constructor.

 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
 TBinomialEfficiencyFitter::Fit().
~TBinomialEfficiencyFitter()
 destructor
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()
TVirtualFitter* GetFitter()
 static: 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).
Int_t 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).

 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(Int_t& npar, Double_t* , Double_t& f, Double_t* par, Int_t flag)
 Compute the likelihood.
TBinomialEfficiencyFitter(const TBinomialEfficiencyFitter& )

Author: Frank Filthaut, Rene Brun 30/05/2007
Last change: root/hist:$Id: TBinomialEfficiencyFitter.h 20882 2007-11-19 11:31:26Z rdm $
Last generated: 2008-09-22 15:41
Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.