28namespace TestStatistics {
31 std::shared_ptr<RooAbsL> likelihood,
32 std::shared_ptr<WrapperCalculationCleanFlags> calculation_is_clean )
46 throw std::logic_error(
"in LikelihoodJob constructor: likelihood is not of a valid subclass!");
70 auto vars = std::make_unique<RooArgSet>(
89 auto message_end = message_begin + message.size() /
sizeof(
update_state_t);
90 std::vector<update_state_t> to_update(message_begin, message_end);
91 for (
auto const &item : to_update) {
110 if (
get_manager()->process_manager().is_master()) {
111 bool valChanged =
false;
112 bool constChanged =
false;
113 std::vector<update_state_t> to_update;
114 for (std::size_t ix = 0u; ix < static_cast<std::size_t>(
vars_.
getSize()); ++ix) {
116 constChanged = (
vars_[ix].isConstant() !=
save_vars_[ix].isConstant());
118 if (valChanged || constChanged) {
136 if (!to_update.empty()) {
138 zmq::message_t message(to_update.begin(), to_update.end());
155 if (
get_manager()->process_manager().is_master()) {
189 results_.emplace_back(task_result->value, task_result->carry);
190 printf(
"result received: %f\n", task_result->value);
193 return job_completed;
200 assert(
get_manager()->process_manager().is_worker());
202 std::size_t N_events =
likelihood_->numDataEntries();
213 {
static_cast<double>(
first) / N_events,
static_cast<double>(last) / N_events}, 0, 0);
217 throw std::logic_error(
218 "in LikelihoodJob::evaluate_task: likelihood types other than binned and unbinned not yet implemented!");
230#define PROCESS_VAL(p) \
231 case (p): s = #p; break;
239 default: s = std::to_string(
static_cast<int>(value));
TBuffer & operator<<(TBuffer &buf, const Tmpl *obj)
Bool_t isConstant() const
Check if the "Constant" attribute is set.
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
virtual RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE)
Add a clone of the specified argument to list.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
void setConstant(Bool_t value=kTRUE)
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
Messenger & messenger() const
ProcessManager & process_manager() const
JobManager * get_manager()
Get JobManager instance; create and activate if necessary.
void gather_worker_results()
Wait for all tasks to be retrieved for the current Job.
value_t receive_from_master_on_worker(bool *more=nullptr)
void send_from_worker_to_master()
void publish_from_master_to_workers(T &&item)
specialization that sends the final message
std::size_t N_workers() const
void add(JobTask job_task)
Enqueue a task.
void enableOffsetting(bool flag) override
std::size_t N_tasks_at_workers_
bool receive_task_result_on_master(const zmq::message_t &message) override
void evaluate_task(std::size_t task) override
void updateWorkersParameters()
std::vector< ROOT::Math::KahanSum< double > > results_
void updateWorkersOffsetting()
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.
LikelihoodJob(std::shared_ptr< RooAbsL > _likelihood, std::shared_ptr< WrapperCalculationCleanFlags > calculation_is_clean)
ROOT::Math::KahanSum< double > result_
LikelihoodJob * clone() const override
LikelihoodType likelihood_type_
Virtual base class for implementation of likelihood calculation strategies.
virtual bool isOffsetting() const
std::shared_ptr< RooAbsL > likelihood_
ROOT::Math::KahanSum< double > applyOffsetting(ROOT::Math::KahanSum< double > current_value)
virtual void enableOffsetting(bool flag)
Likelihood class that sums over multiple -log components.
RooRealVar represents a variable that can be changed from the outside.
virtual void setVal(Double_t value)
Set value of variable to 'value'.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...