Logo ROOT  
Reference Guide
RooGradMinimizerFcn Class Reference

Definition at line 29 of file RooGradMinimizerFcn.h.

Public Types

enum class  GradientCalculatorMode { ExactlyMinuit2 , AlmostMinuit2 }
 
- Public Types inherited from ROOT::Math::IGradientFunctionMultiDimTempl< T >
typedef IBaseFunctionMultiDimTempl< T > BaseFunc
 
typedef IGradientMultiDimTempl< T > BaseGrad
 
- Public Types inherited from ROOT::Math::IBaseFunctionMultiDimTempl< T >
typedef T BackendType
 
typedef IBaseFunctionMultiDimTempl< T > BaseFunc
 

Public Member Functions

 RooGradMinimizerFcn (const RooGradMinimizerFcn &other)
 
 RooGradMinimizerFcn (RooAbsReal *funct, RooMinimizer *context, bool verbose=false)
 
ROOT::Math::IMultiGradFunctionClone () const override
 Clone a function. More...
 
double getErrorDef () const
 
std::string getFunctionName () const override
 RooMinimizer sometimes needs the name of the minimized function. Implement this in the derived class. More...
 
std::string getFunctionTitle () const override
 RooMinimizer sometimes needs the title of the minimized function. Implement this in the derived class. More...
 
ROOT::Minuit2::MnStrategy getStrategy () const
 
unsigned int NDim () const override
 Retrieve the dimension of the function. More...
 
bool returnsInMinuit2ParameterSpace () const override
 
void setErrorLevel (double error_level) const
 
void setGradTolerance (double grad_tolerance) const
 
void setNcycles (unsigned int ncycles) const
 
void setOffsetting (Bool_t flag) override
 Enable or disable offsetting on the function to be minimized, which enhances numerical precision. More...
 
void setStepTolerance (double step_tolerance) const
 
void setStrategy (int istrat)
 
Bool_t Synchronize (std::vector< ROOT::Fit::ParameterSettings > &parameter_settings, Bool_t optConst, Bool_t verbose=kFALSE) override
 Like synchronizeParameterSettings, Synchronize informs Minuit through its parameter_settings vector of RooFit parameter properties, but Synchronize can be overridden to e.g. More...
 
void synchronizeGradientParameterSettings (std::vector< ROOT::Fit::ParameterSettings > &parameter_settings) const
 
- Public Member Functions inherited from ROOT::Math::IGradientFunctionMultiDimTempl< T >
virtual ~IGradientFunctionMultiDimTempl ()
 Virtual Destructor (no operations) More...
 
virtual void FdF (const T *x, T &f, T *df) const
 Optimized method to evaluate at the same time the function value and derivative at a point x. More...
 
virtual void Gradient (const T *x, T *grad) const
 Evaluate all the vector of function derivatives (gradient) at a point x. More...
 
virtual void GradientWithPrevResult (const T *x, T *grad, T *previous_grad, T *previous_g2, T *previous_gstep) const
 In some cases, the gradient algorithm will use information from the previous step, these can be passed in with this overload. More...
 
virtual unsigned int NDim () const=0
 Retrieve the dimension of the function. More...
 
virtual bool returnsInMinuit2ParameterSpace () const
 
- Public Member Functions inherited from ROOT::Math::IBaseFunctionMultiDimTempl< T >
 IBaseFunctionMultiDimTempl ()
 
virtual ~IBaseFunctionMultiDimTempl ()
 virtual destructor More...
 
virtual IBaseFunctionMultiDimTempl< T > * Clone () const =0
 Clone a function. More...
 
virtual unsigned int NDim () const =0
 Retrieve the dimension of the function. More...
 
operator() (const T *x) const
 Evaluate the function at a point x[]. More...
 
- Public Member Functions inherited from ROOT::Math::IGradientMultiDimTempl< T >
virtual ~IGradientMultiDimTempl ()
 virual destructor More...
 
Derivative (const T *x, unsigned int icoord, T *previous_grad, T *previous_g2, T *previous_gstep) const
 In some cases, the derivative algorithm will use information from the previous step, these can be passed in with this overload. More...
 
Derivative (const T *x, unsigned int icoord=0) const
 Return the partial derivative with respect to the passed coordinate. More...
 
virtual void FdF (const T *x, T &f, T *df) const =0
 Optimized method to evaluate at the same time the function value and derivative at a point x. More...
 
virtual void Gradient (const T *x, T *grad) const =0
 Evaluate all the vector of function derivatives (gradient) at a point x. More...
 
- Public Member Functions inherited from RooAbsMinimizerFcn
 RooAbsMinimizerFcn (const RooAbsMinimizerFcn &other)
 
 RooAbsMinimizerFcn (RooArgList paramList, RooMinimizer *context, bool verbose=false)
 
virtual ~RooAbsMinimizerFcn ()=default
 
void ApplyCovarianceMatrix (TMatrixDSym &V)
 Set different external covariance matrix. More...
 
void BackProp (const ROOT::Fit::FitResult &results)
 Put Minuit results back into RooFit objects. More...
 
Int_t evalCounter () const
 
RooArgListGetConstParamList ()
 
RooArgListGetFloatParamList ()
 Logistics. More...
 
virtual std::string getFunctionName () const =0
 RooMinimizer sometimes needs the name of the minimized function. Implement this in the derived class. More...
 
virtual std::string getFunctionTitle () const =0
 RooMinimizer sometimes needs the title of the minimized function. Implement this in the derived class. More...
 
RooArgListGetInitConstParamList ()
 
RooArgListGetInitFloatParamList ()
 
std::ofstream * GetLogFile ()
 
Double_tGetMaxFCN ()
 
unsigned int getNDim () const
 
Int_t GetNumInvalidNLL () const
 
double getOffset () const
 Return a possible offset that's applied to the function to separate invalid function values from valid ones. More...
 
bool getOptConst ()
 
std::vector< doublegetParameterValues () const
 
void SetEvalErrorWall (Bool_t flag)
 
Bool_t SetLogFile (const char *inLogfile)
 Change the file name for logging of a RooMinimizer of all MINUIT steppings through the parameter space. More...
 
virtual void setOffsetting (Bool_t flag)=0
 Enable or disable offsetting on the function to be minimized, which enhances numerical precision. More...
 
void setOptimizeConst (Int_t flag)
 
Bool_t SetPdfParamVal (int index, double value) const
 Set value of parameter i. More...
 
void SetPrintEvalErrors (Int_t numEvalErrors)
 
void SetRecoverFromNaNStrength (double strength)
 Try to recover from invalid function values. More...
 
void SetVerbose (Bool_t flag=kTRUE)
 
virtual Bool_t Synchronize (std::vector< ROOT::Fit::ParameterSettings > &parameters, Bool_t optConst, Bool_t verbose)
 Like synchronizeParameterSettings, Synchronize informs Minuit through its parameter_settings vector of RooFit parameter properties, but Synchronize can be overridden to e.g. More...
 
Bool_t synchronizeParameterSettings (std::vector< ROOT::Fit::ParameterSettings > &parameters, Bool_t optConst, Bool_t verbose)
 Informs Minuit through its parameter_settings vector of RooFit parameter properties. More...
 
void zeroEvalCount ()
 

Protected Attributes

std::vector< ROOT::Minuit2::DerivatorElement_grad
 
std::vector< double_grad_params
 
- Protected Attributes inherited from RooAbsMinimizerFcn
std::unique_ptr< RooArgList_constParamList
 
RooMinimizer_context
 
bool _doEvalErrorWall {true}
 
int _evalCounter {0}
 
std::unique_ptr< RooArgList_floatParamList
 
double _funcOffset {0.}
 
std::unique_ptr< RooArgList_initConstParamList
 
std::unique_ptr< RooArgList_initFloatParamList
 
std::ofstream * _logfile = nullptr
 
double _maxFCN = -std::numeric_limits<double>::infinity()
 
unsigned int _nDim = 0
 
int _numBadNLL = 0
 
Bool_t _optConst = kFALSE
 
int _printEvalErrors = 10
 
double _recoverFromNaNStrength {10.}
 
bool _verbose
 

Private Member Functions

double DoDerivative (const double *x, unsigned int icoord) const override
 
double DoDerivativeWithPrevResult (const double *x, unsigned int i_component, double *previous_grad, double *previous_g2, double *previous_gstep) const override
 
double DoEval (const double *x) const override
 
void resetHasBeenCalculatedFlags () const
 
void runDerivator (unsigned int i_component) const
 
void setOptimizeConstOnFunction (RooAbsArg::ConstOpCode opcode, Bool_t doAlsoTrackingOpt) override
 This function must be overridden in the derived class to pass on constant term optimization configuration to the function to be minimized. More...
 
bool syncParameter (double x, std::size_t ix) const
 
bool syncParameters (const double *x) const
 

Private Attributes

RooAbsReal_funct
 
ROOT::Minuit2::NumericalDerivator _gradf
 
std::vector< bool > has_been_calculated
 
bool none_have_been_calculated = false
 

Additional Inherited Members

- Protected Member Functions inherited from RooAbsMinimizerFcn
void ClearPdfParamAsymErr (Int_t index)
 Modify PDF parameter error by ordinal index (needed by MINUIT) More...
 
void optimizeConstantTerms (bool constStatChange, bool constValChange)
 
void printEvalErrors () const
 Print information about why evaluation failed. More...
 
virtual void setOptimizeConstOnFunction (RooAbsArg::ConstOpCode opcode, Bool_t doAlsoTrackingOpt)=0
 This function must be overridden in the derived class to pass on constant term optimization configuration to the function to be minimized. More...
 
void SetPdfParamErr (Int_t index, Double_t loVal, Double_t hiVal)
 Modify PDF parameter error by ordinal index (needed by MINUIT) More...
 
void SetPdfParamErr (Int_t index, Double_t value)
 Modify PDF parameter error by ordinal index (needed by MINUIT) More...
 

#include <RooGradMinimizerFcn.h>

Inheritance diagram for RooGradMinimizerFcn:
[legend]

Member Enumeration Documentation

◆ GradientCalculatorMode

Enumerator
ExactlyMinuit2 
AlmostMinuit2 

Definition at line 67 of file RooGradMinimizerFcn.h.

Constructor & Destructor Documentation

◆ RooGradMinimizerFcn() [1/2]

RooGradMinimizerFcn::RooGradMinimizerFcn ( RooAbsReal funct,
RooMinimizer context,
bool  verbose = false 
)

Definition at line 40 of file RooGradMinimizerFcn.cxx.

◆ RooGradMinimizerFcn() [2/2]

RooGradMinimizerFcn::RooGradMinimizerFcn ( const RooGradMinimizerFcn other)

Definition at line 53 of file RooGradMinimizerFcn.cxx.

Member Function Documentation

◆ Clone()

ROOT::Math::IMultiGradFunction * RooGradMinimizerFcn::Clone ( ) const
overridevirtual

Clone a function.

Each derived class must implement their version of the Clone method

Implements ROOT::Math::IBaseFunctionMultiDimTempl< T >.

Definition at line 59 of file RooGradMinimizerFcn.cxx.

◆ DoDerivative()

double RooGradMinimizerFcn::DoDerivative ( const double x,
unsigned int  icoord 
) const
overrideprivate

Definition at line 211 of file RooGradMinimizerFcn.cxx.

◆ DoDerivativeWithPrevResult()

double RooGradMinimizerFcn::DoDerivativeWithPrevResult ( const double x,
unsigned int  i_component,
double previous_grad,
double previous_g2,
double previous_gstep 
) const
overrideprivate

Definition at line 218 of file RooGradMinimizerFcn.cxx.

◆ DoEval()

double RooGradMinimizerFcn::DoEval ( const double x) const
overrideprivate

Definition at line 72 of file RooGradMinimizerFcn.cxx.

◆ getErrorDef()

double RooGradMinimizerFcn::getErrorDef ( ) const

◆ getFunctionName()

std::string RooGradMinimizerFcn::getFunctionName ( ) const
inlineoverridevirtual

RooMinimizer sometimes needs the name of the minimized function. Implement this in the derived class.

Implements RooAbsMinimizerFcn.

Definition at line 50 of file RooGradMinimizerFcn.h.

◆ getFunctionTitle()

std::string RooGradMinimizerFcn::getFunctionTitle ( ) const
inlineoverridevirtual

RooMinimizer sometimes needs the title of the minimized function. Implement this in the derived class.

Implements RooAbsMinimizerFcn.

Definition at line 51 of file RooGradMinimizerFcn.h.

◆ getStrategy()

ROOT::Minuit2::MnStrategy RooGradMinimizerFcn::getStrategy ( ) const

◆ NDim()

unsigned int RooGradMinimizerFcn::NDim ( ) const
inlineoverridevirtual

Retrieve the dimension of the function.

Implements ROOT::Math::IBaseFunctionMultiDimTempl< T >.

Definition at line 45 of file RooGradMinimizerFcn.h.

◆ resetHasBeenCalculatedFlags()

void RooGradMinimizerFcn::resetHasBeenCalculatedFlags ( ) const
private

Definition at line 148 of file RooGradMinimizerFcn.cxx.

◆ returnsInMinuit2ParameterSpace()

bool RooGradMinimizerFcn::returnsInMinuit2ParameterSpace ( ) const
inlineoverridevirtual

Reimplemented from ROOT::Math::IGradientFunctionMultiDimTempl< T >.

Definition at line 44 of file RooGradMinimizerFcn.h.

◆ runDerivator()

void RooGradMinimizerFcn::runDerivator ( unsigned int  i_component) const
private

Definition at line 198 of file RooGradMinimizerFcn.cxx.

◆ setErrorLevel()

void RooGradMinimizerFcn::setErrorLevel ( double  error_level) const
inline

Definition at line 49 of file RooGradMinimizerFcn.h.

◆ setGradTolerance()

void RooGradMinimizerFcn::setGradTolerance ( double  grad_tolerance) const
inline

Definition at line 47 of file RooGradMinimizerFcn.h.

◆ setNcycles()

void RooGradMinimizerFcn::setNcycles ( unsigned int  ncycles) const
inline

Definition at line 48 of file RooGradMinimizerFcn.h.

◆ setOffsetting()

void RooGradMinimizerFcn::setOffsetting ( Bool_t  flag)
inlineoverridevirtual

Enable or disable offsetting on the function to be minimized, which enhances numerical precision.

Implements RooAbsMinimizerFcn.

Definition at line 52 of file RooGradMinimizerFcn.h.

◆ setOptimizeConstOnFunction()

void RooGradMinimizerFcn::setOptimizeConstOnFunction ( RooAbsArg::ConstOpCode  opcode,
Bool_t  doAlsoTrackingOpt 
)
inlineoverrideprivatevirtual

This function must be overridden in the derived class to pass on constant term optimization configuration to the function to be minimized.

For a RooAbsArg, this would be RooAbsArg::constOptimizeTestStatistic.

Implements RooAbsMinimizerFcn.

Definition at line 61 of file RooGradMinimizerFcn.h.

◆ setStepTolerance()

void RooGradMinimizerFcn::setStepTolerance ( double  step_tolerance) const
inline

Definition at line 46 of file RooGradMinimizerFcn.h.

◆ setStrategy()

void RooGradMinimizerFcn::setStrategy ( int  istrat)

Definition at line 233 of file RooGradMinimizerFcn.cxx.

◆ Synchronize()

Bool_t RooGradMinimizerFcn::Synchronize ( std::vector< ROOT::Fit::ParameterSettings > &  parameters,
Bool_t  optConst,
Bool_t  verbose = kFALSE 
)
overridevirtual

Like synchronizeParameterSettings, Synchronize informs Minuit through its parameter_settings vector of RooFit parameter properties, but Synchronize can be overridden to e.g.

also include gradient strategy synchronization in subclasses.

Reimplemented from RooAbsMinimizerFcn.

Definition at line 244 of file RooGradMinimizerFcn.cxx.

◆ synchronizeGradientParameterSettings()

void RooGradMinimizerFcn::synchronizeGradientParameterSettings ( std::vector< ROOT::Fit::ParameterSettings > &  parameter_settings) const

Definition at line 64 of file RooGradMinimizerFcn.cxx.

◆ syncParameter()

bool RooGradMinimizerFcn::syncParameter ( double  x,
std::size_t  ix 
) const
private

Definition at line 156 of file RooGradMinimizerFcn.cxx.

◆ syncParameters()

bool RooGradMinimizerFcn::syncParameters ( const double x) const
private

Definition at line 174 of file RooGradMinimizerFcn.cxx.

Member Data Documentation

◆ _funct

RooAbsReal* RooGradMinimizerFcn::_funct
private

Definition at line 84 of file RooGradMinimizerFcn.h.

◆ _grad

std::vector<ROOT::Minuit2::DerivatorElement> RooGradMinimizerFcn::_grad
mutableprotected

Definition at line 79 of file RooGradMinimizerFcn.h.

◆ _grad_params

std::vector<double> RooGradMinimizerFcn::_grad_params
mutableprotected

Definition at line 80 of file RooGradMinimizerFcn.h.

◆ _gradf

ROOT::Minuit2::NumericalDerivator RooGradMinimizerFcn::_gradf
mutableprivate

Definition at line 83 of file RooGradMinimizerFcn.h.

◆ has_been_calculated

std::vector<bool> RooGradMinimizerFcn::has_been_calculated
mutableprivate

Definition at line 85 of file RooGradMinimizerFcn.h.

◆ none_have_been_calculated

bool RooGradMinimizerFcn::none_have_been_calculated = false
mutableprivate

Definition at line 86 of file RooGradMinimizerFcn.h.

Libraries for RooGradMinimizerFcn:
[legend]

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