Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:25

0001 /*****************************************************************************
0002  * Project: RooFit                                                           *
0003  * Package: RooFitCore                                                       *
0004  *    File: $Id: RooPolyVar.h,v 1.7 2007/05/11 09:11:30 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_POLY_VAR
0017 #define ROO_POLY_VAR
0018 
0019 #include <RooAbsReal.h>
0020 #include <RooRealProxy.h>
0021 #include <RooListProxy.h>
0022 
0023 #include <vector>
0024 
0025 class RooPolyVar : public RooAbsReal {
0026 public:
0027    RooPolyVar() {}
0028    RooPolyVar(const char *name, const char *title, RooAbsReal &x);
0029    RooPolyVar(const char *name, const char *title, RooAbsReal &_x, const RooArgList &_coefList, Int_t lowestOrder = 0);
0030 
0031    RooPolyVar(const RooPolyVar &other, const char *name = nullptr);
0032    TObject *clone(const char *newname) const override { return new RooPolyVar(*this, newname); }
0033 
0034    Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName = nullptr) const override;
0035    double analyticalIntegral(Int_t code, const char *rangeName = nullptr) const override;
0036 
0037    void translate(RooFit::Detail::CodeSquashContext &ctx) const override;
0038    std::string buildCallToAnalyticIntegral(Int_t code, const char *rangeName,
0039                                            RooFit::Detail::CodeSquashContext &ctx) const override;
0040 
0041 protected:
0042    RooRealProxy _x;
0043    RooListProxy _coefList;
0044    Int_t _lowestOrder = 0;
0045 
0046    mutable std::vector<double> _wksp; ///<! do not persist
0047 
0048    double evaluate() const override;
0049    void doEval(RooFit::EvalContext &) const override;
0050 
0051    // It doesn't make sense to use the GPU if the polynomial has no terms.
0052    inline bool canComputeBatchWithCuda() const override { return !_coefList.empty(); }
0053 
0054 private:
0055    friend class RooPolynomial;
0056 
0057    static void doEvalImpl(RooAbsArg const* caller, RooFit::EvalContext &,
0058                           RooAbsReal const &x, RooArgList const &coefs, int lowestOrder);
0059 
0060    static void fillCoeffValues(std::vector<double> &wksp, RooListProxy const &coefList);
0061 
0062    ClassDefOverride(RooPolyVar, 1) // Polynomial function
0063 };
0064 
0065 #endif