Skip to content

Commit 5baeea4

Browse files
committed
[RF] Don't override isReducerNode() in RooPolynomial
This was an unneeded optimization, because if the Polynomial doesn't depend on any coefficients and is constant, its results will be cached anyway so it doesn't cost much to fill the full ouput array. This fixes problems with the RooFit code generation facility that uses `isReducerNode()` for scope management.
1 parent 2ffab9f commit 5baeea4

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

roofit/roofit/inc/RooPolynomial.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ class RooPolynomial : public RooAbsPdf {
4444
/// Return the order for the first coefficient in the list.
4545
int lowestOrder() const { return _lowestOrder; }
4646

47-
// If this polynomial has no terms it's a uniform distribution, and a uniform
48-
// pdf is a reducer node because it doesn't depend on the observables.
49-
bool isReducerNode() const override { return _coefList.empty(); }
50-
5147
protected:
5248
RooRealProxy _x;
5349
RooListProxy _coefList;

roofit/roofitcore/src/RooPolyVar.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ void RooPolyVar::doEvalImpl(RooAbsArg const *caller, RooFit::EvalContext &ctx, R
116116
{
117117
std::span<double> output = ctx.output();
118118
if (coefs.empty()) {
119-
output[0] = lowestOrder ? 1.0 : 0.0;
119+
for (std::size_t i = 0; i < output.size(); ++i) {
120+
output[i] = lowestOrder ? 1.0 : 0.0;
121+
}
120122
return;
121123
}
122124

0 commit comments

Comments
 (0)