00001 // @(#)root/hist:$Id: TBinomialEfficiencyFitter.h 20882 2007-11-19 11:31:26Z rdm $ 00002 // Author: Frank Filthaut, Rene Brun 30/05/2007 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TBinomialEfficiencyFitter 00013 #define ROOT_TBinomialEfficiencyFitter 00014 00015 00016 ////////////////////////////////////////////////////////////////////////// 00017 // // 00018 // TBinomialEfficiencyFitter // 00019 // // 00020 // Binomial Fitter for the division of two histograms. // 00021 // Use when you need to calculate a selection's efficiency from two // 00022 // histograms, one containing all entries, and one containing the subset// 00023 // of these entries that pass the selection // 00024 // // 00025 ////////////////////////////////////////////////////////////////////////// 00026 00027 #include "TObject.h" 00028 00029 class TH1; 00030 class TF1; 00031 class TVirtualFitter; 00032 00033 class TBinomialEfficiencyFitter: public TObject { 00034 00035 protected: 00036 TH1 *fDenominator; //Denominator histogram 00037 TH1 *fNumerator; //Numerator histogram 00038 TF1 *fFunction; //Function to fit 00039 Double_t fEpsilon; //Precision required for function integration (option "I") 00040 Bool_t fFitDone; //Set to kTRUE when the fit has been done 00041 Bool_t fAverage; //True if the fit function must be averaged over the bin 00042 Bool_t fRange; //True if the fit range must be taken from the function range 00043 static TVirtualFitter *fgFitter; //pointer to the real fitter 00044 00045 public: 00046 TBinomialEfficiencyFitter(); 00047 TBinomialEfficiencyFitter(const TH1 *numerator, const TH1 *denominator); 00048 virtual ~TBinomialEfficiencyFitter(); 00049 00050 void Set(const TH1 *numerator, const TH1 *denominator); 00051 void SetPrecision(Double_t epsilon); 00052 Int_t Fit(TF1 *f1, Option_t* option = ""); 00053 static TVirtualFitter* GetFitter(); 00054 void ComputeFCN(Int_t& npar, Double_t* /* gin */, Double_t& f, Double_t* par, Int_t flag); 00055 00056 ClassDef(TBinomialEfficiencyFitter, 1) //Binomial Fitter for the division of two histograms 00057 00058 }; 00059 00060 void BinomialEfficiencyFitterFCN(Int_t& npar, Double_t* gin, Double_t& f, Double_t* par, Int_t flag); 00061 00062 #endif