File indexing completed on 2025-01-18 10:11:25
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef RooFit_RooFit_RooPolyFunc_h
0017 #define RooFit_RooFit_RooPolyFunc_h
0018
0019 #include "RooAbsReal.h"
0020 #include "RooRealVar.h"
0021 #include "RooListProxy.h"
0022
0023 #include <vector>
0024
0025 class RooRealVar;
0026 class RooArgList;
0027
0028 class RooPolyFunc : public RooAbsReal {
0029 public:
0030 RooPolyFunc();
0031 RooPolyFunc(const char *name, const char *title, RooAbsReal &x, const RooAbsCollection &coefList);
0032 RooPolyFunc(const char *name, const char *title, RooAbsReal &x, RooAbsReal &y, const RooAbsCollection &coefList);
0033 RooPolyFunc(const char *name, const char *title, const RooAbsCollection &vars);
0034 RooPolyFunc(const RooPolyFunc &other, const char *name = nullptr);
0035 RooPolyFunc &operator=(const RooPolyFunc &other) = delete;
0036 RooPolyFunc &operator=(RooPolyFunc &&other) = delete;
0037 TObject *clone(const char *newname) const override { return new RooPolyFunc(*this, newname); }
0038
0039 std::string asString() const;
0040 inline const RooArgList &variables() const { return _vars; }
0041 inline const std::vector<std::unique_ptr<RooListProxy>> &terms() const { return _terms; }
0042 inline RooRealVar *getCoefficient(const RooArgList &term)
0043 {
0044 return static_cast<RooRealVar *>(term.at(term.size() - 1));
0045 }
0046 inline RooRealVar *getExponent(const RooArgList &term, RooRealVar *v)
0047 {
0048 return static_cast<RooRealVar *>(term.at(_vars.index(v)));
0049 }
0050
0051 void addTerm(double coefficient);
0052 void addTerm(double coefficient, const RooAbsCollection &exponents);
0053 void addTerm(double coefficient, const RooAbsReal &var1, int exp1);
0054 void addTerm(double coefficient, const RooAbsReal &var1, int exp1, const RooAbsReal &var2, int exp2);
0055
0056 static std::unique_ptr<RooPolyFunc>
0057 taylorExpand(const char *name, const char *title, RooAbsReal &func, const RooArgList &observables, int order = 1,
0058 std::vector<double> const &observableValues = {}, double eps1 = 1e-6, double eps2 = 1e-3);
0059
0060 protected:
0061 void setCoordinate(const RooAbsCollection &observables, std::vector<double> const &observableValues);
0062 RooListProxy _vars;
0063 std::vector<std::unique_ptr<RooListProxy>> _terms;
0064
0065
0066 double evaluate() const override;
0067
0068 ClassDefOverride(RooPolyFunc, 1)
0069 };
0070
0071 #endif