Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooPolynomial.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitModels *
4 * File: $Id: RooPolynomial.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) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
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 ROO_POLYNOMIAL
17#define ROO_POLYNOMIAL
18
19#include <RooAbsPdf.h>
20#include <RooRealProxy.h>
21#include <RooListProxy.h>
22
23#include <vector>
24
25class RooPolynomial : public RooAbsPdf {
26public:
28 RooPolynomial(const char *name, const char *title, RooAbsReal &x);
29 RooPolynomial(const char *name, const char *title, RooAbsReal &_x, const RooArgList &_coefList,
30 Int_t lowestOrder = 1);
31
32 RooPolynomial(const RooPolynomial &other, const char *name = nullptr);
33 TObject *clone(const char *newname) const override { return new RooPolynomial(*this, newname); }
34
35 Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName = nullptr) const override;
36 double analyticalIntegral(Int_t code, const char *rangeName = nullptr) const override;
37
38 /// Get the x variable.
39 RooAbsReal const &x() const { return _x.arg(); }
40
41 /// Get the coefficient list.
42 RooArgList const &coefList() const { return _coefList; }
43
44 /// Return the order for the first coefficient in the list.
45 int lowestOrder() const { return _lowestOrder; }
46
47 // If this polynomial has no terms it's a uniform distribution, and a uniform
48 // pdf is a reducer node because it doesn't depend on the observables.
49 bool isReducerNode() const override { return _coefList.empty(); }
50
51 void translate(RooFit::Detail::CodeSquashContext &ctx) const override;
52 std::string buildCallToAnalyticIntegral(Int_t code, const char *rangeName,
53 RooFit::Detail::CodeSquashContext &ctx) const override;
54
55protected:
59
60 mutable std::vector<double> _wksp; //! do not persist
61
62 /// Evaluation
63 double evaluate() const override;
64 void doEval(RooFit::EvalContext &) const override;
65
66 // It doesn't make sense to use the GPU if the polynomial has no terms.
67 inline bool canComputeBatchWithCuda() const override { return !_coefList.empty(); }
68
69private:
70 ClassDefOverride(RooPolynomial, 1); // Polynomial PDF
71};
72
73#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
char name[80]
Definition TGX11.cxx:110
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:55
A class to maintain the context for squashing of RooFit models into code.
RooPolynomial implements a polynomial p.d.f of the form.
double evaluate() const override
do not persist
RooRealProxy _x
void translate(RooFit::Detail::CodeSquashContext &ctx) const override
This function defines a translation for each RooAbsReal based object that can be used to express the ...
TObject * clone(const char *newname) const override
std::string buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const override
This function defines the analytical integral translation for the class.
std::vector< double > _wksp
RooAbsReal const & x() const
Get the x variable.
bool isReducerNode() const override
RooListProxy _coefList
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Do the analytical integral according to the code that was returned by getAnalyticalIntegral().
int lowestOrder() const
Return the order for the first coefficient in the list.
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Advertise to RooFit that this function can be analytically integrated.
void doEval(RooFit::EvalContext &) const override
Compute multiple values of Polynomial.
RooArgList const & coefList() const
Get the coefficient list.
bool canComputeBatchWithCuda() const override
const T & arg() const
Return reference to object held in proxy.
Mother of all ROOT objects.
Definition TObject.h:41