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

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

LogLikelihoodFCN class for likelihood fits.

it is template to distinguish gradient and non-gradient case

Definition at line 40 of file LogLikelihoodFCN.h.

Public Types

typedef BasicFCN< DerivFunType, ModelFunType, UnBinDataBaseFCN
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

 LogLikelihoodFCN (const LogLikelihoodFCN &f)
 Copy constructor.
 LogLikelihoodFCN (const std::shared_ptr< UnBinData > &data, const std::shared_ptr< IModelFunction > &func, int weight=0, bool extended=false, const ::ROOT::EExecutionPolicy &executionPolicy=::ROOT::EExecutionPolicy::kSequential)
 Constructor from unbin data set and model function (pdf).
 LogLikelihoodFCN (const UnBinData &data, const IModelFunction &func, int weight=0, bool extended=false, const ::ROOT::EExecutionPolicy &executionPolicy=::ROOT::EExecutionPolicy::kSequential)
 Constructor from unbin data set and model function (pdf) for object managed by users.
virtual ~LogLikelihoodFCN ()
 Destructor (no operations).
BaseFunctionClone () const override
 clone the function (need to return Base for Windows)
virtual const UnBinDataData () 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 likelihood contribution and its gradient
std::shared_ptr< UnBinDataDataPtr () 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 NFitPoints () const
virtual unsigned int NPoints () const
 return the number of data points used in evaluating the function
LogLikelihoodFCNoperator= (const LogLikelihoodFCN &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
void UseSumOfWeightSquare (bool on=true)

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< UnBinData > &data)
 Set the data pointer.
void SetModelFunction (const std::shared_ptr< IModelFunction > &func)
 Set the function pointer.

Protected Attributes

std::shared_ptr< UnBinDatafData
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
 Execution policy.
std::vector< doublefGrad
 for derivatives
bool fIsExtended
 flag for indicating if likelihood is extended
unsigned int fNCalls
unsigned int fNDim
unsigned int fNEffPoints
 number of effective points used in the fit
unsigned int fNPoints
int fWeight
 flag to indicate if needs to evaluate using weight or weight squared (default weight = 0)

#include <Fit/LogLikelihoodFCN.h>

Inheritance diagram for ROOT::Fit::LogLikelihoodFCN< DerivFunType, ModelFunType >:
ROOT::Fit::BasicFCN< DerivFunType, ROOT::Math::IParamMultiFunction, UnBinData > ROOT::Math::BasicFitMethodFunction< DerivFunType >

Member Typedef Documentation

◆ BaseFCN

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

Definition at line 45 of file LogLikelihoodFCN.h.

◆ BaseFunction

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

Definition at line 48 of file LogLikelihoodFCN.h.

◆ BaseObjFunction

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

Definition at line 47 of file LogLikelihoodFCN.h.

◆ IGradModelFunction

Definition at line 50 of file BasicFCN.h.

◆ IModelFunction

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

Definition at line 50 of file LogLikelihoodFCN.h.

◆ T

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

Definition at line 44 of file LogLikelihoodFCN.h.

◆ Type_t

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

Definition at line 51 of file LogLikelihoodFCN.h.

Constructor & Destructor Documentation

◆ LogLikelihoodFCN() [1/3]

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
ROOT::Fit::LogLikelihoodFCN< DerivFunType, ModelFunType >::LogLikelihoodFCN ( const std::shared_ptr< UnBinData > & data,
const std::shared_ptr< IModelFunction > & func,
int weight = 0,
bool extended = false,
const ::ROOT::EExecutionPolicy & executionPolicy = ::ROOT::EExecutionPolicy::kSequential )
inline

Constructor from unbin data set and model function (pdf).

Definition at line 57 of file LogLikelihoodFCN.h.

◆ LogLikelihoodFCN() [2/3]

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
ROOT::Fit::LogLikelihoodFCN< DerivFunType, ModelFunType >::LogLikelihoodFCN ( const UnBinData & data,
const IModelFunction & func,
int weight = 0,
bool extended = false,
const ::ROOT::EExecutionPolicy & executionPolicy = ::ROOT::EExecutionPolicy::kSequential )
inline

Constructor from unbin data set and model function (pdf) for object managed by users.

Definition at line 69 of file LogLikelihoodFCN.h.

◆ ~LogLikelihoodFCN()

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

Destructor (no operations).

Definition at line 81 of file LogLikelihoodFCN.h.

◆ LogLikelihoodFCN() [3/3]

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

Copy constructor.

Definition at line 86 of file LogLikelihoodFCN.h.

Member Function Documentation

◆ Clone()

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

clone the function (need to return Base for Windows)

Definition at line 112 of file LogLikelihoodFCN.h.

◆ Data()

virtual const UnBinData & ROOT::Fit::BasicFCN< DerivFunType, ROOT::Math::IParamMultiFunction, UnBinData >::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::LogLikelihoodFCN< DerivFunType, ModelFunType >::DataElement ( const double * x,
unsigned int i,
double * g,
double * h = nullptr,
bool fullHessian = false ) const
inlineoverridevirtual

i-th likelihood contribution and its gradient

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

Definition at line 121 of file LogLikelihoodFCN.h.

◆ DataPtr()

std::shared_ptr< UnBinData > ROOT::Fit::BasicFCN< DerivFunType, ROOT::Math::IParamMultiFunction, UnBinData >::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::LogLikelihoodFCN< DerivFunType, ModelFunType >::DoDerivative ( const double * x,
unsigned int icoord ) const
inlineoverrideprivate

Definition at line 161 of file LogLikelihoodFCN.h.

◆ DoEval()

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

Evaluation of the function (required by interface).

Definition at line 155 of file LogLikelihoodFCN.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::LogLikelihoodFCN< DerivFunType, ModelFunType >::Gradient ( const double * x,
double * g ) const
inlineoverride

Definition at line 127 of file LogLikelihoodFCN.h.

◆ HasHessian()

bool ROOT::Fit::BasicFCN< DerivFunType, ROOT::Math::IParamMultiFunction, UnBinData >::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]

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

virtual const IModelFunction & ROOT::Fit::BasicFCN< DerivFunType, ROOT::Math::IParamMultiFunction, UnBinData >::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, UnBinData >::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.

◆ NFitPoints()

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
virtual unsigned int ROOT::Fit::LogLikelihoodFCN< DerivFunType, ModelFunType >::NFitPoints ( ) const
inlinevirtual

Definition at line 118 of file LogLikelihoodFCN.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>
LogLikelihoodFCN & ROOT::Fit::LogLikelihoodFCN< DerivFunType, ModelFunType >::operator= ( const LogLikelihoodFCN< DerivFunType, ModelFunType > & rhs)
inline

Assignment operator.

Definition at line 99 of file LogLikelihoodFCN.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, UnBinData >::SetData ( const std::shared_ptr< UnBinData > & data)
inlineprotectedinherited

Set the data pointer.

Definition at line 98 of file BasicFCN.h.

◆ SetModelFunction()

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

Set the function pointer.

Definition at line 101 of file BasicFCN.h.

◆ Type()

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

get type of fit method function

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

Definition at line 134 of file LogLikelihoodFCN.h.

◆ UpdateNCalls()

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

update number of calls

Definition at line 124 of file FitMethodFunction.h.

◆ UseSumOfWeightSquare()

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
void ROOT::Fit::LogLikelihoodFCN< DerivFunType, ModelFunType >::UseSumOfWeightSquare ( bool on = true)
inline

Definition at line 139 of file LogLikelihoodFCN.h.

Member Data Documentation

◆ fData

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

Definition at line 104 of file BasicFCN.h.

◆ fExecutionPolicy

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

Execution policy.

Definition at line 176 of file LogLikelihoodFCN.h.

◆ fFunc

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

Definition at line 105 of file BasicFCN.h.

◆ fGrad

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

for derivatives

Definition at line 174 of file LogLikelihoodFCN.h.

◆ fIsExtended

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
bool ROOT::Fit::LogLikelihoodFCN< DerivFunType, ModelFunType >::fIsExtended
private

flag for indicating if likelihood is extended

Definition at line 168 of file LogLikelihoodFCN.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::LogLikelihoodFCN< DerivFunType, ModelFunType >::fNEffPoints
mutableprivate

number of effective points used in the fit

Definition at line 172 of file LogLikelihoodFCN.h.

◆ fNPoints

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

Definition at line 142 of file FitMethodFunction.h.

◆ fWeight

template<class DerivFunType, class ModelFunType = ROOT::Math::IParamMultiFunction>
int ROOT::Fit::LogLikelihoodFCN< DerivFunType, ModelFunType >::fWeight
private

flag to indicate if needs to evaluate using weight or weight squared (default weight = 0)

Definition at line 169 of file LogLikelihoodFCN.h.


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