Skip to content

Commit 3fa7244

Browse files
committed
[RF] Register function as value server in pass-through RooRealIntegrals
In pass through mode, the RooRealIntegral should have registered the function as a value server, because we directly depend on its value. As it is only determined later in the constructor if a given integral is in pass through mode, we also have to delay the construction of the function proxy object now. It's important to do this correctly, because the new BatchMode uses the value server interface to analyze the computation graph.
1 parent 0665684 commit 3fa7244

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

roofit/roofitcore/inc/RooArgProxy.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ class RooArgProxy : public TNamed, public RooAbsProxy {
6161

6262
protected:
6363

64+
friend class RooRealIntegral;
65+
6466
bool changePointer(const RooAbsCollection& newServerSet, bool nameChange=false, bool factoryInitMode=false) override ;
6567

6668
virtual void changeDataSet(const RooArgSet* newNormSet) ;

roofit/roofitcore/src/RooRealIntegral.cxx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ RooRealIntegral::RooRealIntegral(const char *name, const char *title,
102102
_anaList("!anaList","Variables to be integrated analytically",this,false,false),
103103
_jacList("!jacList","Jacobian product term",this,false,false),
104104
_facList("!facList","Variables independent of function",this,false,true),
105-
_function("!func","Function to be integrated",this,
106-
const_cast<RooAbsReal&>(function),false,false),
105+
_function("!func","Function to be integrated",this,false,false),
107106
_iconfig((RooNumIntConfig*)config),
108107
_sumCat("!sumCat","SuperCategory for summation",this,false,false),
109108
_mode(0),
@@ -406,7 +405,7 @@ RooRealIntegral::RooRealIntegral(const char *name, const char *title,
406405
RooArgSet anIntDepList ;
407406

408407
RooArgSet *anaSet = new RooArgSet( _anaList, Form("UniqueCloneOf_%s",_anaList.GetName()));
409-
_mode = ((RooAbsReal&)_function.arg()).getAnalyticalIntegralWN(anIntOKDepList,*anaSet,_funcNormSet,RooNameReg::str(_rangeName)) ;
408+
_mode = function.getAnalyticalIntegralWN(anIntOKDepList,*anaSet,_funcNormSet,RooNameReg::str(_rangeName)) ;
410409
_anaList.removeAll() ;
411410
_anaList.add(*anaSet);
412411
delete anaSet;
@@ -539,9 +538,13 @@ RooRealIntegral::RooRealIntegral(const char *name, const char *title,
539538
// Purely analytical integration
540539
_intOperMode = Analytic ;
541540
} else {
542-
// No integration performed
541+
// No integration performed, where the function is a direct value server
543542
_intOperMode = PassThrough ;
543+
_function._valueServer = true;
544544
}
545+
// We are only setting the function proxy now that it's clear if it's a value
546+
// server or not.
547+
_function.setArg(const_cast<RooAbsReal&>(function));
545548

546549
// Determine auto-dirty status
547550
autoSelectDirtyMode() ;
@@ -884,6 +887,10 @@ double RooRealIntegral::evaluate() const
884887

885888
case PassThrough:
886889
{
890+
// In pass through mode, the RooRealIntegral should have registered the
891+
// function as a value server, because we directly depend on its value.
892+
assert(_function.isValueServer());
893+
887894
//setDirtyInhibit(true) ;
888895
retVal= _function.arg().getVal(_funcNormSet) ;
889896
//setDirtyInhibit(false) ;

0 commit comments

Comments
 (0)