Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/RooPolynomial.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*****************************************************************************
0002  * Project: RooFit                                                           *
0003  * Package: RooFitModels                                                     *
0004  *    File: $Id: RooPolynomial.h,v 1.8 2007/05/11 09:13:07 verkerke Exp $
0005  * Authors:                                                                  *
0006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
0007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
0008  *                                                                           *
0009  * Copyright (c) 2000-2005, Regents of the University of California          *
0010  *                          and Stanford University. All rights reserved.    *
0011  *                                                                           *
0012  * Redistribution and use in source and binary forms,                        *
0013  * with or without modification, are permitted according to the terms        *
0014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
0015  *****************************************************************************/
0016 #ifndef ROO_POLYNOMIAL
0017 #define ROO_POLYNOMIAL
0018 
0019 #include <RooAbsPdf.h>
0020 #include <RooRealProxy.h>
0021 #include <RooListProxy.h>
0022 
0023 #include <vector>
0024 
0025 class RooPolynomial : public RooAbsPdf {
0026 public:
0027    RooPolynomial() {}
0028    RooPolynomial(const char *name, const char *title, RooAbsReal &x);
0029    RooPolynomial(const char *name, const char *title, RooAbsReal &_x, const RooArgList &_coefList,
0030                  Int_t lowestOrder = 1);
0031 
0032    RooPolynomial(const RooPolynomial &other, const char *name = nullptr);
0033    TObject *clone(const char *newname) const override { return new RooPolynomial(*this, newname); }
0034 
0035    Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName = nullptr) const override;
0036    double analyticalIntegral(Int_t code, const char *rangeName = nullptr) const override;
0037 
0038    /// Get the x variable.
0039    RooAbsReal const &x() const { return _x.arg(); }
0040 
0041    /// Get the coefficient list.
0042    RooArgList const &coefList() const { return _coefList; }
0043 
0044    /// Return the order for the first coefficient in the list.
0045    int lowestOrder() const { return _lowestOrder; }
0046 
0047    // If this polynomial has no terms it's a uniform distribution, and a uniform
0048    // pdf is a reducer node because it doesn't depend on the observables.
0049    bool isReducerNode() const override { return _coefList.empty(); }
0050 
0051    void translate(RooFit::Detail::CodeSquashContext &ctx) const override;
0052    std::string buildCallToAnalyticIntegral(Int_t code, const char *rangeName,
0053                                            RooFit::Detail::CodeSquashContext &ctx) const override;
0054 
0055 protected:
0056    RooRealProxy _x;
0057    RooListProxy _coefList;
0058    Int_t _lowestOrder = 1;
0059 
0060    mutable std::vector<double> _wksp; //! do not persist
0061 
0062    /// Evaluation
0063    double evaluate() const override;
0064    void doEval(RooFit::EvalContext &) const override;
0065 
0066    // It doesn't make sense to use the GPU if the polynomial has no terms.
0067    inline bool canComputeBatchWithCuda() const override { return !_coefList.empty(); }
0068 
0069 private:
0070    ClassDefOverride(RooPolynomial, 1); // Polynomial PDF
0071 };
0072 
0073 #endif