83 void add(RooRealMPFE&
mpfe) ;
84 void remove(RooRealMPFE&
mpfe) ;
95using std::string, std::ostringstream, std::list;
107 _arg(
"arg",
"arg",
this,arg),
108 _vars(
"vars",
"vars",
this),
122 RooMPSentinel::instance().add(*
this) ;
132RooRealMPFE::RooRealMPFE(
const RooRealMPFE&
other,
const char*
name) :
148 RooMPSentinel::instance().add(*
this) ;
156RooRealMPFE::~RooRealMPFE()
159 RooMPSentinel::instance().remove(*
this);
167void RooRealMPFE::initVars()
171 _saveVars.removeAll() ;
174 std::unique_ptr<RooArgSet> vars{_arg->getParameters(
RooArgSet())};
188double RooRealMPFE::getCarry()
const
192 if (
tmp)
return tmp->getCarry();
203void RooRealMPFE::initialize()
214 clearEvalErrorLog() ;
218 if (
_pipe->isChild()) {
226 GetName() <<
") server process terminating" << std::endl ;
228 delete _arg.absArg();
234 ccoutD(Minimization) <<
"RooRealMPFE::initialize(" << GetName() <<
") successfully forked server process "
235 <<
_pipe->pidOtherEnd() << std::endl;
249void RooRealMPFE::serverLoop()
260 clearEvalErrorLog() ;
264 if (Terminate ==
msg) {
265 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
266 <<
") IPC fromClient> Terminate" << std::endl;
268 *
_pipe <<
msg << BidirMMapPipe::flush;
276 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
277 <<
") IPC fromClient> SendReal [" << idx <<
"]=" <<
value << std::endl ;
289 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
290 <<
") IPC fromClient> SendCat [" << idx <<
"]=" <<
index << std::endl ;
296 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
297 <<
") IPC fromClient> Calculate" << std::endl ;
302 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
303 <<
") IPC fromClient> Calculate" << std::endl ;
312 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
313 <<
") IPC fromClient> Retrieve" << std::endl ;
318 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
319 <<
") IPC toClient> ReturnValue " << _value <<
" NumError " <<
numErrors << std::endl ;
328 printStream(
oss2,
kName|kClassName|kArgs,kInline);
331 std::map<const RooAbsArg*,std::pair<string,list<EvalError> > >::const_iterator iter = evalErrorIter();
333 for (
int i = 0; i < numEvalErrorItems(); ++i) {
334 list<EvalError>::const_iterator
iter2 = iter->second.second.begin();
335 for (; iter->second.second.end() !=
iter2; ++
iter2) {
338 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
339 <<
") IPC toClient> sending error log Arg " << iter->first <<
" Msg " <<
iter2->_msg << std::endl ;
348 *
_pipe << BidirMMapPipe::flush;
357 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
358 <<
") IPC fromClient> ConstOpt " << code <<
" doTrack = " << (
doTrack?
"T":
"F") << std::endl ;
367 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
368 <<
") IPC fromClient> Verbose " << (
flag?1:0) << std::endl ;
378 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
379 <<
") IPC fromClient> ApplyNLLW2 " << (
flag?1:0) << std::endl ;
390 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
391 <<
") IPC fromClient> EnableOffset " << (
flag?1:0) << std::endl ;
404 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
405 <<
") IPC fromClient> LogEvalError flag = " <<
flag2 << std::endl ;
411 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
412 <<
") IPC fromClient> Unknown message (code = " <<
msg <<
")" << std::endl ;
428void RooRealMPFE::calculate()
const
432 if (_state==Initialize) {
433 const_cast<RooRealMPFE*
>(
this)->
initialize() ;
444 if (_state==Client) {
450 for (std::size_t
j=0 ;
j<_vars.size() ;
j++) {
468 if (
_verboseClient) std::cout <<
"RooRealMPFE::calculate(" << GetName()
469 <<
") variable " << _vars.at(i)->GetName() <<
" changed" << std::endl ;
478 double val = (
static_cast<RooAbsReal*
>(var))->getVal() ;
482 if (
_verboseServer) std::cout <<
"RooRealMPFE::calculate(" << GetName()
483 <<
") IPC toServer> SendReal [" << i <<
"]=" << val << (
isC?
" (Constant)":
"") << std::endl ;
488 if (
_verboseServer) std::cout <<
"RooRealMPFE::calculate(" << GetName()
489 <<
") IPC toServer> SendCat [" << i <<
"]=" << idx << std::endl ;
497 if (
_verboseServer) std::cout <<
"RooRealMPFE::calculate(" << GetName()
498 <<
") IPC toServer> Calculate " << std::endl ;
506 *
_pipe <<
msg << BidirMMapPipe::flush;
507 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
508 <<
") IPC toServer> Retrieve " << std::endl ;
511 }
else if (_state!=
Inline) {
512 std::cout <<
"RooRealMPFE::calculate(" << GetName()
513 <<
") ERROR not in Client or Inline mode" << std::endl ;
529double RooRealMPFE::getValV(
const RooArgSet* )
const
532 if (isValueDirty()) {
553double RooRealMPFE::evaluate()
const
559 }
else if (_state==Client) {
579 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
580 <<
") IPC toServer> Retrieve " << std::endl ;
591 std::cout <<
"RooRealMPFE::evaluate(" << GetName()
592 <<
") ERROR: unexpected message from server process: " <<
msg << std::endl ;
595 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
596 <<
") IPC fromServer> ReturnValue " <<
value << std::endl ;
598 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
599 <<
") IPC fromServer> NumErrors " <<
numError << std::endl ;
610 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
611 <<
") IPC fromServer> retrieving error log Arg " << ptr <<
" Msg " <<
msgbuf1 << std::endl ;
636void RooRealMPFE::standby()
639 if (_state==Client) {
642 if (
_verboseServer) std::cout <<
"RooRealMPFE::standby(" << GetName()
643 <<
") IPC toServer> Terminate " << std::endl;
645 *
_pipe <<
msg << BidirMMapPipe::flush;
649 if (Terminate !=
msg || 0 !=
_pipe->close()) {
651 "): Server shutdown failed." << std::endl;
656 __LINE__ <<
"): Pipe has already shut down, not sending "
657 "Terminate to server." << std::endl;
676void RooRealMPFE::constOptimizeTestStatistic(ConstOpCode opcode,
bool doAlsoTracking)
679 if (_state==Client) {
684 if (
_verboseServer) std::cout <<
"RooRealMPFE::constOptimize(" << GetName()
685 <<
") IPC toServer> ConstOpt " << opcode << std::endl ;
705 if (_state==Client) {
708 if (
_verboseServer) std::cout <<
"RooRealMPFE::setVerbose(" << GetName()
709 <<
") IPC toServer> Verbose " << (
serverFlag?1:0) << std::endl ;
720void RooRealMPFE::applyNLLWeightSquared(
bool flag)
723 if (_state==Client) {
726 if (
_verboseServer) std::cout <<
"RooRealMPFE::applyNLLWeightSquared(" << GetName()
727 <<
") IPC toServer> ApplyNLLW2 " << (
flag?1:0) << std::endl ;
736void RooRealMPFE::doApplyNLLW2(
bool flag)
740 nll->applyWeightSquared(
flag) ;
749void RooRealMPFE::enableOffsetting(
bool flag)
752 if (_state==Client) {
755 if (
_verboseServer) std::cout <<
"RooRealMPFE::enableOffsetting(" << GetName()
756 <<
") IPC toServer> EnableOffset " << (
flag?1:0) << std::endl ;
768RooMPSentinel::~RooMPSentinel()
780void RooMPSentinel::add(RooRealMPFE&
mpfe)
790void 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'.
static void callgrind_zero()
Utility function to trigger zeroing of callgrind counters.
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)