92using std::cout, std::endl, std::string, std::ostringstream, std::list, std::pair;
106 _arg(
"arg",
"arg",this,arg),
107 _vars(
"vars",
"vars",this),
108 _calcInProgress(false),
109 _verboseClient(false),
110 _verboseServer(false),
111 _inlineMode(calcInline),
112 _remoteEvalErrorLoggingState(
RooAbsReal::PrintErrors),
114 _updateMaster(nullptr),
134 _arg(
"arg",this,other._arg),
135 _vars(
"vars",this,other._vars),
136 _calcInProgress(false),
137 _verboseClient(other._verboseClient),
138 _verboseServer(other._verboseServer),
139 _inlineMode(other._inlineMode),
140 _forceCalc(other._forceCalc),
141 _remoteEvalErrorLoggingState(other._remoteEvalErrorLoggingState),
143 _updateMaster(nullptr),
191 if (tmp)
return tmp->getCarry();
215 _pipe =
new BidirMMapPipe();
217 if (
_pipe->isChild()) {
225 GetName() <<
") server process terminating" << endl ;
234 <<
_pipe->pidOtherEnd() << endl;
265 <<
") IPC fromClient> Terminate" << endl;
267 *
_pipe << msg << BidirMMapPipe::flush;
276 <<
") IPC fromClient> SendReal [" << idx <<
"]=" <<
value << endl ;
289 <<
") IPC fromClient> SendCat [" << idx <<
"]=" <<
index << endl ;
296 <<
") IPC fromClient> Calculate" << endl ;
302 <<
") IPC fromClient> Calculate" << endl ;
312 <<
") IPC fromClient> Retrieve" << endl ;
318 <<
") IPC toClient> ReturnValue " <<
_value <<
" NumError " << numErrors << endl ;
322 std::string objidstr;
328 objidstr = oss2.str();
330 std::map<const RooAbsArg*,pair<string,list<EvalError> > >::const_iterator iter =
evalErrorIter();
333 list<EvalError>::const_iterator iter2 = iter->second.second.begin();
334 for (; iter->second.second.end() != iter2; ++iter2) {
336 *
_pipe << ptr << iter2->_msg << iter2->_srvval << objidstr;
338 <<
") IPC toClient> sending error log Arg " << iter->first <<
" Msg " << iter2->_msg << endl ;
347 *
_pipe << BidirMMapPipe::flush;
355 *
_pipe >> code >> doTrack;
357 <<
") IPC fromClient> ConstOpt " << code <<
" doTrack = " << (doTrack?
"T":
"F") << endl ;
367 <<
") IPC fromClient> Verbose " << (flag?1:0) << endl ;
378 <<
") IPC fromClient> ApplyNLLW2 " << (flag?1:0) << endl ;
390 <<
") IPC fromClient> EnableOffset " << (flag?1:0) << endl ;
404 <<
") IPC fromClient> LogEvalError flag = " << flag2 << endl ;
411 <<
") IPC fromClient> Unknown message (code = " << msg <<
")" << endl ;
452 for (std::size_t j=0 ; j<
_vars.
size() ; j++) {
469 if ( valChanged || constChanged ||
_forceCalc) {
472 <<
") variable " <<
_vars.
at(i)->
GetName() <<
" changed" << endl ;
481 double val = (
static_cast<RooAbsReal*
>(var))->getVal() ;
483 *
_pipe << msg << i << val << isC;
486 <<
") IPC toServer> SendReal [" << i <<
"]=" << val << (isC?
" (Constant)":
"") << endl ;
490 *
_pipe << msg << i << idx;
492 <<
") IPC toServer> SendCat [" << i <<
"]=" << idx << endl ;
501 <<
") IPC toServer> Calculate " << endl ;
509 *
_pipe << msg << BidirMMapPipe::flush;
511 <<
") IPC toServer> Retrieve " << endl ;
515 cout <<
"RooRealMPFE::calculate(" <<
GetName()
516 <<
") ERROR not in Client or Inline mode" << endl ;
563 double return_value = 0;
565 return_value =
_arg ;
568 bool needflush =
false;
577 *
_pipe << msg << flag;
587 <<
") IPC toServer> Retrieve " << endl ;
589 if (needflush) *
_pipe << BidirMMapPipe::flush;
598 cout <<
"RooRealMPFE::evaluate(" <<
GetName()
599 <<
") ERROR: unexpected message from server process: " << msg << endl ;
603 <<
") IPC fromServer> ReturnValue " <<
value << endl ;
606 <<
") IPC fromServer> NumErrors " << numError << endl ;
609 char *msgbuf1 =
nullptr;
610 char *msgbuf2 =
nullptr;
611 char *msgbuf3 =
nullptr;
616 *
_pipe >> msgbuf1 >> msgbuf2 >> msgbuf3;
618 <<
") IPC fromServer> retrieving error log Arg " << ptr <<
" Msg " << msgbuf1 << endl ;
629 return_value =
value ;
650 <<
") IPC toServer> Terminate " << endl;
652 *
_pipe << msg << BidirMMapPipe::flush;
657 std::cerr <<
"In " << __func__ <<
"(" << __FILE__
", " << __LINE__ <<
658 "): Server shutdown failed." << std::endl;
662 std::cerr <<
"In " << __func__ <<
"(" << __FILE__
", " <<
663 __LINE__ <<
"): Pipe has already shut down, not sending "
664 "Terminate to server." << std::endl;
690 *
_pipe << msg << op << doAlsoTracking;
692 <<
") IPC toServer> ConstOpt " << opcode << endl ;
714 *
_pipe << msg << serverFlag;
716 <<
") IPC toServer> Verbose " << (serverFlag?1:0) << endl ;
732 *
_pipe << msg << flag;
734 <<
") IPC toServer> ApplyNLLW2 " << (flag?1:0) << endl ;
747 nll->applyWeightSquared(flag) ;
761 *
_pipe << msg << flag;
763 <<
") IPC toServer> EnableOffset " << (flag?1:0) << endl ;
777 for(
auto * mpfe : static_range_cast<RooRealMPFE*>(
_mpfeSet)) {
double _evalCarry
! carry of Kahan sum in evaluatePartition
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.
RooFit::OwningPtr< 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...
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 Int_t numEvalErrorItems()
static EvalErrorIter evalErrorIter()
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.
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'.
const T & arg() const
Return reference to object held in proxy.
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.