Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*
0002  * Project: RooFit
0003  * Author:
0004  *   Ruggero Turra <ruggero.turra@cern.ch>, 2016
0005  *
0006  * Copyright (c) 2023, CERN
0007  *
0008  * Redistribution and use in source and binary forms,
0009  * with or without modification, are permitted according to the terms
0010  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
0011  */
0012 
0013 #ifndef RooFit_RooSpline_h
0014 #define RooFit_RooSpline_h
0015 
0016 #include <RooAbsReal.h>
0017 #include <RooRealProxy.h>
0018 
0019 #include <TSpline.h>
0020 
0021 #include <ROOT/RSpan.hxx>
0022 
0023 #include <vector>
0024 
0025 class TGraph;
0026 
0027 class RooSpline : public RooAbsReal {
0028 public:
0029    RooSpline() = default;
0030    RooSpline(const char *name, const char *title, RooAbsReal &x, std::span<const double> x0, std::span<const double> y0,
0031              int order = 3, bool logx = false, bool logy = false);
0032    RooSpline(const char *name, const char *title, RooAbsReal &x, const TGraph &gr, int order = 3, bool logx = false,
0033              bool logy = false);
0034    RooSpline(const RooSpline &other, const char *name = nullptr);
0035 
0036    /// Virtual copy constructor.
0037    /// \param[in] newname The name of the cloned object (optional).
0038    TObject *clone(const char *newname) const override { return new RooSpline(*this, newname); }
0039 
0040 protected:
0041    double evaluate() const override;
0042 
0043 private:
0044    std::unique_ptr<TSpline> _spline; ///< The spline object.
0045    RooRealProxy _x;                  ///< The independent variable.
0046    bool _logx = false;               ///< Flag indicating logarithmic scaling of x values.
0047    bool _logy = false;               ///< Flag indicating logarithmic scaling of y values.
0048 
0049    ClassDefOverride(RooSpline, 1); // A RooFit class for creating spline functions
0050 };
0051 #endif