82 void add(RooRealMPFE&
mpfe) ;
83 void remove(RooRealMPFE&
mpfe) ;
94using std::string, std::ostringstream, std::list;
106 _arg(
"arg",
"arg",
this,arg),
107 _vars(
"vars",
"vars",
this),
121 RooMPSentinel::instance().add(*
this) ;
131RooRealMPFE::RooRealMPFE(
const RooRealMPFE&
other,
const char*
name) :
147 RooMPSentinel::instance().add(*
this) ;
155RooRealMPFE::~RooRealMPFE()
158 RooMPSentinel::instance().remove(*
this);
166void RooRealMPFE::initVars()
170 _saveVars.removeAll() ;
173 std::unique_ptr<RooArgSet> vars{_arg->getParameters(
RooArgSet())};
187double RooRealMPFE::getCarry()
const
191 if (
tmp)
return tmp->getCarry();
202void RooRealMPFE::initialize()
213 clearEvalErrorLog() ;
217 if (
_pipe->isChild()) {
224 GetName() <<
") server process terminating" << std::endl ;
226 delete _arg.absArg();
232 ccoutD(Minimization) <<
"RooRealMPFE::initialize(" << GetName() <<
") successfully forked server process "
233 <<
_pipe->pidOtherEnd() << std::endl;
247void RooRealMPFE::serverLoop()
258 clearEvalErrorLog() ;
262 if (Terminate ==
msg) {
263 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
264 <<
") IPC fromClient> Terminate" << std::endl;
266 *
_pipe <<
msg << BidirMMapPipe::flush;
274 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
275 <<
") IPC fromClient> SendReal [" << idx <<
"]=" <<
value << std::endl ;
287 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
288 <<
") IPC fromClient> SendCat [" << idx <<
"]=" <<
index << std::endl ;
294 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
295 <<
") IPC fromClient> Calculate" << std::endl ;
300 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
301 <<
") IPC fromClient> Calculate" << std::endl ;
310 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
311 <<
") IPC fromClient> Retrieve" << std::endl ;
316 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
317 <<
") IPC toClient> ReturnValue " << _value <<
" NumError " <<
numErrors << std::endl ;
326 printStream(
oss2,
kName|kClassName|kArgs,kInline);
329 std::map<const RooAbsArg*,std::pair<string,list<EvalError> > >::const_iterator iter = evalErrorIter();
331 for (
int i = 0; i < numEvalErrorItems(); ++i) {
332 list<EvalError>::const_iterator
iter2 = iter->second.second.begin();
333 for (; iter->second.second.end() !=
iter2; ++
iter2) {
336 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
337 <<
") IPC toClient> sending error log Arg " << iter->first <<
" Msg " <<
iter2->_msg << std::endl ;
346 *
_pipe << BidirMMapPipe::flush;
355 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
356 <<
") IPC fromClient> ConstOpt " << code <<
" doTrack = " << (
doTrack?
"T":
"F") << std::endl ;
365 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
366 <<
") IPC fromClient> Verbose " << (
flag?1:0) << std::endl ;
376 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
377 <<
") IPC fromClient> ApplyNLLW2 " << (
flag?1:0) << std::endl ;
388 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
389 <<
") IPC fromClient> EnableOffset " << (
flag?1:0) << std::endl ;
402 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
403 <<
") IPC fromClient> LogEvalError flag = " <<
flag2 << std::endl ;
409 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
410 <<
") IPC fromClient> Unknown message (code = " <<
msg <<
")" << std::endl ;
426void RooRealMPFE::calculate()
const
430 if (_state==Initialize) {
431 const_cast<RooRealMPFE*
>(
this)->
initialize() ;
442 if (_state==Client) {
448 for (std::size_t
j=0 ;
j<_vars.size() ;
j++) {
466 if (
_verboseClient) std::cout <<
"RooRealMPFE::calculate(" << GetName()
467 <<
") variable " << _vars.at(i)->GetName() <<
" changed" << std::endl ;
476 double val = (
static_cast<RooAbsReal*
>(var))->getVal() ;
480 if (
_verboseServer) std::cout <<
"RooRealMPFE::calculate(" << GetName()
481 <<
") IPC toServer> SendReal [" << i <<
"]=" << val << (
isC?
" (Constant)":
"") << std::endl ;
486 if (
_verboseServer) std::cout <<
"RooRealMPFE::calculate(" << GetName()
487 <<
") IPC toServer> SendCat [" << i <<
"]=" << idx << std::endl ;
495 if (
_verboseServer) std::cout <<
"RooRealMPFE::calculate(" << GetName()
496 <<
") IPC toServer> Calculate " << std::endl ;
504 *
_pipe <<
msg << BidirMMapPipe::flush;
505 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
506 <<
") IPC toServer> Retrieve " << std::endl ;
509 }
else if (_state!=
Inline) {
510 std::cout <<
"RooRealMPFE::calculate(" << GetName()
511 <<
") ERROR not in Client or Inline mode" << std::endl ;
527double RooRealMPFE::getValV(
const RooArgSet* )
const
530 if (isValueDirty()) {
551double RooRealMPFE::evaluate()
const
557 }
else if (_state==Client) {
577 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
578 <<
") IPC toServer> Retrieve " << std::endl ;
589 std::cout <<
"RooRealMPFE::evaluate(" << GetName()
590 <<
") ERROR: unexpected message from server process: " <<
msg << std::endl ;
593 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
594 <<
") IPC fromServer> ReturnValue " <<
value << std::endl ;
596 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
597 <<
") IPC fromServer> NumErrors " <<
numError << std::endl ;
608 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
609 <<
") IPC fromServer> retrieving error log Arg " << ptr <<
" Msg " <<
msgbuf1 << std::endl ;
634void RooRealMPFE::standby()
637 if (_state==Client) {
640 if (
_verboseServer) std::cout <<
"RooRealMPFE::standby(" << GetName()
641 <<
") IPC toServer> Terminate " << std::endl;
643 *
_pipe <<
msg << BidirMMapPipe::flush;
647 if (Terminate !=
msg || 0 !=
_pipe->close()) {
649 "): Server shutdown failed." << std::endl;
654 __LINE__ <<
"): Pipe has already shut down, not sending "
655 "Terminate to server." << std::endl;
674void RooRealMPFE::constOptimizeTestStatistic(ConstOpCode opcode,
bool doAlsoTracking)
677 if (_state==Client) {
682 if (
_verboseServer) std::cout <<
"RooRealMPFE::constOptimize(" << GetName()
683 <<
") IPC toServer> ConstOpt " << opcode << std::endl ;
703 if (_state==Client) {
706 if (
_verboseServer) std::cout <<
"RooRealMPFE::setVerbose(" << GetName()
707 <<
") IPC toServer> Verbose " << (
serverFlag?1:0) << std::endl ;
718void RooRealMPFE::applyNLLWeightSquared(
bool flag)
721 if (_state==Client) {
724 if (
_verboseServer) std::cout <<
"RooRealMPFE::applyNLLWeightSquared(" << GetName()
725 <<
") IPC toServer> ApplyNLLW2 " << (
flag?1:0) << std::endl ;
734void RooRealMPFE::doApplyNLLW2(
bool flag)
738 nll->applyWeightSquared(
flag) ;
747void RooRealMPFE::enableOffsetting(
bool flag)
750 if (_state==Client) {
753 if (
_verboseServer) std::cout <<
"RooRealMPFE::enableOffsetting(" << GetName()
754 <<
") IPC toServer> EnableOffset " << (
flag?1:0) << std::endl ;
766RooMPSentinel::~RooMPSentinel()
778void RooMPSentinel::add(RooRealMPFE&
mpfe)
788void RooMPSentinel::remove(RooRealMPFE&
mpfe)
ROOT::RRangeCast< T, false, Range_t > static_range_cast(Range_t &&coll)
static Roo_reg_AGKInteg1D instance
int Int_t
Signed integer 4 bytes (int)
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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.
bool isConstant() const
Check if the "Constant" attribute is set.
virtual bool isIdentical(const RooAbsArg &other, bool assumeSameType=false) const =0
A space to attach TBranches.
void setConstant(bool value=true)
Abstract base class for objects that represent a real value and implements functionality common to al...
static void setHideOffset(bool flag)
static void setEvalErrorLoggingMode(ErrorLoggingMode m)
Set evaluation error logging mode.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Object to represent discrete states.
Variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
virtual int GetPid()
Get process id.
RooCmdArg Verbose(bool flag=true)
double nll(double pdf, double weight, int binnedL, int doBinOffset)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
void evaluate(typename Architecture_t::Tensor_t &A, EActivationFunction f)
Apply the given activation function to each value in the given tensor A.
void initialize(typename Architecture_t::Matrix_t &A, EInitialization m)
void Initialize(Bool_t useTMVAStyle=kTRUE)