Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooSpline.h
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 * Author:
4 * Ruggero Turra <ruggero.turra@cern.ch>, 2016
5 *
6 * Copyright (c) 2023, CERN
7 *
8 * Redistribution and use in source and binary forms,
9 * with or without modification, are permitted according to the terms
10 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
11 */
12
13#ifndef RooFit_RooSpline_h
14#define RooFit_RooSpline_h
15
16#include <RooAbsReal.h>
17#include <RooRealProxy.h>
18
19#include <TSpline.h>
20
21#include <ROOT/RSpan.hxx>
22
23#include <vector>
24
25class TGraph;
26
27class RooSpline : public RooAbsReal {
28public:
29 RooSpline() = default;
30 RooSpline(const char *name, const char *title, RooAbsReal &x, std::span<const double> x0, std::span<const double> y0,
31 int order = 3, bool logx = false, bool logy = false);
32 RooSpline(const char *name, const char *title, RooAbsReal &x, const TGraph &gr, int order = 3, bool logx = false,
33 bool logy = false);
34 RooSpline(const RooSpline &other, const char *name = nullptr);
35
36 /// Virtual copy constructor.
37 /// \param[in] newname The name of the cloned object (optional).
38 TObject *clone(const char *newname) const override { return new RooSpline(*this, newname); }
39
40 RooAbsReal const &x() const { return static_cast<RooAbsReal const &>(*_x.absArg()); }
41 int order() const;
42 TSpline const &spline() const { return *_spline; }
43 bool logx() const { return _logx; }
44 bool logy() const { return _logy; }
45
46protected:
47 double evaluate() const override;
48
49private:
50 std::unique_ptr<TSpline> _spline; ///< The spline object.
51 RooRealProxy _x; ///< The independent variable.
52 bool _logx = false; ///< Flag indicating logarithmic scaling of x values.
53 bool _logy = false; ///< Flag indicating logarithmic scaling of y values.
54
55 ClassDefOverride(RooSpline, 1); // A RooFit class for creating spline functions
56};
57#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
char name[80]
Definition TGX11.cxx:110
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:63
RooAbsArg * absArg() const
Return pointer to contained argument.
Definition RooArgProxy.h:46
A RooFit class for creating spline functions.
Definition RooSpline.h:27
bool _logx
Flag indicating logarithmic scaling of x values.
Definition RooSpline.h:52
double evaluate() const override
Evaluate the spline function at the current point.
bool logx() const
Definition RooSpline.h:43
RooAbsReal const & x() const
Definition RooSpline.h:40
RooSpline()=default
TSpline const & spline() const
Definition RooSpline.h:42
bool logy() const
Definition RooSpline.h:44
RooRealProxy _x
The independent variable.
Definition RooSpline.h:51
int order() const
Return the order of the spline.
std::unique_ptr< TSpline > _spline
The spline object.
Definition RooSpline.h:50
bool _logy
Flag indicating logarithmic scaling of y values.
Definition RooSpline.h:53
TObject * clone(const char *newname) const override
Virtual copy constructor.
Definition RooSpline.h:38
A TGraph is an object made of two arrays X and Y with npoints each.
Definition TGraph.h:41
Mother of all ROOT objects.
Definition TObject.h:41
Base class for spline implementation containing the Draw/Paint methods.
Definition TSpline.h:31
TGraphErrors * gr
Definition legend1.C:25