80 void add(RooRealMPFE&
mpfe) ;
81 void remove(RooRealMPFE&
mpfe) ;
92using std::string, std::ostringstream, std::list;
104 _arg(
"arg",
"arg",
this,arg),
105 _vars(
"vars",
"vars",
this),
119 RooMPSentinel::instance().add(*
this) ;
129RooRealMPFE::RooRealMPFE(
const RooRealMPFE&
other,
const char*
name) :
145 RooMPSentinel::instance().add(*
this) ;
153RooRealMPFE::~RooRealMPFE()
156 RooMPSentinel::instance().remove(*
this);
164void RooRealMPFE::initVars()
168 _saveVars.removeAll() ;
171 std::unique_ptr<RooArgSet> vars{_arg->getParameters(
RooArgSet())};
185double RooRealMPFE::getCarry()
const
189 if (
tmp)
return tmp->getCarry();
200void RooRealMPFE::initialize()
211 clearEvalErrorLog() ;
215 if (
_pipe->isChild()) {
222 GetName() <<
") server process terminating" << std::endl ;
224 delete _arg.absArg();
230 ccoutD(Minimization) <<
"RooRealMPFE::initialize(" << GetName() <<
") successfully forked server process "
231 <<
_pipe->pidOtherEnd() << std::endl;
245void RooRealMPFE::serverLoop()
256 clearEvalErrorLog() ;
260 if (Terminate ==
msg) {
261 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
262 <<
") IPC fromClient> Terminate" << std::endl;
264 *
_pipe <<
msg << BidirMMapPipe::flush;
272 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
273 <<
") IPC fromClient> SendReal [" << idx <<
"]=" <<
value << std::endl ;
285 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
286 <<
") IPC fromClient> SendCat [" << idx <<
"]=" <<
index << std::endl ;
292 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
293 <<
") IPC fromClient> Calculate" << std::endl ;
298 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
299 <<
") IPC fromClient> Calculate" << std::endl ;
308 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
309 <<
") IPC fromClient> Retrieve" << std::endl ;
314 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
315 <<
") IPC toClient> ReturnValue " << _value <<
" NumError " <<
numErrors << std::endl ;
324 printStream(
oss2,
kName|kClassName|kArgs,kInline);
327 std::map<const RooAbsArg*,std::pair<string,list<EvalError> > >::const_iterator iter = evalErrorIter();
329 for (
int i = 0; i < numEvalErrorItems(); ++i) {
330 list<EvalError>::const_iterator
iter2 = iter->second.second.begin();
331 for (; iter->second.second.end() !=
iter2; ++
iter2) {
334 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
335 <<
") IPC toClient> sending error log Arg " << iter->first <<
" Msg " <<
iter2->_msg << std::endl ;
344 *
_pipe << BidirMMapPipe::flush;
352 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
353 <<
") IPC fromClient> Verbose " << (
flag?1:0) << std::endl ;
363 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
364 <<
") IPC fromClient> ApplyNLLW2 " << (
flag?1:0) << std::endl ;
375 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
376 <<
") IPC fromClient> EnableOffset " << (
flag?1:0) << std::endl ;
389 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
390 <<
") IPC fromClient> LogEvalError flag = " <<
flag2 << std::endl ;
396 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
397 <<
") IPC fromClient> Unknown message (code = " <<
msg <<
")" << std::endl ;
413void RooRealMPFE::calculate()
const
417 if (_state==Initialize) {
418 const_cast<RooRealMPFE*
>(
this)->
initialize() ;
429 if (_state==Client) {
435 for (std::size_t
j=0 ;
j<_vars.size() ;
j++) {
453 if (
_verboseClient) std::cout <<
"RooRealMPFE::calculate(" << GetName()
454 <<
") variable " << _vars.at(i)->GetName() <<
" changed" << std::endl ;
463 double val = (
static_cast<RooAbsReal*
>(var))->getVal() ;
467 if (
_verboseServer) std::cout <<
"RooRealMPFE::calculate(" << GetName()
468 <<
") IPC toServer> SendReal [" << i <<
"]=" << val << (
isC?
" (Constant)":
"") << std::endl ;
473 if (
_verboseServer) std::cout <<
"RooRealMPFE::calculate(" << GetName()
474 <<
") IPC toServer> SendCat [" << i <<
"]=" << idx << std::endl ;
482 if (
_verboseServer) std::cout <<
"RooRealMPFE::calculate(" << GetName()
483 <<
") IPC toServer> Calculate " << std::endl ;
491 *
_pipe <<
msg << BidirMMapPipe::flush;
492 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
493 <<
") IPC toServer> Retrieve " << std::endl ;
496 }
else if (_state!=
Inline) {
497 std::cout <<
"RooRealMPFE::calculate(" << GetName()
498 <<
") ERROR not in Client or Inline mode" << std::endl ;
514double RooRealMPFE::getValV(
const RooArgSet* )
const
517 if (isValueDirty()) {
538double RooRealMPFE::evaluate()
const
544 }
else if (_state==Client) {
564 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
565 <<
") IPC toServer> Retrieve " << std::endl ;
576 std::cout <<
"RooRealMPFE::evaluate(" << GetName()
577 <<
") ERROR: unexpected message from server process: " <<
msg << std::endl ;
580 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
581 <<
") IPC fromServer> ReturnValue " <<
value << std::endl ;
583 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
584 <<
") IPC fromServer> NumErrors " <<
numError << std::endl ;
595 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
596 <<
") IPC fromServer> retrieving error log Arg " << ptr <<
" Msg " <<
msgbuf1 << std::endl ;
621void RooRealMPFE::standby()
624 if (_state==Client) {
627 if (
_verboseServer) std::cout <<
"RooRealMPFE::standby(" << GetName()
628 <<
") IPC toServer> Terminate " << std::endl;
630 *
_pipe <<
msg << BidirMMapPipe::flush;
634 if (Terminate !=
msg || 0 !=
_pipe->close()) {
636 "): Server shutdown failed." << std::endl;
641 __LINE__ <<
"): Pipe has already shut down, not sending "
642 "Terminate to server." << std::endl;
663 if (_state==Client) {
666 if (
_verboseServer) std::cout <<
"RooRealMPFE::setVerbose(" << GetName()
667 <<
") IPC toServer> Verbose " << (
serverFlag?1:0) << std::endl ;
678void RooRealMPFE::applyNLLWeightSquared(
bool flag)
681 if (_state==Client) {
684 if (
_verboseServer) std::cout <<
"RooRealMPFE::applyNLLWeightSquared(" << GetName()
685 <<
") IPC toServer> ApplyNLLW2 " << (
flag?1:0) << std::endl ;
694void RooRealMPFE::doApplyNLLW2(
bool flag)
698 nll->applyWeightSquared(
flag) ;
707void RooRealMPFE::enableOffsetting(
bool flag)
710 if (_state==Client) {
713 if (
_verboseServer) std::cout <<
"RooRealMPFE::enableOffsetting(" << GetName()
714 <<
") IPC toServer> EnableOffset " << (
flag?1:0) << std::endl ;
726RooMPSentinel::~RooMPSentinel()
738void RooMPSentinel::add(RooRealMPFE&
mpfe)
748void 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)