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

Definition at line 28 of file LikelihoodGradientJob.h.

Classes

struct  task_result_t
 

Public Types

enum class  GradientCalculatorMode { ExactlyMinuit2 , AlmostMinuit2 }
 

Public Member Functions

 LikelihoodGradientJob (const LikelihoodGradientJob &other)
 
 LikelihoodGradientJob (std::shared_ptr< RooAbsL > likelihood, std::shared_ptr< WrapperCalculationCleanFlags > calculation_is_clean, std::size_t N_dim, RooMinimizer *minimizer)
 
LikelihoodGradientJobclone () const override
 
void fillGradient (double *grad) override
 
void fillGradientWithPrevResult (double *grad, double *previous_grad, double *previous_g2, double *previous_gstep) override
 
bool isCalculating () override
 Reports whether or not the gradient is currently being calculated.
 
void update_state () override
 Virtual function to update any necessary state on workers.
 
- Public Member Functions inherited from RooFit::MultiProcess::Job
 Job ()
 
 Job (const Job &other)
 
 ~Job ()
 
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.
 
- Public Member Functions inherited from RooFit::TestStatistics::LikelihoodGradientWrapper
 LikelihoodGradientWrapper (std::shared_ptr< RooAbsL > likelihood, std::shared_ptr< WrapperCalculationCleanFlags > calculation_is_clean, std::size_t N_dim, RooMinimizer *minimizer)
 
virtual ~LikelihoodGradientWrapper ()=default
 
virtual void updateMinuitExternalParameterValues (const std::vector< double > &minuit_external_x)
 

Private Member Functions

void calculate_all ()
 
void evaluate_task (std::size_t task) override
 Job overrides:
 
bool receive_task_result_on_master (const zmq::message_t &message) override
 
void run_derivator (unsigned int i_component) const
 Calculation stuff (mostly duplicates of RooGradMinimizerFcn code):
 
void send_back_task_result_from_worker (std::size_t task) override
 
void setErrorLevel (double error_level) const
 
void setGradTolerance (double grad_tolerance) const
 
void setNCycles (unsigned int ncycles) const
 
void setStepTolerance (double step_tolerance) const
 
void setStrategy (int istrat)
 
void synchronizeParameterSettings (const std::vector< ROOT::Fit::ParameterSettings > &parameter_settings) override
 
void synchronizeParameterSettings (ROOT::Math::IMultiGenFunction *function, const std::vector< ROOT::Fit::ParameterSettings > &parameter_settings) override
 
void synchronizeWithMinimizer (const ROOT::Math::MinimizerOptions &options) override
 Synchronize minimizer settings with calculators in child classes.
 
void update_workers_state ()
 
void update_workers_state_isCalculating ()
 
void updateMinuitInternalParameterValues (const std::vector< double > &minuit_internal_x) override
 Minuit passes in parameter values that may not conform to RooFit internal standards (like applying range clipping), but that the specific calculator does need.
 
bool usesMinuitInternalValues () override
 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.
 

Private Attributes

std::vector< ROOT::Minuit2::DerivatorElementgrad_
 
ROOT::Minuit2::NumericalDerivator gradf_
 
bool isCalculating_ = false
 
std::vector< doubleminuit_internal_x_
 
std::size_t N_tasks_ = 0
 
std::size_t N_tasks_at_workers_ = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from RooFit::TestStatistics::LikelihoodGradientWrapper
static std::unique_ptr< LikelihoodGradientWrappercreate (LikelihoodGradientMode likelihoodGradientMode, std::shared_ptr< RooAbsL > likelihood, std::shared_ptr< WrapperCalculationCleanFlags > calculationIsClean, std::size_t nDim, RooMinimizer *minimizer)
 Factory method.
 
- Protected Member Functions inherited from RooFit::MultiProcess::Job
JobManagerget_manager ()
 Get JobManager instance; create and activate if necessary.
 
- Protected Attributes inherited from RooFit::MultiProcess::Job
std::size_t id_
 
std::size_t state_id_ = 0
 
- Protected Attributes inherited from RooFit::TestStatistics::LikelihoodGradientWrapper
std::shared_ptr< WrapperCalculationCleanFlagscalculation_is_clean_
 
std::shared_ptr< RooAbsLlikelihood_
 
RooMinimizerminimizer_
 

#include </home/sftnight/build/workspace/root-makedoc-v628/rootspi/rdoc/src/v6-28-00-patches/roofit/roofitcore/src/TestStatistics/LikelihoodGradientJob.h>

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

Member Enumeration Documentation

◆ GradientCalculatorMode

Enumerator
ExactlyMinuit2 
AlmostMinuit2 

Definition at line 42 of file LikelihoodGradientJob.h.

Constructor & Destructor Documentation

◆ LikelihoodGradientJob() [1/2]

RooFit::TestStatistics::LikelihoodGradientJob::LikelihoodGradientJob ( std::shared_ptr< RooAbsL likelihood,
std::shared_ptr< WrapperCalculationCleanFlags calculation_is_clean,
std::size_t  N_dim,
RooMinimizer minimizer 
)

Definition at line 28 of file LikelihoodGradientJob.cxx.

◆ LikelihoodGradientJob() [2/2]

RooFit::TestStatistics::LikelihoodGradientJob::LikelihoodGradientJob ( const LikelihoodGradientJob other)

Definition at line 40 of file LikelihoodGradientJob.cxx.

Member Function Documentation

◆ calculate_all()

void RooFit::TestStatistics::LikelihoodGradientJob::calculate_all ( )
private

Definition at line 186 of file LikelihoodGradientJob.cxx.

◆ clone()

LikelihoodGradientJob * RooFit::TestStatistics::LikelihoodGradientJob::clone ( ) const
overridevirtual

◆ evaluate_task()

void RooFit::TestStatistics::LikelihoodGradientJob::evaluate_task ( std::size_t  task)
overrideprivatevirtual

Job overrides:

Implements RooFit::MultiProcess::Job.

Definition at line 102 of file LikelihoodGradientJob.cxx.

◆ fillGradient()

void RooFit::TestStatistics::LikelihoodGradientJob::fillGradient ( double grad)
overridevirtual

◆ fillGradientWithPrevResult()

void RooFit::TestStatistics::LikelihoodGradientJob::fillGradientWithPrevResult ( double grad,
double previous_grad,
double previous_g2,
double previous_gstep 
)
overridevirtual

◆ isCalculating()

bool RooFit::TestStatistics::LikelihoodGradientJob::isCalculating ( )
inlineoverridevirtual

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.

Implements RooFit::TestStatistics::LikelihoodGradientWrapper.

Definition at line 43 of file LikelihoodGradientJob.h.

◆ receive_task_result_on_master()

bool RooFit::TestStatistics::LikelihoodGradientJob::receive_task_result_on_master ( const zmq::message_t &  message)
overrideprivatevirtual

Implements RooFit::MultiProcess::Job.

Definition at line 117 of file LikelihoodGradientJob.cxx.

◆ run_derivator()

void RooFit::TestStatistics::LikelihoodGradientJob::run_derivator ( unsigned int  i_component) const
private

Calculation stuff (mostly duplicates of RooGradMinimizerFcn code):

Definition at line 179 of file LikelihoodGradientJob.cxx.

◆ send_back_task_result_from_worker()

void RooFit::TestStatistics::LikelihoodGradientJob::send_back_task_result_from_worker ( std::size_t  task)
overrideprivatevirtual

Implements RooFit::MultiProcess::Job.

Definition at line 109 of file LikelihoodGradientJob.cxx.

◆ setErrorLevel()

void RooFit::TestStatistics::LikelihoodGradientJob::setErrorLevel ( double  error_level) const
private

Definition at line 94 of file LikelihoodGradientJob.cxx.

◆ setGradTolerance()

void RooFit::TestStatistics::LikelihoodGradientJob::setGradTolerance ( double  grad_tolerance) const
private

Definition at line 84 of file LikelihoodGradientJob.cxx.

◆ setNCycles()

void RooFit::TestStatistics::LikelihoodGradientJob::setNCycles ( unsigned int  ncycles) const
private

Definition at line 89 of file LikelihoodGradientJob.cxx.

◆ setStepTolerance()

void RooFit::TestStatistics::LikelihoodGradientJob::setStepTolerance ( double  step_tolerance) const
private

Definition at line 79 of file LikelihoodGradientJob.cxx.

◆ setStrategy()

void RooFit::TestStatistics::LikelihoodGradientJob::setStrategy ( int  istrat)
private

Definition at line 69 of file LikelihoodGradientJob.cxx.

◆ synchronizeParameterSettings() [1/2]

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

Reimplemented from RooFit::TestStatistics::LikelihoodGradientWrapper.

Definition at line 51 of file LikelihoodGradientJob.cxx.

◆ synchronizeParameterSettings() [2/2]

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

◆ synchronizeWithMinimizer()

void RooFit::TestStatistics::LikelihoodGradientJob::synchronizeWithMinimizer ( const ROOT::Math::MinimizerOptions options)
overrideprivatevirtual

Synchronize minimizer settings with calculators in child classes.

Reimplemented from RooFit::TestStatistics::LikelihoodGradientWrapper.

Definition at line 63 of file LikelihoodGradientJob.cxx.

◆ update_state()

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

◆ update_workers_state()

void RooFit::TestStatistics::LikelihoodGradientJob::update_workers_state ( )
private

Definition at line 130 of file LikelihoodGradientJob.cxx.

◆ update_workers_state_isCalculating()

void RooFit::TestStatistics::LikelihoodGradientJob::update_workers_state_isCalculating ( )
private

Definition at line 140 of file LikelihoodGradientJob.cxx.

◆ updateMinuitInternalParameterValues()

void RooFit::TestStatistics::LikelihoodGradientJob::updateMinuitInternalParameterValues ( const std::vector< double > &  minuit_internal_x)
overrideprivatevirtual

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 from RooFit::TestStatistics::LikelihoodGradientWrapper.

Definition at line 244 of file LikelihoodGradientJob.cxx.

◆ usesMinuitInternalValues()

bool RooFit::TestStatistics::LikelihoodGradientJob::usesMinuitInternalValues ( )
overrideprivatevirtual

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.

Implements RooFit::TestStatistics::LikelihoodGradientWrapper.

Definition at line 249 of file LikelihoodGradientJob.cxx.

Member Data Documentation

◆ grad_

std::vector<ROOT::Minuit2::DerivatorElement> RooFit::TestStatistics::LikelihoodGradientJob::grad_
mutableprivate

Definition at line 82 of file LikelihoodGradientJob.h.

◆ gradf_

ROOT::Minuit2::NumericalDerivator RooFit::TestStatistics::LikelihoodGradientJob::gradf_
mutableprivate

Definition at line 83 of file LikelihoodGradientJob.h.

◆ isCalculating_

bool RooFit::TestStatistics::LikelihoodGradientJob::isCalculating_ = false
mutableprivate

Definition at line 89 of file LikelihoodGradientJob.h.

◆ minuit_internal_x_

std::vector<double> RooFit::TestStatistics::LikelihoodGradientJob::minuit_internal_x_
private

Definition at line 87 of file LikelihoodGradientJob.h.

◆ N_tasks_

std::size_t RooFit::TestStatistics::LikelihoodGradientJob::N_tasks_ = 0
private

Definition at line 85 of file LikelihoodGradientJob.h.

◆ N_tasks_at_workers_

std::size_t RooFit::TestStatistics::LikelihoodGradientJob::N_tasks_at_workers_ = 0
private

Definition at line 86 of file LikelihoodGradientJob.h.

  • roofit/roofitcore/src/TestStatistics/LikelihoodGradientJob.h
  • roofit/roofitcore/src/TestStatistics/LikelihoodGradientJob.cxx