Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
LikelihoodGradientJob.h
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 * Authors:
4 * PB, Patrick Bos, Netherlands eScience Center, p.bos@esciencecenter.nl
5 *
6 * Copyright (c) 2021, CERN
7 *
8 * Redistribution and use in source and binary forms,
9 * with or without modification, are permitted according to the terms
10 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
11 */
12
13#ifndef ROOT_ROOFIT_TESTSTATISTICS_LikelihoodGradientJob
14#define ROOT_ROOFIT_TESTSTATISTICS_LikelihoodGradientJob
15
18
21#include "Minuit2/MnMatrix.h"
22
23#include <vector>
24
25namespace RooFit {
26namespace TestStatistics {
27
29public:
30 LikelihoodGradientJob(std::shared_ptr<RooAbsL> likelihood,
31 std::shared_ptr<WrapperCalculationCleanFlags> calculation_is_clean, std::size_t N_dim,
32 RooMinimizer *minimizer);
33 LikelihoodGradientJob *clone() const override;
35
36 void fillGradient(double *grad) override;
37 void fillGradientWithPrevResult(double *grad, double *previous_grad, double *previous_g2,
38 double *previous_gstep) override;
39
40 void update_state() override;
41
43 bool isCalculating() override { return isCalculating_; };
44
45private:
46 void run_derivator(unsigned int i_component) const;
47
49 const std::vector<ROOT::Fit::ParameterSettings> &parameter_settings) override;
50 // this overload must also be overridden here so that the one above doesn't trigger a overloaded-virtual warning:
51 void synchronizeParameterSettings(const std::vector<ROOT::Fit::ParameterSettings> &parameter_settings) override;
52
53 void synchronizeWithMinimizer(const ROOT::Math::MinimizerOptions &options) override;
54 void setStrategy(int istrat);
55 void setStepTolerance(double step_tolerance) const;
56 void setGradTolerance(double grad_tolerance) const;
57 void setNCycles(unsigned int ncycles) const;
58 void setErrorLevel(double error_level) const;
59
60 void updateMinuitInternalParameterValues(const std::vector<double> &minuit_internal_x) override;
61
62 bool usesMinuitInternalValues() override;
63
64 // Job overrides:
65 void evaluate_task(std::size_t task) override;
66
68 std::size_t job_id;
69 std::size_t task_id;
71 };
72 void send_back_task_result_from_worker(std::size_t task) override;
73 bool receive_task_result_on_master(const zmq::message_t &message) override;
74
77 void calculate_all();
78
79 // members
80
81 // mutables below are because ROOT::Math::IMultiGradFunction::DoDerivative is const
82 mutable std::vector<ROOT::Minuit2::DerivatorElement> grad_;
84
85 std::size_t N_tasks_ = 0;
86 std::size_t N_tasks_at_workers_ = 0;
87 std::vector<double> minuit_internal_x_;
88
89 mutable bool isCalculating_ = false;
90};
91
92} // namespace TestStatistics
93} // namespace RooFit
94
95#endif // ROOT_ROOFIT_LikelihoodGradientJob
Documentation for the abstract class IBaseFunctionMultiDim.
Definition IFunction.h:61
interface class for defining the actual work that must be done
Definition Job.h:25
bool usesMinuitInternalValues() override
Implement usesMinuitInternalValues to return true when you want Minuit to send this class Minuit-inte...
void update_state() override
Virtual function to update any necessary state on workers.
std::vector< ROOT::Minuit2::DerivatorElement > grad_
void fillGradientWithPrevResult(double *grad, double *previous_grad, double *previous_g2, double *previous_gstep) override
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 ra...
void synchronizeParameterSettings(ROOT::Math::IMultiGenFunction *function, const std::vector< ROOT::Fit::ParameterSettings > &parameter_settings) 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 synchronizeWithMinimizer(const ROOT::Math::MinimizerOptions &options) override
Synchronize minimizer settings with calculators in child classes.
void setStepTolerance(double step_tolerance) const
void setGradTolerance(double grad_tolerance) const
bool isCalculating() override
Reports whether or not the gradient is currently being calculated.
void evaluate_task(std::size_t task) override
Job overrides:
bool receive_task_result_on_master(const zmq::message_t &message) override
LikelihoodGradientJob * clone() const override
Virtual base class for implementation of likelihood gradient calculation strategies.
RooMinimizer is a wrapper class around ROOT::Fit:Fitter that provides a seamless interface between th...
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition JSONIO.h:26