24 #include "AliHLTTPCCATrackParam.h"
25 #include "AliHLTTPCCAMath.h"
26 #include "AliHLTTPCCATrackLinearisation.h"
43 float dx = GetX() - t.GetX();
44 float dy = GetY() - t.GetY();
45 float dz = GetZ() - t.GetZ();
46 return dx*dx + dy*dy + dz*dz;
53 float dx = GetX() - t.GetX();
54 float dz = GetZ() - t.GetZ();
59 float AliHLTTPCCATrackParam::GetS(
float x,
float y,
float Bz )
const
63 float k = GetKappa( Bz );
64 float ex = GetCosPhi();
65 float ey = GetSinPhi();
68 float dS = x * ex + y * ey;
69 if ( CAMath::Abs( k ) > 1.e-4 ) dS = CAMath::ATan2( k * dS, 1 + k * ( x * ey - y * ex ) ) / k;
73 void AliHLTTPCCATrackParam::GetDCAPoint(
float x,
float y,
float z,
74 float &xp,
float &yp,
float &zp,
81 float k = GetKappa( Bz );
82 float ex = GetCosPhi();
83 float ey = GetSinPhi();
86 float ax = dx * k + ey;
87 float ay = dy * k - ex;
88 float a = sqrt( ax * ax + ay * ay );
89 xp = x0 + ( dx - ey * ( ( dx * dx + dy * dy ) * k - 2 * ( -dx * ey + dy * ex ) ) / ( a + 1 ) ) / a;
90 yp = y0 + ( dy + ex * ( ( dx * dx + dy * dy ) * k - 2 * ( -dx * ey + dy * ex ) ) / ( a + 1 ) ) / a;
91 float s = GetS( x, y, Bz );
92 zp = GetZ() + GetDzDs() * s;
93 if ( CAMath::Abs( k ) > 1.e-2 ) {
94 float dZ = CAMath::Abs( GetDzDs() * CAMath::TwoPi() / k );
96 zp += CAMath::Nint( ( z - zp ) / dZ ) * dZ;
106 bool AliHLTTPCCATrackParam::TransportToX(
float x,
float sinPhi0,
float cosPhi0,
float Bz,
float maxSinPhi )
115 const float ex = cosPhi0;
116 const float ey = sinPhi0;
117 const float dx = x - X();
119 if ( CAMath::Abs( ex ) < 1.e-4 )
return 0;
120 const float exi = 1. / ex;
122 const float dxBz = dx * Bz;
123 const float dS = dx * exi;
124 const float h2 = dS * exi * exi;
125 const float h4 = .5 * h2 * dxBz;
133 const float sinPhi = SinPhi() + dxBz * QPt();
134 if ( maxSinPhi > 0 && CAMath::Abs( sinPhi ) > maxSinPhi )
return 0;
137 fP[0] += dS * ey + h2 * ( SinPhi() - ey ) + h4 * QPt();
138 fP[1] += dS * DzDs();
141 const float c00 = fC[0];
142 const float c10 = fC[1];
143 const float c11 = fC[2];
144 const float c20 = fC[3];
145 const float c21 = fC[4];
146 const float c22 = fC[5];
147 const float c30 = fC[6];
148 const float c31 = fC[7];
149 const float c32 = fC[8];
150 const float c33 = fC[9];
151 const float c40 = fC[10];
152 const float c41 = fC[11];
153 const float c42 = fC[12];
154 const float c43 = fC[13];
155 const float c44 = fC[14];
158 fC[0] = ( c00 + h2 * h2 * c22 + h4 * h4 * c44
159 + 2 * ( h2 * c20 + h4 * c40 + h2 * h4 * c42 ) );
161 fC[1] = c10 + h2 * c21 + h4 * c41 + dS * ( c30 + h2 * c32 + h4 * c43 );
162 fC[2] = c11 + 2 * dS * c31 + dS * dS * c33;
164 fC[3] = c20 + h2 * c22 + h4 * c42 + dxBz * ( c40 + h2 * c42 + h4 * c44 );
165 fC[4] = c21 + dS * c32 + dxBz * ( c41 + dS * c43 );
166 fC[5] = c22 + 2 * dxBz * c42 + dxBz * dxBz * c44;
168 fC[6] = c30 + h2 * c32 + h4 * c43;
169 fC[7] = c31 + dS * c33;
170 fC[8] = c32 + dxBz * c43;
173 fC[10] = c40 + h2 * c42 + h4 * c44;
174 fC[11] = c41 + dS * c43;
175 fC[12] = c42 + dxBz * c44;
182 bool AliHLTTPCCATrackParam::TransportToX(
float x,
float Bz,
float maxSinPhi )
188 return TransportToX( x, t0, Bz, maxSinPhi );
191 bool AliHLTTPCCATrackParam::TransportToXWithMaterial(
float x,
float Bz,
float maxSinPhi )
195 AliHLTTPCCATrackFitParam par;
196 CalculateFitParameters( par );
197 return TransportToXWithMaterial( x, par, Bz, maxSinPhi );
206 float AliHLTTPCCATrackParam::BetheBlochGeant(
float bg2,
227 const float mK = 0.307075e-3;
228 const float me = 0.511e-3;
229 const float rho = kp0;
230 const float x0 = kp1 * 2.303;
231 const float x1 = kp2 * 2.303;
232 const float mI = kp3;
233 const float mZA = kp4;
234 const float maxT = 2 * me * bg2;
238 const float x = 0.5 * CAMath::Log( bg2 );
239 const float lhwI = CAMath::Log( 28.816 * 1e-9 * CAMath::Sqrt( rho * mZA ) / mI );
242 }
else if ( x > x0 ) {
243 const float r = ( x1 - x ) / ( x1 - x0 );
244 d2 = lhwI + x - 0.5 + ( 0.5 - lhwI - x0 ) * r * r * r;
247 return mK*mZA*( 1 + bg2 ) / bg2*( 0.5*CAMath::Log( 2*me*bg2*maxT / ( mI*mI ) ) - bg2 / ( 1 + bg2 ) - d2 );
250 float AliHLTTPCCATrackParam::BetheBlochSolid(
float bg )
259 return BetheBlochGeant( bg );
262 float AliHLTTPCCATrackParam::BetheBlochGas(
float bg )
271 const float rho = 0.9e-3;
274 const float mI = 140.e-9;
275 const float mZA = 0.49555;
277 return BetheBlochGeant( bg, rho, x0, x1, mI, mZA );
290 bool AliHLTTPCCATrackParam::Rotate(
float alpha,
float maxSinPhi )
294 const float cA = CAMath::Cos( alpha );
295 const float sA = CAMath::Sin( alpha );
296 const float x = X(), y = Y(), sP = SinPhi(), cP = GetCosPhi();
297 const float cosPhi = cP * cA + sP * sA;
298 const float sinPhi = -cP * sA + sP * cA;
300 if ( CAMath::Abs( sinPhi ) > maxSinPhi || CAMath::Abs( cosPhi ) < 1.e-2 || CAMath::Abs( cP ) < 1.e-2 )
return 0;
302 const float j0 = cP / cosPhi;
303 const float j2 = cosPhi / cP;
306 SetY( -x*sA + y*cA );
307 SetSignCosPhi( CAMath::Abs(cosPhi)/cosPhi );
337 const float cA = CAMath::Cos( alpha );
338 const float sA = CAMath::Sin( alpha );
339 const float x0 = X(), y0 = Y(), sP = t0.SinPhi(), cP = t0.CosPhi();
340 const float cosPhi = cP * cA + sP * sA;
341 const float sinPhi = -cP * sA + sP * cA;
343 if ( CAMath::Abs( sinPhi ) > maxSinPhi || CAMath::Abs( cosPhi ) < 1.e-2 || CAMath::Abs( cP ) < 1.e-2 )
return 0;
351 const float j0 = cP / cosPhi;
352 const float j2 = cosPhi / cP;
353 const float d[2] = {Y() - y0, SinPhi() - sP};
355 SetX( x0*cA + y0*sA );
356 SetY( -x0*sA + y0*cA + j0*d[0] );
357 t0.SetCosPhi( cosPhi );
358 t0.SetSinPhi( sinPhi );
360 SetSinPhi( sinPhi + j2*d[1] );
444 #if !defined(HLTCA_GPUCODE)
448 void AliHLTTPCCATrackParam::Print()
const
452 #if !defined(HLTCA_GPUCODE)
453 std::cout <<
"track: x=" << GetX() <<
" c=" << GetSignCosPhi() <<
", P= " << GetY() <<
" " << GetZ() <<
" " << GetSinPhi() <<
" " << GetDzDs() <<
" " << GetQPt() << std::endl;
454 std::cout <<
"errs2: " << GetErr2Y() <<
" " << GetErr2Z() <<
" " << GetErr2SinPhi() <<
" " << GetErr2DzDs() <<
" " << GetErr2QPt() << std::endl;
464 for (
int i = 0; i < 5; i++ ) in >> t.fP[i];
465 for (
int i = 0; i < 15; i++ ) in >> t.fC[i];
476 for (
int i = 0; i < 5; i++ ) out << t.Par()[i] <<
" ";
478 for (
int i = 0; i < 15; i++ ) out << t.Cov()[i] <<
" ";