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) {
434 const_cast<RooRealMPFE*
>(
this)->
initialize() ;
446 if (_state==Client) {
453 for (std::size_t
j=0 ;
j<_vars.size() ;
j++) {
472 if (
_verboseClient) std::cout <<
"RooRealMPFE::calculate(" << GetName()
473 <<
") variable " << _vars.at(i)->GetName() <<
" changed" << std::endl ;
482 double val = (
static_cast<RooAbsReal*
>(var))->getVal() ;
486 if (
_verboseServer) std::cout <<
"RooRealMPFE::calculate(" << GetName()
487 <<
") IPC toServer> SendReal [" << i <<
"]=" << val << (
isC?
" (Constant)":
"") << std::endl ;
492 if (
_verboseServer) std::cout <<
"RooRealMPFE::calculate(" << GetName()
493 <<
") IPC toServer> SendCat [" << i <<
"]=" << idx << std::endl ;
501 if (
_verboseServer) std::cout <<
"RooRealMPFE::calculate(" << GetName()
502 <<
") IPC toServer> Calculate " << std::endl ;
510 *
_pipe <<
msg << BidirMMapPipe::flush;
511 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
512 <<
") IPC toServer> Retrieve " << std::endl ;
515 }
else if (_state!=
Inline) {
516 std::cout <<
"RooRealMPFE::calculate(" << GetName()
517 <<
") ERROR not in Client or Inline mode" << std::endl ;
533double RooRealMPFE::getValV(
const RooArgSet* )
const
536 if (isValueDirty()) {
561double RooRealMPFE::evaluate()
const
567 }
else if (_state==Client) {
587 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
588 <<
") IPC toServer> Retrieve " << std::endl ;
599 std::cout <<
"RooRealMPFE::evaluate(" << GetName()
600 <<
") ERROR: unexpected message from server process: " <<
msg << std::endl ;
603 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
604 <<
") IPC fromServer> ReturnValue " <<
value << std::endl ;
606 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
607 <<
") IPC fromServer> NumErrors " <<
numError << std::endl ;
618 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
619 <<
") IPC fromServer> retrieving error log Arg " << ptr <<
" Msg " <<
msgbuf1 << std::endl ;
644void RooRealMPFE::standby()
647 if (_state==Client) {
650 if (
_verboseServer) std::cout <<
"RooRealMPFE::standby(" << GetName()
651 <<
") IPC toServer> Terminate " << std::endl;
653 *
_pipe <<
msg << BidirMMapPipe::flush;
657 if (Terminate !=
msg || 0 !=
_pipe->close()) {
659 "): Server shutdown failed." << std::endl;
664 __LINE__ <<
"): Pipe has already shut down, not sending "
665 "Terminate to server." << std::endl;
684void RooRealMPFE::constOptimizeTestStatistic(ConstOpCode opcode,
bool doAlsoTracking)
687 if (_state==Client) {
692 if (
_verboseServer) std::cout <<
"RooRealMPFE::constOptimize(" << GetName()
693 <<
") IPC toServer> ConstOpt " << opcode << std::endl ;
713 if (_state==Client) {
716 if (
_verboseServer) std::cout <<
"RooRealMPFE::setVerbose(" << GetName()
717 <<
") IPC toServer> Verbose " << (
serverFlag?1:0) << std::endl ;
728void RooRealMPFE::applyNLLWeightSquared(
bool flag)
731 if (_state==Client) {
734 if (
_verboseServer) std::cout <<
"RooRealMPFE::applyNLLWeightSquared(" << GetName()
735 <<
") IPC toServer> ApplyNLLW2 " << (
flag?1:0) << std::endl ;
744void RooRealMPFE::doApplyNLLW2(
bool flag)
748 nll->applyWeightSquared(
flag) ;
757void RooRealMPFE::enableOffsetting(
bool flag)
760 if (_state==Client) {
763 if (
_verboseServer) std::cout <<
"RooRealMPFE::enableOffsetting(" << GetName()
764 <<
") IPC toServer> EnableOffset " << (
flag?1:0) << std::endl ;
776RooMPSentinel::~RooMPSentinel()
788void RooMPSentinel::add(RooRealMPFE&
mpfe)
798void 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)