TBinLikelihoodFCN.h

Go to the documentation of this file.
00001 // @(#)root/minuit2:$Id: TBinLikelihoodFCN.h 20880 2007-11-19 11:23:41Z rdm $
00002 // Author: L. Moneta    10/2005  
00003 
00004 /**********************************************************************
00005  *                                                                    *
00006  * Copyright (c) 2005 ROOT Foundation,  CERN/PH-SFT                   *
00007  *                                                                    *
00008  **********************************************************************/
00009 
00010 #ifndef ROOT_TBinLikelihoodFCN_H_
00011 #define ROOT_TBinLikelihoodFCN_H_
00012 
00013 #include "Minuit2/FCNBase.h"
00014 
00015 
00016 class TF1;
00017 class TVirtualFitter;
00018 class TChi2FitData;
00019 
00020   /**
00021      Class implementing the standard Chi2 objective function 
00022    */ 
00023 
00024 class TBinLikelihoodFCN : public ROOT::Minuit2::FCNBase {
00025 
00026 
00027 
00028 public: 
00029 
00030 //   // use a param function instead of TF1
00031   typedef TF1 ModelFunction;
00032   // use now same data as chi2 fit data
00033   typedef TChi2FitData BinLikelihoodFitData;
00034 
00035 
00036 
00037   /**
00038      construct passing fitter which has ROOT data object and  model function. 
00039    */
00040   TBinLikelihoodFCN( const TVirtualFitter & fitter);  
00041 
00042   /**
00043      constructor passing data and function 
00044      In this case does not own the data
00045    */
00046   TBinLikelihoodFCN( TChi2FitData * data, ModelFunction * func) : 
00047     fUp(0.5), fOwner(false), fData(data), fFunc(func) {}
00048 
00049 
00050   /**
00051      this class manages the fit data class. Delete it at the end
00052    */
00053   ~TBinLikelihoodFCN();
00054 
00055  
00056   /**
00057      evaluate objective function 
00058   */
00059   double operator()(const std::vector<double>&) const; 
00060 
00061 
00062   /**
00063      return error definition for likelihood = 0.5
00064   */
00065   double Up() const { return fUp; }
00066 
00067   void SetErrorDef( double up) { fUp = up; }
00068 
00069   /**
00070      evaluate chi2 equivalent on the data set
00071   */
00072   double Chi2 ( const std::vector<double>&) const; 
00073 
00074 
00075 private: 
00076 
00077   double fUp; 
00078   bool fOwner;
00079   BinLikelihoodFitData * fData; 
00080   ModelFunction * fFunc; 
00081 
00082 };
00083 
00084 
00085 #endif

Generated on Tue Jul 5 14:26:31 2011 for ROOT_528-00b_version by  doxygen 1.5.1