TChi2FCN.h

Go to the documentation of this file.
00001 // @(#)root/minuit2:$Id: TChi2FCN.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_TChi2FCN_H_
00011 #define ROOT_TChi2FCN_H_
00012 
00013 #include "Minuit2/FCNBase.h"
00014 
00015 
00016 class TF1;
00017 class TVirtualFitter;
00018 
00019 class TChi2FitData;
00020 
00021   /**
00022      Class implementing the standard Chi2 objective function 
00023    */ 
00024 
00025 class TChi2FCN : public ROOT::Minuit2::FCNBase {
00026 
00027 
00028 
00029 public: 
00030 
00031 //   // use a param function instead of TF1
00032   typedef TF1 ModelFunction;
00033 
00034 
00035 
00036   /**
00037      construct passing fitter which has ROOT data object and  model function. 
00038    */
00039   TChi2FCN( const TVirtualFitter & fitter);  
00040 
00041   /**
00042      constructor passing data and function 
00043      In this case does not own the data
00044    */
00045   TChi2FCN( TChi2FitData * data, ModelFunction * func) : 
00046     fUp(1.0), fOwner(false), fData(data), fFunc(func) {}
00047 
00048 
00049   /**
00050      construct objective function passing input data and model function.  
00051    */
00052 
00053   //TChi2FCN( const DataObject & data, const ModelFunction & func);  
00054 
00055   /**
00056      this class manages the fit data class. Delete it at the end
00057    */
00058   ~TChi2FCN();
00059 
00060  
00061   /**
00062      evaluate objective function 
00063   */
00064   double operator()(const std::vector<double>&) const; 
00065 
00066 
00067   /**
00068      return error definition for chi2 = 1
00069   */
00070   double Up() const { return fUp; }
00071 
00072   void SetErrorDef( double up) { fUp = up; }
00073 
00074 protected:
00075 
00076 
00077 private: 
00078 
00079   double fUp;
00080   bool fOwner;
00081   // has to be mutable since I call non const methods (as SetParameters)
00082   TChi2FitData * fData; 
00083   mutable ModelFunction * fFunc; 
00084 
00085 };
00086 
00087 
00088 #endif

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