71 using namespace RooFit;
85 _arg(
"arg",
"arg",this,arg),
86 _vars(
"vars",
"vars",this),
90 _inlineMode(calcInline),
91 _remoteEvalErrorLoggingState(
RooAbsReal::PrintErrors),
94 _retrieveDispatched(
kFALSE), _evalCarry(0.)
113 _arg(
"arg",this,other._arg),
114 _vars(
"vars",this,other._vars),
116 _verboseClient(other._verboseClient),
117 _verboseServer(other._verboseServer),
118 _inlineMode(other._inlineMode),
119 _forceCalc(other._forceCalc),
120 _remoteEvalErrorLoggingState(other._remoteEvalErrorLoggingState),
123 _retrieveDispatched(
kFALSE), _evalCarry(other._evalCarry)
199 if (
_pipe->isChild()) {
207 GetName() <<
") server process terminating" << endl ;
215 GetName() <<
") successfully forked server process " <<
216 _pipe->pidOtherEnd() << endl ;
234 Int_t idx, index, numErrors ;
244 <<
") IPC fromClient> Terminate" << endl;
253 *
_pipe >> idx >> value >> isConst;
255 <<
") IPC fromClient> SendReal [" << idx <<
"]=" << value << endl ;
266 *
_pipe >> idx >> index;
268 <<
") IPC fromClient> SendCat [" << idx <<
"]=" << index << endl ;
275 <<
") IPC fromClient> Calculate" << endl ;
281 <<
") IPC fromClient> Calculate" << endl ;
291 <<
") IPC fromClient> Retrieve" << endl ;
297 <<
") IPC toClient> ReturnValue " <<
_value <<
" NumError " << numErrors << endl ;
301 std::string objidstr;
307 objidstr = oss2.str();
309 std::map<const RooAbsArg*,pair<string,list<EvalError> > >::const_iterator
iter =
evalErrorIter();
312 list<EvalError>::const_iterator iter2 = iter->second.second.begin();
313 for (; iter->second.second.end() != iter2; ++iter2) {
315 *
_pipe << ptr << iter2->_msg << iter2->_srvval << objidstr;
317 <<
") IPC toClient> sending error log Arg " << iter->first <<
" Msg " << iter2->_msg << endl ;
334 *
_pipe >> code >> doTrack;
336 <<
") IPC fromClient> ConstOpt " << code <<
" doTrack = " << (doTrack?
"T":
"F") << endl ;
346 <<
") IPC fromClient> Verbose " << (flag?1:0) << endl ;
357 <<
") IPC fromClient> ApplyNLLW2 " << (flag?1:0) << endl ;
369 <<
") IPC fromClient> EnableOffset " << (flag?1:0) << endl ;
383 <<
") IPC fromClient> LogEvalError flag = " << flag2 << endl ;
390 <<
") IPC fromClient> Unknown message (code = " << msg <<
")" << endl ;
432 while((var = viter.
next())) {
433 saveVar = siter.
next() ;
436 Bool_t valChanged,constChanged ;
447 if ( valChanged || constChanged ||
_forceCalc) {
450 <<
") variable " <<
_vars.
at(i)->
GetName() <<
" changed" << endl ;
457 if (dynamic_cast<RooAbsReal*>(var)) {
461 *
_pipe << msg << i << val << isC;
464 <<
") IPC toServer> SendReal [" << i <<
"]=" << val << (isC?
" (Constant)":
"") << endl ;
465 }
else if (dynamic_cast<RooAbsCategory*>(var)) {
468 *
_pipe << msg << i << idx;
470 <<
") IPC toServer> SendCat [" << i <<
"]=" << idx << endl ;
479 <<
") IPC toServer> Calculate " << endl ;
489 <<
") IPC toServer> Retrieve " << endl ;
493 cout <<
"RooRealMPFE::calculate(" <<
GetName()
494 <<
") ERROR not in Client or Inline mode" << endl ;
543 return_value =
_arg ;
546 bool needflush =
false;
555 *
_pipe << msg << flag;
565 <<
") IPC toServer> Retrieve " << endl ;
576 cout <<
"RooRealMPFE::evaluate(" <<
GetName()
577 <<
") ERROR: unexpected message from server process: " << msg << endl ;
581 <<
") IPC fromServer> ReturnValue " << value << endl ;
584 <<
") IPC fromServer> NumErrors " << numError << endl ;
587 char *msgbuf1 = 0, *msgbuf2 = 0, *msgbuf3 = 0;
592 *
_pipe >> msgbuf1 >> msgbuf2 >> msgbuf3;
594 <<
") IPC fromServer> retrieving error log Arg " << ptr <<
" Msg " << msgbuf1 << endl ;
596 logEvalError(reinterpret_cast<RooAbsReal*>(ptr),msgbuf3,msgbuf1,msgbuf2) ;
605 return_value =
value ;
626 <<
") IPC toServer> Terminate " << endl;
633 std::cerr <<
"In " << __func__ <<
"(" << __FILE__
", " << __LINE__ <<
634 "): Server shutdown failed." << std::endl;
638 std::cerr <<
"In " << __func__ <<
"(" << __FILE__
", " <<
639 __LINE__ <<
"): Pipe has already shut down, not sending "
640 "Terminate to server." << std::endl;
666 *
_pipe << msg << op << doAlsoTracking;
668 <<
") IPC toServer> ConstOpt " << opcode << endl ;
690 *
_pipe << msg << serverFlag;
692 <<
") IPC toServer> Verbose " << (serverFlag?1:0) << endl ;
708 *
_pipe << msg << flag;
710 <<
") IPC toServer> ApplyNLLW2 " << (flag?1:0) << endl ;
737 *
_pipe << msg << flag;
739 <<
") IPC toServer> EnableOffset " << (flag?1:0) << endl ;
virtual int GetPid()
Get process id.
void initVars()
Initialize list of variables of front-end argument 'arg'.
static EvalErrorIter evalErrorIter()
virtual RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE)
Add a clone of the specified argument to list.
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, which is interpreted as an OR of 'enum ContentsOptions' values and in the style given by 'enum StyleOption'.
header file for BidirMMapPipe, a class which forks off a child process and serves as communications c...
RooFIter fwdIterator() const
static void callgrind_zero()
Utility function to trigger zeroing of callgrind counters.
static void clearEvalErrorLog()
Clear the stack of evaluation error messages.
static Int_t numEvalErrorItems()
void initialize()
Initialize the remote process and message passing pipes between current process and remote process...
RooRealMPFE * _updateMaster
Flags if variable needs update on server-side.
virtual Double_t getCarry() const
void applyNLLWeightSquared(Bool_t flag)
Control verbose messaging related to inter process communication on both client and server side...
virtual Double_t evaluate() const
Send message to server process to retrieve output value If error were logged use logEvalError() on re...
static void setHideOffset(Bool_t flag)
void applyWeightSquared(Bool_t flag)
const RooAbsReal & arg() const
Bool_t _retrieveDispatched
Update master.
static void setEvalErrorLoggingMode(ErrorLoggingMode m)
Set evaluation error logging mode.
RooRealMPFE is the multi-processor front-end for parallel calculation of RooAbsReal objects...
virtual Double_t getCarry() const
std::vector< Bool_t > _constChanged
Flags if variable needs update on server-side.
void flush()
flush buffers with unwritten data
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
virtual ~RooRealMPFE()
Destructor.
std::map< std::string, std::string >::const_iterator iter
void serverLoop()
Server loop of remote processes.
virtual Bool_t isIdentical(const RooAbsArg &other, Bool_t assumeSameType=kFALSE)=0
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Reimplementation of standard RooArgList::add()
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...
RooRealVar represents a fundamental (non-derived) real valued object.
virtual void setVal(Double_t value)
Set value of variable to 'value'.
Class RooNLLVar implements a a -log(likelihood) calculation from a dataset and a PDF.
void setVerbose(Bool_t clientFlag=kTRUE, Bool_t serverFlag=kTRUE)
Control verbose messaging related to inter process communication on both client and server side...
RooRealMPFE(const char *name, const char *title, RooAbsReal &arg, Bool_t calcInline=kFALSE)
Construct front-end object for object 'arg' whose evaluation will be calculated asynchronously in a s...
void Initialize(Bool_t useTMVAStyle=kTRUE)
R__EXTERN TSystem * gSystem
static Int_t numEvalErrors()
Return the number of logged evaluation errors since the last clearing.
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
void setConstant(Bool_t value=kTRUE)
virtual void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE)=0
void calculate() const
Client-side function that instructs server process to start asynchronuous (re)calculation of function...
void standby()
Terminate remote server process and return front-end class to standby mode.
RooAbsArg * absArg() const
virtual const char * GetName() const
Returns name of object.
BidirMMapPipe creates a bidirectional channel between the current process and a child it forks...
RooCategory represents a fundamental (non-derived) discrete value object.
static Bool_t hideOffset()
std::vector< Bool_t > _valueChanged
connection to child
Bool_t isConstant() const
void enableOffsetting(Bool_t flag)
Control verbose messaging related to inter process communication on both client and server side...
void remove(RooRealMPFE &mpfe)
Remove given multi-processor front-end object from the sentinel.
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...
RooAbsArg * at(Int_t idx) const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
void add(RooRealMPFE &mpfe)
Register given multi-processor front-end object with the sentinel.
RooAbsTestStatistic is the abstract base class for all test statistics.
static ErrorLoggingMode evalErrorLoggingMode()
Return current evaluation error logging mode.
RooAbsReal::ErrorLoggingMode _remoteEvalErrorLoggingState
RooMPSentinel is a singleton class that keeps track of all parellel execution processes for goodness-...
virtual void removeAll()
Reimplementation of standard RooArgList::removeAll()
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
Bool_t isValueDirty() const
void clearValueDirty() const
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...
void doApplyNLLW2(Bool_t flag)
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
void logEvalError(const char *message, const char *serverValueString=0) const
Log evaluation error message.
RooFit::BidirMMapPipe * _pipe
static RooMPSentinel _sentinel