Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
LikelihoodJob.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_LikelihoodJob
14#define ROOT_ROOFIT_TESTSTATISTICS_LikelihoodJob
15
19#include "LikelihoodSerial.h"
20#include "RooArgList.h"
21
23
24#include <vector>
25
26namespace RooFit {
27namespace TestStatistics {
28
29class LikelihoodSerial;
30
32public:
33 LikelihoodJob(std::shared_ptr<RooAbsL> _likelihood,
34 std::shared_ptr<WrapperCalculationCleanFlags> calculation_is_clean, SharedOffset offset);
35
36 void init_vars();
37
38 void evaluate() override;
39 inline ROOT::Math::KahanSum<double> getResult() const override { return result_; }
40
41 void updateWorkersParameters(); // helper for evaluate
42 void updateWorkersOffsetting(); // helper for enableOffsetting
43
44 // Job overrides:
45 void evaluate_task(std::size_t task) override;
46 void update_state() override;
47
49 std::size_t var_index;
50 double value;
52 };
54
55 // --- RESULT LOGISTICS ---
57 std::size_t job_id; // job ID must always be the first part of any result message/type
58 double value;
59 double carry;
61 };
62
63 void send_back_task_result_from_worker(std::size_t task) override;
64 bool receive_task_result_on_master(const zmq::message_t &message) override;
65
66 void enableOffsetting(bool flag) override;
67
68private:
70 std::vector<ROOT::Math::KahanSum<double>> results_;
71
72 RooArgList vars_; // Variables
73 RooArgList save_vars_; // Copy of variables
74
75 std::size_t n_tasks_at_workers_ = 0;
76
77 // warning: don't use the following values directly, use the getters instead!
78 std::size_t n_event_tasks_;
79 std::size_t n_component_tasks_;
80 std::size_t getNEventTasks();
81 std::size_t getNComponentTasks();
82
85};
86
87std::ostream &operator<<(std::ostream &out, const LikelihoodJob::update_state_mode value);
88
89} // namespace TestStatistics
90} // namespace RooFit
91
92#endif // ROOT_ROOFIT_TESTSTATISTICS_LikelihoodJob
TBuffer & operator<<(TBuffer &buf, const Tmpl *obj)
Definition TBuffer.h:397
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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
The Kahan summation is a compensated summation algorithm, which significantly reduces numerical error...
Definition Util.h:122
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
interface class for defining the actual work that must be done
Definition Job.h:25
void enableOffsetting(bool flag) override
ROOT::Math::KahanSum< double > getResult() const override
Return the latest result of a likelihood evaluation.
bool receive_task_result_on_master(const zmq::message_t &message) override
void evaluate_task(std::size_t task) override
std::vector< ROOT::Math::KahanSum< double > > results_
void send_back_task_result_from_worker(std::size_t task) override
void update_state() override
Virtual function to update any necessary state on workers.
void evaluate() override
Triggers (possibly asynchronous) evaluation of the likelihood.
SharedOffset::OffsetVec offsets_previous_
ROOT::Math::KahanSum< double > result_
Serial likelihood calculation strategy implementation.
Virtual base class for implementation of likelihood calculation strategies.
std::vector< ROOT::Math::KahanSum< double > > OffsetVec
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition CodegenImpl.h:64