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

Definition at line 31 of file LikelihoodJob.h.

Classes

struct  task_result_t
struct  update_state_t

Public Types

enum class  update_state_mode : int { parameters , offsetting }

Public Member Functions

 LikelihoodJob (std::shared_ptr< RooAbsL > _likelihood, std::shared_ptr< WrapperCalculationCleanFlags > calculation_is_clean, SharedOffset offset)
void constOptimizeTestStatistic (RooAbsArg::ConstOpCode opcode, bool doAlsoTrackingOpt)
double defaultErrorLevel () const
void enableOffsetting (bool flag) override
void evaluate () override
 Triggers (possibly asynchronous) evaluation of the likelihood.
void evaluate_task (std::size_t task) override
void gather_worker_results ()
 Wait for all tasks to be retrieved for the current Job.
std::size_t get_state_id ()
 Get the current state identifier.
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 init_vars ()
virtual bool isOffsetting () const
bool receive_task_result_on_master (const zmq::message_t &message) override
void send_back_task_result_from_worker (std::size_t task) override
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.
void update_state () override
 Virtual function to update any necessary state on workers.
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.
void updateWorkersOffsetting ()
void updateWorkersParameters ()

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.
JobManager * get_manager ()
 Get JobManager instance; create and activate if necessary.

Protected Attributes

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

Private Member Functions

std::size_t getNComponentTasks ()
std::size_t getNEventTasks ()

Private Attributes

JobManager * _manager = nullptr
LikelihoodSerial likelihood_serial_
std::size_t n_component_tasks_
std::size_t n_event_tasks_
std::size_t n_tasks_at_workers_ = 0
SharedOffset::OffsetVec offsets_previous_
ROOT::Math::KahanSum< doubleresult_
std::vector< ROOT::Math::KahanSum< double > > results_
RooArgList save_vars_
RooArgList vars_

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

Inheritance diagram for RooFit::TestStatistics::LikelihoodJob:
RooFit::MultiProcess::Job RooFit::TestStatistics::LikelihoodWrapper

Member Enumeration Documentation

◆ update_state_mode

Enumerator
parameters 
offsetting 

Definition at line 53 of file LikelihoodJob.h.

Constructor & Destructor Documentation

◆ LikelihoodJob()

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

Definition at line 35 of file LikelihoodJob.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::LikelihoodJob::enableOffsetting ( bool flag)
overridevirtual

Reimplemented from RooFit::TestStatistics::LikelihoodWrapper.

Definition at line 343 of file LikelihoodJob.cxx.

◆ evaluate()

void RooFit::TestStatistics::LikelihoodJob::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 194 of file LikelihoodJob.cxx.

◆ evaluate_task()

void RooFit::TestStatistics::LikelihoodJob::evaluate_task ( std::size_t task)
overridevirtual

Implements RooFit::MultiProcess::Job.

Definition at line 272 of file LikelihoodJob.cxx.

◆ gather_worker_results()

void RooFit::MultiProcess::Job::gather_worker_results ( )
inherited

Wait for all tasks to be retrieved for the current Job.

Definition at line 126 of file Job.cxx.

◆ get_manager()

JobManager * RooFit::MultiProcess::Job::get_manager ( )
protectedinherited

Get JobManager instance; create and activate if necessary.

Child classes should refrain from direct access to the JobManager instance (through JobManager::instance), but rather use the here provided Job::get_manager(). This function starts the worker_loop on the worker when first called, meaning that the workers will not be running before they are needed.

Definition at line 112 of file Job.cxx.

◆ get_state_id()

std::size_t RooFit::MultiProcess::Job::get_state_id ( )
inherited

Get the current state identifier.

Definition at line 141 of file Job.cxx.

◆ GetName()

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

Definition at line 89 of file LikelihoodWrapper.cxx.

◆ getNComponentTasks()

std::size_t RooFit::TestStatistics::LikelihoodJob::getNComponentTasks ( )
private
Warning
In automatic mode, this function can start MultiProcess (forks, starts workers, etc)!

Definition at line 128 of file LikelihoodJob.cxx.

◆ getNEventTasks()

std::size_t RooFit::TestStatistics::LikelihoodJob::getNEventTasks ( )
private

Definition at line 115 of file LikelihoodJob.cxx.

◆ getResult()

ROOT::Math::KahanSum< double > RooFit::TestStatistics::LikelihoodJob::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 39 of file LikelihoodJob.h.

◆ GetTitle()

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

Definition at line 93 of file LikelihoodWrapper.cxx.

◆ init_vars()

void RooFit::TestStatistics::LikelihoodJob::init_vars ( )

Definition at line 51 of file LikelihoodJob.cxx.

◆ isOffsetting()

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

Definition at line 101 of file LikelihoodWrapper.h.

◆ receive_task_result_on_master()

bool RooFit::TestStatistics::LikelihoodJob::receive_task_result_on_master ( const zmq::message_t & message)
overridevirtual

Implements RooFit::MultiProcess::Job.

Definition at line 258 of file LikelihoodJob.cxx.

◆ send_back_task_result_from_worker()

void RooFit::TestStatistics::LikelihoodJob::send_back_task_result_from_worker ( std::size_t task)
overridevirtual

Implements RooFit::MultiProcess::Job.

Definition at line 243 of file LikelihoodJob.cxx.

◆ 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.

◆ update_state()

void RooFit::TestStatistics::LikelihoodJob::update_state ( )
overridevirtual

Virtual function to update any necessary state on workers.

This function is called from the worker loop when something is received over the ZeroMQ "SUB" socket. The master process sends messages to workers on its "PUB" socket. Thus, we can update, for instance, parameter values on the worker that were updated since the last call on the master side.

Note
Implementers: make sure to also update the state_id_ member.

Reimplemented from RooFit::MultiProcess::Job.

Definition at line 69 of file LikelihoodJob.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.

◆ updateWorkersOffsetting()

void RooFit::TestStatistics::LikelihoodJob::updateWorkersOffsetting ( )

Definition at line 189 of file LikelihoodJob.cxx.

◆ updateWorkersParameters()

void RooFit::TestStatistics::LikelihoodJob::updateWorkersParameters ( )

Definition at line 142 of file LikelihoodJob.cxx.

Member Data Documentation

◆ _manager

JobManager* RooFit::MultiProcess::Job::_manager = nullptr
privateinherited

Definition at line 50 of file Job.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.

◆ id_

std::size_t RooFit::MultiProcess::Job::id_
protectedinherited

Definition at line 45 of file Job.h.

◆ likelihood_

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

Definition at line 107 of file LikelihoodWrapper.h.

◆ likelihood_serial_

LikelihoodSerial RooFit::TestStatistics::LikelihoodJob::likelihood_serial_
private

Definition at line 84 of file LikelihoodJob.h.

◆ likelihood_type_

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

Definition at line 108 of file LikelihoodWrapper.h.

◆ n_component_tasks_

std::size_t RooFit::TestStatistics::LikelihoodJob::n_component_tasks_
private

Definition at line 79 of file LikelihoodJob.h.

◆ n_event_tasks_

std::size_t RooFit::TestStatistics::LikelihoodJob::n_event_tasks_
private

Definition at line 78 of file LikelihoodJob.h.

◆ n_tasks_at_workers_

std::size_t RooFit::TestStatistics::LikelihoodJob::n_tasks_at_workers_ = 0
private

Definition at line 75 of file LikelihoodJob.h.

◆ offsets_previous_

SharedOffset::OffsetVec RooFit::TestStatistics::LikelihoodJob::offsets_previous_
private

Definition at line 83 of file LikelihoodJob.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::LikelihoodJob::result_
private

Definition at line 69 of file LikelihoodJob.h.

◆ results_

std::vector<ROOT::Math::KahanSum<double> > RooFit::TestStatistics::LikelihoodJob::results_
private

Definition at line 70 of file LikelihoodJob.h.

◆ save_vars_

RooArgList RooFit::TestStatistics::LikelihoodJob::save_vars_
private

Definition at line 73 of file LikelihoodJob.h.

◆ shared_offset_

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

Definition at line 112 of file LikelihoodWrapper.h.

◆ state_id_

std::size_t RooFit::MultiProcess::Job::state_id_ = 0
protectedinherited

Definition at line 46 of file Job.h.

◆ vars_

RooArgList RooFit::TestStatistics::LikelihoodJob::vars_
private

Definition at line 72 of file LikelihoodJob.h.


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