BOSS 8.0.0
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 45 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 60 of file EvtCubicSpline.cc.

62 : _p4_p( p4_p )
63 , _p4_d1( p4_d1 )
64 , _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()

Referenced by operator=().

◆ ~EvtCubicSpline()

EvtCubicSpline::~EvtCubicSpline ( )
virtual

Definition at line 38 of file EvtCubicSpline.cc.

38{}

Member Function Documentation

◆ amplitude()

double EvtCubicSpline::amplitude ( )
inline

Definition at line 73 of file EvtCubicSpline.hh.

73{ 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 119 of file EvtCubicSpline.cc.

121 {
122 int i, k;
123 ControlPoint* u = new ControlPoint[n];
124 double sig, p, qn, un;
125 ControlPoint yp1, ypn;
126 /* yp1.real = 2.*(y[1].real - y[0].real) / (x[1] - x[0]);
127 yp1.imag = 2.*(y[1].imag - y[0].imag) / (x[1] - x[0]);
128 ypn.real = 2.*(y[n-1].real - y[n-2].real) / (x[n-1] - x[n-2]);
129 ypn.imag = 2.*(y[n-1].imag - y[n-2].imag) / (x[n-1] - x[n-2]);*/
130 fprime( x, y, yp1 );
131 fprime( x, y, n, ypn );
132
133 /* The lower boundary condition is set either to be "natural" or else to have specified first
134 * derivative*/
135 if ( yp1.real > 0.99e30 )
136 {
137 y2[0].real = 0.;
138 u[0].real = 0.;
139 }
140 else
141 {
142 y2[0].real = -0.5;
143 u[0].real =
144 ( 3.0 / ( x[1] - x[0] ) ) * ( ( y[1].real - y[0].real ) / ( x[1] - x[0] ) - yp1.real );
145 }
146 if ( yp1.imag > 0.99e30 )
147 {
148 y2[0].imag = 0.;
149 u[0].imag = 0.;
150 }
151 else
152 {
153 y2[0].imag = -0.5;
154 u[0].imag =
155 ( 3.0 / ( x[1] - x[0] ) ) * ( ( y[1].imag - y[0].imag ) / ( x[1] - x[0] ) - yp1.imag );
156 }
157
158 /* This is the decomposition loop of the tridiagonal algorithm. y2 and u are used for
159 * temporary storage of the decomposed factors*/
160
161 for ( i = 1; i < n - 1; i++ )
162 {
163 sig = ( x[i] - x[i - 1] ) / ( x[i + 1] - x[i - 1] );
164 p = sig * y2[i - 1].real + 2.0;
165 y2[i].real = ( sig - 1.0 ) / p;
166 u[i].real = ( y[i + 1].real - y[i].real ) / ( x[i + 1] - x[i] ) -
167 ( y[i].real - y[i - 1].real ) / ( x[i] - x[i - 1] );
168 u[i].real = ( 6.0 * u[i].real / ( x[i + 1] - x[i - 1] ) - sig * u[i - 1].real ) / p;
169 p = sig * y2[i - 1].imag + 2.0;
170 y2[i].imag = ( sig - 1.0 ) / p;
171 u[i].imag = ( y[i + 1].imag - y[i].imag ) / ( x[i + 1] - x[i] ) -
172 ( y[i].imag - y[i - 1].imag ) / ( x[i] - x[i - 1] );
173 u[i].imag = ( 6.0 * u[i].imag / ( x[i + 1] - x[i - 1] ) - sig * u[i - 1].imag ) / p;
174 }
175
176 /* The upper boundary condition is set either to be "natural" or else to have specified first
177 * derivative*/
178
179 if ( ypn.real > 0.99e30 )
180 {
181 qn = 0.;
182 un = 0.;
183 }
184 else
185 {
186 qn = 0.5;
187 un = ( 3.0 / ( x[n - 1] - x[n - 2] ) ) *
188 ( ypn.real - ( y[n - 1].real - y[n - 2].real ) / ( x[n - 1] - x[n - 2] ) );
189 }
190 y2[n - 1].real = ( un - qn * u[n - 2].real ) / ( qn * y2[n - 2].real + 1.0 );
191 if ( ypn.imag > 0.99e30 )
192 {
193 qn = 0.;
194 un = 0.;
195 }
196 else
197 {
198 qn = 0.5;
199 un = ( 3.0 / ( x[n - 1] - x[n - 2] ) ) *
200 ( ypn.imag - ( y[n - 1].imag - y[n - 2].imag ) / ( x[n - 1] - x[n - 2] ) );
201 }
202 y2[n - 1].imag = ( un - qn * u[n - 2].imag ) / ( qn * y2[n - 2].imag + 1.0 );
203
204 /* This is the backsubstitution loop of the tridiagonal algorithm */
205
206 for ( k = n - 2; k >= 0; k-- )
207 {
208 y2[k].real = y2[k].real * y2[k + 1].real + u[k].real;
209 y2[k].imag = y2[k].imag * y2[k + 1].imag + u[k].imag;
210 }
211 delete[] u;
212 return true;
213}
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)

Referenced by setParams().

◆ find_bin()

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

Definition at line 110 of file EvtCubicSpline.hh.

110 {
111 int mhi = 0;
112 for ( ; mhi < n; )
113 {
114 if ( mass1 < x[mhi] ) break;
115 mhi++;
116 }
117 return mhi == 0 ? 1 : ( mhi == n ? n - 1 : mhi );
118 }

Referenced by resAmpl().

◆ fprime() [1/2]

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

Definition at line 83 of file EvtCubicSpline.hh.

84 {
85 double s1 = x[n - 1] - x[n - 2], s2 = x[n - 1] - x[n - 3], s3 = x[n - 1] - x[n - 4],
86 s12 = s1 - s2, s13 = s1 - s3, s23 = s2 - s3;
87 yp2.real = -( s1 * s2 / ( s13 * s23 * s3 ) ) * y[n - 4].real +
88 ( s1 * s3 / ( s12 * s2 * s23 ) ) * y[n - 3].real -
89 ( s2 * s3 / ( s1 * s12 * s13 ) ) * y[n - 2].real +
90 ( 1. / s1 + 1. / s2 + 1. / s3 ) * y[n - 1].real;
91 yp2.imag = -( s1 * s2 / ( s13 * s23 * s3 ) ) * y[n - 4].imag +
92 ( s1 * s3 / ( s12 * s2 * s23 ) ) * y[n - 3].imag -
93 ( s2 * s3 / ( s1 * s12 * s13 ) ) * y[n - 2].imag +
94 ( 1. / s1 + 1. / s2 + 1. / s3 ) * y[n - 1].imag;
95 }

Referenced by Complex_Derivative().

◆ fprime() [2/2]

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

Definition at line 96 of file EvtCubicSpline.hh.

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

◆ operator=()

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

Definition at line 42 of file EvtCubicSpline.cc.

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

◆ p4_d1()

const EvtVector4R & EvtCubicSpline::p4_d1 ( )
inline

Definition at line 69 of file EvtCubicSpline.hh.

69{ return _p4_d1; }

Referenced by EvtCubicSpline().

◆ p4_d2()

const EvtVector4R & EvtCubicSpline::p4_d2 ( )
inline

Definition at line 70 of file EvtCubicSpline.hh.

70{ return _p4_d2; }

Referenced by EvtCubicSpline().

◆ p4_p()

const EvtVector4R & EvtCubicSpline::p4_p ( )
inline

Definition at line 68 of file EvtCubicSpline.hh.

68{ return _p4_p; }

Referenced by EvtCubicSpline().

◆ resAmpl()

EvtComplex EvtCubicSpline::resAmpl ( )

Definition at line 217 of file EvtCubicSpline.cc.

217 {
218
219 // EvtComplex ampl(cos(_theta*pi180inv), sin(_theta*pi180inv));
220 // ampl *= _ampl;
221 if ( _nPoints == 0 ) return EvtComplex( 0, 0 );
222
223 // SCALARS ONLY
224 double mAB = ( _p4_d1 + _p4_d2 ).mass();
225 int khiAB = find_bin( mAB, _mHHLimits, _nPoints );
226 int kloAB = khiAB - 1;
227 double dmHH, aa, bb, aa3, bb3;
228 double pwa_coefs_real_kloAB = _yvalues[kloAB].real;
229 double pwa_coefs_imag_kloAB = _yvalues[kloAB].imag;
230 double pwa_coefs_real_khiAB = _yvalues[khiAB].real;
231 double pwa_coefs_imag_khiAB = _yvalues[khiAB].imag;
232 double pwa_coefs_prime_real_kloAB = _y2values[kloAB].real;
233 double pwa_coefs_prime_imag_kloAB = _y2values[kloAB].imag;
234 double pwa_coefs_prime_real_khiAB = _y2values[khiAB].real;
235 double pwa_coefs_prime_imag_khiAB = _y2values[khiAB].imag;
236 dmHH = _mHHLimits[khiAB] - _mHHLimits[kloAB];
237 aa = ( _mHHLimits[khiAB] - mAB ) / dmHH;
238 bb = 1 - aa;
239 aa3 = aa * aa * aa;
240 bb3 = bb * bb * bb;
241 double ret_real = aa * pwa_coefs_real_kloAB + bb * pwa_coefs_real_khiAB +
242 ( ( aa3 - aa ) * pwa_coefs_prime_real_kloAB +
243 ( bb3 - bb ) * pwa_coefs_prime_real_khiAB ) *
244 ( dmHH * dmHH ) / 6.0;
245 double ret_imag = aa * pwa_coefs_imag_kloAB + bb * pwa_coefs_imag_khiAB +
246 ( ( aa3 - aa ) * pwa_coefs_prime_imag_kloAB +
247 ( bb3 - bb ) * pwa_coefs_prime_imag_khiAB ) *
248 ( dmHH * dmHH ) / 6.0;
249 return EvtComplex( ret_real, ret_imag );
250}
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 88 of file EvtCubicSpline.cc.

89 {
90 vector<double> vx, vym, vyp;
91 for ( int i = 0; i < n; i++ )
92 {
93 vx.push_back( x[i] );
94 vym.push_back( ym[i] );
95 vyp.push_back( yp[i] );
96 }
97 setParams( vx, vym, vyp );
98}
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.

72 {
73 if ( _nPoints ) return;
74 double e1, e2, e3;
75 for ( int i = 0; i < x.size(); i++ )
76 {
77 e1 = x[i];
78 e2 = ym[i];
79 e3 = yp[i];
80 _mHHLimits.push_back( e1 );
81 _yvalues.push_back( ControlPoint( e2 * cos( e3 ), e2 * sin( e3 ) ) );
82 _y2values.push_back( ControlPoint( 0, 0 ) );
83 _nPoints++;
84 }
86}
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 76 of file EvtCubicSpline.hh.

76{ return _theta; }

Member Data Documentation

◆ _mHHLimits

vector< double > EvtCubicSpline::_mHHLimits
static

Definition at line 48 of file EvtCubicSpline.hh.

Referenced by resAmpl(), and setParams().

◆ _nPoints

int EvtCubicSpline::_nPoints = 0
static

Definition at line 47 of file EvtCubicSpline.hh.

Referenced by resAmpl(), and setParams().

◆ _y2values

vector< ControlPoint > EvtCubicSpline::_y2values
static

Definition at line 50 of file EvtCubicSpline.hh.

Referenced by resAmpl(), and setParams().

◆ _yvalues

vector< ControlPoint > EvtCubicSpline::_yvalues
static

Definition at line 49 of file EvtCubicSpline.hh.

Referenced by resAmpl(), and setParams().


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