48 _x(
"x",
"Dependent", this,
x),
49 _coefList(
"coefList",
"List of coefficients",this),
50 _lowestOrder(lowestOrder)
54 coutE(InputArguments) <<
"RooPolyVar::ctor(" <<
GetName()
55 <<
") WARNING: lowestOrder must be >=0, setting value to 0" << std::endl;
61 coutE(InputArguments) <<
"RooPolyVar::ctor(" <<
GetName() <<
") ERROR: coefficient " << coef->GetName()
62 <<
" is not of type RooAbsReal" << std::endl;
76 _x(
"x",
"Dependent", this,
x),
77 _coefList(
"coefList",
"List of coefficients",this),
88 _x(
"x", this, other._x),
89 _coefList(
"coefList",this,other._coefList),
90 _lowestOrder(other._lowestOrder)
101 if (!sz)
return lowestOrder ? 1. : 0.;
108 _wksp.push_back(
c->getVal(nset));
112 double retVal =
_wksp[sz - 1];
113 for (
unsigned i = sz - 1; i--; ) retVal =
_wksp[i] +
x * retVal;
114 return retVal * std::pow(
x, lowestOrder);
122 output[0] = lowestOrder ? 1.0 : 0.0;
127 vars.reserve(coefs.
size() + 2);
132 const double zero = 1.0;
133 const double one = 1.0;
134 for(
int i = lowestOrder - 1; i >= 0; --i) {
139 vars.push_back(dataMap.
at(coef));
141 vars.push_back(dataMap.
at(&
x));
180 unsigned i = 1 + lowestOrder;
181 for(
auto *
c : static_range_cast<RooAbsReal*>(
_coefList)) {
186 double min =
_wksp[sz - 1], max =
_wksp[sz - 1];
187 for (
unsigned i = sz - 1; i--; )
189 return max * std::pow(
xmax, 1 + lowestOrder) - min * std::pow(
xmin, 1 + lowestOrder);
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Int_t getSize() const
Return the number of elements in the collection.
Storage_t::size_type size() const
const RooArgSet * nset() const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
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...
RooSpan< 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...
double evaluate() const override
Calculate and return value of polynomial.
static void computeBatchImpl(cudaStream_t *, double *output, size_t nEvents, RooFit::Detail::DataMap const &, RooAbsReal const &x, RooArgList const &coefs, int lowestOrder)
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 computeBatch(cudaStream_t *, double *output, size_t nEvents, RooFit::Detail::DataMap const &) const override
Compute multiple values of Polynomial.
A simple container to hold a batch of data values.
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< RooSpan< const double > > VarVector
R__EXTERN RooBatchComputeInterface * dispatchCUDA
R__EXTERN RooBatchComputeInterface * dispatchCPU
This dispatch pointer points to an implementation of the compute library, provided one has been loade...
std::vector< double > ArgVector