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

Virtual base class for implementation of likelihood calculation strategies.

This class provides the interface necessary for RooMinimizer (through MinuitFcnGrad) to get the likelihood 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, but serial strategies are possible too, as illustrated in LikelihoodSerial.

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 59 of file LikelihoodWrapper.h.

Public Member Functions

 LikelihoodWrapper (std::shared_ptr< RooAbsL > likelihood, std::shared_ptr< WrapperCalculationCleanFlags > calculation_is_clean)
 
virtual ~LikelihoodWrapper ()=default
 
virtual LikelihoodWrapperclone () const =0
 
void constOptimizeTestStatistic (RooAbsArg::ConstOpCode opcode, bool doAlsoTrackingOpt)
 
double defaultErrorLevel () const
 
virtual void enableOffsetting (bool flag)
 
virtual void evaluate ()=0
 Triggers (possibly asynchronous) evaluation of the likelihood.
 
virtual std::string GetName () const
 
virtual ROOT::Math::KahanSum< doublegetResult () const =0
 Return the latest result of a likelihood evaluation.
 
virtual std::string GetTitle () const
 
virtual bool isOffsetting () const
 
ROOT::Math::KahanSum< doubleoffset () const
 
void setApplyWeightSquared (bool flag)
 
void setOffsettingMode (OffsettingMode mode)
 
virtual void synchronizeParameterSettings (const std::vector< ROOT::Fit::ParameterSettings > &parameter_settings)
 
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.
 

Static Public Member Functions

static std::unique_ptr< LikelihoodWrappercreate (LikelihoodMode likelihoodMode, std::shared_ptr< RooAbsL > likelihood, std::shared_ptr< WrapperCalculationCleanFlags > calculationIsClean)
 Factory method.
 

Protected Member Functions

ROOT::Math::KahanSum< doubleapplyOffsetting (ROOT::Math::KahanSum< double > current_value)
 
void swapOffsets ()
 When calculating an unbinned likelihood with square weights applied, a different offset is necessary.
 

Protected Attributes

std::shared_ptr< WrapperCalculationCleanFlagscalculation_is_clean_
 
bool do_offset_ = false
 
std::shared_ptr< RooAbsLlikelihood_
 
ROOT::Math::KahanSum< doubleoffset_
 
ROOT::Math::KahanSum< doubleoffset_save_ {0.}
 !
 
OffsettingMode offsetting_mode_ = OffsettingMode::legacy
 

#include <RooFit/TestStatistics/LikelihoodWrapper.h>

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

Constructor & Destructor Documentation

◆ LikelihoodWrapper()

RooFit::TestStatistics::LikelihoodWrapper::LikelihoodWrapper ( std::shared_ptr< RooAbsL likelihood,
std::shared_ptr< WrapperCalculationCleanFlags calculation_is_clean 
)

Definition at line 50 of file LikelihoodWrapper.cxx.

◆ ~LikelihoodWrapper()

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

Member Function Documentation

◆ applyOffsetting()

ROOT::Math::KahanSum< double > RooFit::TestStatistics::LikelihoodWrapper::applyOffsetting ( ROOT::Math::KahanSum< double current_value)
protected

Definition at line 104 of file LikelihoodWrapper.cxx.

◆ clone()

virtual LikelihoodWrapper * RooFit::TestStatistics::LikelihoodWrapper::clone ( ) const
pure virtual

◆ constOptimizeTestStatistic()

void RooFit::TestStatistics::LikelihoodWrapper::constOptimizeTestStatistic ( RooAbsArg::ConstOpCode  opcode,
bool  doAlsoTrackingOpt 
)

Definition at line 66 of file LikelihoodWrapper.cxx.

◆ create()

std::unique_ptr< LikelihoodWrapper > RooFit::TestStatistics::LikelihoodWrapper::create ( LikelihoodMode  likelihoodMode,
std::shared_ptr< RooAbsL likelihood,
std::shared_ptr< WrapperCalculationCleanFlags calculationIsClean 
)
static

Factory method.

Definition at line 159 of file LikelihoodWrapper.cxx.

◆ defaultErrorLevel()

double RooFit::TestStatistics::LikelihoodWrapper::defaultErrorLevel ( ) const

Definition at line 71 of file LikelihoodWrapper.cxx.

◆ enableOffsetting()

void RooFit::TestStatistics::LikelihoodWrapper::enableOffsetting ( bool  flag)
virtual

Reimplemented in RooFit::TestStatistics::LikelihoodJob.

Definition at line 84 of file LikelihoodWrapper.cxx.

◆ evaluate()

virtual void RooFit::TestStatistics::LikelihoodWrapper::evaluate ( )
pure virtual

Triggers (possibly asynchronous) evaluation of the likelihood.

In parallel strategies, it may be advantageous to allow a calling process to continue on with other tasks while the calculation is offloaded to another process or device, like a GPU. For this reason, evaluate() does not return the result, this is done in getResult().

Implemented in RooFit::TestStatistics::LikelihoodJob, and RooFit::TestStatistics::LikelihoodSerial.

◆ GetName()

std::string RooFit::TestStatistics::LikelihoodWrapper::GetName ( ) const
virtual

Definition at line 75 of file LikelihoodWrapper.cxx.

◆ getResult()

virtual ROOT::Math::KahanSum< double > RooFit::TestStatistics::LikelihoodWrapper::getResult ( ) const
pure virtual

Return the latest result of a likelihood evaluation.

Returns the result that was stored after calling evaluate(). It is up to the implementer to make sure the stored value represents the most recent evaluation call, e.g. by using a mutex.

Implemented in RooFit::TestStatistics::LikelihoodJob, and RooFit::TestStatistics::LikelihoodSerial.

◆ GetTitle()

std::string RooFit::TestStatistics::LikelihoodWrapper::GetTitle ( ) const
virtual

Definition at line 79 of file LikelihoodWrapper.cxx.

◆ isOffsetting()

virtual bool RooFit::TestStatistics::LikelihoodWrapper::isOffsetting ( ) const
inlinevirtual

Definition at line 95 of file LikelihoodWrapper.h.

◆ offset()

ROOT::Math::KahanSum< double > RooFit::TestStatistics::LikelihoodWrapper::offset ( ) const
inline

Definition at line 98 of file LikelihoodWrapper.h.

◆ setApplyWeightSquared()

void RooFit::TestStatistics::LikelihoodWrapper::setApplyWeightSquared ( bool  flag)

Definition at line 140 of file LikelihoodWrapper.cxx.

◆ setOffsettingMode()

void RooFit::TestStatistics::LikelihoodWrapper::setOffsettingMode ( OffsettingMode  mode)

Definition at line 93 of file LikelihoodWrapper.cxx.

◆ swapOffsets()

void RooFit::TestStatistics::LikelihoodWrapper::swapOffsets ( )
protected

When calculating an unbinned likelihood with square weights applied, a different offset is necessary.

Similar situations may ask for a separate offset as well. This function switches between the two sets of offset values.

Definition at line 135 of file LikelihoodWrapper.cxx.

◆ synchronizeParameterSettings()

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

Definition at line 61 of file LikelihoodWrapper.cxx.

◆ synchronizeWithMinimizer()

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

Synchronize minimizer settings with calculators in child classes.

Definition at line 59 of file LikelihoodWrapper.cxx.

◆ updateMinuitExternalParameterValues()

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

Definition at line 155 of file LikelihoodWrapper.cxx.

◆ updateMinuitInternalParameterValues()

void RooFit::TestStatistics::LikelihoodWrapper::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:

Definition at line 154 of file LikelihoodWrapper.cxx.

Member Data Documentation

◆ calculation_is_clean_

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

Definition at line 103 of file LikelihoodWrapper.h.

◆ do_offset_

bool RooFit::TestStatistics::LikelihoodWrapper::do_offset_ = false
protected

Definition at line 105 of file LikelihoodWrapper.h.

◆ likelihood_

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

Definition at line 102 of file LikelihoodWrapper.h.

◆ offset_

ROOT::Math::KahanSum<double> RooFit::TestStatistics::LikelihoodWrapper::offset_
protected

Definition at line 106 of file LikelihoodWrapper.h.

◆ offset_save_

ROOT::Math::KahanSum<double> RooFit::TestStatistics::LikelihoodWrapper::offset_save_ {0.}
protected

!

Definition at line 107 of file LikelihoodWrapper.h.

◆ offsetting_mode_

OffsettingMode RooFit::TestStatistics::LikelihoodWrapper::offsetting_mode_ = OffsettingMode::legacy
protected

Definition at line 108 of file LikelihoodWrapper.h.

Libraries for RooFit::TestStatistics::LikelihoodWrapper:

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