Logo ROOT  
Reference Guide
ROOT::Fit::Fitter Class Reference

Fitter class, entry point for performing all type of fits.

Fits are performed using the generic ROOT::Fit::Fitter::Fit method. The inputs are the data points and a model function (using a ROOT::Math::IParamFunction) The result of the fit is returned and kept internally in the ROOT::Fit::FitResult class. The configuration of the fit (parameters, options, etc...) are specified in the ROOT::Math::FitConfig class. After fitting the config of the fit will be modified to have the new values the resulting parameter of the fit with step sizes equal to the errors. FitConfig can be preserved with initial parameters by calling FitConfig.SetUpdateAfterFit(false);

Definition at line 77 of file Fitter.h.

Public Types

typedef ROOT::Math::IMultiGenFunction BaseFunc
 
typedef ROOT::Math::IMultiGradFunction BaseGradFunc
 
typedef ROOT::Math::IParamGradFunction IGradModel1DFunction
 
typedef ROOT::Math::IParamMultiGradFunction IGradModelFunction
 
typedef ROOT::Math::IParamMultiGradFunction IGradModelFunction_v
 
typedef ROOT::Math::IParamFunction IModel1DFunction
 
typedef ROOT::Math::IParamMultiFunction IModelFunction
 
typedef ROOT::Math::IParamMultiFunction IModelFunction_v
 
template<class T >
using IModelFunctionTempl = ROOT::Math::IParamMultiFunctionTempl< T >
 
typedef 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 are specified in the parameter settings created before For the options same consideration as in the previous method More...
 

Public Member Functions

 Fitter ()
 Default constructor. More...
 
 Fitter (const std::shared_ptr< FitResult > &result)
 Constructor from a result. More...
 
 ~Fitter ()
 Destructor. More...
 
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 only after a fit. More...
 
bool CalculateHessErrors ()
 perform an error analysis on the result using the Hessian Errors are obtaied from the inverse of the Hessian matrix To be called only after fitting and when a minimizer supporting the Hessian calculations is used otherwise an error (false) is returned. More...
 
bool CalculateMinosErrors ()
 perform an error analysis on the result using MINOS To be called only after fitting and when a minimizer supporting MINOS is used otherwise an error (false) is returned. More...
 
FitConfigConfig ()
 access to the configuration (non const method) More...
 
const FitConfigConfig () const
 access to the fit configuration (const method) More...
 
bool EvalFCN ()
 Perform a simple FCN evaluation. More...
 
bool Fit (const BinData &data, const ROOT::Fit::ExecutionPolicy &executionPolicy=ROOT::Fit::ExecutionPolicy::kSerial)
 Fit a binned data set using a least square fit (default method) More...
 
template<class Data , class Function , class cond = typename std::enable_if<!(std::is_same<Function, ROOT::Fit::ExecutionPolicy>::value || std::is_same<Function, int>::value), Function>::type>
bool Fit (const Data &data, const Function &func, const ROOT::Fit::ExecutionPolicy &executionPolicy=ROOT::Fit::ExecutionPolicy::kSerial)
 fit a data set using any generic model function If data set is binned a least square fit is performed If data set is unbinned a maximum likelihood fit (not extended) is done Pre-requisite on the function: it must implement the 1D or multidimensional parametric function interface More...
 
bool Fit (const std::shared_ptr< BinData > &data, const ROOT::Fit::ExecutionPolicy &executionPolicy=ROOT::Fit::ExecutionPolicy::kSerial)
 
bool Fit (const UnBinData &data, bool extended=false, const ROOT::Fit::ExecutionPolicy &executionPolicy=ROOT::Fit::ExecutionPolicy::kSerial)
 fit an unbinned data set using loglikelihood method More...
 
bool FitFCN ()
 Perform a fit with the previously set FCN function. More...
 
bool FitFCN (const ROOT::Math::FitMethodFunction &fcn, const double *params=0)
 Fit using a FitMethodFunction interface. More...
 
bool FitFCN (const ROOT::Math::FitMethodGradFunction &fcn, const double *params=0)
 Fit using a FitMethodGradFunction interface. More...
 
bool FitFCN (const ROOT::Math::IMultiGenFunction &fcn, const double *params=0, unsigned int dataSize=0, bool chi2fit=false)
 Fit using the given FCN function represented by a multi-dimensional function interface (ROOT::Math::IMultiGenFunction). More...
 
bool FitFCN (const ROOT::Math::IMultiGradFunction &fcn, const double *params=0, unsigned int dataSize=0, bool chi2fit=false)
 Fit using the given FCN function representing a multi-dimensional gradient function interface (ROOT::Math::IMultiGradFunction). More...
 
bool FitFCN (MinuitFCN_t fcn, int npar=0, const double *params=0, unsigned int dataSize=0, bool chi2fit=false)
 
template<class Function >
bool FitFCN (unsigned int npar, Function &fcn, const double *params=0, unsigned int dataSize=0, bool chi2fit=false)
 Fit using the a generic FCN function as a C++ callable object implementing double () (const double *) Note that the function dimension (i.e. More...
 
ROOT::Math::IMultiGenFunctionGetFCN () const
 return pointer to last used objective function (is NULL in case fit is not yet done) This pointer will be valid as far as the fitter class has not been deleted. More...
 
ROOT::Math::MinimizerGetMinimizer () const
 return pointer to last used minimizer (is NULL in case fit is not yet done) This pointer is guranteed to be valid as far as the fitter class is valid and a new fit is not redone. More...
 
bool IsBinFit () const
 query if fit is binned. More...
 
bool LeastSquareFit (const BinData &data)
 Fit a binned data set using a least square fit. More...
 
bool LikelihoodFit (const BinData &data, bool extended=true, const ROOT::Fit::ExecutionPolicy &executionPolicy=ROOT::Fit::ExecutionPolicy::kSerial)
 Binned Likelihood fit. More...
 
template<class Data , class Function >
bool LikelihoodFit (const Data &data, const Function &func, bool extended)
 fit a data set using any generic model function Pre-requisite on the function: More...
 
bool LikelihoodFit (const std::shared_ptr< BinData > &data, bool extended=true, const ROOT::Fit::ExecutionPolicy &executionPolicy=ROOT::Fit::ExecutionPolicy::kSerial)
 
bool LikelihoodFit (const std::shared_ptr< UnBinData > &data, bool extended=false, const ROOT::Fit::ExecutionPolicy &executionPolicy=ROOT::Fit::ExecutionPolicy::kSerial)
 
bool LikelihoodFit (const UnBinData &data, bool extended=false, const ROOT::Fit::ExecutionPolicy &executionPolicy=ROOT::Fit::ExecutionPolicy::kSerial)
 Unbinned Likelihood fit. More...
 
bool LinearFit (const BinData &data)
 do a linear fit on a set of bin-data More...
 
bool LinearFit (const std::shared_ptr< BinData > &data)
 
const FitResultResult () const
 get fit result More...
 
bool SetFCN (const ROOT::Math::FitMethodFunction &fcn, const double *params=0)
 Set the objective function (FCN) using a FitMethodFunction interface. More...
 
bool SetFCN (const ROOT::Math::FitMethodGradFunction &fcn, const double *params=0)
 Set the objective function (FCN) using a FitMethodGradFunction interface. More...
 
bool SetFCN (const ROOT::Math::IMultiGenFunction &fcn, const double *params=0, unsigned int dataSize=0, bool chi2fit=false)
 Set the FCN function represented by a multi-dimensional function interface (ROOT::Math::IMultiGenFunction) and optionally the initial parameters See also note above for the initial parameters for FitFCN. More...
 
bool SetFCN (const ROOT::Math::IMultiGenFunction &fcn, const IModelFunction &func, const double *params=0, unsigned int dataSize=0, bool chi2fit=false)
 Set the FCN function represented by a multi-dimensional function interface (ROOT::Math::IMultiGenFunction) and optionally the initial parameters See also note above for the initial parameters for FitFCN With this interface we pass in addition a ModelFunction that will be attached to the FitResult and used to compute confidence interval of the fit. More...
 
bool SetFCN (const ROOT::Math::IMultiGradFunction &fcn, const double *params=0, unsigned int dataSize=0, bool chi2fit=false)
 Set the FCN function represented by a multi-dimensional gradient function interface (ROOT::Math::IMultiGradFunction) and optionally the initial parameters See also note above for the initial parameters for FitFCN. More...
 
bool SetFCN (const ROOT::Math::IMultiGradFunction &fcn, const IModelFunction &func, const double *params=0, unsigned int dataSize=0, bool chi2fit=false)
 Set the FCN function represented by a multi-dimensional gradient function interface (ROOT::Math::IMultiGradFunction) and optionally the initial parameters See also note above for the initial parameters for FitFCN With this interface we pass in addition a ModelFunction that will be attached to the FitResult and used to compute confidence interval of the fit. More...
 
bool SetFCN (MinuitFCN_t fcn, int npar=0, const double *params=0, unsigned int dataSize=0, bool chi2fit=false)
 set objective function using user provided FCN with Minuit-like interface If npar = 0 it is assumed that the parameters are specified in the parameter settings created before For the options same consideration as in the previous method More...
 
template<class Function >
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 the function dimension (i.e. More...
 
void SetFunction (const IGradModel1DFunction &func, bool useGradient=true)
 Set the fitted function from 1D gradient parametric function interface. More...
 
void SetFunction (const IGradModelFunction &func, bool useGradient=true)
 Set the fitted function (model function) from a parametric gradient function interface. More...
 
void SetFunction (const IModel1DFunction &func, bool useGradient=false)
 Set the fitted function (model function) from a vectorized parametric function interface. More...
 
void SetFunction (const IModelFunction &func, bool useGradient=false)
 Set the fitted function (model function) from a parametric function interface. More...
 

Protected Member Functions

bool DoBinnedLikelihoodFit (bool extended=true, const ROOT::Fit::ExecutionPolicy &executionPolicy=ROOT::Fit::ExecutionPolicy::kSerial)
 binned likelihood fit More...
 
bool DoInitMinimizer ()
 
bool DoLeastSquareFit (const ROOT::Fit::ExecutionPolicy &executionPolicy=ROOT::Fit::ExecutionPolicy::kSerial)
 least square fit More...
 
bool DoLinearFit ()
 linear least square fit More...
 
bool DoMinimization (const BaseFunc &f, const ROOT::Math::IMultiGenFunction *chifunc=0)
 do minimization More...
 
bool DoMinimization (const ROOT::Math::IMultiGenFunction *chifunc=0)
 
bool DoUnbinnedLikelihoodFit (bool extended=false, const ROOT::Fit::ExecutionPolicy &executionPolicy=ROOT::Fit::ExecutionPolicy::kSerial)
 un-binned likelihood fit More...
 
void DoUpdateFitConfig ()
 
bool DoUpdateMinimizerOptions (bool canDifferentMinim=true)
 
void ExamineFCN ()
 look at the user provided FCN and get data and model function is they derive from ROOT::Fit FCN classes More...
 
template<class ObjFuncType >
bool GetDataFromFCN ()
 internal functions to get data set and model function from FCN useful for fits done with customized FCN classes More...
 
int GetNCallsFromFCN ()
 
void SetData (const FitData &data)
 
template<class Data >
void SetData (const std::shared_ptr< Data > &data)
 
template<class T >
void SetFunctionAndData (const IModelFunctionTempl< T > &func, const FitData &data)
 

Private Member Functions

 Fitter (const Fitter &)
 Copy constructor (disabled, class is not copyable) More...
 
Fitteroperator= (const Fitter &rhs)
 Assignment operator (disabled, class is not copyable) More...
 

Private Attributes

bool fBinFit
 
FitConfig fConfig
 
std::shared_ptr< ROOT::Fit::FitDatafData
 pointer to used minimizer More...
 
int fDataSize
 
int fFitType
 
std::shared_ptr< IModelFunctionfFunc
 copy of the fitted function containing on output the fit result More...
 
std::shared_ptr< IModelFunction_vfFunc_v
 
std::shared_ptr< ROOT::Math::MinimizerfMinimizer
 pointer to the object containing the result of the fit More...
 
std::shared_ptr< ROOT::Math::IMultiGenFunctionfObjFunction
 pointer to the fit data (binned or unbinned data) More...
 
std::shared_ptr< ROOT::Fit::FitResultfResult
 copy of the fitted function containing on output the fit result More...
 
bool fUseGradient
 

#include <Fit/Fitter.h>

Member Typedef Documentation

◆ BaseFunc

◆ BaseGradFunc

◆ IGradModel1DFunction

◆ IGradModelFunction

◆ IGradModelFunction_v

◆ IModel1DFunction

◆ IModelFunction

◆ IModelFunction_v

◆ IModelFunctionTempl

Definition at line 83 of file Fitter.h.

◆ MinuitFCN_t

typedef void(* ROOT::Fit::Fitter::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 are specified in the parameter settings created before For the options same consideration as in the previous method

Definition at line 329 of file Fitter.h.

Constructor & Destructor Documentation

◆ Fitter() [1/3]

ROOT::Fit::Fitter::Fitter ( )

Default constructor.

Definition at line 61 of file Fitter.cxx.

◆ Fitter() [2/3]

ROOT::Fit::Fitter::Fitter ( const std::shared_ptr< FitResult > &  result)

Constructor from a result.

Definition at line 68 of file Fitter.cxx.

◆ ~Fitter()

ROOT::Fit::Fitter::~Fitter ( )

Destructor.

Definition at line 80 of file Fitter.cxx.

◆ Fitter() [3/3]

ROOT::Fit::Fitter::Fitter ( const Fitter rhs)
private

Copy constructor (disabled, class is not copyable)

Definition at line 87 of file Fitter.cxx.

Member Function Documentation

◆ ApplyWeightCorrection()

bool ROOT::Fit::Fitter::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 only after a fit.

The passed function (loglw2) is a log-likelihood function impelemented using the sum of weight squared When using FitConfig.SetWeightCorrection() this correction is applied automatically when doing a likelihood fit (binned or unbinned)

Definition at line 991 of file Fitter.cxx.

◆ CalculateHessErrors()

bool ROOT::Fit::Fitter::CalculateHessErrors ( )

perform an error analysis on the result using the Hessian Errors are obtaied from the inverse of the Hessian matrix To be called only after fitting and when a minimizer supporting the Hessian calculations is used otherwise an error (false) is returned.

A new FitResult with the Hessian result will be produced

Definition at line 665 of file Fitter.cxx.

◆ CalculateMinosErrors()

bool ROOT::Fit::Fitter::CalculateMinosErrors ( )

perform an error analysis on the result using MINOS To be called only after fitting and when a minimizer supporting MINOS is used otherwise an error (false) is returned.

The result will be appended in the fit result class Optionally a vector of parameter indeces can be passed for selecting the parameters to analyse using FitConfig::SetMinosErrors

Definition at line 741 of file Fitter.cxx.

◆ Config() [1/2]

FitConfig& ROOT::Fit::Fitter::Config ( )
inline

access to the configuration (non const method)

Definition at line 417 of file Fitter.h.

◆ Config() [2/2]

const FitConfig& ROOT::Fit::Fitter::Config ( ) const
inline

access to the fit configuration (const method)

Definition at line 412 of file Fitter.h.

◆ DoBinnedLikelihoodFit()

bool ROOT::Fit::Fitter::DoBinnedLikelihoodFit ( bool  extended = true,
const ROOT::Fit::ExecutionPolicy executionPolicy = ROOT::Fit::ExecutionPolicy::kSerial 
)
protected

binned likelihood fit

Definition at line 434 of file Fitter.cxx.

◆ DoInitMinimizer()

bool ROOT::Fit::Fitter::DoInitMinimizer ( )
protected

Definition at line 837 of file Fitter.cxx.

◆ DoLeastSquareFit()

bool ROOT::Fit::Fitter::DoLeastSquareFit ( const ROOT::Fit::ExecutionPolicy executionPolicy = ROOT::Fit::ExecutionPolicy::kSerial)
protected

least square fit

Definition at line 375 of file Fitter.cxx.

◆ DoLinearFit()

bool ROOT::Fit::Fitter::DoLinearFit ( )
protected

linear least square fit

Definition at line 648 of file Fitter.cxx.

◆ DoMinimization() [1/2]

bool ROOT::Fit::Fitter::DoMinimization ( const BaseFunc f,
const ROOT::Math::IMultiGenFunction chifunc = 0 
)
protected

do minimization

Definition at line 954 of file Fitter.cxx.

◆ DoMinimization() [2/2]

bool ROOT::Fit::Fitter::DoMinimization ( const ROOT::Math::IMultiGenFunction chifunc = 0)
protected

Definition at line 911 of file Fitter.cxx.

◆ DoUnbinnedLikelihoodFit()

bool ROOT::Fit::Fitter::DoUnbinnedLikelihoodFit ( bool  extended = false,
const ROOT::Fit::ExecutionPolicy executionPolicy = ROOT::Fit::ExecutionPolicy::kSerial 
)
protected

un-binned likelihood fit

Definition at line 543 of file Fitter.cxx.

◆ DoUpdateFitConfig()

void ROOT::Fit::Fitter::DoUpdateFitConfig ( )
protected

Definition at line 965 of file Fitter.cxx.

◆ DoUpdateMinimizerOptions()

bool ROOT::Fit::Fitter::DoUpdateMinimizerOptions ( bool  canDifferentMinim = true)
protected

Definition at line 879 of file Fitter.cxx.

◆ EvalFCN()

bool ROOT::Fit::Fitter::EvalFCN ( )

Perform a simple FCN evaluation.

FitResult will be modified and contain the value of the FCN

Definition at line 354 of file Fitter.cxx.

◆ ExamineFCN()

void ROOT::Fit::Fitter::ExamineFCN ( )
protected

look at the user provided FCN and get data and model function is they derive from ROOT::Fit FCN classes

Definition at line 1098 of file Fitter.cxx.

◆ Fit() [1/4]

bool ROOT::Fit::Fitter::Fit ( const BinData data,
const ROOT::Fit::ExecutionPolicy executionPolicy = ROOT::Fit::ExecutionPolicy::kSerial 
)
inline

Fit a binned data set using a least square fit (default method)

Definition at line 151 of file Fitter.h.

◆ Fit() [2/4]

template<class Data , class Function , class cond = typename std::enable_if<!(std::is_same<Function, ROOT::Fit::ExecutionPolicy>::value || std::is_same<Function, int>::value), Function>::type>
bool ROOT::Fit::Fitter::Fit ( const Data &  data,
const Function func,
const ROOT::Fit::ExecutionPolicy executionPolicy = ROOT::Fit::ExecutionPolicy::kSerial 
)
inline

fit a data set using any generic model function If data set is binned a least square fit is performed If data set is unbinned a maximum likelihood fit (not extended) is done Pre-requisite on the function: it must implement the 1D or multidimensional parametric function interface

Definition at line 141 of file Fitter.h.

◆ Fit() [3/4]

bool ROOT::Fit::Fitter::Fit ( const std::shared_ptr< BinData > &  data,
const ROOT::Fit::ExecutionPolicy executionPolicy = ROOT::Fit::ExecutionPolicy::kSerial 
)
inline

Definition at line 155 of file Fitter.h.

◆ Fit() [4/4]

bool ROOT::Fit::Fitter::Fit ( const UnBinData data,
bool  extended = false,
const ROOT::Fit::ExecutionPolicy executionPolicy = ROOT::Fit::ExecutionPolicy::kSerial 
)
inline

fit an unbinned data set using loglikelihood method

Definition at line 170 of file Fitter.h.

◆ FitFCN() [1/7]

bool ROOT::Fit::Fitter::FitFCN ( )

Perform a fit with the previously set FCN function.

Require SetFCN before

Definition at line 336 of file Fitter.cxx.

◆ FitFCN() [2/7]

bool ROOT::Fit::Fitter::FitFCN ( const ROOT::Math::FitMethodFunction fcn,
const double params = 0 
)

Fit using a FitMethodFunction interface.

Same as method above, but now extra information can be taken from the function class

Definition at line 293 of file Fitter.cxx.

◆ FitFCN() [3/7]

bool ROOT::Fit::Fitter::FitFCN ( const ROOT::Math::FitMethodGradFunction fcn,
const double params = 0 
)

Fit using a FitMethodGradFunction interface.

Same as method above, but now extra information can be taken from the function class

◆ FitFCN() [4/7]

bool ROOT::Fit::Fitter::FitFCN ( const ROOT::Math::IMultiGenFunction fcn,
const double params = 0,
unsigned int  dataSize = 0,
bool  chi2fit = false 
)

Fit using the given FCN function represented by a multi-dimensional function interface (ROOT::Math::IMultiGenFunction).

Give optionally the initial arameter values, data size to have the fit Ndf correctly set in the FitResult and flag specifying if it is a chi2 fit. Note that if the parameters values are not given (params=0) the current parameter settings are used. The parameter settings can be created before by using the FitConfig::SetParamsSetting. If they have not been created they are created automatically when the params pointer is not zero. Note that passing a params != 0 will set the parameter settings to the new value AND also the step sizes to some pre-defined value (stepsize = 0.3 * abs(parameter_value) )

Definition at line 275 of file Fitter.cxx.

◆ FitFCN() [5/7]

bool ROOT::Fit::Fitter::FitFCN ( const ROOT::Math::IMultiGradFunction fcn,
const double params = 0,
unsigned int  dataSize = 0,
bool  chi2fit = false 
)

Fit using the given FCN function representing a multi-dimensional gradient function interface (ROOT::Math::IMultiGradFunction).

In this case the minimizer will use the gradient information provided by the function. For the options same consideration as in the previous method

Definition at line 284 of file Fitter.cxx.

◆ FitFCN() [6/7]

bool ROOT::Fit::Fitter::FitFCN ( MinuitFCN_t  fcn,
int  npar = 0,
const double params = 0,
unsigned int  dataSize = 0,
bool  chi2fit = false 
)

Definition at line 326 of file Fitter.cxx.

◆ FitFCN() [7/7]

template<class Function >
bool ROOT::Fit::Fitter::FitFCN ( unsigned int  npar,
Function fcn,
const double params = 0,
unsigned int  dataSize = 0,
bool  chi2fit = false 
)

Fit using the a generic FCN function as a C++ callable object implementing double () (const double *) Note that the function dimension (i.e.

the number of parameter) is needed in this case For the options see documentation for following methods FitFCN(IMultiGenFunction & fcn,..)

Definition at line 610 of file Fitter.h.

◆ GetDataFromFCN()

template<class ObjFuncType >
bool ROOT::Fit::Fitter::GetDataFromFCN
protected

internal functions to get data set and model function from FCN useful for fits done with customized FCN classes

Definition at line 544 of file Fitter.h.

◆ GetFCN()

ROOT::Math::IMultiGenFunction* ROOT::Fit::Fitter::GetFCN ( ) const
inline

return pointer to last used objective function (is NULL in case fit is not yet done) This pointer will be valid as far as the fitter class has not been deleted.

To be used after the fitting. The pointer should not be stored and will be invalided after performing a new fitting. In this case a new instance of the function pointer will be re-created and can be obtained calling again GetFCN()

Definition at line 445 of file Fitter.h.

◆ GetMinimizer()

ROOT::Math::Minimizer* ROOT::Fit::Fitter::GetMinimizer ( ) const
inline

return pointer to last used minimizer (is NULL in case fit is not yet done) This pointer is guranteed to be valid as far as the fitter class is valid and a new fit is not redone.

To be used only after fitting. The pointer should not be stored and will be invalided after performing a new fitting. In this case a new instance of ROOT::Math::Minimizer will be re-created and can be obtained calling again GetMinimizer()

Definition at line 434 of file Fitter.h.

◆ GetNCallsFromFCN()

int ROOT::Fit::Fitter::GetNCallsFromFCN ( )
protected

Definition at line 975 of file Fitter.cxx.

◆ IsBinFit()

bool ROOT::Fit::Fitter::IsBinFit ( ) const
inline

query if fit is binned.

In cse of false teh fit can be unbinned or is not defined (like in case of fitting through a ::FitFCN)

Definition at line 423 of file Fitter.h.

◆ LeastSquareFit()

bool ROOT::Fit::Fitter::LeastSquareFit ( const BinData data)
inline

Fit a binned data set using a least square fit.

Definition at line 163 of file Fitter.h.

◆ LikelihoodFit() [1/5]

bool ROOT::Fit::Fitter::LikelihoodFit ( const BinData data,
bool  extended = true,
const ROOT::Fit::ExecutionPolicy executionPolicy = ROOT::Fit::ExecutionPolicy::kSerial 
)
inline

Binned Likelihood fit.

Default is extended

Definition at line 178 of file Fitter.h.

◆ LikelihoodFit() [2/5]

template<class Data , class Function >
bool ROOT::Fit::Fitter::LikelihoodFit ( const Data &  data,
const Function func,
bool  extended 
)
inline

fit a data set using any generic model function Pre-requisite on the function:

Definition at line 207 of file Fitter.h.

◆ LikelihoodFit() [3/5]

bool ROOT::Fit::Fitter::LikelihoodFit ( const std::shared_ptr< BinData > &  data,
bool  extended = true,
const ROOT::Fit::ExecutionPolicy executionPolicy = ROOT::Fit::ExecutionPolicy::kSerial 
)
inline

Definition at line 184 of file Fitter.h.

◆ LikelihoodFit() [4/5]

bool ROOT::Fit::Fitter::LikelihoodFit ( const std::shared_ptr< UnBinData > &  data,
bool  extended = false,
const ROOT::Fit::ExecutionPolicy executionPolicy = ROOT::Fit::ExecutionPolicy::kSerial 
)
inline

Definition at line 196 of file Fitter.h.

◆ LikelihoodFit() [5/5]

bool ROOT::Fit::Fitter::LikelihoodFit ( const UnBinData data,
bool  extended = false,
const ROOT::Fit::ExecutionPolicy executionPolicy = ROOT::Fit::ExecutionPolicy::kSerial 
)
inline

Unbinned Likelihood fit.

Default is not extended

Definition at line 192 of file Fitter.h.

◆ LinearFit() [1/2]

bool ROOT::Fit::Fitter::LinearFit ( const BinData data)
inline

do a linear fit on a set of bin-data

Definition at line 215 of file Fitter.h.

◆ LinearFit() [2/2]

bool ROOT::Fit::Fitter::LinearFit ( const std::shared_ptr< BinData > &  data)
inline

Definition at line 219 of file Fitter.h.

◆ operator=()

Fitter & ROOT::Fit::Fitter::operator= ( const Fitter rhs)
private

Assignment operator (disabled, class is not copyable)

Definition at line 94 of file Fitter.cxx.

◆ Result()

const FitResult& ROOT::Fit::Fitter::Result ( ) const
inline

get fit result

Definition at line 384 of file Fitter.h.

◆ SetData() [1/2]

void ROOT::Fit::Fitter::SetData ( const FitData data)
inlineprotected

Definition at line 485 of file Fitter.h.

◆ SetData() [2/2]

template<class Data >
void ROOT::Fit::Fitter::SetData ( const std::shared_ptr< Data > &  data)
inlineprotected

Definition at line 497 of file Fitter.h.

◆ SetFCN() [1/8]

bool ROOT::Fit::Fitter::SetFCN ( const ROOT::Math::FitMethodFunction fcn,
const double params = 0 
)

Set the objective function (FCN) using a FitMethodFunction interface.

Same as method above, but now extra information can be taken from the function class

Definition at line 251 of file Fitter.cxx.

◆ SetFCN() [2/8]

bool ROOT::Fit::Fitter::SetFCN ( const ROOT::Math::FitMethodGradFunction fcn,
const double params = 0 
)

Set the objective function (FCN) using a FitMethodGradFunction interface.

Same as method above, but now extra information can be taken from the function class

◆ SetFCN() [3/8]

bool ROOT::Fit::Fitter::SetFCN ( const ROOT::Math::IMultiGenFunction fcn,
const double params = 0,
unsigned int  dataSize = 0,
bool  chi2fit = false 
)

Set the FCN function represented by a multi-dimensional function interface (ROOT::Math::IMultiGenFunction) and optionally the initial parameters See also note above for the initial parameters for FitFCN.

Definition at line 191 of file Fitter.cxx.

◆ SetFCN() [4/8]

bool ROOT::Fit::Fitter::SetFCN ( const ROOT::Math::IMultiGenFunction fcn,
const IModelFunction func,
const double params = 0,
unsigned int  dataSize = 0,
bool  chi2fit = false 
)

Set the FCN function represented by a multi-dimensional function interface (ROOT::Math::IMultiGenFunction) and optionally the initial parameters See also note above for the initial parameters for FitFCN With this interface we pass in addition a ModelFunction that will be attached to the FitResult and used to compute confidence interval of the fit.

Definition at line 223 of file Fitter.cxx.

◆ SetFCN() [5/8]

bool ROOT::Fit::Fitter::SetFCN ( const ROOT::Math::IMultiGradFunction fcn,
const double params = 0,
unsigned int  dataSize = 0,
bool  chi2fit = false 
)

Set the FCN function represented by a multi-dimensional gradient function interface (ROOT::Math::IMultiGradFunction) and optionally the initial parameters See also note above for the initial parameters for FitFCN.

Definition at line 231 of file Fitter.cxx.

◆ SetFCN() [6/8]

bool ROOT::Fit::Fitter::SetFCN ( const ROOT::Math::IMultiGradFunction fcn,
const IModelFunction func,
const double params = 0,
unsigned int  dataSize = 0,
bool  chi2fit = false 
)

Set the FCN function represented by a multi-dimensional gradient function interface (ROOT::Math::IMultiGradFunction) and optionally the initial parameters See also note above for the initial parameters for FitFCN With this interface we pass in addition a ModelFunction that will be attached to the FitResult and used to compute confidence interval of the fit.

Definition at line 242 of file Fitter.cxx.

◆ SetFCN() [7/8]

bool ROOT::Fit::Fitter::SetFCN ( MinuitFCN_t  fcn,
int  npar = 0,
const double params = 0,
unsigned int  dataSize = 0,
bool  chi2fit = false 
)

set objective function using user provided FCN with Minuit-like interface If npar = 0 it is assumed that the parameters are specified in the parameter settings created before For the options same consideration as in the previous method

Definition at line 309 of file Fitter.cxx.

◆ SetFCN() [8/8]

template<class Function >
bool ROOT::Fit::Fitter::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 the function dimension (i.e.

the number of parameter) is needed in this case For the options see documentation for following methods FitFCN(IMultiGenFunction & fcn,..)

Definition at line 615 of file Fitter.h.

◆ SetFunction() [1/4]

void ROOT::Fit::Fitter::SetFunction ( const IGradModel1DFunction func,
bool  useGradient = true 
)

Set the fitted function from 1D gradient parametric function interface.

Definition at line 178 of file Fitter.cxx.

◆ SetFunction() [2/4]

void ROOT::Fit::Fitter::SetFunction ( const IGradModelFunction func,
bool  useGradient = true 
)

Set the fitted function (model function) from a parametric gradient function interface.

Definition at line 164 of file Fitter.cxx.

◆ SetFunction() [3/4]

void ROOT::Fit::Fitter::SetFunction ( const IModel1DFunction func,
bool  useGradient = false 
)

Set the fitted function (model function) from a vectorized parametric function interface.

Set the fitted function from a parametric 1D function interface

Definition at line 140 of file Fitter.cxx.

◆ SetFunction() [4/4]

void ROOT::Fit::Fitter::SetFunction ( const IModelFunction func,
bool  useGradient = false 
)

Set the fitted function (model function) from a parametric function interface.

Definition at line 113 of file Fitter.cxx.

◆ SetFunctionAndData()

template<class T >
void ROOT::Fit::Fitter::SetFunctionAndData ( const IModelFunctionTempl< T > &  func,
const FitData data 
)
inlineprotected

Definition at line 490 of file Fitter.h.

Member Data Documentation

◆ fBinFit

bool ROOT::Fit::Fitter::fBinFit
private

Definition at line 516 of file Fitter.h.

◆ fConfig

FitConfig ROOT::Fit::Fitter::fConfig
private

Definition at line 524 of file Fitter.h.

◆ fData

std::shared_ptr<ROOT::Fit::FitData> ROOT::Fit::Fitter::fData
private

pointer to used minimizer

Definition at line 534 of file Fitter.h.

◆ fDataSize

int ROOT::Fit::Fitter::fDataSize
private

Definition at line 522 of file Fitter.h.

◆ fFitType

int ROOT::Fit::Fitter::fFitType
private

Definition at line 520 of file Fitter.h.

◆ fFunc

std::shared_ptr<IModelFunction> ROOT::Fit::Fitter::fFunc
private

copy of the fitted function containing on output the fit result

Definition at line 528 of file Fitter.h.

◆ fFunc_v

std::shared_ptr<IModelFunction_v> ROOT::Fit::Fitter::fFunc_v
private

Definition at line 526 of file Fitter.h.

◆ fMinimizer

std::shared_ptr<ROOT::Math::Minimizer> ROOT::Fit::Fitter::fMinimizer
private

pointer to the object containing the result of the fit

Definition at line 532 of file Fitter.h.

◆ fObjFunction

std::shared_ptr<ROOT::Math::IMultiGenFunction> ROOT::Fit::Fitter::fObjFunction
private

pointer to the fit data (binned or unbinned data)

Definition at line 536 of file Fitter.h.

◆ fResult

std::shared_ptr<ROOT::Fit::FitResult> ROOT::Fit::Fitter::fResult
private

copy of the fitted function containing on output the fit result

Definition at line 530 of file Fitter.h.

◆ fUseGradient

bool ROOT::Fit::Fitter::fUseGradient
private

Definition at line 514 of file Fitter.h.

Libraries for ROOT::Fit::Fitter:
[legend]

The documentation for this class was generated from the following files: