Logo ROOT  
Reference Guide
RooPolyFunc.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitModels *
4 * File: $Id: RooPolyFunc.h,v 1.8 2007/05/11 09:13:07 verkerke Exp $
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2021: *
10 * CERN, Switzerland *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16#ifndef RooFit_RooFit_RooPolyFunc_h
17#define RooFit_RooFit_RooPolyFunc_h
18
19#include "RooAbsReal.h"
20#include "RooListProxy.h"
21
22#include <vector>
23
24class RooRealVar;
25class RooArgList;
26
27class RooPolyFunc : public RooAbsReal {
28public:
30 RooPolyFunc(const char *name, const char *title, RooAbsReal &x, const RooAbsCollection &coefList);
31 RooPolyFunc(const char *name, const char *title, RooAbsReal &x, RooAbsReal &y, const RooAbsCollection &coefList);
32 RooPolyFunc(const char *name, const char *title, const RooAbsCollection &vars);
33 RooPolyFunc(const RooPolyFunc &other, const char *name = 0);
34 RooPolyFunc &operator=(const RooPolyFunc &other) = delete;
35 RooPolyFunc &operator=(RooPolyFunc &&other) = delete;
36 TObject *clone(const char *newname) const override { return new RooPolyFunc(*this, newname); }
37
38 void addTerm(double coefficient);
39 void addTerm(double coefficient, const RooAbsCollection &exponents);
40 void addTerm(double coefficient, const RooAbsReal &var1, int exp1);
41 void addTerm(double coefficient, const RooAbsReal &var1, int exp1, const RooAbsReal &var2, int exp2);
42
43 static std::unique_ptr<RooAbsReal>
44 taylorExpand(const char *name, const char *title, RooAbsReal &func, const RooAbsCollection &observables,
45 std::vector<double> const &observableValues, int order = 1, double eps1 = 1e-6, double eps2 = 1e-3);
46 static std::unique_ptr<RooAbsReal> taylorExpand(const char *name, const char *title, RooAbsReal &func,
47 const RooAbsCollection &observables, double observablesValue = 0.0,
48 int order = 1, double eps = 1e-6, double eps2 = 1e-3);
49
50protected:
51 void setCoordinate(const RooAbsCollection &observables, std::vector<double> const &observableValues);
53 std::vector<std::unique_ptr<RooListProxy>> _terms;
54
55 /// Evaluation
56 double evaluate() const override;
57
58 ClassDefOverride(RooPolyFunc, 1) // Polynomial Function
59};
60
61#endif
#define e(i)
Definition: RSha256.hxx:103
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
char name[80]
Definition: TGX11.cxx:110
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:64
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:22
RooPolyFunc implements a polynomial function in multi-variables.
Definition: RooPolyFunc.h:27
static std::unique_ptr< RooAbsReal > taylorExpand(const char *name, const char *title, RooAbsReal &func, const RooAbsCollection &observables, std::vector< double > const &observableValues, int order=1, double eps1=1e-6, double eps2=1e-3)
RooPolyFunc & operator=(RooPolyFunc &&other)=delete
RooPolyFunc & operator=(const RooPolyFunc &other)=delete
RooListProxy _vars
Definition: RooPolyFunc.h:52
double evaluate() const override
Evaluation.
RooPolyFunc(const char *name, const char *title, RooAbsReal &x, const RooAbsCollection &coefList)
RooPolyFunc()
Default constructor.
RooPolyFunc(const char *name, const char *title, RooAbsReal &x, RooAbsReal &y, const RooAbsCollection &coefList)
void setCoordinate(const RooAbsCollection &observables, std::vector< double > const &observableValues)
void addTerm(double coefficient)
coverity[UNINIT_CTOR]
Definition: RooPolyFunc.cxx:42
TObject * clone(const char *newname) const override
Definition: RooPolyFunc.h:36
std::vector< std::unique_ptr< RooListProxy > > _terms
Definition: RooPolyFunc.h:53
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:40
Mother of all ROOT objects.
Definition: TObject.h:37
RVec< PromoteType< T > > exp2(const RVec< T > &v)
Definition: RVec.hxx:1745
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17