BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtCubicSpline Class Reference

#include <EvtCubicSpline.hh>

Public Member Functions

EvtCubicSplineoperator= (const EvtCubicSpline &)
 
 EvtCubicSpline (const EvtVector4R &p4_p, const EvtVector4R &p4_d1, const EvtVector4R &p4_d2)
 
virtual ~EvtCubicSpline ()
 
const EvtVector4Rp4_p ()
 
const EvtVector4Rp4_d1 ()
 
const EvtVector4Rp4_d2 ()
 
double amplitude ()
 
double theta ()
 
EvtComplex resAmpl ()
 

Static Public Member Functions

static void setParams (const vector< double > x, const vector< double > ym, const vector< double > yp)
 
static void setParams (const int n, const double *x, const double *ym, const double *yp)
 
static void fprime (const vector< double > &x, const vector< ControlPoint > &y, const int n, ControlPoint &yp2)
 
static void fprime (const vector< double > &x, const vector< ControlPoint > &y, ControlPoint &yp2)
 
static int find_bin (double mass1, const vector< double > &x, const int n)
 
static bool Complex_Derivative (const vector< double > &x, const vector< ControlPoint > &y, const int n, vector< ControlPoint > &y2)
 

Static Public Attributes

static int _nPoints = 0
 
static vector< double > _mHHLimits
 
static vector< ControlPoint_yvalues
 
static vector< ControlPoint_y2values
 

Detailed Description

Definition at line 42 of file EvtCubicSpline.hh.

Constructor & Destructor Documentation

◆ EvtCubicSpline()

EvtCubicSpline::EvtCubicSpline ( const EvtVector4R & p4_p,
const EvtVector4R & p4_d1,
const EvtVector4R & p4_d2 )

Definition at line 61 of file EvtCubicSpline.cc.

63 :
64 _p4_p(p4_p),_p4_d1(p4_d1), _p4_d2(p4_d2)
65 // _m1a(m1a), _m1b(m1b), _g1(g1),
66 // _m2a(m2a), _m2b(m2b), _g2(g2)
67{
68// _nPoints = 0;
69}
const EvtVector4R & p4_p()
const EvtVector4R & p4_d2()
const EvtVector4R & p4_d1()

◆ ~EvtCubicSpline()

EvtCubicSpline::~EvtCubicSpline ( )
virtual

Definition at line 38 of file EvtCubicSpline.cc.

38{}

Member Function Documentation

◆ amplitude()

double EvtCubicSpline::amplitude ( )
inline

Definition at line 71 of file EvtCubicSpline.hh.

71{ return _ampl; }

◆ Complex_Derivative()

bool EvtCubicSpline::Complex_Derivative ( const vector< double > & x,
const vector< ControlPoint > & y,
const int n,
vector< ControlPoint > & y2 )
static

Definition at line 117 of file EvtCubicSpline.cc.

117 {
118 int i,k;
119 ControlPoint *u = new ControlPoint[n];
120 double sig,p,qn,un;
121 ControlPoint yp1, ypn;
122/* yp1.real = 2.*(y[1].real - y[0].real) / (x[1] - x[0]);
123 yp1.imag = 2.*(y[1].imag - y[0].imag) / (x[1] - x[0]);
124 ypn.real = 2.*(y[n-1].real - y[n-2].real) / (x[n-1] - x[n-2]);
125 ypn.imag = 2.*(y[n-1].imag - y[n-2].imag) / (x[n-1] - x[n-2]);*/
126 fprime( x, y,yp1);
127 fprime( x, y,n,ypn);
128
129 /* The lower boundary condition is set either to be "natural" or else to have specified first derivative*/
130 if(yp1.real > 0.99e30) {
131 y2[0].real = 0.;
132 u[0].real = 0.;
133 }
134 else{
135 y2[0].real=-0.5;
136 u[0].real=(3.0/(x[1]-x[0]))*((y[1].real-y[0].real)/(x[1]-x[0])-yp1.real);
137 }
138 if(yp1.imag > 0.99e30) {
139 y2[0].imag = 0.;
140 u[0].imag = 0.;
141 }
142 else{
143 y2[0].imag=-0.5;
144 u[0].imag=(3.0/(x[1]-x[0]))*((y[1].imag-y[0].imag)/(x[1]-x[0])-yp1.imag);
145 }
146
147
148/* This is the decomposition loop of the tridiagonal algorithm. y2 and u are used for temporary storage of the decomposed factors*/
149
150 for(i=1;i<n-1;i++){
151 sig=(x[i]-x[i-1])/(x[i+1]-x[i-1]);
152 p=sig*y2[i-1].real+2.0;
153 y2[i].real=(sig-1.0)/p;
154 u[i].real=(y[i+1].real-y[i].real)/(x[i+1]-x[i]) - (y[i].real-y[i-1].real)/(x[i]-x[i-1]);
155 u[i].real=(6.0*u[i].real/(x[i+1]-x[i-1])-sig*u[i-1].real)/p;
156 p=sig*y2[i-1].imag+2.0;
157 y2[i].imag=(sig-1.0)/p;
158 u[i].imag=(y[i+1].imag-y[i].imag)/(x[i+1]-x[i]) - (y[i].imag-y[i-1].imag)/(x[i]-x[i-1]);
159 u[i].imag=(6.0*u[i].imag/(x[i+1]-x[i-1])-sig*u[i-1].imag)/p;
160 }
161
162 /* The upper boundary condition is set either to be "natural" or else to have specified first derivative*/
163
164 if(ypn.real > 0.99e30) {
165 qn = 0.;
166 un = 0.;
167 }
168 else{
169 qn=0.5;
170 un=(3.0/(x[n-1]-x[n-2]))*(ypn.real-(y[n-1].real-y[n-2].real)/(x[n-1]-x[n-2]));
171 }
172 y2[n-1].real=(un-qn*u[n-2].real)/(qn*y2[n-2].real+1.0);
173 if(ypn.imag > 0.99e30) {
174 qn = 0.;
175 un = 0.;
176 }
177 else{
178 qn=0.5;
179 un=(3.0/(x[n-1]-x[n-2]))*(ypn.imag-(y[n-1].imag-y[n-2].imag)/(x[n-1]-x[n-2]));
180 }
181 y2[n-1].imag=(un-qn*u[n-2].imag)/(qn*y2[n-2].imag+1.0);
182
183 /* This is the backsubstitution loop of the tridiagonal algorithm */
184
185 for(k=n-2;k>=0;k--) {
186 y2[k].real=y2[k].real*y2[k+1].real+u[k].real;
187 y2[k].imag=y2[k].imag*y2[k+1].imag+u[k].imag;
188 }
189 delete [] u;
190 return true;
191}
const Int_t n
Double_t x[10]
double imag(const EvtComplex &c)
static void fprime(const vector< double > &x, const vector< ControlPoint > &y, const int n, ControlPoint &yp2)
double y[1000]

Referenced by setParams().

◆ find_bin()

static int EvtCubicSpline::find_bin ( double mass1,
const vector< double > & x,
const int n )
inlinestatic

Definition at line 106 of file EvtCubicSpline.hh.

106 {
107 int mhi = 0;
108 for (;mhi<n;){
109 if (mass1<x[mhi]) break;
110 mhi++;
111 }
112 return mhi==0?1:(mhi==n?n-1:mhi);
113 }

Referenced by resAmpl().

◆ fprime() [1/2]

static void EvtCubicSpline::fprime ( const vector< double > & x,
const vector< ControlPoint > & y,
const int n,
ControlPoint & yp2 )
inlinestatic

Definition at line 81 of file EvtCubicSpline.hh.

81 {
82 double s1 = x[n-1] - x[n-2],
83 s2 = x[n-1] - x[n-3],
84 s3 = x[n-1] - x[n-4],
85 s12 = s1-s2,
86 s13 = s1-s3,
87 s23 = s2-s3;
88 yp2.real = -( s1*s2/( s13*s23*s3 ) )*y[n-4].real+( s1*s3/( s12*s2*s23 ) )*y[n-3].real
89 -( s2*s3/( s1*s12*s13 ) )*y[n-2].real+( 1./s1+1./s2+1./s3 )*y[n-1].real;
90 yp2.imag = -( s1*s2/( s13*s23*s3 ) )*y[n-4].imag+( s1*s3/( s12*s2*s23 ) )*y[n-3].imag
91 -( s2*s3/( s1*s12*s13 ) )*y[n-2].imag+( 1./s1+1./s2+1./s3 )*y[n-1].imag;
92 }
double double double double * s12
Definition qcdloop1.h:77
double double double double double * s23
Definition qcdloop1.h:77

Referenced by Complex_Derivative().

◆ fprime() [2/2]

static void EvtCubicSpline::fprime ( const vector< double > & x,
const vector< ControlPoint > & y,
ControlPoint & yp2 )
inlinestatic

Definition at line 93 of file EvtCubicSpline.hh.

93 {
94 double s1 = x[0]-x[1],
95 s2 = x[0]-x[2],
96 s3 = x[0]-x[3],
97 s12 = s1-s2,
98 s13 = s1-s3,
99 s23 = s2-s3;
100
101 yp2.real = -( s1*s2/( s13*s23*s3 ) )*y[3].real+( s1*s3/( s12*s2*s23 ) )*y[2].real
102 -( s2*s3/( s1*s12*s13 ) )*y[1].real+( 1./s1+1./s2+1./s3 )*y[0].real;
103 yp2.imag = -( s1*s2/( s13*s23*s3 ) )*y[3].imag+( s1*s3/( s12*s2*s23 ) )*y[2].imag
104 -( s2*s3/( s1*s12*s13 ) )*y[1].imag+( 1./s1+1./s2+1./s3 )*y[0].imag;
105 }

◆ operator=()

EvtCubicSpline & EvtCubicSpline::operator= ( const EvtCubicSpline & n)

Definition at line 42 of file EvtCubicSpline.cc.

43{
44 if ( &n == this ) return *this;
45 _p4_p = n._p4_p;
46 _p4_d1 = n._p4_d1;
47 _p4_d2 = n._p4_d2;
48 _ampl = n._ampl;
49 _theta = n._theta;
50/* _nPoints = n._nPoints;
51 for (int i=0;i<_nPoints;i++){
52 _mHHLimits.push_back(n._mHHLimits[i]);
53 _yvalues.push_back(n._yvalues[i]);
54 _y2values.push_back(n._y2values[i]);
55 }*/
56 return *this;
57}

◆ p4_d1()

const EvtVector4R & EvtCubicSpline::p4_d1 ( )
inline

Definition at line 66 of file EvtCubicSpline.hh.

66{ return _p4_d1; }

◆ p4_d2()

const EvtVector4R & EvtCubicSpline::p4_d2 ( )
inline

Definition at line 67 of file EvtCubicSpline.hh.

67{ return _p4_d2; }

◆ p4_p()

const EvtVector4R & EvtCubicSpline::p4_p ( )
inline

Definition at line 65 of file EvtCubicSpline.hh.

65{ return _p4_p; }

◆ resAmpl()

EvtComplex EvtCubicSpline::resAmpl ( )

Definition at line 195 of file EvtCubicSpline.cc.

195 {
196
197 // EvtComplex ampl(cos(_theta*pi180inv), sin(_theta*pi180inv));
198 // ampl *= _ampl;
199 if (_nPoints ==0) return EvtComplex(0,0);
200
201 // SCALARS ONLY
202 double mAB = (_p4_d1+_p4_d2).mass();
203 int khiAB = find_bin(mAB, _mHHLimits, _nPoints);
204 int kloAB = khiAB -1 ;
205 double dmHH, aa, bb, aa3, bb3;
206 double pwa_coefs_real_kloAB = _yvalues[kloAB].real;
207 double pwa_coefs_imag_kloAB = _yvalues[kloAB].imag;
208 double pwa_coefs_real_khiAB = _yvalues[khiAB].real;
209 double pwa_coefs_imag_khiAB = _yvalues[khiAB].imag;
210 double pwa_coefs_prime_real_kloAB = _y2values[kloAB].real;
211 double pwa_coefs_prime_imag_kloAB = _y2values[kloAB].imag;
212 double pwa_coefs_prime_real_khiAB = _y2values[khiAB].real;
213 double pwa_coefs_prime_imag_khiAB = _y2values[khiAB].imag;
214 dmHH = _mHHLimits[khiAB] - _mHHLimits[kloAB];
215 aa = ( _mHHLimits[khiAB] - mAB )/dmHH;
216 bb = 1 - aa;
217 aa3 = aa * aa * aa; bb3 = bb * bb * bb;
218 double ret_real = aa * pwa_coefs_real_kloAB + bb * pwa_coefs_real_khiAB + ((aa3 - aa)*pwa_coefs_prime_real_kloAB + (bb3 - bb) * pwa_coefs_prime_real_khiAB) * (dmHH*dmHH)/6.0;
219 double ret_imag = aa * pwa_coefs_imag_kloAB + bb * pwa_coefs_imag_khiAB + ((aa3 - aa)*pwa_coefs_prime_imag_kloAB + (bb3 - bb) * pwa_coefs_prime_imag_khiAB) * (dmHH*dmHH)/6.0;
220 return EvtComplex(ret_real,ret_imag);
221}
double mass
static vector< ControlPoint > _yvalues
static vector< double > _mHHLimits
static int find_bin(double mass1, const vector< double > &x, const int n)
static vector< ControlPoint > _y2values
static int _nPoints

Referenced by EvtDDalitz::decay().

◆ setParams() [1/2]

void EvtCubicSpline::setParams ( const int n,
const double * x,
const double * ym,
const double * yp )
static

Definition at line 84 of file EvtCubicSpline.cc.

84 {
85 vector<double> vx, vym, vyp;
86 for (int i=0;i<n;i++){
87 vx.push_back(x[i]);
88 vym.push_back(ym[i]);
89 vyp.push_back(yp[i]);
90 }
91 setParams(vx, vym, vyp);
92}
static void setParams(const vector< double > x, const vector< double > ym, const vector< double > yp)

◆ setParams() [2/2]

void EvtCubicSpline::setParams ( const vector< double > x,
const vector< double > ym,
const vector< double > yp )
static

Definition at line 71 of file EvtCubicSpline.cc.

71 {
72 if (_nPoints) return;
73 double e1, e2, e3;
74 for (int i=0;i<x.size();i++){
75 e1 = x[i]; e2 = ym[i]; e3 = yp[i];
76 _mHHLimits.push_back(e1);
77 _yvalues.push_back(ControlPoint(e2*cos(e3),e2*sin(e3)));
78 _y2values.push_back(ControlPoint(0,0));
79 _nPoints ++;
80 }
82}
double sin(const BesAngle a)
Definition BesAngle.h:210
double cos(const BesAngle a)
Definition BesAngle.h:213
Double_t e1
Double_t e2
static bool Complex_Derivative(const vector< double > &x, const vector< ControlPoint > &y, const int n, vector< ControlPoint > &y2)

Referenced by EvtDDalitz::decay(), and setParams().

◆ theta()

double EvtCubicSpline::theta ( )
inline

Definition at line 74 of file EvtCubicSpline.hh.

74{ return _theta; }

Member Data Documentation

◆ _mHHLimits

vector< double > EvtCubicSpline::_mHHLimits
static

Definition at line 46 of file EvtCubicSpline.hh.

Referenced by resAmpl(), and setParams().

◆ _nPoints

int EvtCubicSpline::_nPoints = 0
static

Definition at line 45 of file EvtCubicSpline.hh.

Referenced by resAmpl(), and setParams().

◆ _y2values

vector< ControlPoint > EvtCubicSpline::_y2values
static

Definition at line 48 of file EvtCubicSpline.hh.

Referenced by resAmpl(), and setParams().

◆ _yvalues

vector< ControlPoint > EvtCubicSpline::_yvalues
static

Definition at line 47 of file EvtCubicSpline.hh.

Referenced by resAmpl(), and setParams().


The documentation for this class was generated from the following files: