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 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 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
49#ifndef _WIN32
50#include "BidirMMapPipe.h"
51#endif
52
53#include <cstdlib>
54#include <sstream>
55#include "RooRealMPFE.h"
56#include "RooArgSet.h"
57#include "RooAbsCategory.h"
58#include "RooRealVar.h"
59#include "RooCategory.h"
60#include "RooMPSentinel.h"
61#include "RooMsgService.h"
62#include "RooNLLVar.h"
63#include "RooTrace.h"
64
65#include "TSystem.h"
66
68
69using namespace std;
70using namespace RooFit;
71
73 ;
74
75
76////////////////////////////////////////////////////////////////////////////////
77/// Construct front-end object for object 'arg' whose evaluation will be calculated
78/// asynchronously in a separate process. If calcInline is true the value of 'arg'
79/// is calculate synchronously in the current process.
80
81RooRealMPFE::RooRealMPFE(const char *name, const char *title, RooAbsReal& arg, bool calcInline) :
82 RooAbsReal(name,title),
83 _state(Initialize),
84 _arg("arg","arg",this,arg),
85 _vars("vars","vars",this),
86 _calcInProgress(false),
87 _verboseClient(false),
88 _verboseServer(false),
89 _inlineMode(calcInline),
90 _remoteEvalErrorLoggingState(RooAbsReal::PrintErrors),
91 _pipe(0),
92 _updateMaster(0),
93 _retrieveDispatched(false), _evalCarry(0.)
94{
95#ifdef _WIN32
96 _inlineMode = true;
97#endif
98 initVars() ;
99 _sentinel.add(*this) ;
100
101}
102
103
104
105////////////////////////////////////////////////////////////////////////////////
106/// Copy constructor. Initializes in clean state so that upon eval
107/// this instance will create its own server processes
108
109RooRealMPFE::RooRealMPFE(const RooRealMPFE& other, const char* name) :
110 RooAbsReal(other, name),
111 _state(Initialize),
112 _arg("arg",this,other._arg),
113 _vars("vars",this,other._vars),
114 _calcInProgress(false),
115 _verboseClient(other._verboseClient),
116 _verboseServer(other._verboseServer),
117 _inlineMode(other._inlineMode),
118 _forceCalc(other._forceCalc),
119 _remoteEvalErrorLoggingState(other._remoteEvalErrorLoggingState),
120 _pipe(0),
121 _updateMaster(0),
122 _retrieveDispatched(false), _evalCarry(other._evalCarry)
123{
124 initVars() ;
125 _sentinel.add(*this) ;
126}
127
128
129
130////////////////////////////////////////////////////////////////////////////////
131/// Destructor
132
134{
135 if (_state==Client) standby();
136 _sentinel.remove(*this);
137}
138
139
140
141////////////////////////////////////////////////////////////////////////////////
142/// Initialize list of variables of front-end argument 'arg'
143
145{
146 // Empty current lists
147 _vars.removeAll() ;
149
150 // Retrieve non-constant parameters
152 //RooArgSet* ncVars = (RooArgSet*) vars->selectByAttrib("Constant",false) ;
153 RooArgList varList(*vars) ;
154
155 // Save in lists
156 _vars.add(varList) ;
157 _saveVars.addClone(varList) ;
158 _valueChanged.resize(_vars.getSize()) ;
159 _constChanged.resize(_vars.getSize()) ;
160
161 // Force next calculation
162 _forceCalc = true ;
163
164 delete vars ;
165 //delete ncVars ;
166}
167
169{
170 if (_inlineMode) {
171 RooAbsTestStatistic* tmp = dynamic_cast<RooAbsTestStatistic*>(_arg.absArg());
172 if (tmp) return tmp->getCarry();
173 else return 0.;
174 } else {
175 return _evalCarry;
176 }
177}
178
179////////////////////////////////////////////////////////////////////////////////
180/// Initialize the remote process and message passing
181/// pipes between current process and remote process
182
184{
185 // Trivial case: Inline mode
186 if (_inlineMode) {
187 _state = Inline ;
188 return ;
189 }
190
191#ifndef _WIN32
192 // Clear eval error log prior to forking
193 // to avoid confusions...
195 // Fork server process and setup IPC
196 _pipe = new BidirMMapPipe();
197
198 if (_pipe->isChild()) {
199 // Start server loop
201 _state = Server ;
202 serverLoop();
203
204 // Kill server at end of service
205 if (_verboseServer) ccoutD(Minimization) << "RooRealMPFE::initialize(" <<
206 GetName() << ") server process terminating" << endl ;
207
208 delete _arg.absArg();
209 delete _pipe;
210 _exit(0) ;
211 } else {
212 // Client process - fork successul
213 if (_verboseClient) ccoutD(Minimization) << "RooRealMPFE::initialize(" <<
214 GetName() << ") successfully forked server process " <<
215 _pipe->pidOtherEnd() << endl ;
216 _state = Client ;
217 _calcInProgress = false ;
218 }
219#endif // _WIN32
220}
221
222
223
224////////////////////////////////////////////////////////////////////////////////
225/// Server loop of remote processes. This function will return
226/// only when an incoming TERMINATE message is received.
227
229{
230#ifndef _WIN32
231 int msg ;
232
233 Int_t idx, index, numErrors ;
234 double value ;
235 bool isConst ;
236
238
239 while(*_pipe && !_pipe->eof()) {
240 *_pipe >> msg;
241 if (Terminate == msg) {
242 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
243 << ") IPC fromClient> Terminate" << endl;
244 // send terminate acknowledged to client
245 *_pipe << msg << BidirMMapPipe::flush;
246 break;
247 }
248
249 switch (msg) {
250 case SendReal:
251 {
252 *_pipe >> idx >> value >> isConst;
253 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
254 << ") IPC fromClient> SendReal [" << idx << "]=" << value << endl ;
255 RooRealVar* rvar = (RooRealVar*)_vars.at(idx) ;
256 rvar->setVal(value) ;
257 if (rvar->isConstant() != isConst) {
258 rvar->setConstant(isConst) ;
259 }
260 }
261 break ;
262
263 case SendCat:
264 {
265 *_pipe >> idx >> index;
266 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
267 << ") IPC fromClient> SendCat [" << idx << "]=" << index << endl ;
268 ((RooCategory*)_vars.at(idx))->setIndex(index) ;
269 }
270 break ;
271
272 case Calculate:
273 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
274 << ") IPC fromClient> Calculate" << endl ;
275 _value = _arg ;
276 break ;
277
279 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
280 << ") IPC fromClient> Calculate" << endl ;
281
283 _value = _arg ;
285 break ;
286
287 case Retrieve:
288 {
289 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
290 << ") IPC fromClient> Retrieve" << endl ;
291 msg = ReturnValue;
292 numErrors = numEvalErrors();
293 *_pipe << msg << _value << getCarry() << numErrors;
294
295 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
296 << ") IPC toClient> ReturnValue " << _value << " NumError " << numErrors << endl ;
297
298 if (numErrors) {
299 // Loop over errors
300 std::string objidstr;
301 {
302 ostringstream oss2;
303 // Format string with object identity as this cannot be evaluated on the other side
304 oss2 << "PID" << gSystem->GetPid() << "/";
306 objidstr = oss2.str();
307 }
308 std::map<const RooAbsArg*,pair<string,list<EvalError> > >::const_iterator iter = evalErrorIter();
309 const RooAbsArg* ptr = 0;
310 for (int i = 0; i < numEvalErrorItems(); ++i) {
311 list<EvalError>::const_iterator iter2 = iter->second.second.begin();
312 for (; iter->second.second.end() != iter2; ++iter2) {
313 ptr = iter->first;
314 *_pipe << ptr << iter2->_msg << iter2->_srvval << objidstr;
315 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
316 << ") IPC toClient> sending error log Arg " << iter->first << " Msg " << iter2->_msg << endl ;
317 }
318 }
319 // let other end know that we're done with the list of errors
320 ptr = 0;
321 *_pipe << ptr;
322 // Clear error list on local side
324 }
325 *_pipe << BidirMMapPipe::flush;
326 }
327 break;
328
329 case ConstOpt:
330 {
331 bool doTrack ;
332 int code;
333 *_pipe >> code >> doTrack;
334 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
335 << ") IPC fromClient> ConstOpt " << code << " doTrack = " << (doTrack?"T":"F") << endl ;
336 ((RooAbsReal&)_arg.arg()).constOptimizeTestStatistic(static_cast<RooAbsArg::ConstOpCode>(code),doTrack) ;
337 break ;
338 }
339
340 case Verbose:
341 {
342 bool flag ;
343 *_pipe >> flag;
344 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
345 << ") IPC fromClient> Verbose " << (flag?1:0) << endl ;
346 _verboseServer = flag ;
347 }
348 break ;
349
350
351 case ApplyNLLW2:
352 {
353 bool flag ;
354 *_pipe >> flag;
355 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
356 << ") IPC fromClient> ApplyNLLW2 " << (flag?1:0) << endl ;
357
358 // Do application of weight-squared here
359 doApplyNLLW2(flag) ;
360 }
361 break ;
362
363 case EnableOffset:
364 {
365 bool flag ;
366 *_pipe >> flag;
367 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
368 << ") IPC fromClient> EnableOffset " << (flag?1:0) << endl ;
369
370 // Enable likelihoof offsetting here
371 ((RooAbsReal&)_arg.arg()).enableOffsetting(flag) ;
372 }
373 break ;
374
375 case LogEvalError:
376 {
377 int iflag2;
378 *_pipe >> iflag2;
381 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
382 << ") IPC fromClient> LogEvalError flag = " << flag2 << endl ;
383 }
384 break ;
385
386
387 default:
388 if (_verboseServer) cout << "RooRealMPFE::serverLoop(" << GetName()
389 << ") IPC fromClient> Unknown message (code = " << msg << ")" << endl ;
390 break ;
391 }
392 }
393
394#endif // _WIN32
395}
396
397
398
399////////////////////////////////////////////////////////////////////////////////
400/// Client-side function that instructs server process to start
401/// asynchronuous (re)calculation of function value. This function
402/// returns immediately. The calculated value can be retrieved
403/// using getVal()
404
406{
407
408 // Start asynchronous calculation of arg value
409 if (_state==Initialize) {
410 // cout << "RooRealMPFE::calculate(" << GetName() << ") initializing" << endl ;
411 const_cast<RooRealMPFE*>(this)->initialize() ;
412 }
413
414 // Inline mode -- Calculate value now
415 if (_state==Inline) {
416 // cout << "RooRealMPFE::calculate(" << GetName() << ") performing Inline calculation NOW" << endl ;
417 _value = _arg ;
419 }
420
421#ifndef _WIN32
422 // Compare current value of variables with saved values and send changes to server
423 if (_state==Client) {
424 // cout << "RooRealMPFE::calculate(" << GetName() << ") state is Client trigger remote calculation" << endl ;
425 Int_t i(0) ;
426
427 //for (i=0 ; i<_vars.getSize() ; i++) {
428 RooAbsArg *var, *saveVar ;
429 for (std::size_t j=0 ; j<_vars.size() ; j++) {
430 var = _vars.at(j);
431 saveVar = _saveVars.at(j);
432
433 //bool valChanged = !(*var==*saveVar) ;
434 bool valChanged,constChanged ;
435 if (!_updateMaster) {
436 valChanged = !var->isIdentical(*saveVar,true) ;
437 constChanged = (var->isConstant() != saveVar->isConstant()) ;
438 _valueChanged[i] = valChanged ;
439 _constChanged[i] = constChanged ;
440 } else {
441 valChanged = _updateMaster->_valueChanged[i] ;
442 constChanged = _updateMaster->_constChanged[i] ;
443 }
444
445 if ( valChanged || constChanged || _forceCalc) {
446 //cout << "RooRealMPFE::calculate(" << GetName() << " variable " << var->GetName() << " changed " << endl ;
447 if (_verboseClient) cout << "RooRealMPFE::calculate(" << GetName()
448 << ") variable " << _vars.at(i)->GetName() << " changed" << endl ;
449 if (constChanged) {
450 ((RooRealVar*)saveVar)->setConstant(var->isConstant()) ;
451 }
452 saveVar->copyCache(var) ;
453
454 // send message to server
455 if (dynamic_cast<RooAbsReal*>(var)) {
456 int msg = SendReal ;
457 double val = ((RooAbsReal*)var)->getVal() ;
458 bool isC = var->isConstant() ;
459 *_pipe << msg << i << val << isC;
460
461 if (_verboseServer) cout << "RooRealMPFE::calculate(" << GetName()
462 << ") IPC toServer> SendReal [" << i << "]=" << val << (isC?" (Constant)":"") << endl ;
463 } else if (dynamic_cast<RooAbsCategory*>(var)) {
464 int msg = SendCat ;
465 UInt_t idx = ((RooAbsCategory*)var)->getCurrentIndex() ;
466 *_pipe << msg << i << idx;
467 if (_verboseServer) cout << "RooRealMPFE::calculate(" << GetName()
468 << ") IPC toServer> SendCat [" << i << "]=" << idx << endl ;
469 }
470 }
471 i++ ;
472 }
473
474 int msg = hideOffset() ? Calculate : CalculateNoOffset;
475 *_pipe << msg;
476 if (_verboseServer) cout << "RooRealMPFE::calculate(" << GetName()
477 << ") IPC toServer> Calculate " << endl ;
478
479 // Clear dirty state and mark that calculation request was dispatched
481 _calcInProgress = true ;
482 _forceCalc = false ;
483
484 msg = Retrieve ;
485 *_pipe << msg << BidirMMapPipe::flush;
486 if (_verboseServer) cout << "RooRealMPFE::evaluate(" << GetName()
487 << ") IPC toServer> Retrieve " << endl ;
488 _retrieveDispatched = true ;
489
490 } else if (_state!=Inline) {
491 cout << "RooRealMPFE::calculate(" << GetName()
492 << ") ERROR not in Client or Inline mode" << endl ;
493 }
494
495
496#endif // _WIN32
497}
498
499
500
501
502////////////////////////////////////////////////////////////////////////////////
503/// If value needs recalculation and calculation has not beed started
504/// with a call to calculate() start it now. This function blocks
505/// until remote process has finished calculation and returns
506/// remote value
507
508double RooRealMPFE::getValV(const RooArgSet* /*nset*/) const
509{
510
511 if (isValueDirty()) {
512 // Cache is dirty, no calculation has been started yet
513 //cout << "RooRealMPFE::getValF(" << GetName() << ") cache is dirty, caling calculate and evaluate" << endl ;
514 calculate() ;
515 _value = evaluate() ;
516 } else if (_calcInProgress) {
517 //cout << "RooRealMPFE::getValF(" << GetName() << ") calculation in progress, calling evaluate" << endl ;
518 // Cache is clean and calculation is in progress
519 _value = evaluate() ;
520 } else {
521 //cout << "RooRealMPFE::getValF(" << GetName() << ") cache is clean, doing nothing" << endl ;
522 // Cache is clean and calculated value is in cache
523 }
524
525// cout << "RooRealMPFE::getValV(" << GetName() << ") value = " << Form("%5.10f",_value) << endl ;
526 return _value ;
527}
528
529
530
531////////////////////////////////////////////////////////////////////////////////
532/// Send message to server process to retrieve output value
533/// If error were logged use logEvalError() on remote side
534/// transfer those errors to the local eval error queue.
535
537{
538 // Retrieve value of arg
539 double return_value = 0;
540 if (_state==Inline) {
541 return_value = _arg ;
542 } else if (_state==Client) {
543#ifndef _WIN32
544 bool needflush = false;
545 int msg;
546 double value;
547
548 // If current error loggin state is not the same as remote state
549 // update the remote state
551 msg = LogEvalError ;
553 *_pipe << msg << flag;
554 needflush = true;
556 }
557
558 if (!_retrieveDispatched) {
559 msg = Retrieve ;
560 *_pipe << msg;
561 needflush = true;
562 if (_verboseServer) cout << "RooRealMPFE::evaluate(" << GetName()
563 << ") IPC toServer> Retrieve " << endl ;
564 }
565 if (needflush) *_pipe << BidirMMapPipe::flush;
566 _retrieveDispatched = false ;
567
568
569 Int_t numError;
570
571 *_pipe >> msg >> value >> _evalCarry >> numError;
572
573 if (msg!=ReturnValue) {
574 cout << "RooRealMPFE::evaluate(" << GetName()
575 << ") ERROR: unexpected message from server process: " << msg << endl ;
576 return 0 ;
577 }
578 if (_verboseServer) cout << "RooRealMPFE::evaluate(" << GetName()
579 << ") IPC fromServer> ReturnValue " << value << endl ;
580
581 if (_verboseServer) cout << "RooRealMPFE::evaluate(" << GetName()
582 << ") IPC fromServer> NumErrors " << numError << endl ;
583 if (numError) {
584 // Retrieve remote errors and feed into local error queue
585 char *msgbuf1 = 0, *msgbuf2 = 0, *msgbuf3 = 0;
586 RooAbsArg *ptr = 0;
587 while (true) {
588 *_pipe >> ptr;
589 if (!ptr) break;
590 *_pipe >> msgbuf1 >> msgbuf2 >> msgbuf3;
591 if (_verboseServer) cout << "RooRealMPFE::evaluate(" << GetName()
592 << ") IPC fromServer> retrieving error log Arg " << ptr << " Msg " << msgbuf1 << endl ;
593
594 logEvalError(reinterpret_cast<RooAbsReal*>(ptr),msgbuf3,msgbuf1,msgbuf2) ;
595 }
596 std::free(msgbuf1);
597 std::free(msgbuf2);
598 std::free(msgbuf3);
599 }
600
601 // Mark end of calculation in progress
602 _calcInProgress = false ;
603 return_value = value ;
604#endif // _WIN32
605 }
606
607 return return_value;
608}
609
610
611
612////////////////////////////////////////////////////////////////////////////////
613/// Terminate remote server process and return front-end class
614/// to standby mode. Calls to calculate() or evaluate() after
615/// this call will automatically recreated the server process.
616
618{
619#ifndef _WIN32
620 if (_state==Client) {
621 if (_pipe->good()) {
622 // Terminate server process ;
623 if (_verboseServer) cout << "RooRealMPFE::standby(" << GetName()
624 << ") IPC toServer> Terminate " << endl;
625 int msg = Terminate;
626 *_pipe << msg << BidirMMapPipe::flush;
627 // read handshake
628 msg = 0;
629 *_pipe >> msg;
630 if (Terminate != msg || 0 != _pipe->close()) {
631 std::cerr << "In " << __func__ << "(" << __FILE__ ", " << __LINE__ <<
632 "): Server shutdown failed." << std::endl;
633 }
634 } else {
635 if (_verboseServer) {
636 std::cerr << "In " << __func__ << "(" << __FILE__ ", " <<
637 __LINE__ << "): Pipe has already shut down, not sending "
638 "Terminate to server." << std::endl;
639 }
640 }
641 // Close pipes
642 delete _pipe;
643 _pipe = 0;
644
645 // Revert to initialize state
647 }
648#endif // _WIN32
649}
650
651
652
653////////////////////////////////////////////////////////////////////////////////
654/// Intercept call to optimize constant term in test statistics
655/// and forward it to object on server side.
656
658{
659#ifndef _WIN32
660 if (_state==Client) {
661
662 int msg = ConstOpt ;
663 int op = opcode;
664 *_pipe << msg << op << doAlsoTracking;
665 if (_verboseServer) cout << "RooRealMPFE::constOptimize(" << GetName()
666 << ") IPC toServer> ConstOpt " << opcode << endl ;
667
668 initVars() ;
669 }
670#endif // _WIN32
671
672 if (_state==Inline) {
673 ((RooAbsReal&)_arg.arg()).constOptimizeTestStatistic(opcode,doAlsoTracking) ;
674 }
675}
676
677
678
679////////////////////////////////////////////////////////////////////////////////
680/// Control verbose messaging related to inter process communication
681/// on both client and server side
682
683void RooRealMPFE::setVerbose(bool clientFlag, bool serverFlag)
684{
685#ifndef _WIN32
686 if (_state==Client) {
687 int msg = Verbose ;
688 *_pipe << msg << serverFlag;
689 if (_verboseServer) cout << "RooRealMPFE::setVerbose(" << GetName()
690 << ") IPC toServer> Verbose " << (serverFlag?1:0) << endl ;
691 }
692#endif // _WIN32
693 _verboseClient = clientFlag ; _verboseServer = serverFlag ;
694}
695
696
697////////////////////////////////////////////////////////////////////////////////
698/// Control verbose messaging related to inter process communication
699/// on both client and server side
700
702{
703#ifndef _WIN32
704 if (_state==Client) {
705 int msg = ApplyNLLW2 ;
706 *_pipe << msg << flag;
707 if (_verboseServer) cout << "RooRealMPFE::applyNLLWeightSquared(" << GetName()
708 << ") IPC toServer> ApplyNLLW2 " << (flag?1:0) << endl ;
709 }
710#endif // _WIN32
711 doApplyNLLW2(flag) ;
712}
713
714
715////////////////////////////////////////////////////////////////////////////////
716
718{
719 RooNLLVar* nll = dynamic_cast<RooNLLVar*>(_arg.absArg()) ;
720 if (nll) {
721 nll->applyWeightSquared(flag) ;
722 }
723}
724
725
726////////////////////////////////////////////////////////////////////////////////
727/// Control verbose messaging related to inter process communication
728/// on both client and server side
729
731{
732#ifndef _WIN32
733 if (_state==Client) {
734 int msg = EnableOffset ;
735 *_pipe << msg << flag;
736 if (_verboseServer) cout << "RooRealMPFE::enableOffsetting(" << GetName()
737 << ") IPC toServer> EnableOffset " << (flag?1:0) << endl ;
738 }
739#endif // _WIN32
740 ((RooAbsReal&)_arg.arg()).enableOffsetting(flag) ;
741}
742
743
744
header file for BidirMMapPipe, a class which forks off a child process and serves as communications c...
#define ccoutD(a)
Definition: RooMsgService.h:41
#define ClassImp(name)
Definition: Rtypes.h:375
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:110
R__EXTERN TSystem * gSystem
Definition: TSystem.h:559
#define free
Definition: civetweb.c:1539
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:71
virtual void copyCache(const RooAbsArg *source, bool valueOnly=false, bool setValDirty=true)=0
bool isConstant() const
Check if the "Constant" attribute is set.
Definition: RooAbsArg.h:362
void clearValueDirty() const
Definition: RooAbsArg.h:601
bool isValueDirty() const
Definition: RooAbsArg.h:421
virtual bool isIdentical(const RooAbsArg &other, bool assumeSameType=false) const =0
RooArgSet * getParameters(const RooAbsData *data, bool stripDisconnected=true) 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:541
friend class RooRealMPFE
Definition: RooAbsArg.h:666
A space to attach TBranches.
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
Int_t getSize() const
Return the number of elements in the collection.
Storage_t::size_type size() const
virtual RooAbsArg * addClone(const RooAbsArg &var, bool silent=false)
Add a clone of the specified argument to list.
void setConstant(bool value=true)
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:62
static Int_t numEvalErrorItems()
Definition: RooAbsReal.cxx:311
static bool hideOffset()
Definition: RooAbsReal.cxx:117
static EvalErrorIter evalErrorIter()
Definition: RooAbsReal.cxx:319
static ErrorLoggingMode evalErrorLoggingMode()
Return current evaluation error logging mode.
double _value
Cache for current value of object.
Definition: RooAbsReal.h:480
static void setHideOffset(bool flag)
Definition: RooAbsReal.cxx:116
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=nullptr) 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 getCarry() const
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:22
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
Definition: RooArgList.h:110
RooAbsArg * absArg() const
Return pointer to contained argument.
Definition: RooArgProxy.h:47
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:56
RooCategory is an object to represent discrete states.
Definition: RooCategory.h:28
void removeAll() override
Remove all argument inset using remove(const RooAbsArg&).
bool add(const RooAbsArg &var, bool valueServer, bool shapeServer, bool silent)
Overloaded RooCollection_t::add() method insert object into set and registers object as server to own...
BidirMMapPipe creates a bidirectional channel between the current process and a child it forks.
bool good() const
status of stream is good
bool isChild() const
return if this end of the pipe is the child end
bool eof() const
true if end-of-file
int close()
flush buffers, close pipe
pid_t pidOtherEnd() const
return PID of the process on the other end of the pipe
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:30
void applyWeightSquared(bool flag) override
Disables or enables the usage of squared weights.
Definition: RooNLLVar.cxx:199
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
! connection to child
Definition: RooRealMPFE.h:80
RooArgList _saveVars
Copy of variables.
Definition: RooRealMPFE.h:72
void calculate() const
Client-side function that instructs server process to start asynchronuous (re)calculation of function...
void initialize()
Initialize the remote process and message passing pipes between current process and remote process.
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
bool _calcInProgress
Definition: RooRealMPFE.h:73
RooListProxy _vars
Variables.
Definition: RooRealMPFE.h:71
double _evalCarry
!
Definition: RooRealMPFE.h:86
void applyNLLWeightSquared(bool flag)
Control verbose messaging related to inter process communication on both client and server side.
void initVars()
Initialize list of variables of front-end argument 'arg'.
RooRealMPFE * _updateMaster
! Update master
Definition: RooRealMPFE.h:84
void doApplyNLLW2(bool flag)
bool _retrieveDispatched
!
Definition: RooRealMPFE.h:85
bool _verboseClient
Definition: RooRealMPFE.h:74
void setVerbose(bool clientFlag=true, bool serverFlag=true)
Control verbose messaging related to inter process communication on both client and server side.
bool _forceCalc
Definition: RooRealMPFE.h:77
std::vector< bool > _constChanged
! Flags if variable needs update on server-side
Definition: RooRealMPFE.h:83
double evaluate() const override
Send message to server process to retrieve output value If error were logged use logEvalError() on re...
void constOptimizeTestStatistic(ConstOpCode opcode, bool doAlsoTracking=true) override
Intercept call to optimize constant term in test statistics and forward it to object on server side.
virtual double getCarry() const
std::vector< bool > _valueChanged
! Flags if variable needs update on server-side
Definition: RooRealMPFE.h:82
void enableOffsetting(bool flag) override
Control verbose messaging related to inter process communication on both client and server side.
bool _verboseServer
Definition: RooRealMPFE.h:75
RooRealProxy _arg
Function to calculate in parallel process.
Definition: RooRealMPFE.h:70
bool _inlineMode
Definition: RooRealMPFE.h:76
~RooRealMPFE() override
Destructor.
RooAbsReal::ErrorLoggingMode _remoteEvalErrorLoggingState
Definition: RooRealMPFE.h:78
double getValV(const RooArgSet *nset=nullptr) const override
If value needs recalculation and calculation has not beed started with a call to calculate() start it...
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:40
void setVal(double value) override
Set value of variable to 'value'.
Definition: RooRealVar.cxx:254
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:296
const char * GetName() const override
Returns name of object.
Definition: TNamed.h:47
virtual int GetPid()
Get process id.
Definition: TSystem.cxx:710
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition: Common.h:18
@ Minimization
Definition: RooGlobalFunc.h:61
void Initialize(Bool_t useTMVAStyle=kTRUE)
Definition: tmvaglob.cxx:176