13 #ifndef ROOT_Fit_Fitter
14 #define ROOT_Fit_Fitter
128 template <
class Data ,
class Function>
141 bool Fit(
const std::shared_ptr<BinData> &
data) {
189 template <
class Data ,
class Function>
214 template <
class Function>
215 bool FitFCN(
unsigned int npar,
Function & fcn,
const double * params = 0,
unsigned int dataSize = 0,
bool chi2fit =
false);
223 template <
class Function>
224 bool SetFCN(
unsigned int npar,
Function & fcn,
const double * params = 0,
unsigned int dataSize = 0,
bool chi2fit =
false);
294 bool FitFCN(
MinuitFCN_t fcn,
int npar = 0,
const double * params = 0,
unsigned int dataSize = 0,
bool chi2fit =
false);
301 bool SetFCN(
MinuitFCN_t fcn,
int npar = 0,
const double * params = 0,
unsigned int dataSize = 0,
bool chi2fit =
false);
447 template <
class Data>
459 template <
class ObjFuncType>
477 std::shared_ptr<IModelFunction>
fFunc;
479 std::shared_ptr<ROOT::Fit::FitResult>
fResult;
483 std::shared_ptr<ROOT::Fit::FitData>
fData;
492 template <
class ObjFuncType>
494 ObjFuncType * objfunc =
dynamic_cast<ObjFuncType*
>(
fObjFunction.get() );
496 fFunc = objfunc->ModelFunctionPtr();
497 fData = objfunc->DataPtr();
517 template<
class Function>
520 return FitFCN(wf,par,datasize,chi2fit);
522 template<
class Function>
525 return SetFCN(wf,par,datasize,chi2fit);
531 #endif // endif __CINT__
ROOT::Math::IParamFunction IModel1DFunction
const FitConfig & Config() const
access to the fit configuration (const method)
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
void ExamineFCN()
look at the user provided FCN and get data and model function is they derive from ROOT::Fit FCN class...
FitConfig & Config()
access to the configuration (non const method)
bool CalculateMinosErrors()
perform an error analysis on the result using MINOS To be called only after fitting and when a minimi...
bool Fit(const std::shared_ptr< BinData > &data)
bool LikelihoodFit(const UnBinData &data, bool extended=false)
Unbinned Likelihood fit.
Fitter & operator=(const Fitter &rhs)
Assignment operator (disabled, class is not copyable)
bool EvalFCN()
Perform a simple FCN evaluation.
bool DoBinnedLikelihoodFit(bool extended=true)
binned likelihood fit
Base class for all the fit data types: Stores the coordinates and the DataOptions.
void SetData(const FitData &data)
ROOT::Math::IMultiGenFunction BaseFunc
std::shared_ptr< IModelFunction > fFunc
Class describing the unbinned data sets (just x coordinates values) of any dimensions.
Interface (abstract class) for parametric gradient multi-dimensional functions providing in addition ...
bool Fit(const UnBinData &data, bool extended=false)
fit an unbinned data set using loglikelihood method
ROOT::Math::IMultiGenFunction * GetFCN() const
return pointer to last used objective function (is NULL in case fit is not yet done) This pointer wil...
bool DoLinearFit()
linear least square fit
bool LikelihoodFit(const std::shared_ptr< UnBinData > &data, bool extended=false)
std::shared_ptr< ROOT::Fit::FitResult > fResult
copy of the fitted function containing on output the fit result
bool CalculateHessErrors()
perform an error analysis on the result using the Hessian Errors are obtaied from the inverse of the ...
bool LeastSquareFit(const BinData &data)
Fit a binned data set using a least square fit.
Fitter()
Default constructor.
ROOT::Math::IParamMultiGradFunction IGradModelFunction
Abstract Minimizer class, defining the interface for the various minimizer (like Minuit2, Minuit, GSL, etc..) Plug-in's exist in ROOT to be able to instantiate the derived classes like ROOT::Math::GSLMinimizer or ROOT::Math::Minuit2Minimizer via the plug-in manager.
const FitResult & Result() const
get fit result
ROOT::Math::IParamGradFunction IGradModel1DFunction
std::vector< std::vector< double > > Data
bool LinearFit(const BinData &data)
do a linear fit on a set of bin-data
void(* MinuitFCN_t)(int &npar, double *gin, double &f, double *u, int flag)
fit using user provided FCN with Minuit-like interface If npar = 0 it is assumed that the parameters ...
bool ApplyWeightCorrection(const ROOT::Math::IMultiGenFunction &loglw2, bool minimizeW2L=false)
apply correction in the error matrix for the weights for likelihood fits This method can be called on...
Documentation for the abstract class IBaseFunctionMultiDim.
std::shared_ptr< ROOT::Fit::FitData > fData
pointer to used minimizer
bool Fit(const Data &data, const Function &func)
fit a data set using any generic model function If data set is binned a least square fit is performed...
RooCmdArg Minimizer(const char *type, const char *alg=0)
Fitter class, entry point for performing all type of fits.
bool Fit(const BinData &data)
Fit a binned data set using a least square fit (default method)
bool FitFCN()
Perform a fit with the previously set FCN function.
Class describing the binned data sets : vectors of x coordinates, y values and optionally error on y ...
bool IsBinFit() const
query if fit is binned.
void SetFunction(const IModelFunction &func, bool useGradient=false)
Set the fitted function (model function) from a parametric function interface.
std::shared_ptr< ROOT::Math::Minimizer > fMinimizer
pointer to the object containing the result of the fit
bool LikelihoodFit(const BinData &data, bool extended=true)
Binned Likelihood fit.
Interface (abstract class) for parametric one-dimensional gradient functions providing in addition to...
bool LikelihoodFit(const std::shared_ptr< BinData > &data, bool extended=true)
class containg the result of the fit and all the related information (fitted parameter values...
Specialized IParamFunction interface (abstract class) for one-dimensional parametric functions It is ...
FitMethodFunction class Interface for objective functions (like chi2 and likelihood used in the fit) ...
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
double func(double *x, double *p)
ROOT::Math::IMultiGradFunction BaseGradFunc
std::shared_ptr< ROOT::Math::IMultiGenFunction > fObjFunction
pointer to the fit data (binned or unbinned data)
bool GetDataFromFCN()
internal functions to get data set and model function from FCN useful for fits done with customized F...
bool DoLeastSquareFit()
least square fit
Template class to wrap any C++ callable object implementing operator() (const double * x) in a multi-...
BasicFitMethodFunction< ROOT::Math::IMultiGradFunction > FitMethodGradFunction
typedef void((*Func_t)())
void SetFunctionAndData(const IModelFunction &func, const FitData &data)
bool SetFCN(unsigned int npar, Function &fcn, const double *params=0, unsigned int dataSize=0, bool chi2fit=false)
Set a generic FCN function as a C++ callable object implementing double () (const double *) Note that...
Double_t(* Function)(Double_t)
bool LikelihoodFit(const Data &data, const Function &func, bool extended)
fit a data set using any generic model function Pre-requisite on the function:
bool LinearFit(const std::shared_ptr< BinData > &data)
void SetData(const std::shared_ptr< Data > &data)
bool DoMinimization(const BaseFunc &f, const ROOT::Math::IMultiGenFunction *chifunc=0)
do minimization
ROOT::Math::IParamMultiFunction IModelFunction
Class describing the configuration of the fit, options and parameter settings using the ROOT::Fit::Pa...
bool DoUnbinnedLikelihoodFit(bool extended=false)
un-binned likelihood fit
BasicFitMethodFunction< ROOT::Math::IMultiGenFunction > FitMethodFunction
ROOT::Math::Minimizer * GetMinimizer() const
return pointer to last used minimizer (is NULL in case fit is not yet done) This pointer is guranteed...