ParabolicInterpolator.h
Go to the documentation of this file.
1 // ParabolicInterpolator.h
2 //
3 // David Adams
4 // December 2018
5 //
6 // Class to perform parabolic, i.e. fixed curvature, interpolation
7 // between two points.
8 //
9 // y = a*(x-x1) + b*(x-x2) + c*(x-x1)*(x-x2)
10 
11 #ifndef ParabolicInterpolator_H
12 #define ParabolicInterpolator_H
13 
14 #include <string>
15 
16 class TF1;
17 
19 
20 public:
21 
22  struct Point {
23  double x;
24  double y;
25  Point() : x(0.0), y(0.0) { };
26  Point(double a_x, double a_y) : x(a_x), y(a_y) { }
27  };
28 
29  using Name = std::string;
30 
31  // Ctors.
32  ParabolicInterpolator(const Point xy1, const Point& xy2, double c);
33 
34  // Return the params.
35  const Point& xy1() const { return m_xy1; }
36  const Point& xy2() const { return m_xy2; }
37  double a() const { return m_a; }
38  double b() const { return m_b; }
39  double c() const { return m_c; }
40 
41  // Return Root TF1.
42  // If x2 > x1, then (x1, x2) is the range for the function.
43  TF1* getTF1(Name ="parint", double x1=0.0, double x2=0.0) const;
44 
45 private:
46 
49  double m_a;
50  double m_b;
51  double m_c;
52 
53 };
54 
55 #endif
ParabolicInterpolator(const Point xy1, const Point &xy2, double c)
std::string string
Definition: nybbler.cc:12
const Point & xy1() const
TF1 * getTF1(Name="parint", double x1=0.0, double x2=0.0) const
const Point & xy2() const
Point(double a_x, double a_y)