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, SharedOffset offset);
33
34 void fillGradient(double *grad) override;
35 void fillGradientWithPrevResult(double *grad, double *previous_grad, double *previous_g2,
36 double *previous_gstep) override;
37
38 void update_state() override;
39
41 bool isCalculating() override { return isCalculating_; };
42
43private:
44 void run_derivator(unsigned int i_component) const;
45
47 const std::vector<ROOT::Fit::ParameterSettings> &parameter_settings) override;
48 // this overload must also be overridden here so that the one above doesn't trigger a overloaded-virtual warning:
49 void synchronizeParameterSettings(const std::vector<ROOT::Fit::ParameterSettings> &parameter_settings) override;
50
51 void synchronizeWithMinimizer(const ROOT::Math::MinimizerOptions &options) override;
52 void setStrategy(int istrat);
53 void setStepTolerance(double step_tolerance) const;
54 void setGradTolerance(double grad_tolerance) const;
55 void setNCycles(unsigned int ncycles) const;
56 void setErrorLevel(double error_level) const;
57
58 void updateMinuitInternalParameterValues(const std::vector<double> &minuit_internal_x) override;
59
60 bool usesMinuitInternalValues() override;
61
62 // Job overrides:
63 void evaluate_task(std::size_t task) override;
64
66 std::size_t job_id;
67 std::size_t task_id;
69 };
70 void send_back_task_result_from_worker(std::size_t task) override;
71 bool receive_task_result_on_master(const zmq::message_t &message) override;
72
75 void calculate_all();
76
77 // members
78
79 // mutables below are because ROOT::Math::IMultiGradFunction::DoDerivative is const
80 mutable std::vector<ROOT::Minuit2::DerivatorElement> grad_;
82
83 std::size_t N_tasks_ = 0;
84 std::size_t N_tasks_at_workers_ = 0;
85 std::vector<double> minuit_internal_x_;
86
87 mutable bool isCalculating_ = false;
88
90};
91
92} // namespace TestStatistics
93} // namespace RooFit
94
95#endif // ROOT_ROOFIT_LikelihoodGradientJob
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
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
Virtual base class for implementation of likelihood gradient calculation strategies.
Wrapper class around ROOT::Math::Minimizer that provides a seamless interface between the minimizer f...
std::vector< ROOT::Math::KahanSum< double > > OffsetVec
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition JSONIO.h:26