Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType > Class Template Reference

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
class ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >

Chi2FCN class for binned fits using the least square methods.

Definition at line 46 of file Chi2FCN.h.

Public Types

typedef BasicFCN< DerivFunType, ModelFunType, BinDataBaseFCN
typedef BaseObjFunction::BaseFunction BaseFunction
typedef ::ROOT::Math::BasicFitMethodFunction< DerivFunType > BaseObjFunction
typedef ::ROOT::Math::IParamMultiFunctionTempl< TIModelFunction
typedef ModelFunType::BackendType T
typedef BaseObjFunction::Type_t Type_t

Public Member Functions

 Chi2FCN (const BinData &data, const IModelFunction &func, const ::ROOT::EExecutionPolicy &executionPolicy=::ROOT::EExecutionPolicy::kSequential)
 Same Constructor from data set (binned ) and model function cloning the function and the data.
 Chi2FCN (const Chi2FCN &f)
 Copy constructor.
 Chi2FCN (const std::shared_ptr< BinData > &data, const std::shared_ptr< IModelFunction > &func, const ::ROOT::EExecutionPolicy &executionPolicy=::ROOT::EExecutionPolicy::kSequential)
 Constructor from data set (binned ) and model function.
virtual ~Chi2FCN ()
 Destructor (no operations).
BaseFunctionClone () const override
virtual const BinDataData () const
 access to const reference to the data
double DataElement (const double *x, unsigned int i, double *g, double *h=nullptr, bool fullHessian=false) const override
 i-th chi-square residual
std::shared_ptr< BinDataDataPtr () const
 access to data pointer
virtual bool G2 (const double *, double *) const
 Computes the Second derivatives.
void Gradient (const double *x, double *g) const override
bool HasHessian () const override
 flag to indicate if can compute Hessian
virtual bool Hessian (const double *x, double *hess) const
 Computes the full Hessian.
bool IsAGradFCN ()
virtual const IModelFunctionModelFunction () const
 access to const reference to the model function
std::shared_ptr< IModelFunctionModelFunctionPtr () const
 access to function pointer
virtual unsigned int NCalls () const
 return the total number of function calls (override if needed)
unsigned int NDim () const override
 Number of dimension (parameters) .
virtual unsigned int NPoints () const
 return the number of data points used in evaluating the function
Chi2FCNoperator= (const Chi2FCN &rhs)
 Assignment operator.
virtual void ResetNCalls ()
 reset number of function calls
BaseObjFunction::Type_t Type () const override
 get type of fit method function
virtual void UpdateNCalls () const
 update number of calls

Static Public Member Functions

static bool IsAGradFCN ()
 Static function to indicate if a function is supporting gradient.

Protected Types

typedef ::ROOT::Math::IParametricGradFunctionMultiDimTempl< TIGradModelFunction

Protected Member Functions

void SetData (const std::shared_ptr< BinData > &data)
 Set the data pointer.
void SetModelFunction (const std::shared_ptr< IModelFunction > &func)
 Set the function pointer.
virtual void SetNFitPoints (unsigned int n) const
 set number of fit points (need to be called in const methods, make it const)

Protected Attributes

std::shared_ptr< BinDatafData
std::shared_ptr< IModelFunctionfFunc

Private Member Functions

double DoDerivative (const double *x, unsigned int icoord) const override
double DoEval (const double *x) const override
 Evaluation of the function (required by interface).

Private Attributes

::ROOT::EExecutionPolicy fExecutionPolicy
std::vector< doublefGrad
 for derivatives
unsigned int fNCalls
unsigned int fNDim
unsigned int fNEffPoints
 number of effective points used in the fit
unsigned int fNPoints

#include <Fit/Chi2FCN.h>

Inheritance diagram for ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >:
ROOT::Fit::BasicFCN< DerivFunType, ROOT::Math::IParamMultiFunction, BinData > ROOT::Math::BasicFitMethodFunction< DerivFunType >

Member Typedef Documentation

◆ BaseFCN

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
typedef BasicFCN<DerivFunType, ModelFunType, BinData> ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::BaseFCN

Definition at line 51 of file Chi2FCN.h.

◆ BaseFunction

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
typedef BaseObjFunction::BaseFunction ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::BaseFunction

Definition at line 54 of file Chi2FCN.h.

◆ BaseObjFunction

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
typedef ::ROOT::Math::BasicFitMethodFunction<DerivFunType> ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::BaseObjFunction

Definition at line 53 of file Chi2FCN.h.

◆ IGradModelFunction

typedef ::ROOT::Math::IParametricGradFunctionMultiDimTempl<T> ROOT::Fit::BasicFCN< DerivFunType, ROOT::Math::IParamMultiFunction, BinData >::IGradModelFunction
protectedinherited

Definition at line 50 of file BasicFCN.h.

◆ IModelFunction

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
typedef ::ROOT::Math::IParamMultiFunctionTempl<T> ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::IModelFunction

Definition at line 57 of file Chi2FCN.h.

◆ T

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
typedef ModelFunType::BackendType ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::T

Definition at line 50 of file Chi2FCN.h.

◆ Type_t

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
typedef BaseObjFunction::Type_t ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::Type_t

Definition at line 58 of file Chi2FCN.h.

Constructor & Destructor Documentation

◆ Chi2FCN() [1/3]

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::Chi2FCN ( const std::shared_ptr< BinData > & data,
const std::shared_ptr< IModelFunction > & func,
const ::ROOT::EExecutionPolicy & executionPolicy = ::ROOT::EExecutionPolicy::kSequential )
inline

Constructor from data set (binned ) and model function.

Definition at line 63 of file Chi2FCN.h.

◆ Chi2FCN() [2/3]

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::Chi2FCN ( const BinData & data,
const IModelFunction & func,
const ::ROOT::EExecutionPolicy & executionPolicy = ::ROOT::EExecutionPolicy::kSequential )
inline

Same Constructor from data set (binned ) and model function cloning the function and the data.

Definition at line 73 of file Chi2FCN.h.

◆ ~Chi2FCN()

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
virtual ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::~Chi2FCN ( )
inlinevirtual

Destructor (no operations).

Definition at line 83 of file Chi2FCN.h.

◆ Chi2FCN() [3/3]

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::Chi2FCN ( const Chi2FCN< DerivFunType, ModelFunType > & f)
inline

Copy constructor.

Definition at line 87 of file Chi2FCN.h.

Member Function Documentation

◆ Clone()

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
BaseFunction * ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::Clone ( ) const
inlineoverride

Definition at line 107 of file Chi2FCN.h.

◆ Data()

virtual const BinData & ROOT::Fit::BasicFCN< DerivFunType, ROOT::Math::IParamMultiFunction, BinData >::Data ( ) const
inlinevirtualinherited

access to const reference to the data

Definition at line 72 of file BasicFCN.h.

◆ DataElement()

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
double ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::DataElement ( const double * x,
unsigned int i,
double * g,
double * h = nullptr,
bool fullHessian = false ) const
inlineoverridevirtual

i-th chi-square residual

Implements ROOT::Math::BasicFitMethodFunction< DerivFunType >.

Definition at line 117 of file Chi2FCN.h.

◆ DataPtr()

std::shared_ptr< BinData > ROOT::Fit::BasicFCN< DerivFunType, ROOT::Math::IParamMultiFunction, BinData >::DataPtr ( ) const
inlineinherited

access to data pointer

Definition at line 75 of file BasicFCN.h.

◆ DoDerivative()

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
double ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::DoDerivative ( const double * x,
unsigned int icoord ) const
inlineoverrideprivate

Definition at line 153 of file Chi2FCN.h.

◆ DoEval()

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
double ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::DoEval ( const double * x) const
inlineoverrideprivate

Evaluation of the function (required by interface).

Definition at line 144 of file Chi2FCN.h.

◆ G2()

virtual bool ROOT::Math::BasicFitMethodFunction< DerivFunType >::G2 ( const double * ,
double *  ) const
inlinevirtualinherited

Computes the Second derivatives.

Return false if this is not supported

Definition at line 104 of file FitMethodFunction.h.

◆ Gradient()

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
void ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::Gradient ( const double * x,
double * g ) const
inlineoverride

Definition at line 123 of file Chi2FCN.h.

◆ HasHessian()

bool ROOT::Fit::BasicFCN< DerivFunType, ROOT::Math::IParamMultiFunction, BinData >::HasHessian ( ) const
inlineoverridevirtualinherited

flag to indicate if can compute Hessian

Reimplemented from ROOT::Math::BasicFitMethodFunction< DerivFunType >.

Definition at line 84 of file BasicFCN.h.

◆ Hessian()

virtual bool ROOT::Math::BasicFitMethodFunction< DerivFunType >::Hessian ( const double * x,
double * hess ) const
inlinevirtualinherited

Computes the full Hessian.

Return false if Hessian is not supported

Definition at line 81 of file FitMethodFunction.h.

◆ IsAGradFCN() [1/2]

◆ IsAGradFCN() [2/2]

bool ROOT::Math::BasicFitMethodFunction< DerivFunType >::IsAGradFCN ( )
inlinestaticinherited

Static function to indicate if a function is supporting gradient.

Definition at line 135 of file FitMethodFunction.h.

◆ ModelFunction()

virtual const IModelFunction & ROOT::Fit::BasicFCN< DerivFunType, ROOT::Math::IParamMultiFunction, BinData >::ModelFunction ( ) const
inlinevirtualinherited

access to const reference to the model function

Definition at line 78 of file BasicFCN.h.

◆ ModelFunctionPtr()

std::shared_ptr< IModelFunction > ROOT::Fit::BasicFCN< DerivFunType, ROOT::Math::IParamMultiFunction, BinData >::ModelFunctionPtr ( ) const
inlineinherited

access to function pointer

Definition at line 81 of file BasicFCN.h.

◆ NCalls()

virtual unsigned int ROOT::Math::BasicFitMethodFunction< DerivFunType >::NCalls ( ) const
inlinevirtualinherited

return the total number of function calls (override if needed)

Definition at line 119 of file FitMethodFunction.h.

◆ NDim()

unsigned int ROOT::Math::BasicFitMethodFunction< DerivFunType >::NDim ( ) const
inlineoverrideinherited

Number of dimension (parameters) .

From IGenMultiFunction interface

Definition at line 63 of file FitMethodFunction.h.

◆ NPoints()

virtual unsigned int ROOT::Math::BasicFitMethodFunction< DerivFunType >::NPoints ( ) const
inlinevirtualinherited

return the number of data points used in evaluating the function

Definition at line 109 of file FitMethodFunction.h.

◆ operator=()

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
Chi2FCN & ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::operator= ( const Chi2FCN< DerivFunType, ModelFunType > & rhs)
inline

Assignment operator.

Definition at line 97 of file Chi2FCN.h.

◆ ResetNCalls()

virtual void ROOT::Math::BasicFitMethodFunction< DerivFunType >::ResetNCalls ( )
inlinevirtualinherited

reset number of function calls

Definition at line 129 of file FitMethodFunction.h.

◆ SetData()

void ROOT::Fit::BasicFCN< DerivFunType, ROOT::Math::IParamMultiFunction, BinData >::SetData ( const std::shared_ptr< BinData > & data)
inlineprotectedinherited

Set the data pointer.

Definition at line 98 of file BasicFCN.h.

◆ SetModelFunction()

void ROOT::Fit::BasicFCN< DerivFunType, ROOT::Math::IParamMultiFunction, BinData >::SetModelFunction ( const std::shared_ptr< IModelFunction > & func)
inlineprotectedinherited

Set the function pointer.

Definition at line 101 of file BasicFCN.h.

◆ SetNFitPoints()

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
virtual void ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::SetNFitPoints ( unsigned int n) const
inlineprotectedvirtual

set number of fit points (need to be called in const methods, make it const)

Definition at line 137 of file Chi2FCN.h.

◆ Type()

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
BaseObjFunction::Type_t ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::Type ( ) const
inlineoverridevirtual

get type of fit method function

Reimplemented from ROOT::Math::BasicFitMethodFunction< DerivFunType >.

Definition at line 131 of file Chi2FCN.h.

◆ UpdateNCalls()

virtual void ROOT::Math::BasicFitMethodFunction< DerivFunType >::UpdateNCalls ( ) const
inlinevirtualinherited

update number of calls

Definition at line 124 of file FitMethodFunction.h.

Member Data Documentation

◆ fData

std::shared_ptr<BinData> ROOT::Fit::BasicFCN< DerivFunType, ROOT::Math::IParamMultiFunction, BinData >::fData
protectedinherited

Definition at line 104 of file BasicFCN.h.

◆ fExecutionPolicy

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
::ROOT::EExecutionPolicy ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::fExecutionPolicy
private

Definition at line 162 of file Chi2FCN.h.

◆ fFunc

std::shared_ptr<IModelFunction> ROOT::Fit::BasicFCN< DerivFunType, ROOT::Math::IParamMultiFunction, BinData >::fFunc
protectedinherited

Definition at line 105 of file BasicFCN.h.

◆ fGrad

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
std::vector<double> ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::fGrad
mutableprivate

for derivatives

Definition at line 161 of file Chi2FCN.h.

◆ fNCalls

unsigned int ROOT::Math::BasicFitMethodFunction< DerivFunType >::fNCalls
mutableprivateinherited

Definition at line 143 of file FitMethodFunction.h.

◆ fNDim

unsigned int ROOT::Math::BasicFitMethodFunction< DerivFunType >::fNDim
privateinherited

Definition at line 141 of file FitMethodFunction.h.

◆ fNEffPoints

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
unsigned int ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >::fNEffPoints
mutableprivate

number of effective points used in the fit

Definition at line 159 of file Chi2FCN.h.

◆ fNPoints

unsigned int ROOT::Math::BasicFitMethodFunction< DerivFunType >::fNPoints
privateinherited

Definition at line 142 of file FitMethodFunction.h.


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