@@ -89,7 +89,7 @@ RooFormulaVar::RooFormulaVar(const char *name, const char *title, const char* in
8989 _value = traceEval (nullptr );
9090 } else {
9191 _formula = new RooFormula (GetName (), _formExpr, dependents, checkVariables);
92- _formExpr = _formula->formulaString ().c_str ();
92+ _formExpr = _formula->reindexedFormulaForUsedVars ().c_str ();
9393 _actualVars.add (_formula->actualDependents ());
9494 }
9595}
@@ -112,7 +112,7 @@ RooFormulaVar::RooFormulaVar(const char *name, const char *title, const RooArgLi
112112 _value = traceEval (nullptr );
113113 } else {
114114 _formula = new RooFormula (GetName (), _formExpr, dependents, checkVariables);
115- _formExpr = _formula->formulaString ().c_str ();
115+ _formExpr = _formula->reindexedFormulaForUsedVars ().c_str ();
116116 _actualVars.add (_formula->actualDependents ());
117117 }
118118}
@@ -132,7 +132,7 @@ RooFormulaVar::RooFormulaVar(const RooFormulaVar& other, const char* name) :
132132 }
133133 if (other._formula && other._formula ->ok ()) {
134134 _formula = new RooFormula (*other._formula );
135- _formExpr = _formula->formulaString ().c_str ();
135+ _formExpr = _formula->reindexedFormulaForUsedVars ().c_str ();
136136 }
137137}
138138
@@ -145,7 +145,7 @@ RooFormula& RooFormulaVar::getFormula() const
145145 if (!_formula) {
146146 // After being read from file, the formula object might not exist, yet:
147147 _formula = new RooFormula (GetName (), _formExpr, _actualVars);
148- const_cast <TString&>(_formExpr) = _formula->formulaString ().c_str ();
148+ const_cast <TString &>(_formExpr) = _formula->reindexedFormulaForUsedVars ().c_str ();
149149 }
150150
151151 return *_formula;
@@ -180,7 +180,7 @@ bool RooFormulaVar::redirectServersHook(const RooAbsCollection& newServerList, b
180180{
181181 bool error = getFormula ().changeDependents (newServerList,mustReplaceAll,nameChange);
182182
183- _formExpr = getFormula ().GetTitle ();
183+ _formExpr = getFormula ().reindexedFormulaForUsedVars (). c_str ();
184184 return error || RooAbsReal::redirectServersHook (newServerList, mustReplaceAll, nameChange, isRecursive);
185185}
186186
0 commit comments