78 _x(
"x",
"Dependent", this,
x),
79 _coefList(
"coefList",
"List of coefficients",this),
80 _lowestOrder(lowestOrder)
85 <<
") WARNING: lowestOrder must be >=0, setting value to 0" << endl ;
94 <<
" is not of type RooAbsReal" << endl ;
106 _x(
"x",
"Dependent", this,
x),
107 _coefList(
"coefList",
"List of coefficients",this),
116 _x(
"x", this, other._x),
117 _coefList(
"coefList",this,other._coefList),
118 _lowestOrder(other._lowestOrder)
135 if (!sz)
return lowestOrder ? 1. : 0.;
146 for (
unsigned i = sz - 1; i--; ) retVal =
_wksp[i] +
x * retVal;
147 return retVal *
std::pow(
x, lowestOrder) + (lowestOrder ? 1.0 : 0.0);
155void compute(
size_t batchSize,
const int lowestOrder,
156 double * __restrict
output,
157 const double * __restrict
const X,
158 const std::vector<BatchHelpers::BracketAdapterWithMask>& coefList )
160 const int nCoef = coefList.size();
161 if (nCoef==0 && lowestOrder==0) {
162 for (
size_t i=0; i<batchSize; i++) {
166 else if (nCoef==0 && lowestOrder>0) {
167 for (
size_t i=0; i<batchSize; i++) {
171 for (
size_t i=0; i<batchSize; i++) {
172 output[i] = coefList[nCoef-1][i];
175 if (nCoef == 0)
return;
182 for (
int k=nCoef-3; k>=0; k-=2) {
183 for (
size_t i=0; i<batchSize; i++) {
184 double coef1 = coefList[k+1][i];
185 double coef2 = coefList[ k ][i];
191 for (
size_t i=0; i<batchSize; i++) {
196 if (lowestOrder == 0)
return;
197 for (
int k=2; k<=lowestOrder; k+=2) {
198 for (
size_t i=0; i<batchSize; i++) {
202 const bool isOdd = lowestOrder%2;
203 for (
size_t i=0; i<batchSize; i++) {
204 if (isOdd)
output[i] *= X[i];
214 batchSize = xData.
size();
222 std::vector<BatchHelpers::BracketAdapterWithMask> coefList;
223 for (
int i=0; i<nCoef; i++) {
226 coefList.emplace_back(val, valBatch);
257 unsigned i = 1 + lowestOrder;
265 for (
unsigned i = sz - 1; i--; )
double pow(double, double)
RooSpan< double > makeWritableBatchUnInit(std::size_t begin, std::size_t batchSize)
Make a batch and return a span pointing to the pdf-local memory.
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
RooFIter fwdIterator() const R__SUGGEST_ALTERNATIVE("begin()
One-time forward iterator.
virtual RooSpan< const double > getValBatch(std::size_t begin, std::size_t batchSize, const RooArgSet *normSet=nullptr) const
Compute batch of values for given range, and normalise by integrating over the observables in nset.
const RooArgSet * nset() const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Bool_t matchArgs(const RooArgSet &allDeps, RooArgSet &numDeps, const RooArgProxy &a) const
Utility function for use in getAnalyticalIntegral().
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
BatchHelpers::BatchData _batchData
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
RooAbsArg * next()
Return next element or nullptr if at end.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Reimplementation of standard RooArgList::add()
RooPolynomial implements a polynomial p.d.f of the form.
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Advertise to RooFit that this function can be analytically integrated.
Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
Do the analytical integral according to the code that was returned by getAnalyticalIntegral().
RooPolynomial()
coverity[UNINIT_CTOR]
Double_t evaluate() const
do not persist
RooSpan< double > evaluateBatch(std::size_t begin, std::size_t batchSize) const
Evaluate function for a batch of input data points.
std::vector< Double_t > _wksp
virtual ~RooPolynomial()
Destructor.
A simple container to hold a batch of data values.
constexpr std::span< T >::pointer data() const
constexpr std::span< T >::index_type size() const noexcept
constexpr bool empty() const noexcept
Double_t min(const char *rname=0) const
Query lower limit of range. This requires the payload to be RooAbsRealLValue or derived.
RooSpan< const double > getValBatch(std::size_t begin, std::size_t batchSize) const
Double_t max(const char *rname=0) const
Query upper limit of range. This requires the payload to be RooAbsRealLValue or derived.
virtual const char * GetName() const
Returns name of object.
static void output(int code)