53 _x(
"x",
"Dependent", this,
x),
54 _coefList(
"coefList",
"List of coefficients", this),
55 _lowestOrder(lowestOrder)
59 coutE(InputArguments) <<
"RooPolyVar::ctor(" <<
GetName()
60 <<
") WARNING: lowestOrder must be >=0, setting value to 0" << std::endl;
72 _x(
"x",
"Dependent", this,
x),
73 _coefList(
"coefList",
"List of coefficients", this),
83 _x(
"x", this, other._x),
84 _coefList(
"coefList", this, other._coefList),
85 _lowestOrder(other._lowestOrder)
92 wksp.reserve(coefList.
size());
95 for (
const auto arg : coefList) {
97 wksp.push_back(
c->getVal(nset));
133 output[0] = lowestOrder ? 1.0 : 0.0;
137 std::vector<std::span<const double>> vars;
138 vars.reserve(coefs.
size() + 2);
143 std::array<double, RooBatchCompute::bufferSize> zeros;
144 std::array<double, RooBatchCompute::bufferSize> ones;
145 std::fill_n(zeros.data(), zeros.size(), 0.0);
146 std::fill_n(ones.data(), ones.size(), 1.0);
147 std::span<const double> zerosSpan{zeros.data(), 1};
148 std::span<const double> onesSpan{ones.data(), 1};
149 for (
int i = lowestOrder - 1; i >= 0; --i) {
150 vars.push_back(i == 0 ? onesSpan : zerosSpan);
154 vars.push_back(dataMap.
at(coef));
156 vars.push_back(dataMap.
at(&
x));
157 std::array<double, 1> extraArgs{
double(vars.size() - 1)};
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.
RooBatchCompute::Config config(RooAbsArg const *arg) const
std::span< const double > at(RooAbsArg const *arg, RooAbsArg const *caller=nullptr)
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.
double evaluate() const override
Calculate and return value of polynomial.
void computeBatch(double *output, size_t nEvents, RooFit::Detail::DataMap const &) const override
Compute multiple values 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
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 ...
static void computeBatchImpl(RooAbsArg const *caller, double *output, size_t nEvents, RooFit::Detail::DataMap const &, RooAbsReal const &x, RooArgList const &coefs, int lowestOrder)
double max(const char *rname=nullptr) const
Query upper limit of range. This requires the payload to be RooAbsRealLValue or derived.
const T & arg() const
Return reference to object held in proxy.
double min(const char *rname=nullptr) const
Query lower limit of range. This requires the payload to be RooAbsRealLValue or derived.
const char * GetName() const override
Returns name of object.
void compute(Config cfg, Computer comp, RestrictArr output, size_t size, VarSpan vars, ArgSpan extraArgs={})
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.
double polynomialEvaluate(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.