]>
Commit | Line | Data |
---|---|---|
73042f01 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
803d1ab0 | 16 | /* $Id$ */ |
0938c7d3 | 17 | |
73042f01 | 18 | //----------------------------------------------------------------- |
19 | // Implementation of the TPC track class | |
7c27857f | 20 | // This class is used by the AliTPCtracker class |
21 | // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch | |
73042f01 | 22 | //----------------------------------------------------------------- |
23 | ||
19364939 | 24 | #include <Riostream.h> |
b19a0509 | 25 | |
73042f01 | 26 | #include "AliTPCtrack.h" |
7c27857f | 27 | #include "AliCluster.h" |
9c9d2487 | 28 | #include "AliBarrelTrack.h" |
83d73500 | 29 | #include "AliESDtrack.h" |
73042f01 | 30 | |
31 | ClassImp(AliTPCtrack) | |
b9de75e1 | 32 | |
e3f7105e | 33 | //_________________________________________________________________________ |
34 | AliTPCtrack::AliTPCtrack(): AliKalmanTrack() | |
35 | { | |
2fc0c115 | 36 | //------------------------------------------------- |
37 | // default constructor | |
38 | //------------------------------------------------- | |
e3f7105e | 39 | fX = fP0 = fP1 = fP2 = fP3 = fP3 = fP4 = 0.0; |
40 | fAlpha = fdEdx = 0.0; | |
9c9d2487 | 41 | fNWrong = fNRotation = fNumber = 0; // [SR, 01.04.2003] |
e3f7105e | 42 | } |
43 | ||
73042f01 | 44 | //_________________________________________________________________________ |
45 | AliTPCtrack::AliTPCtrack(UInt_t index, const Double_t xx[5], | |
b19a0509 | 46 | const Double_t cc[15], Double_t xref, Double_t alpha) : AliKalmanTrack() { |
73042f01 | 47 | //----------------------------------------------------------------- |
48 | // This is the main track constructor. | |
49 | //----------------------------------------------------------------- | |
73042f01 | 50 | fX=xref; |
be9c5115 | 51 | fAlpha=alpha; |
52 | if (fAlpha<-TMath::Pi()) fAlpha += 2*TMath::Pi(); | |
53 | if (fAlpha>=TMath::Pi()) fAlpha -= 2*TMath::Pi(); | |
54 | fdEdx=0.; | |
73042f01 | 55 | |
b19a0509 | 56 | fP0=xx[0]; fP1=xx[1]; fP2=xx[2]; fP3=xx[3]; fP4=xx[4]; |
73042f01 | 57 | |
b19a0509 | 58 | fC00=cc[0]; |
59 | fC10=cc[1]; fC11=cc[2]; | |
60 | fC20=cc[3]; fC21=cc[4]; fC22=cc[5]; | |
61 | fC30=cc[6]; fC31=cc[7]; fC32=cc[8]; fC33=cc[9]; | |
62 | fC40=cc[10]; fC41=cc[11]; fC42=cc[12]; fC43=cc[13]; fC44=cc[14]; | |
73042f01 | 63 | |
be9c5115 | 64 | fIndex[0]=index; |
65 | SetNumberOfClusters(1); | |
51584047 | 66 | // |
67 | //MI | |
68 | fSdEdx = 0; | |
69 | fNFoundable = 0; | |
70 | fBConstrain = 0; | |
71 | fLastPoint = 0; | |
72 | fFirstPoint = 0; | |
73 | fRemoval = 0; | |
74 | fTrackType = 0; | |
75 | fLab2 = 0; | |
b9de75e1 | 76 | } |
77 | ||
78 | //_____________________________________________________________________________ | |
e1a65e92 | 79 | AliTPCtrack::AliTPCtrack(const AliKalmanTrack& t,Double_t alpha) : |
80 | AliKalmanTrack(t) { | |
b9de75e1 | 81 | //----------------------------------------------------------------- |
82 | // Conversion AliKalmanTrack -> AliTPCtrack. | |
83 | //----------------------------------------------------------------- | |
b9de75e1 | 84 | SetChi2(0.); |
85 | SetNumberOfClusters(0); | |
b9de75e1 | 86 | |
87 | fdEdx = 0.; | |
88 | fAlpha = alpha; | |
89 | if (fAlpha < -TMath::Pi()) fAlpha += 2*TMath::Pi(); | |
90 | else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi(); | |
91 | ||
92 | //Conversion of the track parameters | |
93 | Double_t x,p[5]; t.GetExternalParameters(x,p); | |
94 | fX=x; x=GetConvConst(); | |
95 | fP0=p[0]; | |
96 | fP1=p[1]; | |
97 | fP3=p[3]; | |
98 | fP4=p[4]/x; | |
99 | fP2=fP4*fX - p[2]; | |
100 | ||
101 | //Conversion of the covariance matrix | |
102 | Double_t c[15]; t.GetExternalCovariance(c); | |
103 | c[10]/=x; c[11]/=x; c[12]/=x; c[13]/=x; c[14]/=x*x; | |
104 | ||
105 | Double_t c22=fX*fX*c[14] - 2*fX*c[12] + c[5]; | |
106 | Double_t c32=fX*c[13] - c[8]; | |
107 | Double_t c20=fX*c[10] - c[3], c21=fX*c[11] - c[4], c42=fX*c[14] - c[12]; | |
108 | ||
109 | fC00=c[0 ]; | |
110 | fC10=c[1 ]; fC11=c[2 ]; | |
111 | fC20=c20; fC21=c21; fC22=c22; | |
112 | fC30=c[6 ]; fC31=c[7 ]; fC32=c32; fC33=c[9 ]; | |
113 | fC40=c[10]; fC41=c[11]; fC42=c42; fC43=c[13]; fC44=c[14]; | |
51584047 | 114 | // |
115 | //MI | |
116 | fSdEdx = 0; | |
117 | fNFoundable = 0; | |
118 | fBConstrain = 0; | |
119 | fLastPoint = 0; | |
120 | fFirstPoint = 0; | |
121 | fRemoval = 0; | |
122 | fTrackType = 0; | |
123 | fLab2 = 0; | |
73042f01 | 124 | } |
125 | ||
83d73500 | 126 | //_____________________________________________________________________________ |
127 | AliTPCtrack::AliTPCtrack(const AliESDtrack& t) : AliKalmanTrack() { | |
128 | //----------------------------------------------------------------- | |
129 | // Conversion AliESDtrack -> AliTPCtrack. | |
130 | //----------------------------------------------------------------- | |
131 | SetNumberOfClusters(t.GetTPCclusters(fIndex)); | |
132 | SetLabel(t.GetLabel()); | |
133 | SetMass(t.GetMass()); | |
134 | ||
135 | fdEdx = t.GetTPCsignal(); | |
136 | fAlpha = t.GetAlpha(); | |
137 | if (fAlpha < -TMath::Pi()) fAlpha += 2*TMath::Pi(); | |
138 | else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi(); | |
139 | ||
140 | //Conversion of the track parameters | |
141 | Double_t x,p[5]; t.GetExternalParameters(x,p); | |
142 | fX=x; x=GetConvConst(); | |
143 | fP0=p[0]; | |
144 | fP1=p[1]; | |
145 | fP3=p[3]; | |
146 | fP4=p[4]/x; | |
147 | fP2=fP4*fX - p[2]; | |
148 | ||
149 | //Conversion of the covariance matrix | |
150 | Double_t c[15]; t.GetExternalCovariance(c); | |
151 | c[10]/=x; c[11]/=x; c[12]/=x; c[13]/=x; c[14]/=x*x; | |
152 | ||
153 | Double_t c22=fX*fX*c[14] - 2*fX*c[12] + c[5]; | |
154 | Double_t c32=fX*c[13] - c[8]; | |
155 | Double_t c20=fX*c[10] - c[3], c21=fX*c[11] - c[4], c42=fX*c[14] - c[12]; | |
156 | ||
157 | fC00=c[0 ]; | |
158 | fC10=c[1 ]; fC11=c[2 ]; | |
159 | fC20=c20; fC21=c21; fC22=c22; | |
160 | fC30=c[6 ]; fC31=c[7 ]; fC32=c32; fC33=c[9 ]; | |
161 | fC40=c[10]; fC41=c[11]; fC42=c42; fC43=c[13]; fC44=c[14]; | |
162 | ||
0798b21e | 163 | if ((t.GetStatus()&AliESDtrack::kTIME) == 0) return; |
83d73500 | 164 | StartTimeIntegral(); |
165 | Double_t times[10]; t.GetIntegratedTimes(times); SetIntegratedTimes(times); | |
166 | SetIntegratedLength(t.GetIntegratedLength()); | |
51584047 | 167 | // |
168 | //MI | |
169 | fSdEdx = 0; | |
170 | fNFoundable = 0; | |
171 | fBConstrain = 0; | |
172 | fLastPoint = 0; | |
173 | fFirstPoint = 0; | |
174 | fRemoval = 0; | |
175 | fTrackType = 0; | |
176 | fLab2 = 0; | |
babd135a | 177 | // SetFakeRatio(t.GetTPCFakeRatio()); |
83d73500 | 178 | } |
179 | ||
73042f01 | 180 | //_____________________________________________________________________________ |
b19a0509 | 181 | AliTPCtrack::AliTPCtrack(const AliTPCtrack& t) : AliKalmanTrack(t) { |
73042f01 | 182 | //----------------------------------------------------------------- |
183 | // This is a track copy constructor. | |
184 | //----------------------------------------------------------------- | |
be9c5115 | 185 | fX=t.fX; |
186 | fAlpha=t.fAlpha; | |
73042f01 | 187 | fdEdx=t.fdEdx; |
188 | ||
be9c5115 | 189 | fP0=t.fP0; fP1=t.fP1; fP2=t.fP2; fP3=t.fP3; fP4=t.fP4; |
190 | ||
191 | fC00=t.fC00; | |
192 | fC10=t.fC10; fC11=t.fC11; | |
193 | fC20=t.fC20; fC21=t.fC21; fC22=t.fC22; | |
194 | fC30=t.fC30; fC31=t.fC31; fC32=t.fC32; fC33=t.fC33; | |
195 | fC40=t.fC40; fC41=t.fC41; fC42=t.fC42; fC43=t.fC43; fC44=t.fC44; | |
196 | ||
176aff27 | 197 | //Int_t n=GetNumberOfClusters(); |
51584047 | 198 | for (Int_t i=0; i<kMaxRow; i++) fIndex[i]=t.fIndex[i]; |
199 | // | |
200 | //MI | |
201 | fSdEdx = t.fSdEdx; | |
202 | fNFoundable = t.fNFoundable; | |
203 | fBConstrain = t.fBConstrain; | |
204 | fLastPoint = t.fLastPoint; | |
205 | fFirstPoint = t.fFirstPoint; | |
206 | fRemoval = t.fRemoval ; | |
207 | fTrackType = t.fTrackType; | |
208 | fLab2 = t.fLab2; | |
209 | ||
be9c5115 | 210 | } |
9c9d2487 | 211 | //_____________________________________________________________________________ |
212 | ||
2fc0c115 | 213 | void AliTPCtrack::GetBarrelTrack(AliBarrelTrack *track) const{ |
9c9d2487 | 214 | // |
215 | // Create a Barrel Track out of this track | |
216 | // Current track is propagated to the reference plane | |
217 | // by the tracker | |
218 | // | |
219 | // [SR, 01.04.2003] | |
220 | ||
221 | if (!track) return; | |
222 | Double_t xr, vec[5], cov[15]; | |
223 | ||
224 | track->SetLabel(GetLabel()); | |
225 | track->SetX(fX, fAlpha); | |
226 | track->SetNClusters(GetNumberOfClusters(), GetChi2()); | |
2b5dc063 | 227 | Double_t times[10]; |
228 | GetIntegratedTimes(times); | |
229 | track->SetTime(times, GetIntegratedLength()); | |
9c9d2487 | 230 | |
2b5dc063 | 231 | track->SetMass(GetMass()); |
232 | track->SetdEdX(GetdEdx()); | |
9c9d2487 | 233 | |
234 | track->SetNWrongClusters(fNWrong); | |
235 | track->SetNRotate(fNRotation); | |
be9c5115 | 236 | |
9c9d2487 | 237 | GetExternalParameters(xr, vec); |
238 | track->SetStateVector(vec); | |
239 | ||
240 | GetExternalCovariance(cov); | |
241 | track->SetCovarianceMatrix(cov); | |
242 | ||
243 | } | |
be9c5115 | 244 | //_____________________________________________________________________________ |
245 | Int_t AliTPCtrack::Compare(const TObject *o) const { | |
246 | //----------------------------------------------------------------- | |
247 | // This function compares tracks according to the their curvature | |
248 | //----------------------------------------------------------------- | |
249 | AliTPCtrack *t=(AliTPCtrack*)o; | |
024a7fe9 | 250 | //Double_t co=TMath::Abs(t->Get1Pt()); |
251 | //Double_t c =TMath::Abs(Get1Pt()); | |
252 | Double_t co=t->GetSigmaY2()*t->GetSigmaZ2(); | |
253 | Double_t c =GetSigmaY2()*GetSigmaZ2(); | |
be9c5115 | 254 | if (c>co) return 1; |
255 | else if (c<co) return -1; | |
256 | return 0; | |
257 | } | |
258 | ||
259 | //_____________________________________________________________________________ | |
260 | void AliTPCtrack::GetExternalCovariance(Double_t cc[15]) const { | |
261 | //------------------------------------------------------------------------- | |
262 | // This function returns an external representation of the covriance matrix. | |
263 | // (See comments in AliTPCtrack.h about external track representation) | |
264 | //------------------------------------------------------------------------- | |
9b280d80 | 265 | Double_t a=GetConvConst(); |
be9c5115 | 266 | |
b9de75e1 | 267 | Double_t c22=fX*fX*fC44-2*fX*fC42+fC22; |
268 | Double_t c32=fX*fC43-fC32; | |
269 | Double_t c20=fX*fC40-fC20, c21=fX*fC41-fC21, c42=fX*fC44-fC42; | |
be9c5115 | 270 | |
271 | cc[0 ]=fC00; | |
272 | cc[1 ]=fC10; cc[2 ]=fC11; | |
273 | cc[3 ]=c20; cc[4 ]=c21; cc[5 ]=c22; | |
b9de75e1 | 274 | cc[6 ]=fC30; cc[7 ]=fC31; cc[8 ]=c32; cc[9 ]=fC33; |
275 | cc[10]=fC40*a; cc[11]=fC41*a; cc[12]=c42*a; cc[13]=fC43*a; cc[14]=fC44*a*a; | |
be9c5115 | 276 | |
277 | } | |
278 | ||
279 | //_____________________________________________________________________________ | |
280 | Double_t AliTPCtrack::GetPredictedChi2(const AliCluster *c) const | |
281 | { | |
282 | //----------------------------------------------------------------- | |
283 | // This function calculates a predicted chi2 increment. | |
284 | //----------------------------------------------------------------- | |
285 | Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2(); | |
286 | r00+=fC00; r01+=fC10; r11+=fC11; | |
287 | ||
288 | Double_t det=r00*r11 - r01*r01; | |
289 | if (TMath::Abs(det) < 1.e-10) { | |
290 | Int_t n=GetNumberOfClusters(); | |
291 | if (n>4) cerr<<n<<" AliKalmanTrack warning: Singular matrix !\n"; | |
292 | return 1e10; | |
293 | } | |
294 | Double_t tmp=r00; r00=r11; r11=tmp; r01=-r01; | |
295 | ||
296 | Double_t dy=c->GetY() - fP0, dz=c->GetZ() - fP1; | |
297 | ||
298 | return (dy*r00*dy + 2*r01*dy*dz + dz*r11*dz)/det; | |
73042f01 | 299 | } |
300 | ||
c630aafd | 301 | Double_t AliTPCtrack::GetYat(Double_t xk) const { |
302 | //----------------------------------------------------------------- | |
303 | // This function calculates the Y-coordinate of a track at the plane x=xk. | |
304 | //----------------------------------------------------------------- | |
305 | Double_t c1=fP4*fX - fP2, r1=TMath::Sqrt(1.- c1*c1); | |
df02fd67 | 306 | Double_t c2=fP4*xk - fP2; |
307 | if (c2*c2>0.99999) { | |
308 | Int_t n=GetNumberOfClusters(); | |
309 | if (n>4) cerr<<n<<"AliTPCtrack::GetYat: can't evaluate the y-coord !\n"; | |
310 | return 1e10; | |
311 | } | |
312 | Double_t r2=TMath::Sqrt(1.- c2*c2); | |
c630aafd | 313 | return fP0 + (xk-fX)*(c1+c2)/(r1+r2); |
314 | } | |
315 | ||
73042f01 | 316 | //_____________________________________________________________________________ |
176aff27 | 317 | Int_t AliTPCtrack::PropagateTo(Double_t xk,Double_t /*x0*/,Double_t rho) { |
73042f01 | 318 | //----------------------------------------------------------------- |
319 | // This function propagates a track to a reference plane x=xk. | |
320 | //----------------------------------------------------------------- | |
1627d1c4 | 321 | if (TMath::Abs(fP4*xk - fP2) >= 0.9) { |
322 | // Int_t n=GetNumberOfClusters(); | |
323 | //if (n>4) cerr<<n<<" AliTPCtrack warning: Propagation failed !\n"; | |
73042f01 | 324 | return 0; |
325 | } | |
e3f7105e | 326 | |
327 | // old position for time [SR, GSI 17.02.2003] | |
328 | Double_t oldX = fX; | |
329 | Double_t oldY = fP0; | |
330 | Double_t oldZ = fP1; | |
331 | // | |
73042f01 | 332 | |
b19a0509 | 333 | Double_t x1=fX, x2=x1+(xk-x1), dx=x2-x1, y1=fP0, z1=fP1; |
b9de75e1 | 334 | Double_t c1=fP4*x1 - fP2, r1=sqrt(1.- c1*c1); |
335 | Double_t c2=fP4*x2 - fP2, r2=sqrt(1.- c2*c2); | |
73042f01 | 336 | |
b19a0509 | 337 | fP0 += dx*(c1+c2)/(r1+r2); |
b9de75e1 | 338 | fP1 += dx*(c1+c2)/(c1*r2 + c2*r1)*fP3; |
73042f01 | 339 | |
340 | //f = F - 1 | |
341 | Double_t rr=r1+r2, cc=c1+c2, xx=x1+x2; | |
b19a0509 | 342 | Double_t f02=-dx*(2*rr + cc*(c1/r1 + c2/r2))/(rr*rr); |
b9de75e1 | 343 | Double_t f04= dx*(rr*xx + cc*(c1*x1/r1+c2*x2/r2))/(rr*rr); |
73042f01 | 344 | Double_t cr=c1*r2+c2*r1; |
b9de75e1 | 345 | Double_t f12=-dx*fP3*(2*cr + cc*(c2*c1/r1-r1 + c1*c2/r2-r2))/(cr*cr); |
346 | Double_t f13= dx*cc/cr; | |
347 | Double_t f14=dx*fP3*(cr*xx-cc*(r1*x2-c2*c1*x1/r1+r2*x1-c1*c2*x2/r2))/(cr*cr); | |
73042f01 | 348 | |
349 | //b = C*ft | |
b9de75e1 | 350 | Double_t b00=f02*fC20 + f04*fC40, b01=f12*fC20 + f14*fC40 + f13*fC30; |
351 | Double_t b10=f02*fC21 + f04*fC41, b11=f12*fC21 + f14*fC41 + f13*fC31; | |
352 | Double_t b20=f02*fC22 + f04*fC42, b21=f12*fC22 + f14*fC42 + f13*fC32; | |
353 | Double_t b30=f02*fC32 + f04*fC43, b31=f12*fC32 + f14*fC43 + f13*fC33; | |
354 | Double_t b40=f02*fC42 + f04*fC44, b41=f12*fC42 + f14*fC44 + f13*fC43; | |
73042f01 | 355 | |
356 | //a = f*b = f*C*ft | |
b9de75e1 | 357 | Double_t a00=f02*b20+f04*b40,a01=f02*b21+f04*b41,a11=f12*b21+f14*b41+f13*b31; |
73042f01 | 358 | |
359 | //F*C*Ft = C + (a + b + bt) | |
b19a0509 | 360 | fC00 += a00 + 2*b00; |
361 | fC10 += a01 + b01 + b10; | |
362 | fC20 += b20; | |
363 | fC30 += b30; | |
364 | fC40 += b40; | |
365 | fC11 += a11 + 2*b11; | |
366 | fC21 += b21; | |
367 | fC31 += b31; | |
368 | fC41 += b41; | |
73042f01 | 369 | |
370 | fX=x2; | |
371 | ||
372 | //Multiple scattering****************** | |
b19a0509 | 373 | Double_t d=sqrt((x1-fX)*(x1-fX)+(y1-fP0)*(y1-fP0)+(z1-fP1)*(z1-fP1)); |
be9c5115 | 374 | Double_t p2=(1.+ GetTgl()*GetTgl())/(Get1Pt()*Get1Pt()); |
7f6ddf58 | 375 | Double_t beta2=p2/(p2 + GetMass()*GetMass()); |
babd135a | 376 | beta2 = TMath::Min(beta2,0.99999999999); |
024a7fe9 | 377 | //Double_t theta2=14.1*14.1/(beta2*p2*1e6)*d/x0*rho; |
378 | Double_t theta2=1.0259e-6*10*10/20/(beta2*p2)*d*rho; | |
73042f01 | 379 | |
b9de75e1 | 380 | Double_t ey=fP4*fX - fP2, ez=fP3; |
381 | Double_t xz=fP4*ez, zz1=ez*ez+1, xy=fP2+ey; | |
982aff31 | 382 | |
b19a0509 | 383 | fC22 += (2*ey*ez*ez*fP2+1-ey*ey+ez*ez+fP2*fP2*ez*ez)*theta2; |
b9de75e1 | 384 | fC32 += ez*zz1*xy*theta2; |
385 | fC33 += zz1*zz1*theta2; | |
386 | fC42 += xz*ez*xy*theta2; | |
387 | fC43 += xz*zz1*theta2; | |
388 | fC44 += xz*xz*theta2; | |
982aff31 | 389 | /* |
390 | // | |
391 | //MI coeficints | |
392 | Double_t dc22 = (1-ey*ey+xz*xz*fX*fX)*theta2; | |
393 | Double_t dc32 = (xz*fX*zz1)*theta2; | |
394 | Double_t dc33 = (zz1*zz1)*theta2; | |
395 | Double_t dc42 = (xz*fX*xz)*theta2; | |
396 | Double_t dc43 = (zz1*xz)*theta2; | |
397 | Double_t dc44 = (xz*xz)*theta2; | |
398 | fC22 += dc22; | |
399 | fC32 += dc32; | |
400 | fC33 += dc33; | |
401 | fC42 += dc42; | |
402 | fC43 += dc43; | |
403 | fC44 += dc44; | |
404 | */ | |
73042f01 | 405 | //Energy losses************************ |
406 | Double_t dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2)) - beta2)*d*rho; | |
407 | if (x1 < x2) dE=-dE; | |
b9de75e1 | 408 | cc=fP4; |
982aff31 | 409 | |
410 | //Double_t E = sqrt(p2+GetMass()*GetMass()); | |
411 | //Double_t mifac = TMath::Sqrt(1.+dE*dE/p2+2*E*dE/p2)-1; | |
412 | //Double_t belfac = E*dE/p2; | |
413 | // | |
7f6ddf58 | 414 | fP4*=(1.- sqrt(p2+GetMass()*GetMass())/p2*dE); |
b9de75e1 | 415 | fP2+=fX*(fP4-cc); |
73042f01 | 416 | |
e3f7105e | 417 | // Integrated Time [SR, GSI, 17.02.2003] |
0fa7dfa7 | 418 | if (x1 < x2) |
419 | if (IsStartedTimeIntegral()) { | |
e3f7105e | 420 | Double_t l2 = (fX-oldX)*(fX-oldX)+(fP0-oldY)*(fP0-oldY)+(fP1-oldZ)*(fP1-oldZ); |
421 | AddTimeStep(TMath::Sqrt(l2)); | |
422 | } | |
423 | // | |
424 | ||
73042f01 | 425 | return 1; |
426 | } | |
427 | ||
428 | //_____________________________________________________________________________ | |
7f6ddf58 | 429 | Int_t AliTPCtrack::PropagateToVertex(Double_t x0,Double_t rho) |
73042f01 | 430 | { |
431 | //----------------------------------------------------------------- | |
432 | // This function propagates tracks to the "vertex". | |
433 | //----------------------------------------------------------------- | |
b9de75e1 | 434 | Double_t c=fP4*fX - fP2; |
435 | Double_t tgf=-fP2/(fP4*fP0 + sqrt(1-c*c)); | |
73042f01 | 436 | Double_t snf=tgf/sqrt(1.+ tgf*tgf); |
b9de75e1 | 437 | Double_t xv=(fP2+snf)/fP4; |
7f6ddf58 | 438 | return PropagateTo(xv,x0,rho); |
73042f01 | 439 | } |
440 | ||
441 | //_____________________________________________________________________________ | |
be9c5115 | 442 | Int_t AliTPCtrack::Update(const AliCluster *c, Double_t chisq, UInt_t index) { |
73042f01 | 443 | //----------------------------------------------------------------- |
444 | // This function associates a cluster with this track. | |
445 | //----------------------------------------------------------------- | |
9c9d2487 | 446 | |
447 | // update the number of wrong SR[20.03.2003] | |
448 | Int_t absLabel = TMath::Abs(GetLabel()); | |
449 | if ( (c->GetLabel(0) != absLabel) && | |
450 | (c->GetLabel(0) != absLabel) && | |
451 | (c->GetLabel(0) != absLabel)) fNWrong++; | |
452 | // | |
453 | ||
73042f01 | 454 | Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2(); |
b19a0509 | 455 | r00+=fC00; r01+=fC10; r11+=fC11; |
73042f01 | 456 | Double_t det=r00*r11 - r01*r01; |
457 | Double_t tmp=r00; r00=r11/det; r11=tmp/det; r01=-r01/det; | |
458 | ||
b19a0509 | 459 | Double_t k00=fC00*r00+fC10*r01, k01=fC00*r01+fC10*r11; |
460 | Double_t k10=fC10*r00+fC11*r01, k11=fC10*r01+fC11*r11; | |
461 | Double_t k20=fC20*r00+fC21*r01, k21=fC20*r01+fC21*r11; | |
462 | Double_t k30=fC30*r00+fC31*r01, k31=fC30*r01+fC31*r11; | |
463 | Double_t k40=fC40*r00+fC41*r01, k41=fC40*r01+fC41*r11; | |
73042f01 | 464 | |
b19a0509 | 465 | Double_t dy=c->GetY() - fP0, dz=c->GetZ() - fP1; |
b9de75e1 | 466 | Double_t cur=fP4 + k40*dy + k41*dz, eta=fP2 + k20*dy + k21*dz; |
1627d1c4 | 467 | if (TMath::Abs(cur*fX-eta) >= 0.9) { |
468 | // Int_t n=GetNumberOfClusters(); | |
469 | //if (n>4) cerr<<n<<" AliTPCtrack warning: Filtering failed !\n"; | |
be9c5115 | 470 | return 0; |
73042f01 | 471 | } |
472 | ||
b19a0509 | 473 | fP0 += k00*dy + k01*dz; |
474 | fP1 += k10*dy + k11*dz; | |
475 | fP2 = eta; | |
b9de75e1 | 476 | fP3 += k30*dy + k31*dz; |
477 | fP4 = cur; | |
73042f01 | 478 | |
b19a0509 | 479 | Double_t c01=fC10, c02=fC20, c03=fC30, c04=fC40; |
480 | Double_t c12=fC21, c13=fC31, c14=fC41; | |
73042f01 | 481 | |
b19a0509 | 482 | fC00-=k00*fC00+k01*fC10; fC10-=k00*c01+k01*fC11; |
483 | fC20-=k00*c02+k01*c12; fC30-=k00*c03+k01*c13; | |
484 | fC40-=k00*c04+k01*c14; | |
73042f01 | 485 | |
b19a0509 | 486 | fC11-=k10*c01+k11*fC11; |
487 | fC21-=k10*c02+k11*c12; fC31-=k10*c03+k11*c13; | |
488 | fC41-=k10*c04+k11*c14; | |
73042f01 | 489 | |
b19a0509 | 490 | fC22-=k20*c02+k21*c12; fC32-=k20*c03+k21*c13; |
491 | fC42-=k20*c04+k21*c14; | |
73042f01 | 492 | |
b19a0509 | 493 | fC33-=k30*c03+k31*c13; |
b9de75e1 | 494 | fC43-=k40*c03+k41*c13; |
73042f01 | 495 | |
b19a0509 | 496 | fC44-=k40*c04+k41*c14; |
73042f01 | 497 | |
be9c5115 | 498 | Int_t n=GetNumberOfClusters(); |
499 | fIndex[n]=index; | |
500 | SetNumberOfClusters(n+1); | |
501 | SetChi2(GetChi2()+chisq); | |
502 | ||
503 | return 1; | |
73042f01 | 504 | } |
505 | ||
506 | //_____________________________________________________________________________ | |
507 | Int_t AliTPCtrack::Rotate(Double_t alpha) | |
508 | { | |
509 | //----------------------------------------------------------------- | |
510 | // This function rotates this track. | |
511 | //----------------------------------------------------------------- | |
9c9d2487 | 512 | |
513 | if (alpha != 0) fNRotation++; // [SR, 01.04.2003] | |
514 | ||
73042f01 | 515 | fAlpha += alpha; |
be9c5115 | 516 | if (fAlpha<-TMath::Pi()) fAlpha += 2*TMath::Pi(); |
517 | if (fAlpha>=TMath::Pi()) fAlpha -= 2*TMath::Pi(); | |
73042f01 | 518 | |
b19a0509 | 519 | Double_t x1=fX, y1=fP0; |
73042f01 | 520 | Double_t ca=cos(alpha), sa=sin(alpha); |
b9de75e1 | 521 | Double_t r1=fP4*fX - fP2; |
73042f01 | 522 | |
523 | fX = x1*ca + y1*sa; | |
b19a0509 | 524 | fP0=-x1*sa + y1*ca; |
b9de75e1 | 525 | fP2=fP2*ca + (fP4*y1 + sqrt(1.- r1*r1))*sa; |
73042f01 | 526 | |
b9de75e1 | 527 | Double_t r2=fP4*fX - fP2; |
73042f01 | 528 | if (TMath::Abs(r2) >= 0.99999) { |
be9c5115 | 529 | Int_t n=GetNumberOfClusters(); |
530 | if (n>4) cerr<<n<<" AliTPCtrack warning: Rotation failed !\n"; | |
73042f01 | 531 | return 0; |
532 | } | |
533 | ||
b9de75e1 | 534 | Double_t y0=fP0 + sqrt(1.- r2*r2)/fP4; |
535 | if ((fP0-y0)*fP4 >= 0.) { | |
be9c5115 | 536 | Int_t n=GetNumberOfClusters(); |
537 | if (n>4) cerr<<n<<" AliTPCtrack warning: Rotation failed !!!\n"; | |
73042f01 | 538 | return 0; |
539 | } | |
540 | ||
541 | //f = F - 1 | |
b9de75e1 | 542 | Double_t f00=ca-1, f24=(y1 - r1*x1/sqrt(1.- r1*r1))*sa, |
543 | f20=fP4*sa, f22=(ca + sa*r1/sqrt(1.- r1*r1))-1; | |
73042f01 | 544 | |
545 | //b = C*ft | |
b9de75e1 | 546 | Double_t b00=fC00*f00, b02=fC00*f20+fC40*f24+fC20*f22; |
547 | Double_t b10=fC10*f00, b12=fC10*f20+fC41*f24+fC21*f22; | |
548 | Double_t b20=fC20*f00, b22=fC20*f20+fC42*f24+fC22*f22; | |
549 | Double_t b30=fC30*f00, b32=fC30*f20+fC43*f24+fC32*f22; | |
550 | Double_t b40=fC40*f00, b42=fC40*f20+fC44*f24+fC42*f22; | |
73042f01 | 551 | |
552 | //a = f*b = f*C*ft | |
b9de75e1 | 553 | Double_t a00=f00*b00, a02=f00*b02, a22=f20*b02+f24*b42+f22*b22; |
73042f01 | 554 | |
555 | // *** Double_t dy2=fCyy; | |
556 | ||
557 | //F*C*Ft = C + (a + b + bt) | |
b19a0509 | 558 | fC00 += a00 + 2*b00; |
559 | fC10 += b10; | |
560 | fC20 += a02+b20+b02; | |
561 | fC30 += b30; | |
562 | fC40 += b40; | |
563 | fC21 += b12; | |
564 | fC32 += b32; | |
565 | fC22 += a22 + 2*b22; | |
566 | fC42 += b42; | |
73042f01 | 567 | |
568 | // *** fCyy+=dy2*sa*sa*r1*r1/(1.- r1*r1); | |
569 | // *** fCzz+=d2y*sa*sa*fT*fT/(1.- r1*r1); | |
570 | ||
571 | return 1; | |
572 | } | |
573 | ||
b9de75e1 | 574 | void AliTPCtrack::ResetCovariance() { |
575 | //------------------------------------------------------------------ | |
576 | //This function makes a track forget its history :) | |
577 | //------------------------------------------------------------------ | |
578 | ||
579 | fC00*=10.; | |
580 | fC10=0.; fC11*=10.; | |
581 | fC20=0.; fC21=0.; fC22*=10.; | |
582 | fC30=0.; fC31=0.; fC32=0.; fC33*=10.; | |
583 | fC40=0.; fC41=0.; fC42=0.; fC43=0.; fC44*=10.; | |
584 | ||
73042f01 | 585 | } |
77e58468 | 586 | |
587 | //////////////////////////////////////////////////////////////////////// | |
588 | Double_t AliTPCtrack::Phi() const { | |
7c27857f | 589 | // |
590 | // | |
591 | // | |
77e58468 | 592 | Double_t phi = TMath::ASin(GetSnp()) + fAlpha; |
593 | if (phi<0) phi+=2*TMath::Pi(); | |
594 | if (phi>=2*TMath::Pi()) phi-=2*TMath::Pi(); | |
595 | return phi; | |
596 | } | |
597 | //////////////////////////////////////////////////////////////////////// | |
598 | ||
51584047 | 599 | |
600 | ||
601 | //////////////////////////////////////////////////////////////////////// | |
602 | // MI ADDITION | |
603 | ||
604 | Float_t AliTPCtrack::Density(Int_t row0, Int_t row1) | |
605 | { | |
606 | // | |
607 | // calculate cluster density | |
608 | Int_t good = 0; | |
609 | Int_t found = 0; | |
610 | //if (row0<fFirstPoint) row0 = fFirstPoint; | |
611 | if (row1>fLastPoint) row1 = fLastPoint; | |
612 | ||
613 | ||
614 | for (Int_t i=row0;i<=row1;i++){ | |
615 | // Int_t index = fClusterIndex[i]; | |
616 | Int_t index = fIndex[i]; | |
617 | if (index!=-1) good++; | |
618 | if (index>0) found++; | |
619 | } | |
620 | Float_t density=0; | |
621 | if (good>0) density = Float_t(found)/Float_t(good); | |
622 | return density; | |
623 | } | |
624 | ||
625 | ||
626 | Float_t AliTPCtrack::Density2(Int_t row0, Int_t row1) | |
627 | { | |
628 | // | |
629 | // calculate cluster density | |
630 | Int_t good = 0; | |
631 | Int_t found = 0; | |
632 | // | |
633 | for (Int_t i=row0;i<=row1;i++){ | |
634 | Int_t index = fIndex[i]; | |
635 | if (index!=-1) good++; | |
636 | if (index>0) found++; | |
637 | } | |
638 | Float_t density=0; | |
639 | if (good>0) density = Float_t(found)/Float_t(good); | |
640 | return density; | |
641 | } | |
642 | ||
643 | ||
644 | Double_t AliTPCtrack::GetZat0() const | |
645 | { | |
646 | // | |
647 | // return virtual z - supposing that x = 0 | |
648 | if (TMath::Abs(fP2)>1) return 0; | |
649 | if (TMath::Abs(fX*fP4-fP2)>1) return 0; | |
650 | Double_t vz = fP1+fP3/fP4*(asin(-fP2)-asin(fX*fP4-fP2)); | |
651 | return vz; | |
652 | } | |
653 | ||
654 | ||
655 | Double_t AliTPCtrack::GetD(Double_t x, Double_t y) const { | |
656 | //------------------------------------------------------------------ | |
657 | // This function calculates the transverse impact parameter | |
658 | // with respect to a point with global coordinates (x,y) | |
659 | //------------------------------------------------------------------ | |
660 | //Double_t xt=fX, yt=fP0; | |
661 | ||
662 | Double_t sn=TMath::Sin(fAlpha), cs=TMath::Cos(fAlpha); | |
663 | Double_t a = x*cs + y*sn; | |
664 | y = -x*sn + y*cs; x=a; | |
665 | // | |
666 | Double_t r = TMath::Abs(1/fP4); | |
667 | Double_t x0 = TMath::Abs(fP2*r); | |
668 | Double_t y0 = fP0; | |
669 | y0= fP0+TMath::Sqrt(1-(fP4*fX-fP2)*(fP4*fX-fP2))/fP4; | |
670 | ||
671 | Double_t delta = TMath::Sqrt((x-x0)*(x-x0)+(y-y0)*(y-y0)); | |
672 | // Double_t delta = TMath::Sqrt(TMath::Abs(x*x-2*x0*x+x0*x0+ y*y-2*y*y0+y0*y0)); | |
673 | delta -= TMath::Abs(r); | |
674 | return delta; | |
675 | } |