Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TBinomialEfficiencyFitter.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/hist:$Id$
0002 // Author: Frank Filthaut, Rene Brun   30/05/2007
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TBinomialEfficiencyFitter
0013 #define ROOT_TBinomialEfficiencyFitter
0014 
0015 
0016 //////////////////////////////////////////////////////////////////////////
0017 //                                                                      //
0018 // TBinomialEfficiencyFitter                                            //
0019 //                                                                      //
0020 // Binomial Fitter for the division of two histograms.                  //
0021 // Use when you need to calculate a selection's efficiency from two     //
0022 // histograms, one containing all entries, and one containing the subset//
0023 // of these entries that pass the selection                             //
0024 //                                                                      //
0025 //////////////////////////////////////////////////////////////////////////
0026 
0027 #include "TObject.h"
0028 
0029 #include "TFitResultPtr.h"
0030 
0031 
0032 
0033 class TH1;
0034 class TF1;
0035 
0036 namespace ROOT {
0037    namespace Fit {
0038       class Fitter;
0039    }
0040 }
0041 
0042 class TBinomialEfficiencyFitter: public TObject {
0043 
0044 protected:
0045    TH1             *fDenominator;    ///< Denominator histogram
0046    TH1             *fNumerator;      ///< Numerator histogram
0047    TF1             *fFunction;       ///< Function to fit
0048    Double_t         fEpsilon;        ///< Precision required for function integration (option "I")
0049    Bool_t           fFitDone;        ///< Set to kTRUE when the fit has been done
0050    Bool_t           fAverage;        ///< True if the fit function must be averaged over the bin
0051    Bool_t           fRange;          ///< True if the fit range must be taken from the function range
0052    ROOT::Fit::Fitter *fFitter;       ///< pointer to the real fitter
0053 
0054 private:
0055 
0056    void   ComputeFCN(Double_t& f, const Double_t* par);
0057 
0058 public:
0059    TBinomialEfficiencyFitter();
0060    TBinomialEfficiencyFitter(const TH1 *numerator, const TH1 *denominator);
0061    ~TBinomialEfficiencyFitter() override;
0062 
0063    void   Set(const TH1 *numerator, const TH1 *denominator);
0064    void   SetPrecision(Double_t epsilon);
0065    TFitResultPtr  Fit(TF1 *f1, Option_t* option = "");
0066    ROOT::Fit::Fitter * GetFitter();
0067    Double_t  EvaluateFCN(const Double_t * par) {
0068       Double_t f = 0;
0069       ComputeFCN(f, par);
0070       return f;
0071    }
0072 
0073    ClassDefOverride(TBinomialEfficiencyFitter, 1) //Binomial Fitter for the division of two histograms
0074 
0075 
0076 };
0077 
0078 
0079 #endif