13 #ifndef ROOT_Fit_Fitter
14 #define ROOT_Fit_Fitter
28 #ifndef ROOT_Fit_BinData
31 #ifndef ROOT_Fit_UnBinData
35 #ifndef ROOT_Fit_FitConfig
39 #ifndef ROOT_Fit_FitResult
43 #ifndef ROOT_Math_IParamFunctionfwd
145 template <
class Data ,
class Function>
158 bool Fit(
const std::shared_ptr<BinData> & data) {
185 bool LikelihoodFit(
const std::shared_ptr<BinData> & data,
bool extended =
true) {
196 bool LikelihoodFit(
const std::shared_ptr<UnBinData> & data,
bool extended =
false) {
206 template <
class Data ,
class Function>
231 template <
class Function>
232 bool FitFCN(
unsigned int npar,
Function &
fcn,
const double * params = 0,
unsigned int dataSize = 0,
bool chi2fit =
false);
240 template <
class Function>
241 bool SetFCN(
unsigned int npar,
Function &
fcn,
const double * params = 0,
unsigned int dataSize = 0,
bool chi2fit =
false);
311 bool FitFCN(
MinuitFCN_t fcn,
int npar = 0,
const double * params = 0,
unsigned int dataSize = 0,
bool chi2fit =
false);
318 bool SetFCN(
MinuitFCN_t fcn,
int npar = 0,
const double * params = 0,
unsigned int dataSize = 0,
bool chi2fit =
false);
464 template <
class Data>
465 void SetData(
const std::shared_ptr<Data> & data) {
466 fData = std::static_pointer_cast<
Data>(data);
476 template <
class ObjFuncType>
494 std::shared_ptr<IModelFunction>
fFunc;
496 std::shared_ptr<ROOT::Fit::FitResult>
fResult;
500 std::shared_ptr<ROOT::Fit::FitData>
fData;
509 template <
class ObjFuncType>
511 ObjFuncType * objfunc =
dynamic_cast<ObjFuncType*
>(
fObjFunction.get() );
513 fFunc = objfunc->ModelFunctionPtr();
514 fData = objfunc->DataPtr();
533 #ifndef ROOT_Math_WrappedFunction
537 template<
class Function>
540 return FitFCN(wf,par,datasize,chi2fit);
542 template<
class Function>
545 return SetFCN(wf,par,datasize,chi2fit);
551 #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...
void fcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag)
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.
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.
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...
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...
IParamFunction interface (abstract class) describing multi-dimensional parameteric functions It is a ...
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)
Interface (abstract class) for parametric gradient multi-dimensional functions providing in addition ...
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...
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)
Documentation for the abstract class IBaseFunctionMultiDim.
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...