Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooRealMPFE.cxx
Go to the documentation of this file.
1/// \cond ROOFIT_INTERNAL
2
3/*****************************************************************************
4 * Project: RooFit *
5 * Package: RooFitCore *
6 * @(#)root/roofitcore:$Id$
7 * Authors: *
8 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
9 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
10 * *
11 * Copyright (c) 2000-2005, Regents of the University of California *
12 * and Stanford University. All rights reserved. *
13 * *
14 * Redistribution and use in source and binary forms, *
15 * with or without modification, are permitted according to the terms *
16 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
17 *****************************************************************************/
18
19/**
20\file RooRealMPFE.cxx
21\class RooRealMPFE
22\ingroup Roofitcore
23
24Multi-processor front-end for parallel calculation
25of RooAbsReal objects. Each RooRealMPFE forks a process that calculates
26the value of the proxies RooAbsReal object. The (re)calculation of
27the proxied object is started asynchronously with the calculate() option.
28A subsequent call to getVal() will return the calculated value when available
29If the calculation is still in progress when getVal() is called it blocks
30the calling process until the calculation is done. The forked calculation process
31is terminated when the front-end object is deleted
32Simple use demonstration
33
34~~~{.cpp}
35RooAbsReal* slowFunc ;
36
37double val = slowFunc->getVal() // Evaluate slowFunc in current process
38
39RooRealMPFE mpfe("mpfe","frontend to slowFunc",*slowFunc) ;
40mpfe.calculate() ; // Start calculation of slow-func in remote process
41 // .. do other stuff here ..
42double val = mpfe.getVal() // Wait for remote calculation to finish and retrieve value
43~~~
44
45For general multiprocessing in ROOT, please refer to the TProcessExecutor class.
46
47**/
48
49#include "Riostream.h"
50
51#ifndef _WIN32
52#include "BidirMMapPipe.h"
53#endif
54
55#include <cstdlib>
56#include <memory>
57#include <sstream>
58#include "RooRealMPFE.h"
59#include "RooArgSet.h"
60#include "RooAbsCategory.h"
61#include "RooRealVar.h"
62#include "RooCategory.h"
63#include "RooMsgService.h"
64#include "RooNLLVar.h"
65#include "RooTrace.h"
66
67#include "Rtypes.h"
68#include "TSystem.h"
69
70
71class RooRealMPFE ;
72
73// RooMPSentinel is a singleton class that keeps track of all
74// parallel execution processes for goodness-of-fit calculations.
75// The primary task of RooMPSentinel is to terminate all server processes
76// when the main ROOT process is exiting.
77struct RooMPSentinel {
78
79 static RooMPSentinel& instance();
80
82
83 void add(RooRealMPFE& mpfe) ;
84 void remove(RooRealMPFE& mpfe) ;
85
87};
88
89RooMPSentinel& RooMPSentinel::instance() {
90 static RooMPSentinel inst;
91 return inst;
92}
93
94
95using std::string, std::ostringstream, std::list;
96using namespace RooFit;
97
98
99////////////////////////////////////////////////////////////////////////////////
100/// Construct front-end object for object 'arg' whose evaluation will be calculated
101/// asynchronously in a separate process. If calcInline is true the value of 'arg'
102/// is calculate synchronously in the current process.
103
104RooRealMPFE::RooRealMPFE(const char *name, const char *title, RooAbsReal& arg, bool calcInline) :
105 RooAbsReal(name,title),
106 _state(Initialize),
107 _arg("arg","arg",this,arg),
108 _vars("vars","vars",this),
114 _pipe(nullptr),
115 _updateMaster(nullptr),
117{
118#ifdef _WIN32
119 _inlineMode = true;
120#endif
121 initVars() ;
122 RooMPSentinel::instance().add(*this) ;
123
124}
125
126
127
128////////////////////////////////////////////////////////////////////////////////
129/// Copy constructor. Initializes in clean state so that upon eval
130/// this instance will create its own server processes
131
132RooRealMPFE::RooRealMPFE(const RooRealMPFE& other, const char* name) :
134 _state(Initialize),
135 _arg("arg",this,other._arg),
136 _vars("vars",this,other._vars),
143 _pipe(nullptr),
144 _updateMaster(nullptr),
146{
147 initVars() ;
148 RooMPSentinel::instance().add(*this) ;
149}
150
151
152
153////////////////////////////////////////////////////////////////////////////////
154/// Destructor
155
156RooRealMPFE::~RooRealMPFE()
157{
158 if (_state==Client) standby();
159 RooMPSentinel::instance().remove(*this);
160}
161
162
163
164////////////////////////////////////////////////////////////////////////////////
165/// Initialize list of variables of front-end argument 'arg'
166
167void RooRealMPFE::initVars()
168{
169 // Empty current lists
170 _vars.removeAll() ;
171 _saveVars.removeAll() ;
172
173 // Retrieve non-constant parameters
174 std::unique_ptr<RooArgSet> vars{_arg->getParameters(RooArgSet())};
175 // RooArgSet *ncVars = vars->selectByAttrib("Constant", false);
176 RooArgList varList(*vars) ;
177
178 // Save in lists
179 _vars.add(varList) ;
180 _saveVars.addClone(varList) ;
181 _valueChanged.resize(_vars.size()) ;
182 _constChanged.resize(_vars.size()) ;
183
184 // Force next calculation
185 _forceCalc = true ;
186}
187
188double RooRealMPFE::getCarry() const
189{
190 if (_inlineMode) {
191 RooAbsTestStatistic* tmp = dynamic_cast<RooAbsTestStatistic*>(_arg.absArg());
192 if (tmp) return tmp->getCarry();
193 else return 0.;
194 } else {
195 return _evalCarry;
196 }
197}
198
199////////////////////////////////////////////////////////////////////////////////
200/// Initialize the remote process and message passing
201/// pipes between current process and remote process
202
203void RooRealMPFE::initialize()
204{
205 // Trivial case: Inline mode
206 if (_inlineMode) {
207 _state = Inline ;
208 return ;
209 }
210
211#ifndef _WIN32
212 // Clear eval error log prior to forking
213 // to avoid confusions...
214 clearEvalErrorLog() ;
215 // Fork server process and setup IPC
216 _pipe = new BidirMMapPipe();
217
218 if (_pipe->isChild()) {
219 // Start server loop
221 _state = Server ;
222 serverLoop();
223
224 // Kill server at end of service
225 if (_verboseServer) ccoutD(Minimization) << "RooRealMPFE::initialize(" <<
226 GetName() << ") server process terminating" << std::endl ;
227
228 delete _arg.absArg();
229 delete _pipe;
230 _exit(0) ;
231 } else {
232 // Client process - fork successful
233 if (_verboseClient) {
234 ccoutD(Minimization) << "RooRealMPFE::initialize(" << GetName() << ") successfully forked server process "
235 << _pipe->pidOtherEnd() << std::endl;
236 }
237 _state = Client ;
239 }
240#endif // _WIN32
241}
242
243
244
245////////////////////////////////////////////////////////////////////////////////
246/// Server loop of remote processes. This function will return
247/// only when an incoming TERMINATE message is received.
248
249void RooRealMPFE::serverLoop()
250{
251#ifndef _WIN32
252 int msg ;
253
254 Int_t idx;
255 Int_t index;
257 double value ;
258 bool isConst ;
259
260 clearEvalErrorLog() ;
261
262 while(*_pipe && !_pipe->eof()) {
263 *_pipe >> msg;
264 if (Terminate == msg) {
265 if (_verboseServer) std::cout << "RooRealMPFE::serverLoop(" << GetName()
266 << ") IPC fromClient> Terminate" << std::endl;
267 // send terminate acknowledged to client
268 *_pipe << msg << BidirMMapPipe::flush;
269 break;
270 }
271
272 switch (msg) {
273 case SendReal:
274 {
275 *_pipe >> idx >> value >> isConst;
276 if (_verboseServer) std::cout << "RooRealMPFE::serverLoop(" << GetName()
277 << ") IPC fromClient> SendReal [" << idx << "]=" << value << std::endl ;
278 RooRealVar* rvar = static_cast<RooRealVar*>(_vars.at(idx)) ;
279 rvar->setVal(value) ;
280 if (rvar->isConstant() != isConst) {
281 rvar->setConstant(isConst) ;
282 }
283 }
284 break ;
285
286 case SendCat:
287 {
288 *_pipe >> idx >> index;
289 if (_verboseServer) std::cout << "RooRealMPFE::serverLoop(" << GetName()
290 << ") IPC fromClient> SendCat [" << idx << "]=" << index << std::endl ;
291 (static_cast<RooCategory*>(_vars.at(idx)))->setIndex(index) ;
292 }
293 break ;
294
295 case Calculate:
296 if (_verboseServer) std::cout << "RooRealMPFE::serverLoop(" << GetName()
297 << ") IPC fromClient> Calculate" << std::endl ;
298 _value = _arg ;
299 break ;
300
302 if (_verboseServer) std::cout << "RooRealMPFE::serverLoop(" << GetName()
303 << ") IPC fromClient> Calculate" << std::endl ;
304
306 _value = _arg ;
308 break ;
309
310 case Retrieve:
311 {
312 if (_verboseServer) std::cout << "RooRealMPFE::serverLoop(" << GetName()
313 << ") IPC fromClient> Retrieve" << std::endl ;
315 numErrors = numEvalErrors();
316 *_pipe << msg << _value << getCarry() << numErrors;
317
318 if (_verboseServer) std::cout << "RooRealMPFE::serverLoop(" << GetName()
319 << ") IPC toClient> ReturnValue " << _value << " NumError " << numErrors << std::endl ;
320
321 if (numErrors) {
322 // Loop over errors
323 std::string objidstr;
324 {
325 ostringstream oss2;
326 // Format string with object identity as this cannot be evaluated on the other side
327 oss2 << "PID" << gSystem->GetPid() << "/";
328 printStream(oss2,kName|kClassName|kArgs,kInline);
329 objidstr = oss2.str();
330 }
331 std::map<const RooAbsArg*,std::pair<string,list<EvalError> > >::const_iterator iter = evalErrorIter();
332 const RooAbsArg* ptr = nullptr;
333 for (int i = 0; i < numEvalErrorItems(); ++i) {
334 list<EvalError>::const_iterator iter2 = iter->second.second.begin();
335 for (; iter->second.second.end() != iter2; ++iter2) {
336 ptr = iter->first;
337 *_pipe << ptr << iter2->_msg << iter2->_srvval << objidstr;
338 if (_verboseServer) std::cout << "RooRealMPFE::serverLoop(" << GetName()
339 << ") IPC toClient> sending error log Arg " << iter->first << " Msg " << iter2->_msg << std::endl ;
340 }
341 }
342 // let other end know that we're done with the list of errors
343 ptr = nullptr;
344 *_pipe << ptr;
345 // Clear error list on local side
346 clearEvalErrorLog();
347 }
348 *_pipe << BidirMMapPipe::flush;
349 }
350 break;
351
352 case ConstOpt:
353 {
354 bool doTrack ;
355 int code;
356 *_pipe >> code >> doTrack;
357 if (_verboseServer) std::cout << "RooRealMPFE::serverLoop(" << GetName()
358 << ") IPC fromClient> ConstOpt " << code << " doTrack = " << (doTrack?"T":"F") << std::endl ;
359 ((RooAbsReal&)_arg.arg()).constOptimizeTestStatistic(static_cast<RooAbsArg::ConstOpCode>(code),doTrack) ;
360 break ;
361 }
362
363 case Verbose:
364 {
365 bool flag ;
366 *_pipe >> flag;
367 if (_verboseServer) std::cout << "RooRealMPFE::serverLoop(" << GetName()
368 << ") IPC fromClient> Verbose " << (flag?1:0) << std::endl ;
370 }
371 break ;
372
373
374 case ApplyNLLW2:
375 {
376 bool flag ;
377 *_pipe >> flag;
378 if (_verboseServer) std::cout << "RooRealMPFE::serverLoop(" << GetName()
379 << ") IPC fromClient> ApplyNLLW2 " << (flag?1:0) << std::endl ;
380
381 // Do application of weight-squared here
383 }
384 break ;
385
386 case EnableOffset:
387 {
388 bool flag ;
389 *_pipe >> flag;
390 if (_verboseServer) std::cout << "RooRealMPFE::serverLoop(" << GetName()
391 << ") IPC fromClient> EnableOffset " << (flag?1:0) << std::endl ;
392
393 // Enable likelihoof offsetting here
394 ((RooAbsReal&)_arg.arg()).enableOffsetting(flag) ;
395 }
396 break ;
397
398 case LogEvalError:
399 {
400 int iflag2;
401 *_pipe >> iflag2;
404 if (_verboseServer) std::cout << "RooRealMPFE::serverLoop(" << GetName()
405 << ") IPC fromClient> LogEvalError flag = " << flag2 << std::endl ;
406 }
407 break ;
408
409
410 default:
411 if (_verboseServer) std::cout << "RooRealMPFE::serverLoop(" << GetName()
412 << ") IPC fromClient> Unknown message (code = " << msg << ")" << std::endl ;
413 break ;
414 }
415 }
416
417#endif // _WIN32
418}
419
420
421
422////////////////////////////////////////////////////////////////////////////////
423/// Client-side function that instructs server process to start
424/// asynchronous (re)calculation of function value. This function
425/// returns immediately. The calculated value can be retrieved
426/// using getVal()
427
428void RooRealMPFE::calculate() const
429{
430
431 // Start asynchronous calculation of arg value
432 if (_state==Initialize) {
433 const_cast<RooRealMPFE*>(this)->initialize() ;
434 }
435
436 // Inline mode -- Calculate value now
437 if (_state==Inline) {
438 _value = _arg ;
439 clearValueDirty() ;
440 }
441
442#ifndef _WIN32
443 // Compare current value of variables with saved values and send changes to server
444 if (_state==Client) {
445 Int_t i(0) ;
446
447 //for (i=0 ; i<_vars.size() ; i++) {
448 RooAbsArg *var;
450 for (std::size_t j=0 ; j<_vars.size() ; j++) {
451 var = _vars.at(j);
452 saveVar = _saveVars.at(j);
453
454 //bool valChanged = !(*var==*saveVar) ;
455 bool valChanged;
456 bool constChanged;
457 if (!_updateMaster) {
458 valChanged = !var->isIdentical(*saveVar,true) ;
459 constChanged = (var->isConstant() != saveVar->isConstant()) ;
462 } else {
463 valChanged = _updateMaster->_valueChanged[i] ;
464 constChanged = _updateMaster->_constChanged[i] ;
465 }
466
468 if (_verboseClient) std::cout << "RooRealMPFE::calculate(" << GetName()
469 << ") variable " << _vars.at(i)->GetName() << " changed" << std::endl ;
470 if (constChanged) {
471 (static_cast<RooRealVar*>(saveVar))->setConstant(var->isConstant()) ;
472 }
473 saveVar->copyCache(var) ;
474
475 // send message to server
476 if (dynamic_cast<RooAbsReal*>(var)) {
477 int msg = SendReal ;
478 double val = (static_cast<RooAbsReal*>(var))->getVal() ;
479 bool isC = var->isConstant() ;
480 *_pipe << msg << i << val << isC;
481
482 if (_verboseServer) std::cout << "RooRealMPFE::calculate(" << GetName()
483 << ") IPC toServer> SendReal [" << i << "]=" << val << (isC?" (Constant)":"") << std::endl ;
484 } else if (dynamic_cast<RooAbsCategory*>(var)) {
485 int msg = SendCat ;
486 UInt_t idx = (static_cast<RooAbsCategory*>(var))->getCurrentIndex() ;
487 *_pipe << msg << i << idx;
488 if (_verboseServer) std::cout << "RooRealMPFE::calculate(" << GetName()
489 << ") IPC toServer> SendCat [" << i << "]=" << idx << std::endl ;
490 }
491 }
492 i++ ;
493 }
494
495 int msg = hideOffset() ? Calculate : CalculateNoOffset;
496 *_pipe << msg;
497 if (_verboseServer) std::cout << "RooRealMPFE::calculate(" << GetName()
498 << ") IPC toServer> Calculate " << std::endl ;
499
500 // Clear dirty state and mark that calculation request was dispatched
501 clearValueDirty() ;
503 _forceCalc = false ;
504
505 msg = Retrieve ;
506 *_pipe << msg << BidirMMapPipe::flush;
507 if (_verboseServer) std::cout << "RooRealMPFE::evaluate(" << GetName()
508 << ") IPC toServer> Retrieve " << std::endl ;
510
511 } else if (_state!=Inline) {
512 std::cout << "RooRealMPFE::calculate(" << GetName()
513 << ") ERROR not in Client or Inline mode" << std::endl ;
514 }
515
516
517#endif // _WIN32
518}
519
520
521
522
523////////////////////////////////////////////////////////////////////////////////
524/// If value needs recalculation and calculation has not been started
525/// with a call to calculate() start it now. This function blocks
526/// until remote process has finished calculation and returns
527/// remote value
528
529double RooRealMPFE::getValV(const RooArgSet* /*nset*/) const
530{
531
532 if (isValueDirty()) {
533 // Cache is dirty, no calculation has been started yet
534 calculate() ;
535 _value = evaluate() ;
536 } else if (_calcInProgress) {
537 // Cache is clean and calculation is in progress
538 _value = evaluate() ;
539 } else {
540 // Cache is clean and calculated value is in cache
541 }
542
543 return _value ;
544}
545
546
547
548////////////////////////////////////////////////////////////////////////////////
549/// Send message to server process to retrieve output value
550/// If error were logged use logEvalError() on remote side
551/// transfer those errors to the local eval error queue.
552
553double RooRealMPFE::evaluate() const
554{
555 // Retrieve value of arg
556 double return_value = 0;
557 if (_state==Inline) {
558 return_value = _arg ;
559 } else if (_state==Client) {
560#ifndef _WIN32
561 bool needflush = false;
562 int msg;
563 double value;
564
565 // If current error logging state is not the same as remote state
566 // update the remote state
567 if (evalErrorLoggingMode() != _remoteEvalErrorLoggingState) {
568 msg = LogEvalError ;
569 RooAbsReal::ErrorLoggingMode flag = evalErrorLoggingMode() ;
570 *_pipe << msg << flag;
571 needflush = true;
572 _remoteEvalErrorLoggingState = evalErrorLoggingMode() ;
573 }
574
575 if (!_retrieveDispatched) {
576 msg = Retrieve ;
577 *_pipe << msg;
578 needflush = true;
579 if (_verboseServer) std::cout << "RooRealMPFE::evaluate(" << GetName()
580 << ") IPC toServer> Retrieve " << std::endl ;
581 }
582 if (needflush) *_pipe << BidirMMapPipe::flush;
584
585
587
588 *_pipe >> msg >> value >> _evalCarry >> numError;
589
590 if (msg!=ReturnValue) {
591 std::cout << "RooRealMPFE::evaluate(" << GetName()
592 << ") ERROR: unexpected message from server process: " << msg << std::endl ;
593 return 0 ;
594 }
595 if (_verboseServer) std::cout << "RooRealMPFE::evaluate(" << GetName()
596 << ") IPC fromServer> ReturnValue " << value << std::endl ;
597
598 if (_verboseServer) std::cout << "RooRealMPFE::evaluate(" << GetName()
599 << ") IPC fromServer> NumErrors " << numError << std::endl ;
600 if (numError) {
601 // Retrieve remote errors and feed into local error queue
602 char *msgbuf1 = nullptr;
603 char *msgbuf2 = nullptr;
604 char *msgbuf3 = nullptr;
605 RooAbsArg *ptr = nullptr;
606 while (true) {
607 *_pipe >> ptr;
608 if (!ptr) break;
609 *_pipe >> msgbuf1 >> msgbuf2 >> msgbuf3;
610 if (_verboseServer) std::cout << "RooRealMPFE::evaluate(" << GetName()
611 << ") IPC fromServer> retrieving error log Arg " << ptr << " Msg " << msgbuf1 << std::endl ;
612
613 logEvalError(reinterpret_cast<RooAbsReal*>(ptr),msgbuf3,msgbuf1,msgbuf2) ;
614 }
615 std::free(msgbuf1);
616 std::free(msgbuf2);
617 std::free(msgbuf3);
618 }
619
620 // Mark end of calculation in progress
623#endif // _WIN32
624 }
625
626 return return_value;
627}
628
629
630
631////////////////////////////////////////////////////////////////////////////////
632/// Terminate remote server process and return front-end class
633/// to standby mode. Calls to calculate() or evaluate() after
634/// this call will automatically recreated the server process.
635
636void RooRealMPFE::standby()
637{
638#ifndef _WIN32
639 if (_state==Client) {
640 if (_pipe->good()) {
641 // Terminate server process ;
642 if (_verboseServer) std::cout << "RooRealMPFE::standby(" << GetName()
643 << ") IPC toServer> Terminate " << std::endl;
644 int msg = Terminate;
645 *_pipe << msg << BidirMMapPipe::flush;
646 // read handshake
647 msg = 0;
648 *_pipe >> msg;
649 if (Terminate != msg || 0 != _pipe->close()) {
650 std::cerr << "In " << __func__ << "(" << __FILE__ ", " << __LINE__ <<
651 "): Server shutdown failed." << std::endl;
652 }
653 } else {
654 if (_verboseServer) {
655 std::cerr << "In " << __func__ << "(" << __FILE__ ", " <<
656 __LINE__ << "): Pipe has already shut down, not sending "
657 "Terminate to server." << std::endl;
658 }
659 }
660 // Close pipes
661 delete _pipe;
662 _pipe = nullptr;
663
664 // Revert to initialize state
665 _state = Initialize;
666 }
667#endif // _WIN32
668}
669
670
671
672////////////////////////////////////////////////////////////////////////////////
673/// Intercept call to optimize constant term in test statistics
674/// and forward it to object on server side.
675
676void RooRealMPFE::constOptimizeTestStatistic(ConstOpCode opcode, bool doAlsoTracking)
677{
678#ifndef _WIN32
679 if (_state==Client) {
680
681 int msg = ConstOpt ;
682 int op = opcode;
683 *_pipe << msg << op << doAlsoTracking;
684 if (_verboseServer) std::cout << "RooRealMPFE::constOptimize(" << GetName()
685 << ") IPC toServer> ConstOpt " << opcode << std::endl ;
686
687 initVars() ;
688 }
689#endif // _WIN32
690
691 if (_state==Inline) {
692 ((RooAbsReal&)_arg.arg()).constOptimizeTestStatistic(opcode,doAlsoTracking) ;
693 }
694}
695
696
697
698////////////////////////////////////////////////////////////////////////////////
699/// Control verbose messaging related to inter process communication
700/// on both client and server side
701
702void RooRealMPFE::setVerbose(bool clientFlag, bool serverFlag)
703{
704#ifndef _WIN32
705 if (_state==Client) {
706 int msg = Verbose ;
707 *_pipe << msg << serverFlag;
708 if (_verboseServer) std::cout << "RooRealMPFE::setVerbose(" << GetName()
709 << ") IPC toServer> Verbose " << (serverFlag?1:0) << std::endl ;
710 }
711#endif // _WIN32
713}
714
715
716////////////////////////////////////////////////////////////////////////////////
717/// Control verbose messaging related to inter process communication
718/// on both client and server side
719
720void RooRealMPFE::applyNLLWeightSquared(bool flag)
721{
722#ifndef _WIN32
723 if (_state==Client) {
724 int msg = ApplyNLLW2 ;
725 *_pipe << msg << flag;
726 if (_verboseServer) std::cout << "RooRealMPFE::applyNLLWeightSquared(" << GetName()
727 << ") IPC toServer> ApplyNLLW2 " << (flag?1:0) << std::endl ;
728 }
729#endif // _WIN32
731}
732
733
734////////////////////////////////////////////////////////////////////////////////
735
736void RooRealMPFE::doApplyNLLW2(bool flag)
737{
738 RooNLLVar* nll = dynamic_cast<RooNLLVar*>(_arg.absArg()) ;
739 if (nll) {
740 nll->applyWeightSquared(flag) ;
741 }
742}
743
744
745////////////////////////////////////////////////////////////////////////////////
746/// Control verbose messaging related to inter process communication
747/// on both client and server side
748
749void RooRealMPFE::enableOffsetting(bool flag)
750{
751#ifndef _WIN32
752 if (_state==Client) {
753 int msg = EnableOffset ;
754 *_pipe << msg << flag;
755 if (_verboseServer) std::cout << "RooRealMPFE::enableOffsetting(" << GetName()
756 << ") IPC toServer> EnableOffset " << (flag?1:0) << std::endl ;
757 }
758#endif // _WIN32
759 ((RooAbsReal&)_arg.arg()).enableOffsetting(flag) ;
760}
761
762
763
764////////////////////////////////////////////////////////////////////////////////
765/// Destructor. Terminate all parallel processes still registered with
766/// the sentinel
767
768RooMPSentinel::~RooMPSentinel()
769{
770 for(auto * mpfe : static_range_cast<RooRealMPFE*>(_mpfeSet)) {
771 mpfe->standby() ;
772 }
773}
774
775
776
777////////////////////////////////////////////////////////////////////////////////
778/// Register given multi-processor front-end object with the sentinel
779
780void RooMPSentinel::add(RooRealMPFE& mpfe)
781{
782 _mpfeSet.add(mpfe,true) ;
783}
784
785
786
787////////////////////////////////////////////////////////////////////////////////
788/// Remove given multi-processor front-end object from the sentinel
789
790void RooMPSentinel::remove(RooRealMPFE& mpfe)
791{
792 _mpfeSet.remove(mpfe,true) ;
793}
794
795/// \endcond
ROOT::RRangeCast< T, false, Range_t > static_range_cast(Range_t &&coll)
static Roo_reg_AGKInteg1D instance
#define ccoutD(a)
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:60
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
Definition TGX11.cxx:145
@ kName
R__EXTERN TSystem * gSystem
Definition TSystem.h:582
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:76
bool isConstant() const
Check if the "Constant" attribute is set.
Definition RooAbsArg.h:283
virtual bool isIdentical(const RooAbsArg &other, bool assumeSameType=false) const =0
A space to attach TBranches.
void setConstant(bool value=true)
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:63
static void setHideOffset(bool flag)
static void setEvalErrorLoggingMode(ErrorLoggingMode m)
Set evaluation error logging mode.
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
Object to represent discrete states.
Definition RooCategory.h:28
Variable that can be changed from the outside.
Definition RooRealVar.h:37
void setVal(double value) override
Set value of variable to 'value'.
static void callgrind_zero()
Utility function to trigger zeroing of callgrind counters.
Definition RooTrace.cxx:352
virtual int GetPid()
Get process id.
Definition TSystem.cxx:720
RooCmdArg Verbose(bool flag=true)
double nll(double pdf, double weight, int binnedL, int doBinOffset)
Definition MathFuncs.h:452
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition CodegenImpl.h:72
void evaluate(typename Architecture_t::Tensor_t &A, EActivationFunction f)
Apply the given activation function to each value in the given tensor A.
Definition Functions.h:98
void initialize(typename Architecture_t::Matrix_t &A, EInitialization m)
Definition Functions.h:282
void Initialize(Bool_t useTMVAStyle=kTRUE)
Definition tmvaglob.cxx:176