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
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_t calcInline) :
82 RooAbsReal(name,title),
83 _state(Initialize),
84 _arg("arg","arg",this,arg),
85 _vars("vars","vars",this),
86 _calcInProgress(kFALSE),
87 _verboseClient(kFALSE),
88 _verboseServer(kFALSE),
89 _inlineMode(calcInline),
90 _remoteEvalErrorLoggingState(RooAbsReal::PrintErrors),
91 _pipe(0),
92 _updateMaster(0),
93 _retrieveDispatched(kFALSE), _evalCarry(0.)
94{
95#ifdef _WIN32
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(kFALSE),
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(kFALSE), _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",kFALSE) ;
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 = kTRUE ;
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 ;
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 ;
235 Bool_t 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_t 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_t 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_t 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_t 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 RooFIter viter = _vars.fwdIterator() ;
427 RooFIter siter = _saveVars.fwdIterator() ;
428
429 //for (i=0 ; i<_vars.getSize() ; i++) {
430 RooAbsArg *var, *saveVar ;
431 while((var = viter.next())) {
432 saveVar = siter.next() ;
433
434 //Bool_t valChanged = !(*var==*saveVar) ;
435 Bool_t valChanged,constChanged ;
436 if (!_updateMaster) {
437 valChanged = !var->isIdentical(*saveVar,kTRUE) ;
438 constChanged = (var->isConstant() != saveVar->isConstant()) ;
439 _valueChanged[i] = valChanged ;
440 _constChanged[i] = constChanged ;
441 } else {
442 valChanged = _updateMaster->_valueChanged[i] ;
443 constChanged = _updateMaster->_constChanged[i] ;
444 }
445
446 if ( valChanged || constChanged || _forceCalc) {
447 //cout << "RooRealMPFE::calculate(" << GetName() << " variable " << var->GetName() << " changed " << endl ;
448 if (_verboseClient) cout << "RooRealMPFE::calculate(" << GetName()
449 << ") variable " << _vars.at(i)->GetName() << " changed" << endl ;
450 if (constChanged) {
451 ((RooRealVar*)saveVar)->setConstant(var->isConstant()) ;
452 }
453 saveVar->copyCache(var) ;
454
455 // send message to server
456 if (dynamic_cast<RooAbsReal*>(var)) {
457 int msg = SendReal ;
458 Double_t val = ((RooAbsReal*)var)->getVal() ;
459 Bool_t isC = var->isConstant() ;
460 *_pipe << msg << i << val << isC;
461
462 if (_verboseServer) cout << "RooRealMPFE::calculate(" << GetName()
463 << ") IPC toServer> SendReal [" << i << "]=" << val << (isC?" (Constant)":"") << endl ;
464 } else if (dynamic_cast<RooAbsCategory*>(var)) {
465 int msg = SendCat ;
466 UInt_t idx = ((RooAbsCategory*)var)->getCurrentIndex() ;
467 *_pipe << msg << i << idx;
468 if (_verboseServer) cout << "RooRealMPFE::calculate(" << GetName()
469 << ") IPC toServer> SendCat [" << i << "]=" << idx << endl ;
470 }
471 }
472 i++ ;
473 }
474
475 int msg = hideOffset() ? Calculate : CalculateNoOffset;
476 *_pipe << msg;
477 if (_verboseServer) cout << "RooRealMPFE::calculate(" << GetName()
478 << ") IPC toServer> Calculate " << endl ;
479
480 // Clear dirty state and mark that calculation request was dispatched
484
485 msg = Retrieve ;
486 *_pipe << msg << BidirMMapPipe::flush;
487 if (_verboseServer) cout << "RooRealMPFE::evaluate(" << GetName()
488 << ") IPC toServer> Retrieve " << endl ;
490
491 } else if (_state!=Inline) {
492 cout << "RooRealMPFE::calculate(" << GetName()
493 << ") ERROR not in Client or Inline mode" << endl ;
494 }
495
496
497#endif // _WIN32
498}
499
500
501
502
503////////////////////////////////////////////////////////////////////////////////
504/// If value needs recalculation and calculation has not beed started
505/// with a call to calculate() start it now. This function blocks
506/// until remote process has finished calculation and returns
507/// remote value
508
510{
511
512 if (isValueDirty()) {
513 // Cache is dirty, no calculation has been started yet
514 //cout << "RooRealMPFE::getValF(" << GetName() << ") cache is dirty, caling calculate and evaluate" << endl ;
515 calculate() ;
516 _value = evaluate() ;
517 } else if (_calcInProgress) {
518 //cout << "RooRealMPFE::getValF(" << GetName() << ") calculation in progress, calling evaluate" << endl ;
519 // Cache is clean and calculation is in progress
520 _value = evaluate() ;
521 } else {
522 //cout << "RooRealMPFE::getValF(" << GetName() << ") cache is clean, doing nothing" << endl ;
523 // Cache is clean and calculated value is in cache
524 }
525
526// cout << "RooRealMPFE::getValV(" << GetName() << ") value = " << Form("%5.10f",_value) << endl ;
527 return _value ;
528}
529
530
531
532////////////////////////////////////////////////////////////////////////////////
533/// Send message to server process to retrieve output value
534/// If error were logged use logEvalError() on remote side
535/// transfer those errors to the local eval error queue.
536
538{
539 // Retrieve value of arg
540 Double_t return_value = 0;
541 if (_state==Inline) {
542 return_value = _arg ;
543 } else if (_state==Client) {
544#ifndef _WIN32
545 bool needflush = false;
546 int msg;
548
549 // If current error loggin state is not the same as remote state
550 // update the remote state
552 msg = LogEvalError ;
554 *_pipe << msg << flag;
555 needflush = true;
557 }
558
559 if (!_retrieveDispatched) {
560 msg = Retrieve ;
561 *_pipe << msg;
562 needflush = true;
563 if (_verboseServer) cout << "RooRealMPFE::evaluate(" << GetName()
564 << ") IPC toServer> Retrieve " << endl ;
565 }
566 if (needflush) *_pipe << BidirMMapPipe::flush;
568
569
570 Int_t numError;
571
572 *_pipe >> msg >> value >> _evalCarry >> numError;
573
574 if (msg!=ReturnValue) {
575 cout << "RooRealMPFE::evaluate(" << GetName()
576 << ") ERROR: unexpected message from server process: " << msg << endl ;
577 return 0 ;
578 }
579 if (_verboseServer) cout << "RooRealMPFE::evaluate(" << GetName()
580 << ") IPC fromServer> ReturnValue " << value << endl ;
581
582 if (_verboseServer) cout << "RooRealMPFE::evaluate(" << GetName()
583 << ") IPC fromServer> NumErrors " << numError << endl ;
584 if (numError) {
585 // Retrieve remote errors and feed into local error queue
586 char *msgbuf1 = 0, *msgbuf2 = 0, *msgbuf3 = 0;
587 RooAbsArg *ptr = 0;
588 while (true) {
589 *_pipe >> ptr;
590 if (!ptr) break;
591 *_pipe >> msgbuf1 >> msgbuf2 >> msgbuf3;
592 if (_verboseServer) cout << "RooRealMPFE::evaluate(" << GetName()
593 << ") IPC fromServer> retrieving error log Arg " << ptr << " Msg " << msgbuf1 << endl ;
594
595 logEvalError(reinterpret_cast<RooAbsReal*>(ptr),msgbuf3,msgbuf1,msgbuf2) ;
596 }
597 std::free(msgbuf1);
598 std::free(msgbuf2);
599 std::free(msgbuf3);
600 }
601
602 // Mark end of calculation in progress
604 return_value = value ;
605#endif // _WIN32
606 }
607
608 return return_value;
609}
610
611
612
613////////////////////////////////////////////////////////////////////////////////
614/// Terminate remote server process and return front-end class
615/// to standby mode. Calls to calculate() or evaluate() after
616/// this call will automatically recreated the server process.
617
619{
620#ifndef _WIN32
621 if (_state==Client) {
622 if (_pipe->good()) {
623 // Terminate server process ;
624 if (_verboseServer) cout << "RooRealMPFE::standby(" << GetName()
625 << ") IPC toServer> Terminate " << endl;
626 int msg = Terminate;
627 *_pipe << msg << BidirMMapPipe::flush;
628 // read handshake
629 msg = 0;
630 *_pipe >> msg;
631 if (Terminate != msg || 0 != _pipe->close()) {
632 std::cerr << "In " << __func__ << "(" << __FILE__ ", " << __LINE__ <<
633 "): Server shutdown failed." << std::endl;
634 }
635 } else {
636 if (_verboseServer) {
637 std::cerr << "In " << __func__ << "(" << __FILE__ ", " <<
638 __LINE__ << "): Pipe has already shut down, not sending "
639 "Terminate to server." << std::endl;
640 }
641 }
642 // Close pipes
643 delete _pipe;
644 _pipe = 0;
645
646 // Revert to initialize state
648 }
649#endif // _WIN32
650}
651
652
653
654////////////////////////////////////////////////////////////////////////////////
655/// Intercept call to optimize constant term in test statistics
656/// and forward it to object on server side.
657
659{
660#ifndef _WIN32
661 if (_state==Client) {
662
663 int msg = ConstOpt ;
664 int op = opcode;
665 *_pipe << msg << op << doAlsoTracking;
666 if (_verboseServer) cout << "RooRealMPFE::constOptimize(" << GetName()
667 << ") IPC toServer> ConstOpt " << opcode << endl ;
668
669 initVars() ;
670 }
671#endif // _WIN32
672
673 if (_state==Inline) {
674 ((RooAbsReal&)_arg.arg()).constOptimizeTestStatistic(opcode,doAlsoTracking) ;
675 }
676}
677
678
679
680////////////////////////////////////////////////////////////////////////////////
681/// Control verbose messaging related to inter process communication
682/// on both client and server side
683
684void RooRealMPFE::setVerbose(Bool_t clientFlag, Bool_t serverFlag)
685{
686#ifndef _WIN32
687 if (_state==Client) {
688 int msg = Verbose ;
689 *_pipe << msg << serverFlag;
690 if (_verboseServer) cout << "RooRealMPFE::setVerbose(" << GetName()
691 << ") IPC toServer> Verbose " << (serverFlag?1:0) << endl ;
692 }
693#endif // _WIN32
694 _verboseClient = clientFlag ; _verboseServer = serverFlag ;
695}
696
697
698////////////////////////////////////////////////////////////////////////////////
699/// Control verbose messaging related to inter process communication
700/// on both client and server side
701
703{
704#ifndef _WIN32
705 if (_state==Client) {
706 int msg = ApplyNLLW2 ;
707 *_pipe << msg << flag;
708 if (_verboseServer) cout << "RooRealMPFE::applyNLLWeightSquared(" << GetName()
709 << ") IPC toServer> ApplyNLLW2 " << (flag?1:0) << endl ;
710 }
711#endif // _WIN32
712 doApplyNLLW2(flag) ;
713}
714
715
716////////////////////////////////////////////////////////////////////////////////
717
719{
720 RooNLLVar* nll = dynamic_cast<RooNLLVar*>(_arg.absArg()) ;
721 if (nll) {
722 nll->applyWeightSquared(flag) ;
723 }
724}
725
726
727////////////////////////////////////////////////////////////////////////////////
728/// Control verbose messaging related to inter process communication
729/// on both client and server side
730
732{
733#ifndef _WIN32
734 if (_state==Client) {
735 int msg = EnableOffset ;
736 *_pipe << msg << flag;
737 if (_verboseServer) cout << "RooRealMPFE::enableOffsetting(" << GetName()
738 << ") IPC toServer> EnableOffset " << (flag?1:0) << endl ;
739 }
740#endif // _WIN32
741 ((RooAbsReal&)_arg.arg()).enableOffsetting(flag) ;
742}
743
744
745
header file for BidirMMapPipe, a class which forks off a child process and serves as communications c...
#define ccoutD(a)
Definition: RooMsgService.h:37
const Bool_t kFALSE
Definition: RtypesCore.h:101
const Bool_t kTRUE
Definition: RtypesCore.h:100
#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:78
virtual bool isIdentical(const RooAbsArg &other, Bool_t assumeSameType=kFALSE) const =0
virtual void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE)=0
friend class RooArgSet
Definition: RooAbsArg.h:651
Bool_t isValueDirty() const
Definition: RooAbsArg.h:445
void clearValueDirty() const
Definition: RooAbsArg.h:625
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:569
friend class RooRealMPFE
Definition: RooAbsArg.h:697
Bool_t isConstant() const
Check if the "Constant" attribute is set.
Definition: RooAbsArg.h:386
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.
virtual RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE)
Add a clone of the specified argument to list.
RooFIter fwdIterator() const
One-time forward iterator.
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:63
static Int_t numEvalErrorItems()
Definition: RooAbsReal.cxx:342
static void setHideOffset(Bool_t flag)
Definition: RooAbsReal.cxx:121
static Bool_t hideOffset()
Definition: RooAbsReal.cxx:122
static EvalErrorIter evalErrorIter()
Definition: RooAbsReal.cxx:350
Double_t _value
Cache for current value of object.
Definition: RooAbsReal.h:483
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: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:40
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:57
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...
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
RooAbsArg * next()
Return next element or nullptr if at end.
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...
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.
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
Variables.
Definition: RooRealMPFE.h:71
Bool_t _inlineMode
Definition: RooRealMPFE.h:76
void initVars()
Initialize list of variables of front-end argument 'arg'.
RooRealMPFE * _updateMaster
! Update master
Definition: RooRealMPFE.h:84
Double_t getValV(const RooArgSet *nset=0) const override
If value needs recalculation and calculation has not beed started with a call to calculate() start it...
void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTracking=kTRUE) override
Intercept call to optimize constant term in test statistics and forward it to object on server side.
std::vector< Bool_t > _valueChanged
! Flags if variable needs update on server-side
Definition: RooRealMPFE.h:82
void doApplyNLLW2(Bool_t flag)
Bool_t _calcInProgress
Definition: RooRealMPFE.h:73
std::vector< Bool_t > _constChanged
! Flags if variable needs update on server-side
Definition: RooRealMPFE.h:83
Bool_t _forceCalc
Definition: RooRealMPFE.h:77
void enableOffsetting(Bool_t flag) override
Control verbose messaging related to inter process communication on both client and server side.
Double_t evaluate() const override
Send message to server process to retrieve output value If error were logged use logEvalError() on re...
Bool_t _verboseServer
Definition: RooRealMPFE.h:75
RooRealProxy _arg
Function to calculate in parallel process.
Definition: RooRealMPFE.h:70
~RooRealMPFE() override
Destructor.
Bool_t _retrieveDispatched
!
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:40
void setVal(Double_t value) override
Set value of variable to 'value'.
Definition: RooRealVar.cxx:281
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:63
void Initialize(Bool_t useTMVAStyle=kTRUE)
Definition: tmvaglob.cxx:176