Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooPolyVar.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooPolyVar.h,v 1.7 2007/05/11 09:11:30 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_POLY_VAR
17#define ROO_POLY_VAR
18
19#include <RooAbsReal.h>
20#include <RooRealProxy.h>
21#include <RooListProxy.h>
22
23#include <vector>
24
25class RooPolyVar : public RooAbsReal {
26public:
28 RooPolyVar(const char *name, const char *title, RooAbsReal &x);
29 RooPolyVar(const char *name, const char *title, RooAbsReal &_x, const RooArgList &_coefList, Int_t lowestOrder = 0);
30
31 RooPolyVar(const RooPolyVar &other, const char *name = nullptr);
32 TObject *clone(const char *newname) const override { return new RooPolyVar(*this, newname); }
33
34 Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName = nullptr) const override;
35 double analyticalIntegral(Int_t code, const char *rangeName = nullptr) const override;
36
37 void translate(RooFit::Detail::CodeSquashContext &ctx) const override;
38 std::string buildCallToAnalyticIntegral(Int_t code, const char *rangeName,
39 RooFit::Detail::CodeSquashContext &ctx) const override;
40
41protected:
45
46 mutable std::vector<double> _wksp; ///<! do not persist
47
48 double evaluate() const override;
49 void doEval(RooFit::EvalContext &) const override;
50
51 // It doesn't make sense to use the GPU if the polynomial has no terms.
52 inline bool canComputeBatchWithCuda() const override { return !_coefList.empty(); }
53
54private:
55 friend class RooPolynomial;
56
57 static void doEvalImpl(RooAbsArg const* caller, RooFit::EvalContext &,
58 RooAbsReal const &x, RooArgList const &coefs, int lowestOrder);
59
60 static void fillCoeffValues(std::vector<double> &wksp, RooListProxy const &coefList);
61
62 ClassDefOverride(RooPolyVar, 1) // Polynomial function
63};
64
65#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
char name[80]
Definition TGX11.cxx:110
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:79
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:24
A class to maintain the context for squashing of RooFit models into code.
A RooAbsReal implementing a polynomial in terms of a list of RooAbsReal coefficients.
Definition RooPolyVar.h:25
static void fillCoeffValues(std::vector< double > &wksp, RooListProxy const &coefList)
bool canComputeBatchWithCuda() const override
Definition RooPolyVar.h:52
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.
void doEval(RooFit::EvalContext &) const override
Compute multiple values of Polynomial.
double evaluate() const override
Calculate and return value of polynomial.
TObject * clone(const char *newname) const override
Definition RooPolyVar.h:32
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Advertise that we can internally integrate over x.
std::vector< double > _wksp
! do not persist
Definition RooPolyVar.h:46
Int_t _lowestOrder
Definition RooPolyVar.h:44
static void doEvalImpl(RooAbsArg const *caller, RooFit::EvalContext &, RooAbsReal const &x, RooArgList const &coefs, int lowestOrder)
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Calculate and return analytical integral over x.
RooListProxy _coefList
Definition RooPolyVar.h:43
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 ...
RooRealProxy _x
Definition RooPolyVar.h:42
RooPolynomial implements a polynomial p.d.f of the form.
Mother of all ROOT objects.
Definition TObject.h:41
Double_t x[n]
Definition legend1.C:17