51 _x(
"x",
"Dependent", this,
x),
52 _coefList(
"coefList",
"List of coefficients", this),
53 _lowestOrder(lowestOrder)
57 coutE(InputArguments) <<
"RooPolyVar::ctor(" <<
GetName()
58 <<
") WARNING: lowestOrder must be >=0, setting value to 0" << std::endl;
64 coutE(InputArguments) <<
"RooPolyVar::ctor(" <<
GetName() <<
") ERROR: coefficient " << coef->GetName()
65 <<
" is not of type RooAbsReal" << std::endl;
77 _x(
"x",
"Dependent", this,
x),
78 _coefList(
"coefList",
"List of coefficients", this),
88 _x(
"x", this, other._x),
89 _coefList(
"coefList", this, other._coefList),
90 _lowestOrder(other._lowestOrder)
97 wksp.reserve(coefList.
size());
100 for (
const auto arg : coefList) {
102 wksp.push_back(
c->getVal(nset));
138 output[0] = lowestOrder ? 1.0 : 0.0;
143 vars.reserve(coefs.
size() + 2);
148 const double zero = 1.0;
149 const double one = 1.0;
150 for (
int i = lowestOrder - 1; i >= 0; --i) {
151 vars.push_back(i == 0 ? std::span<const double>{&one, 1} : std::span<const double>{&zero, 1});
155 vars.push_back(dataMap.
at(coef));
157 vars.push_back(dataMap.
at(&
x));
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Int_t getSize() const
Return the number of elements in the collection.
Storage_t::size_type size() const
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.
bool add(const RooAbsArg &var, bool valueServer, bool shapeServer, bool silent)
Overloaded RooCollection_t::add() method insert object into set and registers object as server to own...
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)
Class RooPolyVar is a RooAbsReal implementing a polynomial in terms of a list of RooAbsReal coefficie...
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.
std::vector< std::span< const double > > VarVector
std::vector< double > ArgVector
void compute(Config cfg, Computer comp, RestrictArr output, size_t size, const VarVector &vars, ArgVector &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.