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 "RooArgList.h"
20
22
23#include <vector>
24
25namespace RooFit {
26namespace TestStatistics {
27
29public:
30 LikelihoodJob(std::shared_ptr<RooAbsL> _likelihood,
31 std::shared_ptr<WrapperCalculationCleanFlags> calculation_is_clean /*, RooMinimizer *minimizer*/);
32 LikelihoodJob *clone() const override;
33
34 void init_vars();
35
36 void evaluate() override;
37 inline ROOT::Math::KahanSum<double> getResult() const override { return result_; }
38
39 void updateWorkersParameters(); // helper for evaluate
40 void updateWorkersOffsetting(); // helper for enableOffsetting
41
42 // Job overrides:
43 void evaluate_task(std::size_t task) override;
44 void update_state() override;
45
47 std::size_t var_index;
48 double value;
50 };
52
53 // --- RESULT LOGISTICS ---
55 std::size_t job_id; // job ID must always be the first part of any result message/type
56 double value;
57 double carry;
58 };
59
60 void send_back_task_result_from_worker(std::size_t task) override;
61 bool receive_task_result_on_master(const zmq::message_t &message) override;
62
63 void enableOffsetting(bool flag) override;
64
65private:
67 std::vector<ROOT::Math::KahanSum<double>> results_;
68
69 RooArgList vars_; // Variables
70 RooArgList save_vars_; // Copy of variables
71
73 std::size_t n_tasks_at_workers_ = 0;
74
75 // warning: don't use the following values directly, use the getters instead!
76 std::size_t n_event_tasks_;
77 std::size_t n_component_tasks_;
78 std::size_t getNEventTasks();
79 std::size_t getNComponentTasks();
80};
81
82std::ostream &operator<<(std::ostream &out, const LikelihoodJob::update_state_mode value);
83
84} // namespace TestStatistics
85} // namespace RooFit
86
87#endif // ROOT_ROOFIT_LikelihoodJob
TBuffer & operator<<(TBuffer &buf, const Tmpl *obj)
Definition TBuffer.h:399
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.
ROOT::Math::KahanSum< double > result_
LikelihoodJob * clone() const override
Virtual base class for implementation of likelihood calculation strategies.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition JSONIO.h:26