#ifndef DFitFunctor_h #define DFitFunctor_h #include #include #include #include #include #include "RVersion.h" #include "TMath.h" #include "TObject.h" #include "TRandom3.h" #include "TH1D.h" #include "TNtuple.h" #include "TMatrixDSym.h" #include "TF1.h" using namespace std; //FIT TYPES CANNOT BE "Total" "Signal" OR "Background" (reserved for DFitGroup) class DFitFunctor : public TObject { public: DFitFunctor(string locFitType, vector locInitParams, int locFuncColor = kBlack); DFitFunctor(string locFitType, TF1* locFunc); virtual ~DFitFunctor(void); virtual double operator()(double* locX, double* locParamArray) = 0; size_t Get_NumParams(void) const; string Get_FitType(void) const; vector Get_InitParams(void) const; vector Get_ParamNames(void) const; virtual void Calc_CutRange(double locSignalWidthParameter, double& locCutRangeMin, double& locCutRangeMax) const; virtual void Calc_Integral(double& locIntegral, double& locIntegralError) const; virtual void Calc_Integral(double locRangeMin, double locRangeMax, double& locIntegral, double& locIntegralError) const; virtual void Set_CovarianceMatrix(const TMatrixDSym& locFullCovarianceMatrix, unsigned int locParamIndex); virtual void Create_Function(string locFuncName, double locFitRangeMin, double locFitRangeMax); virtual void Create_Function(string locFuncName, double locFitRangeMin, double locFitRangeMax, double* locParamArray, double* locParamErrorArray = NULL); virtual string Get_ParamStream(void) const; void Fix_Parameter(size_t locParamIndex); private: DFitFunctor(void){} string dFitType; public: vector dInitParams; int dFuncColor; unsigned int dNumXPoints; bool dAddFitToFitObjectFlag; //whether or not to add the fit function from this object to the fit hist or graph TF1* dFunc; //WARNING: This is NULL until AFTER the fit is performed!! TMatrixDSym dCovarianceMatrix; set dFixedParams; //indices of params to fix the values of vector dParamNames; map > dParamLimits; //limits of the params ClassDef(DFitFunctor, 1) }; #endif