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 auto vars = _arg->getParameters(
RooArgSet());
187double RooRealMPFE::getCarry()
const
190 RooAbsTestStatistic*
>(_arg.absArg());
191 if (tmp)
return tmp->getCarry();
202void RooRealMPFE::initialize()
213 clearEvalErrorLog() ;
217 if (
_pipe->isChild()) {
225 GetName() <<
") server process terminating" << std::endl ;
227 delete _arg.absArg();
233 ccoutD(Minimization) <<
"RooRealMPFE::initialize(" << GetName() <<
") successfully forked server process "
234 <<
_pipe->pidOtherEnd() << std::endl;
248void RooRealMPFE::serverLoop()
259 clearEvalErrorLog() ;
263 if (Terminate ==
msg) {
264 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
265 <<
") IPC fromClient> Terminate" << std::endl;
267 *
_pipe <<
msg << BidirMMapPipe::flush;
275 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
276 <<
") IPC fromClient> SendReal [" << idx <<
"]=" <<
value << std::endl ;
288 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
289 <<
") IPC fromClient> SendCat [" << idx <<
"]=" <<
index << std::endl ;
295 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
296 <<
") IPC fromClient> Calculate" << std::endl ;
301 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
302 <<
") IPC fromClient> Calculate" << std::endl ;
311 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
312 <<
") IPC fromClient> Retrieve" << std::endl ;
317 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
318 <<
") IPC toClient> ReturnValue " << _value <<
" NumError " <<
numErrors << std::endl ;
327 printStream(
oss2,
kName|kClassName|kArgs,kInline);
330 std::map<const RooAbsArg*,std::pair<string,list<EvalError> > >::const_iterator iter = evalErrorIter();
332 for (
int i = 0; i < numEvalErrorItems(); ++i) {
333 list<EvalError>::const_iterator
iter2 = iter->second.second.begin();
334 for (; iter->second.second.end() !=
iter2; ++
iter2) {
337 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
338 <<
") IPC toClient> sending error log Arg " << iter->first <<
" Msg " <<
iter2->_msg << std::endl ;
347 *
_pipe << BidirMMapPipe::flush;
356 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
357 <<
") IPC fromClient> ConstOpt " << code <<
" doTrack = " << (
doTrack?
"T":
"F") << std::endl ;
366 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
367 <<
") IPC fromClient> Verbose " << (
flag?1:0) << std::endl ;
377 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
378 <<
") IPC fromClient> ApplyNLLW2 " << (
flag?1:0) << std::endl ;
389 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
390 <<
") IPC fromClient> EnableOffset " << (
flag?1:0) << std::endl ;
403 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
404 <<
") IPC fromClient> LogEvalError flag = " <<
flag2 << std::endl ;
410 if (
_verboseServer) std::cout <<
"RooRealMPFE::serverLoop(" << GetName()
411 <<
") IPC fromClient> Unknown message (code = " <<
msg <<
")" << std::endl ;
427void RooRealMPFE::calculate()
const
431 if (_state==Initialize) {
433 const_cast<RooRealMPFE*
>(
this)->
initialize() ;
445 if (_state==Client) {
452 for (std::size_t
j=0 ;
j<_vars.size() ;
j++) {
471 if (
_verboseClient) std::cout <<
"RooRealMPFE::calculate(" << GetName()
472 <<
") variable " << _vars.at(i)->GetName() <<
" changed" << std::endl ;
481 double val = (
static_cast<RooAbsReal*
>(var))->getVal() ;
485 if (
_verboseServer) std::cout <<
"RooRealMPFE::calculate(" << GetName()
486 <<
") IPC toServer> SendReal [" << i <<
"]=" << val << (
isC?
" (Constant)":
"") << std::endl ;
491 if (
_verboseServer) std::cout <<
"RooRealMPFE::calculate(" << GetName()
492 <<
") IPC toServer> SendCat [" << i <<
"]=" << idx << std::endl ;
500 if (
_verboseServer) std::cout <<
"RooRealMPFE::calculate(" << GetName()
501 <<
") IPC toServer> Calculate " << std::endl ;
509 *
_pipe <<
msg << BidirMMapPipe::flush;
510 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
511 <<
") IPC toServer> Retrieve " << std::endl ;
514 }
else if (_state!=
Inline) {
515 std::cout <<
"RooRealMPFE::calculate(" << GetName()
516 <<
") ERROR not in Client or Inline mode" << std::endl ;
532double RooRealMPFE::getValV(
const RooArgSet* )
const
535 if (isValueDirty()) {
560double RooRealMPFE::evaluate()
const
566 }
else if (_state==Client) {
586 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
587 <<
") IPC toServer> Retrieve " << std::endl ;
598 std::cout <<
"RooRealMPFE::evaluate(" << GetName()
599 <<
") ERROR: unexpected message from server process: " <<
msg << std::endl ;
602 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
603 <<
") IPC fromServer> ReturnValue " <<
value << std::endl ;
605 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
606 <<
") IPC fromServer> NumErrors " <<
numError << std::endl ;
617 if (
_verboseServer) std::cout <<
"RooRealMPFE::evaluate(" << GetName()
618 <<
") IPC fromServer> retrieving error log Arg " << ptr <<
" Msg " <<
msgbuf1 << std::endl ;
643void RooRealMPFE::standby()
646 if (_state==Client) {
649 if (
_verboseServer) std::cout <<
"RooRealMPFE::standby(" << GetName()
650 <<
") IPC toServer> Terminate " << std::endl;
652 *
_pipe <<
msg << BidirMMapPipe::flush;
656 if (Terminate !=
msg || 0 !=
_pipe->close()) {
658 "): Server shutdown failed." << std::endl;
663 __LINE__ <<
"): Pipe has already shut down, not sending "
664 "Terminate to server." << std::endl;
683void RooRealMPFE::constOptimizeTestStatistic(ConstOpCode opcode,
bool doAlsoTracking)
686 if (_state==Client) {
691 if (
_verboseServer) std::cout <<
"RooRealMPFE::constOptimize(" << GetName()
692 <<
") IPC toServer> ConstOpt " << opcode << std::endl ;
712 if (_state==Client) {
715 if (
_verboseServer) std::cout <<
"RooRealMPFE::setVerbose(" << GetName()
716 <<
") IPC toServer> Verbose " << (
serverFlag?1:0) << std::endl ;
727void RooRealMPFE::applyNLLWeightSquared(
bool flag)
730 if (_state==Client) {
733 if (
_verboseServer) std::cout <<
"RooRealMPFE::applyNLLWeightSquared(" << GetName()
734 <<
") IPC toServer> ApplyNLLW2 " << (
flag?1:0) << std::endl ;
743void RooRealMPFE::doApplyNLLW2(
bool flag)
747 nll->applyWeightSquared(
flag) ;
756void RooRealMPFE::enableOffsetting(
bool flag)
759 if (_state==Client) {
762 if (
_verboseServer) std::cout <<
"RooRealMPFE::enableOffsetting(" << GetName()
763 <<
") IPC toServer> EnableOffset " << (
flag?1:0) << std::endl ;
775RooMPSentinel::~RooMPSentinel()
787void RooMPSentinel::add(RooRealMPFE&
mpfe)
797void RooMPSentinel::remove(RooRealMPFE&
mpfe)
ROOT::RRangeCast< T, false, Range_t > static_range_cast(Range_t &&coll)
static Roo_reg_AGKInteg1D instance
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)