52 _x(
"x",
"Dependent", this,
x),
53 _coefList(
"coefList",
"List of coefficients", this),
54 _lowestOrder(lowestOrder)
58 coutE(InputArguments) <<
"RooPolyVar::ctor(" <<
GetName()
59 <<
") WARNING: lowestOrder must be >=0, setting value to 0" << std::endl;
71 _x(
"x",
"Dependent", this,
x),
72 _coefList(
"coefList",
"List of coefficients", this),
82 _x(
"x", this, other._x),
83 _coefList(
"coefList", this, other._coefList),
84 _lowestOrder(other._lowestOrder)
91 wksp.reserve(coefList.
size());
94 for (
const auto arg : coefList) {
96 wksp.push_back(
c->getVal(nset));
131 output[0] = lowestOrder ? 1.0 : 0.0;
135 std::vector<std::span<const double>> vars;
136 vars.reserve(coefs.
size() + 2);
141 std::array<double, RooBatchCompute::bufferSize> zeros;
142 std::array<double, RooBatchCompute::bufferSize> ones;
143 std::fill_n(zeros.data(), zeros.size(), 0.0);
144 std::fill_n(ones.data(), ones.size(), 1.0);
145 std::span<const double> zerosSpan{zeros.data(), 1};
146 std::span<const double> onesSpan{ones.data(), 1};
147 for (
int i = lowestOrder - 1; i >= 0; --i) {
148 vars.push_back(i == 0 ? onesSpan : zerosSpan);
152 vars.push_back(ctx.
at(coef));
154 vars.push_back(ctx.
at(&
x));
155 std::array<double, 1> extraArgs{
double(vars.size() - 1)};
180 const double xmin =
_x.min(rangeName);
181 const double xmax =
_x.max(rangeName);
194 const double xmin =
_x.min(rangeName);
195 const double xmax =
_x.max(rangeName);
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Storage_t::size_type size() const
bool addTyped(const RooAbsCollection &list, bool silent=false)
Adds elements of a given RooAbsCollection to the container if they match the specified type.
const RooArgSet * nset() const
Abstract base class for objects that represent a real value and implements functionality common to al...
bool matchArgs(const RooArgSet &allDeps, RooArgSet &numDeps, const RooArgProxy &a) const
Utility function for use in getAnalyticalIntegral().
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
A class to maintain the context for squashing of RooFit models into code.
std::string buildCall(std::string const &funcname, Args_t const &...args)
Build the code to call the function with name funcname, passing some arguments.
void addResult(RooAbsArg const *key, std::string const &value)
A function to save an expression that includes/depends on the result of the input node.
std::span< const double > at(RooAbsArg const *arg, RooAbsArg const *caller=nullptr)
std::span< double > output()
RooBatchCompute::Config config(RooAbsArg const *arg) const
A RooAbsReal implementing a polynomial in terms of a list of RooAbsReal coefficients.
static void fillCoeffValues(std::vector< double > &wksp, RooListProxy const &coefList)
std::string buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const override
This function defines the analytical integral translation for the class.
void doEval(RooFit::EvalContext &) const override
Compute multiple values of Polynomial.
double evaluate() const override
Calculate and return value of polynomial.
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Advertise that we can internally integrate over x.
std::vector< double > _wksp
! do not persist
static void doEvalImpl(RooAbsArg const *caller, RooFit::EvalContext &, RooAbsReal const &x, RooArgList const &coefs, int lowestOrder)
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Calculate and return analytical integral over x.
void translate(RooFit::Detail::CodeSquashContext &ctx) const override
This function defines a translation for each RooAbsReal based object that can be used to express the ...
const char * GetName() const override
Returns name of object.
void compute(Config cfg, Computer comp, std::span< double > output, VarSpan vars, ArgSpan extraArgs={})
double polynomial(double const *coeffs, int nCoeffs, int lowestOrder, double x)
In pdfMode, a coefficient for the constant term of 1.0 is implied if lowestOrder > 0.
double polynomialIntegral(double const *coeffs, int nCoeffs, int lowestOrder, double xMin, double xMax)
In pdfMode, a coefficient for the constant term of 1.0 is implied if lowestOrder > 0.