ParabolicInterpolator.cxx
Go to the documentation of this file.
1 // ParabolicInterpolator.cxx
2 
4 #include "TF1.h"
5 
6 //**********************************************************************
7 
9 ParabolicInterpolator(const Point a_xy1, const Point& a_xy2, double c)
10 : m_xy1(a_xy1), m_xy2(a_xy2), m_a(0.0), m_b(0.0), m_c(c) {
11  double dx = xy2().x - xy1().x;
12  if ( fabs(dx) < 1.e-20 ) return;
13  m_a = xy2().y/dx;
14  m_b = xy1().y/dx;
15 }
16 
17 //**********************************************************************
18 
19 TF1* ParabolicInterpolator::getTF1(Name fnam, double x1, double x2) const {
20  const Name sfun = "[2]*(x-[0]) + [3]*(x-[1]) + [4]*(x-[0])*(x-[1])";
21  TF1* pf = new TF1(fnam.c_str(), sfun.c_str(), x1, x2);
22  pf->SetParName(0, "x1");
23  pf->SetParName(1, "x2");
24  pf->SetParName(2, "a");
25  pf->SetParName(3, "b");
26  pf->SetParName(4, "c");
27  pf->SetParameter(0, xy1().x);
28  pf->SetParameter(1, xy2().x);
29  pf->SetParameter(2, a());
30  pf->SetParameter(3, b());
31  pf->SetParameter(4, c());
32  return pf;
33 }
34 
35 //**********************************************************************
ParabolicInterpolator(const Point xy1, const Point &xy2, double c)
const Point & xy1() const
const double e
TF1 * getTF1(Name="parint", double x1=0.0, double x2=0.0) const
const Point & xy2() const
list x
Definition: train.py:276