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

template<class DerivFunType, class ModelFunType, class DataType>
class ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >

BasicFCN class: base class for the objective functions used in the fits It has a reference to the data and the model function used in the fit.

It cannot be instantiated but constructed from the derived classes

Definition at line 40 of file BasicFCN.h.

Public Types

enum  Type_t
 enumeration specifying the possible fit method types More...

Public Member Functions

virtual const DataType & Data () const
 access to const reference to the data
virtual double DataElement (const double *x, unsigned int i, double *g=nullptr, double *h=nullptr, bool fullHessian=false) const=0
 method returning the data i-th contribution to the fit objective function For example the residual for the least square functions or the pdf element for the likelihood functions.
std::shared_ptr< DataType > DataPtr () const
 access to data pointer
virtual bool G2 (const double *, double *) const
 Computes the Second derivatives.
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
virtual void ResetNCalls ()
 reset number of function calls
virtual Type_t Type () const
 return the type of method, override if needed
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 BaseObjFunction::BaseFunction BaseFunction
typedef ::ROOT::Math::BasicFitMethodFunction< DerivFunType > BaseObjFunction
typedef ::ROOT::Math::IParametricGradFunctionMultiDimTempl< TIGradModelFunction
typedef ::ROOT::Math::IParamMultiFunctionTempl< TIModelFunction
typedef ModelFunType::BackendType T

Protected Member Functions

 BasicFCN (const std::shared_ptr< DataType > &data, const std::shared_ptr< IModelFunction > &func)
 Constructor from data set and model function.
virtual ~BasicFCN ()
 Destructor (no operations).
void SetData (const std::shared_ptr< DataType > &data)
 Set the data pointer.
void SetModelFunction (const std::shared_ptr< IModelFunction > &func)
 Set the function pointer.

Protected Attributes

std::shared_ptr< DataType > fData
std::shared_ptr< IModelFunctionfFunc

Private Attributes

unsigned int fNCalls
unsigned int fNDim
unsigned int fNPoints

#include <Fit/BasicFCN.h>

Inheritance diagram for ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >:
ROOT::Math::BasicFitMethodFunction< DerivFunType > ROOT::Fit::Chi2FCN< ROOT::Math::IMultiGenFunction, ROOT::Math::IParamMultiFunction > ROOT::Fit::Chi2FCN< ROOT::Math::IMultiGradFunction, ROOT::Math::IParamMultiFunction > ROOT::Fit::LogLikelihoodFCN< ROOT::Math::IMultiGenFunction, ROOT::Math::IParamMultiFunction > ROOT::Fit::LogLikelihoodFCN< ROOT::Math::IMultiGradFunction, ROOT::Math::IParamMultiFunction > ROOT::Fit::PoissonLikelihoodFCN< ROOT::Math::IMultiGenFunction, ROOT::Math::IParamMultiFunction > ROOT::Fit::PoissonLikelihoodFCN< ROOT::Math::IMultiGradFunction, ROOT::Math::IParamMultiFunction >

Member Typedef Documentation

◆ BaseFunction

template<class DerivFunType, class ModelFunType, class DataType>
typedef BaseObjFunction::BaseFunction ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >::BaseFunction
protected

Definition at line 47 of file BasicFCN.h.

◆ BaseObjFunction

template<class DerivFunType, class ModelFunType, class DataType>
typedef ::ROOT::Math::BasicFitMethodFunction<DerivFunType> ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >::BaseObjFunction
protected

Definition at line 46 of file BasicFCN.h.

◆ IGradModelFunction

template<class DerivFunType, class ModelFunType, class DataType>
typedef ::ROOT::Math::IParametricGradFunctionMultiDimTempl<T> ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >::IGradModelFunction
protected

Definition at line 50 of file BasicFCN.h.

◆ IModelFunction

template<class DerivFunType, class ModelFunType, class DataType>
typedef ::ROOT::Math::IParamMultiFunctionTempl<T> ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >::IModelFunction
protected

Definition at line 49 of file BasicFCN.h.

◆ T

template<class DerivFunType, class ModelFunType, class DataType>
typedef ModelFunType::BackendType ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >::T
protected

Definition at line 44 of file BasicFCN.h.

Member Enumeration Documentation

◆ Type_t

enumeration specifying the possible fit method types

Definition at line 46 of file FitMethodFunction.h.

Constructor & Destructor Documentation

◆ BasicFCN()

template<class DerivFunType, class ModelFunType, class DataType>
ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >::BasicFCN ( const std::shared_ptr< DataType > & data,
const std::shared_ptr< IModelFunction > & func )
inlineprotected

Constructor from data set and model function.

Definition at line 55 of file BasicFCN.h.

◆ ~BasicFCN()

template<class DerivFunType, class ModelFunType, class DataType>
virtual ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >::~BasicFCN ( )
inlineprotectedvirtual

Destructor (no operations).

Definition at line 66 of file BasicFCN.h.

Member Function Documentation

◆ Data()

template<class DerivFunType, class ModelFunType, class DataType>
virtual const DataType & ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >::Data ( ) const
inlinevirtual

access to const reference to the data

Definition at line 72 of file BasicFCN.h.

◆ DataElement()

virtual double ROOT::Math::BasicFitMethodFunction< DerivFunType >::DataElement ( const double * x,
unsigned int i,
double * g = nullptr,
double * h = nullptr,
bool fullHessian = false ) const
pure virtualinherited

method returning the data i-th contribution to the fit objective function For example the residual for the least square functions or the pdf element for the likelihood functions.

Estimating also the gradient of the data element if the passed pointer is not null and the Hessian. The flag fullHessian is set when one needs to compute the full Hessian (not the approximated one) and should be used when the full second derivatives of the model functions are available

Implemented in ROOT::Fit::Chi2FCN< DerivFunType, ModelFunType >, ROOT::Fit::Chi2FCN< ROOT::Math::IMultiGenFunction, ROOT::Math::IParamMultiFunction >, ROOT::Fit::Chi2FCN< ROOT::Math::IMultiGradFunction, ROOT::Math::IParamMultiFunction >, ROOT::Fit::LogLikelihoodFCN< DerivFunType, ModelFunType >, ROOT::Fit::LogLikelihoodFCN< ROOT::Math::IMultiGenFunction, ROOT::Math::IParamMultiFunction >, ROOT::Fit::LogLikelihoodFCN< ROOT::Math::IMultiGradFunction, ROOT::Math::IParamMultiFunction >, ROOT::Fit::PoissonLikelihoodFCN< DerivFunType, ModelFunType >, ROOT::Fit::PoissonLikelihoodFCN< ROOT::Math::IMultiGenFunction, ROOT::Math::IParamMultiFunction >, and ROOT::Fit::PoissonLikelihoodFCN< ROOT::Math::IMultiGradFunction, ROOT::Math::IParamMultiFunction >.

◆ DataPtr()

template<class DerivFunType, class ModelFunType, class DataType>
std::shared_ptr< DataType > ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >::DataPtr ( ) const
inline

access to data pointer

Definition at line 75 of file BasicFCN.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.

◆ HasHessian()

template<class DerivFunType, class ModelFunType, class DataType>
bool ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >::HasHessian ( ) const
inlineoverridevirtual

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]

Definition at line 149 of file FitMethodFunction.h.

◆ 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()

template<class DerivFunType, class ModelFunType, class DataType>
virtual const IModelFunction & ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >::ModelFunction ( ) const
inlinevirtual

access to const reference to the model function

Definition at line 78 of file BasicFCN.h.

◆ ModelFunctionPtr()

template<class DerivFunType, class ModelFunType, class DataType>
std::shared_ptr< IModelFunction > ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >::ModelFunctionPtr ( ) const
inline

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.

◆ ResetNCalls()

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

reset number of function calls

Definition at line 129 of file FitMethodFunction.h.

◆ SetData()

template<class DerivFunType, class ModelFunType, class DataType>
void ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >::SetData ( const std::shared_ptr< DataType > & data)
inlineprotected

Set the data pointer.

Definition at line 98 of file BasicFCN.h.

◆ SetModelFunction()

template<class DerivFunType, class ModelFunType, class DataType>
void ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >::SetModelFunction ( const std::shared_ptr< IModelFunction > & func)
inlineprotected

Set the function pointer.

Definition at line 101 of file BasicFCN.h.

◆ Type()

◆ 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

template<class DerivFunType, class ModelFunType, class DataType>
std::shared_ptr<DataType> ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >::fData
protected

Definition at line 104 of file BasicFCN.h.

◆ fFunc

template<class DerivFunType, class ModelFunType, class DataType>
std::shared_ptr<IModelFunction> ROOT::Fit::BasicFCN< DerivFunType, ModelFunType, DataType >::fFunc
protected

Definition at line 105 of file BasicFCN.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.

◆ 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: