Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooFit::TestStatistics::LikelihoodGradientWrapper Class Referenceabstract

Virtual base class for implementation of likelihood gradient calculation strategies.

This class provides the interface necessary for RooMinimizer (through MinuitFcnGrad) to get the likelihood gradient values it needs for fitting the pdf to the data. The strategy by which these values are obtained is up to the implementer of this class. Its intended purpose was mainly to allow for parallel calculation strategies.

Note
The class is not intended for use by end-users. We recommend to either use RooMinimizer with a RooAbsL derived likelihood object, or to use a higher level entry point like RooAbsPdf::fitTo() or RooAbsPdf::createNLL().

Definition at line 38 of file LikelihoodGradientWrapper.h.

Public Member Functions

 LikelihoodGradientWrapper (const LikelihoodGradientWrapper &)=delete
 
virtual ~LikelihoodGradientWrapper ()=default
 
virtual void fillGradient (double *grad)=0
 
virtual void fillGradientWithPrevResult (double *grad, double *previous_grad, double *previous_g2, double *previous_gstep)=0
 
virtual bool isCalculating ()=0
 Reports whether or not the gradient is currently being calculated.
 
LikelihoodGradientWrapperoperator= (const LikelihoodGradientWrapper &)=delete
 
virtual void synchronizeParameterSettings (const std::vector< ROOT::Fit::ParameterSettings > &parameter_settings)
 
virtual void synchronizeParameterSettings (ROOT::Math::IMultiGenFunction *function, const std::vector< ROOT::Fit::ParameterSettings > &parameter_settings)=0
 
virtual void synchronizeWithMinimizer (const ROOT::Math::MinimizerOptions &options)
 Synchronize minimizer settings with calculators in child classes.
 
virtual void updateMinuitExternalParameterValues (const std::vector< double > &minuit_external_x)
 
virtual void updateMinuitInternalParameterValues (const std::vector< double > &minuit_internal_x)
 Minuit passes in parameter values that may not conform to RooFit internal standards (like applying range clipping), but that the specific calculator does need.
 
virtual bool usesMinuitInternalValues ()=0
 Implement usesMinuitInternalValues to return true when you want Minuit to send this class Minuit-internal values, or return false when you want "regular" Minuit-external values.
 

Static Public Member Functions

static std::unique_ptr< LikelihoodGradientWrappercreate (LikelihoodGradientMode likelihoodGradientMode, std::shared_ptr< RooAbsL > likelihood, std::shared_ptr< WrapperCalculationCleanFlags > calculationIsClean, std::size_t nDim, RooMinimizer *minimizer, SharedOffset offset)
 Factory method.
 

Protected Member Functions

 LikelihoodGradientWrapper (std::shared_ptr< RooAbsL > likelihood, std::shared_ptr< WrapperCalculationCleanFlags > calculation_is_clean, std::size_t N_dim, RooMinimizer *minimizer, SharedOffset offset)
 

Protected Attributes

std::shared_ptr< WrapperCalculationCleanFlagscalculation_is_clean_
 
std::shared_ptr< RooAbsLlikelihood_
 
RooMinimizerminimizer_
 
SharedOffset shared_offset_
 

#include <RooFit/TestStatistics/LikelihoodGradientWrapper.h>

Inheritance diagram for RooFit::TestStatistics::LikelihoodGradientWrapper:
[legend]

Constructor & Destructor Documentation

◆ LikelihoodGradientWrapper() [1/2]

RooFit::TestStatistics::LikelihoodGradientWrapper::LikelihoodGradientWrapper ( std::shared_ptr< RooAbsL likelihood,
std::shared_ptr< WrapperCalculationCleanFlags calculation_is_clean,
std::size_t  N_dim,
RooMinimizer minimizer,
SharedOffset  offset 
)
protected

Definition at line 42 of file LikelihoodGradientWrapper.cxx.

◆ ~LikelihoodGradientWrapper()

virtual RooFit::TestStatistics::LikelihoodGradientWrapper::~LikelihoodGradientWrapper ( )
virtualdefault

◆ LikelihoodGradientWrapper() [2/2]

RooFit::TestStatistics::LikelihoodGradientWrapper::LikelihoodGradientWrapper ( const LikelihoodGradientWrapper )
delete

Member Function Documentation

◆ create()

std::unique_ptr< LikelihoodGradientWrapper > RooFit::TestStatistics::LikelihoodGradientWrapper::create ( LikelihoodGradientMode  likelihoodGradientMode,
std::shared_ptr< RooAbsL likelihood,
std::shared_ptr< WrapperCalculationCleanFlags calculationIsClean,
std::size_t  nDim,
RooMinimizer minimizer,
SharedOffset  offset 
)
static

Factory method.

Definition at line 70 of file LikelihoodGradientWrapper.cxx.

◆ fillGradient()

virtual void RooFit::TestStatistics::LikelihoodGradientWrapper::fillGradient ( double grad)
pure virtual

◆ fillGradientWithPrevResult()

virtual void RooFit::TestStatistics::LikelihoodGradientWrapper::fillGradientWithPrevResult ( double grad,
double previous_grad,
double previous_g2,
double previous_gstep 
)
pure virtual

◆ isCalculating()

virtual bool RooFit::TestStatistics::LikelihoodGradientWrapper::isCalculating ( )
pure virtual

Reports whether or not the gradient is currently being calculated.

This is used in MinuitFcnGrad to switch between LikelihoodWrapper implementations inside and outside of a LikelihoodGradientJob calculation when the LikelihoodWrapper used is LikelihoodJob. This is to prevent Jobs from being started within Jobs.

Implemented in RooFit::TestStatistics::LikelihoodGradientJob.

◆ operator=()

LikelihoodGradientWrapper & RooFit::TestStatistics::LikelihoodGradientWrapper::operator= ( const LikelihoodGradientWrapper )
delete

◆ synchronizeParameterSettings() [1/2]

void RooFit::TestStatistics::LikelihoodGradientWrapper::synchronizeParameterSettings ( const std::vector< ROOT::Fit::ParameterSettings > &  parameter_settings)
virtual

◆ synchronizeParameterSettings() [2/2]

virtual void RooFit::TestStatistics::LikelihoodGradientWrapper::synchronizeParameterSettings ( ROOT::Math::IMultiGenFunction function,
const std::vector< ROOT::Fit::ParameterSettings > &  parameter_settings 
)
pure virtual

◆ synchronizeWithMinimizer()

void RooFit::TestStatistics::LikelihoodGradientWrapper::synchronizeWithMinimizer ( const ROOT::Math::MinimizerOptions options)
virtual

Synchronize minimizer settings with calculators in child classes.

Reimplemented in RooFit::TestStatistics::LikelihoodGradientJob.

Definition at line 53 of file LikelihoodGradientWrapper.cxx.

◆ updateMinuitExternalParameterValues()

void RooFit::TestStatistics::LikelihoodGradientWrapper::updateMinuitExternalParameterValues ( const std::vector< double > &  minuit_external_x)
virtual

Definition at line 64 of file LikelihoodGradientWrapper.cxx.

◆ updateMinuitInternalParameterValues()

void RooFit::TestStatistics::LikelihoodGradientWrapper::updateMinuitInternalParameterValues ( const std::vector< double > &  minuit_internal_x)
virtual

Minuit passes in parameter values that may not conform to RooFit internal standards (like applying range clipping), but that the specific calculator does need.

This function can be implemented to receive these Minuit-internal values.

Reimplemented in RooFit::TestStatistics::LikelihoodGradientJob.

Definition at line 61 of file LikelihoodGradientWrapper.cxx.

◆ usesMinuitInternalValues()

virtual bool RooFit::TestStatistics::LikelihoodGradientWrapper::usesMinuitInternalValues ( )
pure virtual

Implement usesMinuitInternalValues to return true when you want Minuit to send this class Minuit-internal values, or return false when you want "regular" Minuit-external values.

Minuit internally uses a transformed parameter space to graciously handle externally mandated parameter range boundaries. Transformation from Minuit-internal to external (i.e. "regular") parameters is done using trigonometric functions that in some cases can cause a few bits of precision loss with respect to the original parameter values. To circumvent this, Minuit also allows external gradient providers (like LikelihoodGradientWrapper) to take the Minuit-internal parameter values directly, without transformation. This way, the gradient provider (e.g. the implementation of this class) can handle transformation manually, possibly with higher precision.

Implemented in RooFit::TestStatistics::LikelihoodGradientJob.

Member Data Documentation

◆ calculation_is_clean_

std::shared_ptr<WrapperCalculationCleanFlags> RooFit::TestStatistics::LikelihoodGradientWrapper::calculation_is_clean_
protected

Definition at line 91 of file LikelihoodGradientWrapper.h.

◆ likelihood_

std::shared_ptr<RooAbsL> RooFit::TestStatistics::LikelihoodGradientWrapper::likelihood_
protected

Definition at line 89 of file LikelihoodGradientWrapper.h.

◆ minimizer_

RooMinimizer* RooFit::TestStatistics::LikelihoodGradientWrapper::minimizer_
protected

Definition at line 90 of file LikelihoodGradientWrapper.h.

◆ shared_offset_

SharedOffset RooFit::TestStatistics::LikelihoodGradientWrapper::shared_offset_
protected

Definition at line 92 of file LikelihoodGradientWrapper.h.

Libraries for RooFit::TestStatistics::LikelihoodGradientWrapper:

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