92using std::cout, std::endl, std::string, std::ostringstream, std::list;
104 _arg(
"arg",
"arg",this,arg),
105 _vars(
"vars",
"vars",this),
106 _calcInProgress(false),
107 _verboseClient(false),
108 _verboseServer(false),
109 _inlineMode(calcInline),
110 _remoteEvalErrorLoggingState(
RooAbsReal::PrintErrors),
112 _updateMaster(nullptr),
113 _retrieveDispatched(false), _evalCarry(0.)
132 _arg(
"arg",this,other._arg),
133 _vars(
"vars",this,other._vars),
134 _calcInProgress(false),
135 _verboseClient(other._verboseClient),
136 _verboseServer(other._verboseServer),
137 _inlineMode(other._inlineMode),
138 _forceCalc(other._forceCalc),
139 _remoteEvalErrorLoggingState(other._remoteEvalErrorLoggingState),
141 _updateMaster(nullptr),
142 _retrieveDispatched(false), _evalCarry(other._evalCarry)
189 if (tmp)
return tmp->getCarry();
213 _pipe =
new BidirMMapPipe();
215 if (
_pipe->isChild()) {
223 GetName() <<
") server process terminating" << endl ;
232 <<
_pipe->pidOtherEnd() << endl;
263 <<
") IPC fromClient> Terminate" << endl;
265 *
_pipe << msg << BidirMMapPipe::flush;
274 <<
") IPC fromClient> SendReal [" << idx <<
"]=" <<
value << endl ;
287 <<
") IPC fromClient> SendCat [" << idx <<
"]=" <<
index << endl ;
294 <<
") IPC fromClient> Calculate" << endl ;
300 <<
") IPC fromClient> Calculate" << endl ;
310 <<
") IPC fromClient> Retrieve" << endl ;
316 <<
") IPC toClient> ReturnValue " <<
_value <<
" NumError " << numErrors << endl ;
320 std::string objidstr;
326 objidstr = oss2.str();
328 std::map<const RooAbsArg*,std::pair<string,list<EvalError> > >::const_iterator iter =
evalErrorIter();
331 list<EvalError>::const_iterator iter2 = iter->second.second.begin();
332 for (; iter->second.second.end() != iter2; ++iter2) {
334 *
_pipe << ptr << iter2->_msg << iter2->_srvval << objidstr;
336 <<
") IPC toClient> sending error log Arg " << iter->first <<
" Msg " << iter2->_msg << endl ;
345 *
_pipe << BidirMMapPipe::flush;
353 *
_pipe >> code >> doTrack;
355 <<
") IPC fromClient> ConstOpt " << code <<
" doTrack = " << (doTrack?
"T":
"F") << endl ;
365 <<
") IPC fromClient> Verbose " << (flag?1:0) << endl ;
376 <<
") IPC fromClient> ApplyNLLW2 " << (flag?1:0) << endl ;
388 <<
") IPC fromClient> EnableOffset " << (flag?1:0) << endl ;
402 <<
") IPC fromClient> LogEvalError flag = " << flag2 << endl ;
409 <<
") IPC fromClient> Unknown message (code = " << msg <<
")" << endl ;
450 for (std::size_t j=0 ; j<
_vars.
size() ; j++) {
467 if ( valChanged || constChanged ||
_forceCalc) {
470 <<
") variable " <<
_vars.
at(i)->
GetName() <<
" changed" << endl ;
479 double val = (
static_cast<RooAbsReal*
>(var))->getVal() ;
481 *
_pipe << msg << i << val << isC;
484 <<
") IPC toServer> SendReal [" << i <<
"]=" << val << (isC?
" (Constant)":
"") << endl ;
488 *
_pipe << msg << i << idx;
490 <<
") IPC toServer> SendCat [" << i <<
"]=" << idx << endl ;
499 <<
") IPC toServer> Calculate " << endl ;
507 *
_pipe << msg << BidirMMapPipe::flush;
509 <<
") IPC toServer> Retrieve " << endl ;
513 cout <<
"RooRealMPFE::calculate(" <<
GetName()
514 <<
") ERROR not in Client or Inline mode" << endl ;
561 double return_value = 0;
563 return_value =
_arg ;
566 bool needflush =
false;
575 *
_pipe << msg << flag;
585 <<
") IPC toServer> Retrieve " << endl ;
587 if (needflush) *
_pipe << BidirMMapPipe::flush;
596 cout <<
"RooRealMPFE::evaluate(" <<
GetName()
597 <<
") ERROR: unexpected message from server process: " << msg << endl ;
601 <<
") IPC fromServer> ReturnValue " <<
value << endl ;
604 <<
") IPC fromServer> NumErrors " << numError << endl ;
607 char *msgbuf1 =
nullptr;
608 char *msgbuf2 =
nullptr;
609 char *msgbuf3 =
nullptr;
614 *
_pipe >> msgbuf1 >> msgbuf2 >> msgbuf3;
616 <<
") IPC fromServer> retrieving error log Arg " << ptr <<
" Msg " << msgbuf1 << endl ;
627 return_value =
value ;
648 <<
") IPC toServer> Terminate " << endl;
650 *
_pipe << msg << BidirMMapPipe::flush;
655 std::cerr <<
"In " << __func__ <<
"(" << __FILE__
", " << __LINE__ <<
656 "): Server shutdown failed." << std::endl;
660 std::cerr <<
"In " << __func__ <<
"(" << __FILE__
", " <<
661 __LINE__ <<
"): Pipe has already shut down, not sending "
662 "Terminate to server." << std::endl;
688 *
_pipe << msg << op << doAlsoTracking;
690 <<
") IPC toServer> ConstOpt " << opcode << endl ;
712 *
_pipe << msg << serverFlag;
714 <<
") IPC toServer> Verbose " << (serverFlag?1:0) << endl ;
730 *
_pipe << msg << flag;
732 <<
") IPC toServer> ApplyNLLW2 " << (flag?1:0) << endl ;
745 nll->applyWeightSquared(flag) ;
759 *
_pipe << msg << flag;
761 <<
") IPC toServer> EnableOffset " << (flag?1:0) << endl ;
775 for(
auto * mpfe : static_range_cast<RooRealMPFE*>(
_mpfeSet)) {
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
R__EXTERN TSystem * gSystem
Common abstract base class for objects that represent a value and a "shape" in RooFit.
virtual void copyCache(const RooAbsArg *source, bool valueOnly=false, bool setValDirty=true)=0
bool isConstant() const
Check if the "Constant" attribute is set.
void clearValueDirty() const
bool isValueDirty() const
virtual bool isIdentical(const RooAbsArg &other, bool assumeSameType=false) const =0
A space to attach TBranches.
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
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)
Abstract base class for objects that represent a real value and implements functionality common to al...
static ErrorLoggingMode evalErrorLoggingMode()
Return current evaluation error logging mode.
double _value
Cache for current value of object.
static void setHideOffset(bool flag)
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.
static Int_t numEvalErrorItems()
static auto evalErrorIter()
void logEvalError(const char *message, const char *serverValueString=nullptr) const
Log evaluation error message.
static void clearEvalErrorLog()
Clear the stack of evaluation error messages.
Abstract base class for all test statistics.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
RooAbsArg * absArg() const
Return pointer to contained argument.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Object to represent discrete states.
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...
Implements a -log(likelihood) calculation from a dataset and a PDF.
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,...
Multi-processor front-end for parallel calculation of RooAbsReal objects.
RooFit::BidirMMapPipe * _pipe
! connection to child
RooArgList _saveVars
Copy of variables.
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.
RooListProxy _vars
Variables.
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
void doApplyNLLW2(bool flag)
bool _retrieveDispatched
!
void setVerbose(bool clientFlag=true, bool serverFlag=true)
Control verbose messaging related to inter process communication on both client and server side.
std::vector< bool > _constChanged
! Flags if variable needs update on server-side
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
void enableOffsetting(bool flag) override
Control verbose messaging related to inter process communication on both client and server side.
RooRealProxy _arg
Function to calculate in parallel process.
~RooRealMPFE() override
Destructor.
RooAbsReal::ErrorLoggingMode _remoteEvalErrorLoggingState
double getValV(const RooArgSet *nset=nullptr) const override
If value needs recalculation and calculation has not been started with a call to calculate() start it...
Variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
static void callgrind_zero()
Utility function to trigger zeroing of callgrind counters.
const char * GetName() const override
Returns name of object.
virtual int GetPid()
Get process id.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
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.
static RooMPSentinel & instance()
~RooMPSentinel()
Destructor.