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

Serial likelihood calculation strategy implementation.

This class serves as a baseline reference implementation of the LikelihoodWrapper. It reimplements the previous RooNLLVar "BulkPartition" single CPU strategy in the new RooFit::TestStatistics framework.

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 24 of file LikelihoodSerial.h.

Public Member Functions

 LikelihoodSerial (std::shared_ptr< RooAbsL > _likelihood, std::shared_ptr< WrapperCalculationCleanFlags > calculation_is_clean, SharedOffset offset)
void constOptimizeTestStatistic (RooAbsArg::ConstOpCode opcode, bool doAlsoTrackingOpt)
double defaultErrorLevel () const
virtual void enableOffsetting (bool flag)
void evaluate () override
 Triggers (possibly asynchronous) evaluation of the likelihood.
virtual std::string GetName () const
ROOT::Math::KahanSum< doublegetResult () const override
 Return the latest result of a likelihood evaluation.
virtual std::string GetTitle () const
void initVars ()
 Helper function for the constructor.
virtual bool isOffsetting () 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, SharedOffset offset)
 Factory method.

Protected Member Functions

void calculate_offsets ()
 (Re)calculate (on each worker) all component offsets.

Protected Attributes

std::shared_ptr< WrapperCalculationCleanFlagscalculation_is_clean_
bool do_offset_ = false
std::shared_ptr< RooAbsLlikelihood_
LikelihoodType likelihood_type_
OffsettingMode offsetting_mode_ = OffsettingMode::legacy
SharedOffset shared_offset_

Private Attributes

RooArgList _saveVars
 Copy of variables.
RooArgList _vars
 Variables.
ROOT::Math::KahanSum< doubleresult

#include </home/stephan/code/root-2/roofit/roofitcore/src/TestStatistics/LikelihoodSerial.h>

Inheritance diagram for RooFit::TestStatistics::LikelihoodSerial:
RooFit::TestStatistics::LikelihoodWrapper

Constructor & Destructor Documentation

◆ LikelihoodSerial()

RooFit::TestStatistics::LikelihoodSerial::LikelihoodSerial ( std::shared_ptr< RooAbsL > _likelihood,
std::shared_ptr< WrapperCalculationCleanFlags > calculation_is_clean,
SharedOffset offset )

Definition at line 34 of file LikelihoodSerial.cxx.

Member Function Documentation

◆ calculate_offsets()

void RooFit::TestStatistics::LikelihoodWrapper::calculate_offsets ( )
protectedinherited

(Re)calculate (on each worker) all component offsets.

Note that these are calculated over the full event range! This will decrease the effectiveness of offsetting proportionally to the number of splits over the event range. The alternative, however, becomes very complex to implement and maintain, so this is a compromise.

Definition at line 123 of file LikelihoodWrapper.cxx.

◆ constOptimizeTestStatistic()

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

Definition at line 80 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,
SharedOffset offset )
staticinherited

Factory method.

Definition at line 212 of file LikelihoodWrapper.cxx.

◆ defaultErrorLevel()

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

Definition at line 85 of file LikelihoodWrapper.cxx.

◆ enableOffsetting()

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

Reimplemented in RooFit::TestStatistics::LikelihoodJob.

Definition at line 98 of file LikelihoodWrapper.cxx.

◆ evaluate()

void RooFit::TestStatistics::LikelihoodSerial::evaluate ( )
overridevirtual

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

Implements RooFit::TestStatistics::LikelihoodWrapper.

Definition at line 65 of file LikelihoodSerial.cxx.

◆ GetName()

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

Definition at line 89 of file LikelihoodWrapper.cxx.

◆ getResult()

ROOT::Math::KahanSum< double > RooFit::TestStatistics::LikelihoodSerial::getResult ( ) const
inlineoverridevirtual

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.

Implements RooFit::TestStatistics::LikelihoodWrapper.

Definition at line 32 of file LikelihoodSerial.h.

◆ GetTitle()

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

Definition at line 93 of file LikelihoodWrapper.cxx.

◆ initVars()

void RooFit::TestStatistics::LikelihoodSerial::initVars ( )

Helper function for the constructor.

This is a separate function (instead of just in ctor) for historical reasons. Its predecessor RooRealMPFE::initVars() was used from multiple ctors, but also from RooRealMPFE::constOptimizeTestStatistic at the end, which makes sense, because it might change the set of variables. We may at some point want to do this here as well.

Definition at line 49 of file LikelihoodSerial.cxx.

◆ isOffsetting()

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

Definition at line 101 of file LikelihoodWrapper.h.

◆ setApplyWeightSquared()

void RooFit::TestStatistics::LikelihoodWrapper::setApplyWeightSquared ( bool flag)
inherited
Note
Currently we do not recalculate the offset value, so in practice swapped offsets are zero/disabled. This differs from using RooNLLVar, so your fit may yield slightly different values.

Definition at line 173 of file LikelihoodWrapper.cxx.

◆ setOffsettingMode()

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

Definition at line 107 of file LikelihoodWrapper.cxx.

◆ synchronizeParameterSettings()

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

Definition at line 75 of file LikelihoodWrapper.cxx.

◆ synchronizeWithMinimizer()

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

Synchronize minimizer settings with calculators in child classes.

Definition at line 73 of file LikelihoodWrapper.cxx.

◆ updateMinuitExternalParameterValues()

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

Definition at line 208 of file LikelihoodWrapper.cxx.

◆ updateMinuitInternalParameterValues()

void RooFit::TestStatistics::LikelihoodWrapper::updateMinuitInternalParameterValues ( const std::vector< double > & minuit_internal_x)
virtualinherited

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 207 of file LikelihoodWrapper.cxx.

Member Data Documentation

◆ _saveVars

RooArgList RooFit::TestStatistics::LikelihoodSerial::_saveVars
private

Copy of variables.

Definition at line 38 of file LikelihoodSerial.h.

◆ _vars

RooArgList RooFit::TestStatistics::LikelihoodSerial::_vars
private

Variables.

Definition at line 37 of file LikelihoodSerial.h.

◆ calculation_is_clean_

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

Definition at line 109 of file LikelihoodWrapper.h.

◆ do_offset_

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

Definition at line 111 of file LikelihoodWrapper.h.

◆ likelihood_

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

Definition at line 107 of file LikelihoodWrapper.h.

◆ likelihood_type_

LikelihoodType RooFit::TestStatistics::LikelihoodWrapper::likelihood_type_
protectedinherited

Definition at line 108 of file LikelihoodWrapper.h.

◆ offsetting_mode_

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

Definition at line 114 of file LikelihoodWrapper.h.

◆ result

ROOT::Math::KahanSum<double> RooFit::TestStatistics::LikelihoodSerial::result
private

Definition at line 35 of file LikelihoodSerial.h.

◆ shared_offset_

SharedOffset RooFit::TestStatistics::LikelihoodWrapper::shared_offset_
protectedinherited

Definition at line 112 of file LikelihoodWrapper.h.


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