59 _x(
"x",
"Dependent", this,
x),
60 _coefList(
"coefList",
"List of coefficients", this),
61 _expList(
"expList",
"List of exponents", this)
64 coutE(InputArguments) <<
"RooPowerSum::ctor(" <<
GetName()
65 <<
") ERROR: coefficient list and exponent list must be of same length" << std::endl;
77 _x(
"x", this, other._x),
78 _coefList(
"coefList", this, other._coefList),
79 _expList(
"expList", this, other._expList)
88 std::vector<std::span<const double>> vars;
90 vars.push_back(ctx.
at(
_x));
99 std::array<double, 1> args{
static_cast<double>(
_coefList.
size())};
115 std::vector<double> coefs;
116 std::vector<double> exps;
128 for (
unsigned int i = 0; i < sz; ++i) {
129 retval += coefs[i] * std::pow(
x, exps[i]);
147 const double xmin =
_x.min(rangeName);
148 const double xmax =
_x.max(rangeName);
154 std::vector<double> coefs;
155 std::vector<double> exps;
167 for (
unsigned int i = 0; i < sz; ++i) {
169 retval += coefs[i] * (log(
xmax) - log(
xmin));
171 retval += coefs[i] / (exps[i] + 1) * (pow(
xmax, (exps[i] + 1)) - pow(
xmin, (exps[i] + 1)));
179 std::stringstream ss;
184 ss << static_cast<RooAbsReal *>(
_coefList.
at(i))->getVal();
190 ss << static_cast<RooAbsReal *>(
_expList.
at(i))->getVal();
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.
Abstract interface for all probability density functions.
const RooArgSet * nset() const
Abstract base class for objects that represent a real value and implements functionality common to al...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
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.
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
std::span< const double > at(RooAbsArg const *arg, RooAbsArg const *caller=nullptr)
std::span< double > output()
RooBatchCompute::Config config(RooAbsArg const *arg) const
RooPowerSum implements a power law PDF of the form.
RooArgList const & coefList() const
Get the list of coefficients.
double evaluate() const override
Evaluation.
int getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Advertise to RooFit that this function can be analytically integrated.
double analyticalIntegral(int code, const char *rangeName=nullptr) const override
Do the analytical integral according to the code that was returned by getAnalyticalIntegral().
void doEval(RooFit::EvalContext &) const override
do not persist
RooArgList const & expList() const
Get the list of exponents.
std::string getFormulaExpression(bool expand) const
const char * GetName() const override
Returns name of object.
void compute(Config cfg, Computer comp, std::span< double > output, VarSpan vars, ArgSpan extraArgs={})