52 for (
const auto &var :
_vars) {
73 for (
const auto &var :
_vars) {
75 if (
strcmp(
var1.GetName(), var->GetName()) == 0)
97 for (
const auto &var :
_vars) {
99 if (
strcmp(
var1.GetName(), var->GetName()) == 0)
101 if (
strcmp(
var2.GetName(), var->GetName()) == 0)
116 <<
exponents.size() <<
") provided do not match the number of variables (" <<
_vars.
size()
150 _terms.emplace_back(std::make_unique<RooListProxy>(
term->GetName(),
this, *
term));
159 std::stringstream
ss;
164 if (coef->getVal() > 0 && !first)
166 ss << coef->getVal();
171 if (exp->getVal() == 0)
178 ss <<
"pow(" << var->GetName() <<
"," << exp->getVal() <<
")";
199 poly_term *= pow(var->getVal(), exp->getVal());
210 std::size_t
iObs = 0;
219 var->setConstant(
true);
242std::unique_ptr<RooPolyFunc>
247 auto taylorPoly = std::make_unique<RooPolyFunc>(
name, title, observables);
257 errorMsgStream <<
"RooPolyFunc::taylorExpand(" <<
name <<
") ERROR: duplicate input observables!";
260 throw std::invalid_argument(
errorMsg);
279 <<
") ERROR: observableValues must be empty, contain one element, or match observables.size()!";
282 throw std::invalid_argument(
errorMsg);
286 if (order >= 3 || order <= 0) {
288 errorMsgStream <<
"RooPolyFunc::taylorExpand(" <<
name <<
") ERROR: order must be 0, 1, or 2";
291 throw std::invalid_argument(
errorMsg);
void fixObservables(const RooAbsCollection &observables)
void setCoordinates(const RooAbsCollection &observables, std::vector< double > const &observableValues)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
const_iterator begin() const
const_iterator end() const
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Abstract container object that can hold multiple RooAbsArg objects.
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 base class for objects that represent a real value and implements functionality common to al...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooDerivative * derivative(RooRealVar &obs, Int_t order=1, double eps=0.001)
Return function representing first, second or third order derivative of this function.
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.
RooPolyFunc implements a polynomial function in multi-variables.
double evaluate() const override
Evaluation.
RooPolyFunc()
Default constructor.
void addTerm(double coefficient)
coverity[UNINIT_CTOR]
static std::unique_ptr< RooPolyFunc > taylorExpand(const char *name, const char *title, RooAbsReal &func, const RooArgList &observables, int order=1, std::vector< double > const &observableValues={}, double eps1=1e-6, double eps2=1e-3)
Taylor expanding given function in terms of observables around observableValues.
std::string asString() const
Return to RooPolyFunc as a string.
std::vector< std::unique_ptr< RooListProxy > > _terms
Variable that can be changed from the outside.
const char * GetName() const override
Returns name of object.
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...