Logo ROOT  
Reference Guide
RooRealMPFE.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16
17/**
18\file RooRealMPFE.cxx
19\class RooRealMPFE
20\ingroup Roofitcore
21
22RooRealMPFE is the multi-processor front-end for parallel calculation
23of RooAbsReal objects. Each RooRealMPFE forks a process that calculates
24the value of the proxies RooAbsReal object. The (re)calculation of
25the proxied object is started asynchronously with the calculate() option.
26A subsequent call to getVal() will return the calculated value when available
27If the calculation is still in progress when getVal() is called it blocks
28the calling process until the calculation is done. The forked calculation process
29is terminated when the front-end object is deleted
30Simple use demonstration
31
32~~~{.cpp}
33RooAbsReal* slowFunc ;
34
35Double_t val = slowFunc->getVal() // Evaluate slowFunc in current process
36
37RooRealMPFE mpfe("mpfe","frontend to slowFunc",*slowFunc) ;
38mpfe.calculate() ; // Start calculation of slow-func in remote process
39 // .. do other stuff here ..
40Double_t val = mpfe.getVal() // Wait for remote calculation to finish and retrieve value
41~~~
42
43For general multiprocessing in ROOT, please refer to the TProcessExecutor class.
44
45**/
46
47#include "Riostream.h"
48#include "RooFit.h"
49
50#ifndef _WIN32
51#include "BidirMMapPipe.h"
52#endif
53
54#include <cstdlib>
55#include <sstream>
56#include "RooRealMPFE.h"
57#include "RooArgSet.h"
58#include "RooAbsCategory.h"
59#include "RooRealVar.h"
60#include "RooCategory.h"
61#include "RooMPSentinel.h"
62#include "RooMsgService.h"
63#include "RooNLLVar.h"
64#include "RooTrace.h"
65
66#include "TSystem.h"
67
69
70using namespace std;
71using namespace RooFit;
72
74 ;
75
76
77////////////////////////////////////////////////////////////////////////////////
78/// Construct front-end object for object 'arg' whose evaluation will be calculated
79/// asynchronously in a separate process. If calcInline is true the value of 'arg'
80/// is calculate synchronously in the current process.
81
82RooRealMPFE::RooRealMPFE(const char *name, const char *title, RooAbsReal& arg, Bool_t calcInline) :
83 RooAbsReal(name,title),
84 _state(Initialize),
85 _arg("arg","arg",this,arg),
86 _vars("vars","vars",this),
87 _calcInProgress(kFALSE),
88 _verboseClient(kFALSE),
89 _verboseServer(kFALSE),
90 _inlineMode(calcInline),
91 _remoteEvalErrorLoggingState(RooAbsReal::PrintErrors),
92 _pipe(0),
93 _updateMaster(0),
94 _retrieveDispatched(kFALSE), _evalCarry(0.)
95{
96#ifdef _WIN32
98#endif
99 initVars() ;
100 _sentinel.add(*this) ;
101
102}
103
104
105
106////////////////////////////////////////////////////////////////////////////////
107/// Copy constructor. Initializes in clean state so that upon eval
108/// this instance will create its own server processes
109
110RooRealMPFE::RooRealMPFE(const RooRealMPFE& other, const char* name) :
111 RooAbsReal(other, name),
112 _state(Initialize),
113 _arg("arg",this,other._arg),
114 _vars("vars",this,other._vars),
115 _calcInProgress(kFALSE),
116 _verboseClient(other._verboseClient),
117 _verboseServer(other._verboseServer),
118 _inlineMode(other._inlineMode),
119 _forceCalc(other._forceCalc),
120 _remoteEvalErrorLoggingState(other._remoteEvalErrorLoggingState),
121 _pipe(0),
122 _updateMaster(0),
123 _retrieveDispatched(kFALSE), _evalCarry(other._evalCarry)
124{
125 initVars() ;
126 _sentinel.add(*this) ;
127}
128
129
130
131////////////////////////////////////////////////////////////////////////////////
132/// Destructor
133
135{
136 if (_state==Client) standby();
137 _sentinel.remove(*this);
138}
139
140
141
142////////////////////////////////////////////////////////////////////////////////
143/// Initialize list of variables of front-end argument 'arg'
144
146{
147 // Empty current lists
148 _vars.removeAll() ;
150
151 // Retrieve non-constant parameters
153 //RooArgSet* ncVars = (RooArgSet*) vars->selectByAttrib("Constant",kFALSE) ;
154 RooArgList varList(*vars) ;
155
156 // Save in lists
157 _vars.add(varList) ;
158 _saveVars.addClone(varList) ;
159 _valueChanged.resize(_vars.getSize()) ;
160 _constChanged.resize(_vars.getSize()) ;
161
162 // Force next calculation
163 _forceCalc = kTRUE ;
164
165 delete vars ;
166 //delete ncVars ;
167}
168
170{
171 if (_inlineMode) {
172 RooAbsTestStatistic* tmp = dynamic_cast<RooAbsTestStatistic*>(_arg.absArg());
173 if (tmp) return tmp->getCarry();
174 else return 0.;
175 } else {
176 return _evalCarry;
177 }
178}
179
180////////////////////////////////////////////////////////////////////////////////
181/// Initialize the remote process and message passing
182/// pipes between current process and remote process
183
185{
186 // Trivial case: Inline mode
187 if (_inlineMode) {
188 _state = Inline ;
189 return ;
190 }
191
192#ifndef _WIN32
193 // Clear eval error log prior to forking
194 // to avoid confusions...
196 // Fork server process and setup IPC
197 _pipe = new BidirMMapPipe();
198
199 if (_pipe->isChild()) {
200 // Start server loop
202 _state = Server ;
203 serverLoop();
204
205 // Kill server at end of service
206 if (_verboseServer) ccoutD(Minimization) << "RooRealMPFE::initialize(" <<
207 GetName() << ") server process terminating" << endl ;
208
209 delete _arg.absArg();
210 delete _pipe;
211 _exit(0) ;
212 } else {
213 // Client process - fork successul
214 if (_verboseClient) ccoutD(Minimization) << "RooRealMPFE::initialize(" <<
215 GetName() << ") successfully forked server process " <<
216 _pipe->pidOtherEnd() << endl ;
217 _state = Client ;
219 }
220#endif // _WIN32
221}
222
223
224
225////////////////////////////////////////////////////////////////////////////////
226/// Server loop of remote processes. This function will return
227/// only when an incoming TERMINATE message is received.
228
230{
231#ifndef _WIN32
232 int msg ;
233
234 Int_t idx, index, numErrors ;
235 Double_t value ;
236 Bool_t isConst ;
237
239
240 while(*_pipe && !_pipe->eof()) {
241 *_pipe >> msg;
242 if (Terminate == msg) {
243 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
244 << ") IPC fromClient> Terminate" << endl;
245 // send terminate acknowledged to client
246 *_pipe << msg << BidirMMapPipe::flush;
247 break;
248 }
249
250 switch (msg) {
251 case SendReal:
252 {
253 *_pipe >> idx >> value >> isConst;
254 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
255 << ") IPC fromClient> SendReal [" << idx << "]=" << value << endl ;
256 RooRealVar* rvar = (RooRealVar*)_vars.at(idx) ;
257 rvar->setVal(value) ;
258 if (rvar->isConstant() != isConst) {
259 rvar->setConstant(isConst) ;
260 }
261 }
262 break ;
263
264 case SendCat:
265 {
266 *_pipe >> idx >> index;
267 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
268 << ") IPC fromClient> SendCat [" << idx << "]=" << index << endl ;
269 ((RooCategory*)_vars.at(idx))->setIndex(index) ;
270 }
271 break ;
272
273 case Calculate:
274 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
275 << ") IPC fromClient> Calculate" << endl ;
276 _value = _arg ;
277 break ;
278
280 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
281 << ") IPC fromClient> Calculate" << endl ;
282
284 _value = _arg ;
286 break ;
287
288 case Retrieve:
289 {
290 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
291 << ") IPC fromClient> Retrieve" << endl ;
292 msg = ReturnValue;
293 numErrors = numEvalErrors();
294 *_pipe << msg << _value << getCarry() << numErrors;
295
296 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
297 << ") IPC toClient> ReturnValue " << _value << " NumError " << numErrors << endl ;
298
299 if (numErrors) {
300 // Loop over errors
301 std::string objidstr;
302 {
303 ostringstream oss2;
304 // Format string with object identity as this cannot be evaluated on the other side
305 oss2 << "PID" << gSystem->GetPid() << "/";
307 objidstr = oss2.str();
308 }
309 std::map<const RooAbsArg*,pair<string,list<EvalError> > >::const_iterator iter = evalErrorIter();
310 const RooAbsArg* ptr = 0;
311 for (int i = 0; i < numEvalErrorItems(); ++i) {
312 list<EvalError>::const_iterator iter2 = iter->second.second.begin();
313 for (; iter->second.second.end() != iter2; ++iter2) {
314 ptr = iter->first;
315 *_pipe << ptr << iter2->_msg << iter2->_srvval << objidstr;
316 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
317 << ") IPC toClient> sending error log Arg " << iter->first << " Msg " << iter2->_msg << endl ;
318 }
319 }
320 // let other end know that we're done with the list of errors
321 ptr = 0;
322 *_pipe << ptr;
323 // Clear error list on local side
325 }
327 }
328 break;
329
330 case ConstOpt:
331 {
332 Bool_t doTrack ;
333 int code;
334 *_pipe >> code >> doTrack;
335 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
336 << ") IPC fromClient> ConstOpt " << code << " doTrack = " << (doTrack?"T":"F") << endl ;
337 ((RooAbsReal&)_arg.arg()).constOptimizeTestStatistic(static_cast<RooAbsArg::ConstOpCode>(code),doTrack) ;
338 break ;
339 }
340
341 case Verbose:
342 {
343 Bool_t flag ;
344 *_pipe >> flag;
345 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
346 << ") IPC fromClient> Verbose " << (flag?1:0) << endl ;
347 _verboseServer = flag ;
348 }
349 break ;
350
351
352 case ApplyNLLW2:
353 {
354 Bool_t flag ;
355 *_pipe >> flag;
356 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
357 << ") IPC fromClient> ApplyNLLW2 " << (flag?1:0) << endl ;
358
359 // Do application of weight-squared here
360 doApplyNLLW2(flag) ;
361 }
362 break ;
363
364 case EnableOffset:
365 {
366 Bool_t flag ;
367 *_pipe >> flag;
368 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
369 << ") IPC fromClient> EnableOffset " << (flag?1:0) << endl ;
370
371 // Enable likelihoof offsetting here
372 ((RooAbsReal&)_arg.arg()).enableOffsetting(flag) ;
373 }
374 break ;
375
376 case LogEvalError:
377 {
378 int iflag2;
379 *_pipe >> iflag2;
382 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
383 << ") IPC fromClient> LogEvalError flag = " << flag2 << endl ;
384 }
385 break ;
386
387
388 default:
389 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
390 << ") IPC fromClient> Unknown message (code = " << msg << ")" << endl ;
391 break ;
392 }
393 }
394
395#endif // _WIN32
396}
397
398
399
400////////////////////////////////////////////////////////////////////////////////
401/// Client-side function that instructs server process to start
402/// asynchronuous (re)calculation of function value. This function
403/// returns immediately. The calculated value can be retrieved
404/// using getVal()
405
407{
408
409 // Start asynchronous calculation of arg value
410 if (_state==Initialize) {
411 // cout << "RooRealMPFE::calculate(" << GetName() << ") initializing" << endl ;
412 const_cast<RooRealMPFE*>(this)->initialize() ;
413 }
414
415 // Inline mode -- Calculate value now
416 if (_state==Inline) {
417 // cout << "RooRealMPFE::calculate(" << GetName() << ") performing Inline calculation NOW" << endl ;
418 _value = _arg ;
420 }
421
422#ifndef _WIN32
423 // Compare current value of variables with saved values and send changes to server
424 if (_state==Client) {
425 // cout << "RooRealMPFE::calculate(" << GetName() << ") state is Client trigger remote calculation" << endl ;
426 Int_t i(0) ;
427 RooFIter viter = _vars.fwdIterator() ;
428 RooFIter siter = _saveVars.fwdIterator() ;
429
430 //for (i=0 ; i<_vars.getSize() ; i++) {
431 RooAbsArg *var, *saveVar ;
432 while((var = viter.next())) {
433 saveVar = siter.next() ;
434
435 //Bool_t valChanged = !(*var==*saveVar) ;
436 Bool_t valChanged,constChanged ;
437 if (!_updateMaster) {
438 valChanged = !var->isIdentical(*saveVar,kTRUE) ;
439 constChanged = (var->isConstant() != saveVar->isConstant()) ;
440 _valueChanged[i] = valChanged ;
441 _constChanged[i] = constChanged ;
442 } else {
443 valChanged = _updateMaster->_valueChanged[i] ;
444 constChanged = _updateMaster->_constChanged[i] ;
445 }
446
447 if ( valChanged || constChanged || _forceCalc) {
448 //cout << "RooRealMPFE::calculate(" << GetName() << " variable " << var->GetName() << " changed " << endl ;
449 if (_verboseClient) cout << "RooRealMPFE::calculate(" << GetName()
450 << ") variable " << _vars.at(i)->GetName() << " changed" << endl ;
451 if (constChanged) {
452 ((RooRealVar*)saveVar)->setConstant(var->isConstant()) ;
453 }
454 saveVar->copyCache(var) ;
455
456 // send message to server
457 if (dynamic_cast<RooAbsReal*>(var)) {
458 int msg = SendReal ;
459 Double_t val = ((RooAbsReal*)var)->getVal() ;
460 Bool_t isC = var->isConstant() ;
461 *_pipe << msg << i << val << isC;
462
463 if (_verboseServer) cout << "RooRealMPFE::calculate(" << GetName()
464 << ") IPC toServer> SendReal [" << i << "]=" << val << (isC?" (Constant)":"") << endl ;
465 } else if (dynamic_cast<RooAbsCategory*>(var)) {
466 int msg = SendCat ;
467 UInt_t idx = ((RooAbsCategory*)var)->getIndex() ;
468 *_pipe << msg << i << idx;
469 if (_verboseServer) cout << "RooRealMPFE::calculate(" << GetName()
470 << ") IPC toServer> SendCat [" << i << "]=" << idx << endl ;
471 }
472 }
473 i++ ;
474 }
475
476 int msg = hideOffset() ? Calculate : CalculateNoOffset;
477 *_pipe << msg;
478 if (_verboseServer) cout << "RooRealMPFE::calculate(" << GetName()
479 << ") IPC toServer> Calculate " << endl ;
480
481 // Clear dirty state and mark that calculation request was dispatched
485
486 msg = Retrieve ;
487 *_pipe << msg << BidirMMapPipe::flush;
488 if (_verboseServer) cout << "RooRealMPFE::evaluate(" << GetName()
489 << ") IPC toServer> Retrieve " << endl ;
491
492 } else if (_state!=Inline) {
493 cout << "RooRealMPFE::calculate(" << GetName()
494 << ") ERROR not in Client or Inline mode" << endl ;
495 }
496
497
498#endif // _WIN32
499}
500
501
502
503
504////////////////////////////////////////////////////////////////////////////////
505/// If value needs recalculation and calculation has not beed started
506/// with a call to calculate() start it now. This function blocks
507/// until remote process has finished calculation and returns
508/// remote value
509
511{
512
513 if (isValueDirty()) {
514 // Cache is dirty, no calculation has been started yet
515 //cout << "RooRealMPFE::getValF(" << GetName() << ") cache is dirty, caling calculate and evaluate" << endl ;
516 calculate() ;
517 _value = evaluate() ;
518 } else if (_calcInProgress) {
519 //cout << "RooRealMPFE::getValF(" << GetName() << ") calculation in progress, calling evaluate" << endl ;
520 // Cache is clean and calculation is in progress
521 _value = evaluate() ;
522 } else {
523 //cout << "RooRealMPFE::getValF(" << GetName() << ") cache is clean, doing nothing" << endl ;
524 // Cache is clean and calculated value is in cache
525 }
526
527// cout << "RooRealMPFE::getValV(" << GetName() << ") value = " << Form("%5.10f",_value) << endl ;
528 return _value ;
529}
530
531
532
533////////////////////////////////////////////////////////////////////////////////
534/// Send message to server process to retrieve output value
535/// If error were logged use logEvalError() on remote side
536/// transfer those errors to the local eval error queue.
537
539{
540 // Retrieve value of arg
541 Double_t return_value = 0;
542 if (_state==Inline) {
543 return_value = _arg ;
544 } else if (_state==Client) {
545#ifndef _WIN32
546 bool needflush = false;
547 int msg;
548 Double_t value;
549
550 // If current error loggin state is not the same as remote state
551 // update the remote state
553 msg = LogEvalError ;
555 *_pipe << msg << flag;
556 needflush = true;
558 }
559
560 if (!_retrieveDispatched) {
561 msg = Retrieve ;
562 *_pipe << msg;
563 needflush = true;
564 if (_verboseServer) cout << "RooRealMPFE::evaluate(" << GetName()
565 << ") IPC toServer> Retrieve " << endl ;
566 }
567 if (needflush) *_pipe << BidirMMapPipe::flush;
569
570
571 Int_t numError;
572
573 *_pipe >> msg >> value >> _evalCarry >> numError;
574
575 if (msg!=ReturnValue) {
576 cout << "RooRealMPFE::evaluate(" << GetName()
577 << ") ERROR: unexpected message from server process: " << msg << endl ;
578 return 0 ;
579 }
580 if (_verboseServer) cout << "RooRealMPFE::evaluate(" << GetName()
581 << ") IPC fromServer> ReturnValue " << value << endl ;
582
583 if (_verboseServer) cout << "RooRealMPFE::evaluate(" << GetName()
584 << ") IPC fromServer> NumErrors " << numError << endl ;
585 if (numError) {
586 // Retrieve remote errors and feed into local error queue
587 char *msgbuf1 = 0, *msgbuf2 = 0, *msgbuf3 = 0;
588 RooAbsArg *ptr = 0;
589 while (true) {
590 *_pipe >> ptr;
591 if (!ptr) break;
592 *_pipe >> msgbuf1 >> msgbuf2 >> msgbuf3;
593 if (_verboseServer) cout << "RooRealMPFE::evaluate(" << GetName()
594 << ") IPC fromServer> retrieving error log Arg " << ptr << " Msg " << msgbuf1 << endl ;
595
596 logEvalError(reinterpret_cast<RooAbsReal*>(ptr),msgbuf3,msgbuf1,msgbuf2) ;
597 }
598 std::free(msgbuf1);
599 std::free(msgbuf2);
600 std::free(msgbuf3);
601 }
602
603 // Mark end of calculation in progress
605 return_value = value ;
606#endif // _WIN32
607 }
608
609 return return_value;
610}
611
612
613
614////////////////////////////////////////////////////////////////////////////////
615/// Terminate remote server process and return front-end class
616/// to standby mode. Calls to calculate() or evaluate() after
617/// this call will automatically recreated the server process.
618
620{
621#ifndef _WIN32
622 if (_state==Client) {
623 if (_pipe->good()) {
624 // Terminate server process ;
625 if (_verboseServer) cout << "RooRealMPFE::standby(" << GetName()
626 << ") IPC toServer> Terminate " << endl;
627 int msg = Terminate;
628 *_pipe << msg << BidirMMapPipe::flush;
629 // read handshake
630 msg = 0;
631 *_pipe >> msg;
632 if (Terminate != msg || 0 != _pipe->close()) {
633 std::cerr << "In " << __func__ << "(" << __FILE__ ", " << __LINE__ <<
634 "): Server shutdown failed." << std::endl;
635 }
636 } else {
637 if (_verboseServer) {
638 std::cerr << "In " << __func__ << "(" << __FILE__ ", " <<
639 __LINE__ << "): Pipe has already shut down, not sending "
640 "Terminate to server." << std::endl;
641 }
642 }
643 // Close pipes
644 delete _pipe;
645 _pipe = 0;
646
647 // Revert to initialize state
649 }
650#endif // _WIN32
651}
652
653
654
655////////////////////////////////////////////////////////////////////////////////
656/// Intercept call to optimize constant term in test statistics
657/// and forward it to object on server side.
658
660{
661#ifndef _WIN32
662 if (_state==Client) {
663
664 int msg = ConstOpt ;
665 int op = opcode;
666 *_pipe << msg << op << doAlsoTracking;
667 if (_verboseServer) cout << "RooRealMPFE::constOptimize(" << GetName()
668 << ") IPC toServer> ConstOpt " << opcode << endl ;
669
670 initVars() ;
671 }
672#endif // _WIN32
673
674 if (_state==Inline) {
675 ((RooAbsReal&)_arg.arg()).constOptimizeTestStatistic(opcode,doAlsoTracking) ;
676 }
677}
678
679
680
681////////////////////////////////////////////////////////////////////////////////
682/// Control verbose messaging related to inter process communication
683/// on both client and server side
684
685void RooRealMPFE::setVerbose(Bool_t clientFlag, Bool_t serverFlag)
686{
687#ifndef _WIN32
688 if (_state==Client) {
689 int msg = Verbose ;
690 *_pipe << msg << serverFlag;
691 if (_verboseServer) cout << "RooRealMPFE::setVerbose(" << GetName()
692 << ") IPC toServer> Verbose " << (serverFlag?1:0) << endl ;
693 }
694#endif // _WIN32
695 _verboseClient = clientFlag ; _verboseServer = serverFlag ;
696}
697
698
699////////////////////////////////////////////////////////////////////////////////
700/// Control verbose messaging related to inter process communication
701/// on both client and server side
702
704{
705#ifndef _WIN32
706 if (_state==Client) {
707 int msg = ApplyNLLW2 ;
708 *_pipe << msg << flag;
709 if (_verboseServer) cout << "RooRealMPFE::applyNLLWeightSquared(" << GetName()
710 << ") IPC toServer> ApplyNLLW2 " << (flag?1:0) << endl ;
711 }
712#endif // _WIN32
713 doApplyNLLW2(flag) ;
714}
715
716
717////////////////////////////////////////////////////////////////////////////////
718
720{
721 RooNLLVar* nll = dynamic_cast<RooNLLVar*>(_arg.absArg()) ;
722 if (nll) {
723 nll->applyWeightSquared(flag) ;
724 }
725}
726
727
728////////////////////////////////////////////////////////////////////////////////
729/// Control verbose messaging related to inter process communication
730/// on both client and server side
731
733{
734#ifndef _WIN32
735 if (_state==Client) {
736 int msg = EnableOffset ;
737 *_pipe << msg << flag;
738 if (_verboseServer) cout << "RooRealMPFE::enableOffsetting(" << GetName()
739 << ") IPC toServer> EnableOffset " << (flag?1:0) << endl ;
740 }
741#endif // _WIN32
742 ((RooAbsReal&)_arg.arg()).enableOffsetting(flag) ;
743}
744
745
746
header file for BidirMMapPipe, a class which forks off a child process and serves as communications c...
#define ccoutD(a)
Definition: RooMsgService.h:38
int Int_t
Definition: RtypesCore.h:41
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:365
char name[80]
Definition: TGX11.cxx:109
R__EXTERN TSystem * gSystem
Definition: TSystem.h:560
#define free
Definition: civetweb.c:1539
BidirMMapPipe creates a bidirectional channel between the current process and a child it forks.
void flush()
flush buffers with unwritten data
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:71
virtual void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE)=0
friend class RooArgSet
Definition: RooAbsArg.h:551
RooArgSet * getParameters(const RooAbsData *data, Bool_t stripDisconnected=kTRUE) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
Definition: RooAbsArg.cxx:548
Bool_t isValueDirty() const
Definition: RooAbsArg.h:390
virtual Bool_t isIdentical(const RooAbsArg &other, Bool_t assumeSameType=kFALSE)=0
void clearValueDirty() const
Definition: RooAbsArg.h:526
friend class RooRealMPFE
Definition: RooAbsArg.h:600
Bool_t isConstant() const
Definition: RooAbsArg.h:320
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
RooFIter fwdIterator() const R__SUGGEST_ALTERNATIVE("begin()
One-time forward iterator.
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
Int_t getSize() const
virtual RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE)
Add a clone of 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...
Definition: RooAbsReal.h:59
static Int_t numEvalErrorItems()
Definition: RooAbsReal.cxx:324
static void setHideOffset(Bool_t flag)
Definition: RooAbsReal.cxx:117
static Bool_t hideOffset()
Definition: RooAbsReal.cxx:118
static EvalErrorIter evalErrorIter()
Definition: RooAbsReal.cxx:332
Double_t _value
Definition: RooAbsReal.h:446
static ErrorLoggingMode evalErrorLoggingMode()
Return current evaluation error logging mode.
static Int_t numEvalErrors()
Return the number of logged evaluation errors since the last clearing.
static void setEvalErrorLoggingMode(ErrorLoggingMode m)
Set evaluation error logging mode.
void logEvalError(const char *message, const char *serverValueString=0) const
Log evaluation error message.
static void clearEvalErrorLog()
Clear the stack of evaluation error messages.
RooAbsTestStatistic is the abstract base class for all test statistics.
virtual Double_t getCarry() const
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:21
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
Definition: RooArgList.h:74
RooAbsArg * absArg() const
Definition: RooArgProxy.h:37
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:28
RooCategory represents a fundamental (non-derived) discrete value object.
Definition: RooCategory.h:24
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
RooAbsArg * next()
Return next element or nullptr if at end.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Reimplementation of standard RooArgList::add()
virtual void removeAll()
Reimplementation of standard RooArgList::removeAll()
RooMPSentinel is a singleton class that keeps track of all parellel execution processes for goodness-...
Definition: RooMPSentinel.h:23
void remove(RooRealMPFE &mpfe)
Remove given multi-processor front-end object from the sentinel.
void add(RooRealMPFE &mpfe)
Register given multi-processor front-end object with the sentinel.
Class RooNLLVar implements a -log(likelihood) calculation from a dataset and a PDF.
Definition: RooNLLVar.h:26
void applyWeightSquared(Bool_t flag)
Definition: RooNLLVar.cxx:226
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer,...
RooRealMPFE is the multi-processor front-end for parallel calculation of RooAbsReal objects.
Definition: RooRealMPFE.h:30
State _state
Definition: RooRealMPFE.h:59
RooFit::BidirMMapPipe * _pipe
Definition: RooRealMPFE.h:80
RooArgList _saveVars
Definition: RooRealMPFE.h:72
void calculate() const
Client-side function that instructs server process to start asynchronuous (re)calculation of function...
virtual Double_t getCarry() const
void applyNLLWeightSquared(Bool_t flag)
Control verbose messaging related to inter process communication on both client and server side.
void initialize()
Initialize the remote process and message passing pipes between current process and remote process.
virtual ~RooRealMPFE()
Destructor.
virtual Double_t evaluate() const
Send message to server process to retrieve output value If error were logged use logEvalError() on re...
void serverLoop()
Server loop of remote processes.
void standby()
Terminate remote server process and return front-end class to standby mode.
@ CalculateNoOffset
Definition: RooRealMPFE.h:62
static RooMPSentinel _sentinel
Definition: RooRealMPFE.h:88
RooListProxy _vars
Definition: RooRealMPFE.h:71
Bool_t _inlineMode
Definition: RooRealMPFE.h:76
void initVars()
Initialize list of variables of front-end argument 'arg'.
RooRealMPFE * _updateMaster
Flags if variable needs update on server-side.
Definition: RooRealMPFE.h:84
void enableOffsetting(Bool_t flag)
Control verbose messaging related to inter process communication on both client and server side.
std::vector< Bool_t > _valueChanged
connection to child
Definition: RooRealMPFE.h:82
virtual Double_t getValV(const RooArgSet *nset=0) const
If value needs recalculation and calculation has not beed started with a call to calculate() start it...
void doApplyNLLW2(Bool_t flag)
Bool_t _calcInProgress
Definition: RooRealMPFE.h:73
virtual void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTracking=kTRUE)
Intercept call to optimize constant term in test statistics and forward it to object on server side.
std::vector< Bool_t > _constChanged
Flags if variable needs update on server-side.
Definition: RooRealMPFE.h:83
Bool_t _forceCalc
Definition: RooRealMPFE.h:77
Bool_t _verboseServer
Definition: RooRealMPFE.h:75
RooRealProxy _arg
Definition: RooRealMPFE.h:70
Bool_t _retrieveDispatched
Update master.
Definition: RooRealMPFE.h:85
Bool_t _verboseClient
Definition: RooRealMPFE.h:74
RooAbsReal::ErrorLoggingMode _remoteEvalErrorLoggingState
Definition: RooRealMPFE.h:78
Double_t _evalCarry
Definition: RooRealMPFE.h:86
void setVerbose(Bool_t clientFlag=kTRUE, Bool_t serverFlag=kTRUE)
Control verbose messaging related to inter process communication on both client and server side.
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:35
virtual void setVal(Double_t value)
Set value of variable to 'value'.
Definition: RooRealVar.cxx:278
const T & arg() const
Return reference to object held in proxy.
static void callgrind_zero()
Utility function to trigger zeroing of callgrind counters.
Definition: RooTrace.cxx:298
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual int GetPid()
Get process id.
Definition: TSystem.cxx:717
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
@ Minimization
Definition: RooGlobalFunc.h:67
void Initialize(Bool_t useTMVAStyle=kTRUE)
Definition: tmvaglob.cxx:176