AliTrack() defined in the implementation file
[u/mrichter/AliRoot.git] / TRD / AliTRDtrack.cxx
CommitLineData
46d29e70 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
16/*
17$Log$
b8dc2353 18Revision 1.15 2003/01/27 16:34:49 cblume
19Update of tracking by Sergei and Chuncheng
20
b3a5a838 21Revision 1.14 2002/11/07 15:52:09 cblume
22Update of tracking code for tilted pads
23
fd621f36 24Revision 1.13 2002/10/22 15:53:08 alibrary
25Introducing Riostream.h
26
a2cb5b3d 27Revision 1.12 2002/10/14 14:57:44 hristov
28Merging the VirtualMC branch to the main development branch (HEAD)
29
b9d0a01d 30Revision 1.8.10.2 2002/07/24 10:09:31 alibrary
31Updating VirtualMC
32
fd621f36 33RRevision 1.11 2002/06/13 12:09:58 hristov
b9d0a01d 34Minor corrections
35
ca6c93d6 36Revision 1.10 2002/06/12 09:54:35 cblume
37Update of tracking code provided by Sergei
38
0a29d0f1 39Revision 1.8 2001/05/30 12:17:47 hristov
40Loop variables declared once
41
3ab6f951 42Revision 1.7 2001/05/28 17:07:58 hristov
43Last minute changes; ExB correction in AliTRDclusterizerV1; taking into account of material in G10 TEC frames and material between TEC planes (C.Blume,S.Sedykh)
44
2a941f4e 45Revision 1.4 2000/12/08 16:07:02 cblume
46Update of the tracking by Sergei
47
bbf92647 48Revision 1.3 2000/10/15 23:40:01 cblume
49Remove AliTRDconst
50
0e9c2ad5 51Revision 1.2 2000/10/06 16:49:46 cblume
52Made Getters const
53
46d29e70 54Revision 1.1.2.1 2000/09/22 14:47:52 cblume
55Add the tracking code
56
57*/
58
a2cb5b3d 59#include <Riostream.h>
5443e65e 60#include <TObject.h>
46d29e70 61
46d29e70 62#include "AliTRDgeometry.h"
63#include "AliTRDcluster.h"
64#include "AliTRDtrack.h"
5443e65e 65#include "../TPC/AliTPCtrack.h"
46d29e70 66
b3a5a838 67
46d29e70 68ClassImp(AliTRDtrack)
69
70
71//_____________________________________________________________________________
72
a819a5f7 73AliTRDtrack::AliTRDtrack(const AliTRDcluster *c, UInt_t index,
5443e65e 74 const Double_t xx[5], const Double_t cc[15],
75 Double_t xref, Double_t alpha) : AliKalmanTrack() {
46d29e70 76 //-----------------------------------------------------------------
77 // This is the main track constructor.
78 //-----------------------------------------------------------------
5443e65e 79
80 fSeedLab = -1;
46d29e70 81
82 fAlpha=alpha;
5443e65e 83 if (fAlpha<-TMath::Pi()) fAlpha += 2*TMath::Pi();
84 if (fAlpha>=TMath::Pi()) fAlpha -= 2*TMath::Pi();
85
46d29e70 86 fX=xref;
87
b3a5a838 88 fY=xx[0]; fZ=xx[1]; fE=xx[2]; fT=xx[3]; fC=xx[4];
46d29e70 89
90 fCyy=cc[0];
91 fCzy=cc[1]; fCzz=cc[2];
b3a5a838 92 fCey=cc[3]; fCez=cc[4]; fCee=cc[5];
93 fCty=cc[6]; fCtz=cc[7]; fCte=cc[8]; fCtt=cc[9];
b8dc2353 94 fCcy=cc[10]; fCcz=cc[11]; fCce=cc[12]; fCct=cc[13]; fCcc=cc[14];
95
5443e65e 96 fIndex[0]=index;
97 SetNumberOfClusters(1);
98
99 fdEdx=0.;
a2b90f83 100
b3a5a838 101 fLhElectron = 0.0;
102
5443e65e 103 Double_t q = TMath::Abs(c->GetQ());
a819a5f7 104 Double_t s = fX*fC - fE, t=fT;
5443e65e 105 if(s*s < 1) q *= TMath::Sqrt((1-s*s)/(1+t*t));
106
107 fdQdl[0] = q;
b8dc2353 108
46d29e70 109}
110
111//_____________________________________________________________________________
5443e65e 112AliTRDtrack::AliTRDtrack(const AliTRDtrack& t) : AliKalmanTrack(t) {
46d29e70 113 //
114 // Copy constructor.
115 //
b8dc2353 116
5443e65e 117 SetLabel(t.GetLabel());
118 fSeedLab=t.GetSeedLabel();
46d29e70 119
5443e65e 120 SetChi2(t.GetChi2());
46d29e70 121 fdEdx=t.fdEdx;
122
b3a5a838 123 fLhElectron = 0.0;
124
46d29e70 125 fAlpha=t.fAlpha;
126 fX=t.fX;
127
b8dc2353 128 fY=t.fY; fZ=t.fZ; fE=t.fE; fT=t.fT; fC=t.fC;
46d29e70 129
130 fCyy=t.fCyy;
131 fCzy=t.fCzy; fCzz=t.fCzz;
b3a5a838 132 fCey=t.fCey; fCez=t.fCez; fCee=t.fCee;
133 fCty=t.fCty; fCtz=t.fCtz; fCte=t.fCte; fCtt=t.fCtt;
b8dc2353 134 fCcy=t.fCcy; fCcz=t.fCcz; fCce=t.fCce; fCct=t.fCct; fCcc=t.fCcc;
46d29e70 135
5443e65e 136 Int_t n=t.GetNumberOfClusters();
137 SetNumberOfClusters(n);
138 for (Int_t i=0; i<n; i++) {
a819a5f7 139 fIndex[i]=t.fIndex[i];
140 fdQdl[i]=t.fdQdl[i];
141 }
b8dc2353 142
5443e65e 143}
144
145//_____________________________________________________________________________
b3a5a838 146AliTRDtrack::AliTRDtrack(const AliKalmanTrack& t, Double_t alpha)
147 :AliKalmanTrack(t) {
5443e65e 148 //
149 // Constructor from AliTPCtrack or AliITStrack .
150 //
151
152 SetLabel(t.GetLabel());
153 SetChi2(0.);
b8dc2353 154 SetMass(t.GetMass());
5443e65e 155 SetNumberOfClusters(0);
156
157 fdEdx=0;
158
b3a5a838 159 fLhElectron = 0.0;
160
5443e65e 161 fAlpha = alpha;
162 if (fAlpha < -TMath::Pi()) fAlpha += 2*TMath::Pi();
163 else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi();
164
165 Double_t x, p[5]; t.GetExternalParameters(x,p);
166
167 fX=x;
168
169 x = GetConvConst();
170
b8dc2353 171 fY=p[0];
172 fZ=p[1];
b3a5a838 173 fT=p[3];
174 fC=p[4]/x;
b8dc2353 175 fE=fC*fX - p[2];
5443e65e 176
177 //Conversion of the covariance matrix
178 Double_t c[15]; t.GetExternalCovariance(c);
179
180 c[10]/=x; c[11]/=x; c[12]/=x; c[13]/=x; c[14]/=x*x;
181
182 Double_t c22=fX*fX*c[14] - 2*fX*c[12] + c[5];
183 Double_t c32=fX*c[13] - c[8];
184 Double_t c20=fX*c[10] - c[3], c21=fX*c[11] - c[4], c42=fX*c[14] - c[12];
185
b8dc2353 186 fCyy=c[0 ];
187 fCzy=c[1 ]; fCzz=c[2 ];
188 fCey=c20; fCez=c21; fCee=c22;
189 fCty=c[6 ]; fCtz=c[7 ]; fCte=c32; fCtt=c[9 ];
190 fCcy=c[10]; fCcz=c[11]; fCce=c42; fCct=c[13]; fCcc=c[14];
5443e65e 191
192}
193
194//____________________________________________________________________________
195void AliTRDtrack::GetExternalParameters(Double_t& xr, Double_t x[5]) const {
196 //
197 // This function returns external TRD track representation
198 //
199 xr=fX;
200 x[0]=GetY();
201 x[1]=GetZ();
202 x[2]=GetSnp();
203 x[3]=GetTgl();
b8dc2353 204 x[4]=Get1Pt();
5443e65e 205}
206
207//_____________________________________________________________________________
208void AliTRDtrack::GetExternalCovariance(Double_t cc[15]) const {
209 //
210 // This function returns external representation of the covriance matrix.
211 //
212 Double_t a=GetConvConst();
213
b3a5a838 214 Double_t c22=fX*fX*fCcc-2*fX*fCce+fCee;
215 Double_t c32=fX*fCct-fCte;
216 Double_t c20=fX*fCcy-fCey, c21=fX*fCcz-fCez, c42=fX*fCcc-fCce;
5443e65e 217
218 cc[0 ]=fCyy;
219 cc[1 ]=fCzy; cc[2 ]=fCzz;
220 cc[3 ]=c20; cc[4 ]=c21; cc[5 ]=c22;
221 cc[6 ]=fCty; cc[7 ]=fCtz; cc[8 ]=c32; cc[9 ]=fCtt;
b8dc2353 222 cc[10]=fCcy*a; cc[11]=fCcz*a; cc[12]=c42*a; cc[13]=fCct*a; cc[14]=fCcc*a*a;
223
5443e65e 224}
225
46d29e70 226
227//_____________________________________________________________________________
228void AliTRDtrack::GetCovariance(Double_t cc[15]) const {
b8dc2353 229
46d29e70 230 cc[0]=fCyy;
231 cc[1]=fCzy; cc[2]=fCzz;
b3a5a838 232 cc[3]=fCey; cc[4]=fCez; cc[5]=fCee;
233 cc[6]=fCcy; cc[7]=fCcz; cc[8]=fCce; cc[9]=fCcc;
234 cc[10]=fCty; cc[11]=fCtz; cc[12]=fCte; cc[13]=fCct; cc[14]=fCtt;
b8dc2353 235
46d29e70 236}
237
238//_____________________________________________________________________________
2a941f4e 239Int_t AliTRDtrack::Compare(const TObject *o) const {
46d29e70 240
5443e65e 241// Compares tracks according to their Y2 or curvature
46d29e70 242
243 AliTRDtrack *t=(AliTRDtrack*)o;
244 // Double_t co=t->GetSigmaY2();
245 // Double_t c =GetSigmaY2();
246
247 Double_t co=TMath::Abs(t->GetC());
248 Double_t c =TMath::Abs(GetC());
249
250 if (c>co) return 1;
251 else if (c<co) return -1;
252 return 0;
253}
254
255//_____________________________________________________________________________
a819a5f7 256void AliTRDtrack::CookdEdx(Double_t low, Double_t up) {
257 //-----------------------------------------------------------------
258 // Calculates dE/dX within the "low" and "up" cuts.
259 //-----------------------------------------------------------------
5443e65e 260
a819a5f7 261 Int_t i;
5443e65e 262 Int_t nc=GetNumberOfClusters();
a819a5f7 263
5443e65e 264 Float_t sorted[kMAX_CLUSTERS_PER_TRACK];
265 for (i=0; i < nc; i++) {
266 sorted[i]=fdQdl[i];
267 }
a819a5f7 268
269 Int_t swap;
5443e65e 270
a819a5f7 271 do {
272 swap=0;
273 for (i=0; i<nc-1; i++) {
274 if (sorted[i]<=sorted[i+1]) continue;
275 Float_t tmp=sorted[i];
276 sorted[i]=sorted[i+1]; sorted[i+1]=tmp;
277 swap++;
278 }
279 } while (swap);
280
281 Int_t nl=Int_t(low*nc), nu=Int_t(up*nc);
282 Float_t dedx=0;
283 for (i=nl; i<=nu; i++) dedx += sorted[i];
284 dedx /= (nu-nl+1);
5443e65e 285
a819a5f7 286 SetdEdx(dedx);
287}
288
289
a819a5f7 290//_____________________________________________________________________________
b3a5a838 291Int_t AliTRDtrack::PropagateTo(Double_t xk,Double_t x0,Double_t rho)
46d29e70 292{
293 // Propagates a track of particle with mass=pm to a reference plane
294 // defined by x=xk through media of density=rho and radiationLength=x0
295
296 if (TMath::Abs(fC*xk - fE) >= 0.99999) {
b8dc2353 297 Int_t n=GetNumberOfClusters();
5443e65e 298 if (n>4) cerr<<n<<" AliTRDtrack warning: Propagation failed !\n";
46d29e70 299 return 0;
300 }
301
302 Double_t x1=fX, x2=x1+(xk-x1), dx=x2-x1, y1=fY, z1=fZ;
5443e65e 303 Double_t c1=fC*x1 - fE;
304 if((c1*c1) > 1) return 0;
305 Double_t r1=sqrt(1.- c1*c1);
b8dc2353 306 Double_t c2=fC*x2 - fE;
5443e65e 307 if((c2*c2) > 1) return 0;
308 Double_t r2=sqrt(1.- c2*c2);
46d29e70 309
310 fY += dx*(c1+c2)/(r1+r2);
311 fZ += dx*(c1+c2)/(c1*r2 + c2*r1)*fT;
312
313 //f = F - 1
314 Double_t rr=r1+r2, cc=c1+c2, xx=x1+x2;
b3a5a838 315 Double_t f02=-dx*(2*rr + cc*(c1/r1 + c2/r2))/(rr*rr);
316 Double_t f04= dx*(rr*xx + cc*(c1*x1/r1+c2*x2/r2))/(rr*rr);
46d29e70 317 Double_t cr=c1*r2+c2*r1;
b3a5a838 318 Double_t f12=-dx*fT*(2*cr + cc*(c2*c1/r1-r1 + c1*c2/r2-r2))/(cr*cr);
319 Double_t f13= dx*cc/cr;
b8dc2353 320 Double_t f14=dx*fT*(cr*xx-cc*(r1*x2-c2*c1*x1/r1+r2*x1-c1*c2*x2/r2))/(cr*cr);
46d29e70 321
322 //b = C*ft
b3a5a838 323 Double_t b00=f02*fCey + f04*fCcy, b01=f12*fCey + f14*fCcy + f13*fCty;
324 Double_t b10=f02*fCez + f04*fCcz, b11=f12*fCez + f14*fCcz + f13*fCtz;
325 Double_t b20=f02*fCee + f04*fCce, b21=f12*fCee + f14*fCce + f13*fCte;
326 Double_t b30=f02*fCte + f04*fCct, b31=f12*fCte + f14*fCct + f13*fCtt;
327 Double_t b40=f02*fCce + f04*fCcc, b41=f12*fCce + f14*fCcc + f13*fCct;
46d29e70 328
329 //a = f*b = f*C*ft
b3a5a838 330 Double_t a00=f02*b20+f04*b40,a01=f02*b21+f04*b41,a11=f12*b21+f14*b41+f13*b31;
46d29e70 331
332 //F*C*Ft = C + (a + b + bt)
333 fCyy += a00 + 2*b00;
334 fCzy += a01 + b01 + b10;
b3a5a838 335 fCey += b20;
336 fCty += b30;
337 fCcy += b40;
46d29e70 338 fCzz += a11 + 2*b11;
b3a5a838 339 fCez += b21;
340 fCtz += b31;
b8dc2353 341 fCcz += b41;
46d29e70 342
b8dc2353 343 fX=x2;
46d29e70 344
345 //Multiple scattering ******************
46d29e70 346 Double_t d=sqrt((x1-fX)*(x1-fX)+(y1-fY)*(y1-fY)+(z1-fZ)*(z1-fZ));
b8dc2353 347 Double_t p2=(1.+ GetTgl()*GetTgl())/(Get1Pt()*Get1Pt());
b3a5a838 348 Double_t beta2=p2/(p2 + GetMass()*GetMass());
b8dc2353 349 Double_t theta2=14.1*14.1/(beta2*p2*1e6)*d/x0*rho;
46d29e70 350
351 Double_t ey=fC*fX - fE, ez=fT;
352 Double_t xz=fC*ez, zz1=ez*ez+1, xy=fE+ey;
353
46d29e70 354 fCee += (2*ey*ez*ez*fE+1-ey*ey+ez*ez+fE*fE*ez*ez)*theta2;
355 fCte += ez*zz1*xy*theta2;
356 fCtt += zz1*zz1*theta2;
b3a5a838 357 fCce += xz*ez*xy*theta2;
358 fCct += xz*zz1*theta2;
359 fCcc += xz*xz*theta2;
46d29e70 360
46d29e70 361 //Energy losses************************
b8dc2353 362 if((5940*beta2/(1-beta2+1e-10) - beta2) < 0) return 0;
5443e65e 363
b8dc2353 364 Double_t dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2+1e-10)) - beta2)*d*rho;
365 if (x1 < x2) dE=-dE;
366 cc=fC;
b3a5a838 367 fC*=(1.- sqrt(p2+GetMass()*GetMass())/p2*dE);
b8dc2353 368 fE+=fX*(fC-cc);
46d29e70 369
b8dc2353 370 return 1;
46d29e70 371}
372
fd621f36 373
46d29e70 374//_____________________________________________________________________________
fd621f36 375Int_t AliTRDtrack::Update(const AliTRDcluster *c, Double_t chisq, UInt_t index, Double_t h01)
46d29e70 376{
377 // Assignes found cluster to the track and updates track information
378
b8dc2353 379 Bool_t fNoTilt = kTRUE;
380 if(TMath::Abs(h01) > 0.003) fNoTilt = kFALSE;
fd621f36 381
b8dc2353 382 Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2();
383 r00+=fCyy; r01+=fCzy; r11+=fCzz;
46d29e70 384 Double_t det=r00*r11 - r01*r01;
385 Double_t tmp=r00; r00=r11/det; r11=tmp/det; r01=-r01/det;
386
b8dc2353 387 Double_t k00=fCyy*r00+fCzy*r01, k01=fCyy*r01+fCzy*r11;
388 Double_t k10=fCzy*r00+fCzz*r01, k11=fCzy*r01+fCzz*r11;
389 Double_t k20=fCey*r00+fCez*r01, k21=fCey*r01+fCez*r11;
390 Double_t k30=fCty*r00+fCtz*r01, k31=fCty*r01+fCtz*r11;
391 Double_t k40=fCcy*r00+fCcz*r01, k41=fCcy*r01+fCcz*r11;
46d29e70 392
393 Double_t dy=c->GetY() - fY, dz=c->GetZ() - fZ;
b3a5a838 394 Double_t cur=fC + k40*dy + k41*dz, eta=fE + k20*dy + k21*dz;
fd621f36 395
b3a5a838 396 Double_t c01=fCzy, c02=fCey, c03=fCty, c04=fCcy;
397 Double_t c12=fCez, c13=fCtz, c14=fCcz;
46d29e70 398
b8dc2353 399 if(fNoTilt) {
400 if (TMath::Abs(cur*fX-eta) >= 0.99999) {
401 Int_t n=GetNumberOfClusters();
402 if (n>4) cerr<<n<<" AliTRDtrack warning: Filtering failed !\n";
403 return 0;
404 }
405 fY += k00*dy + k01*dz;
406 fZ += k10*dy + k11*dz;
407 fE = eta;
408 fT += k30*dy + k31*dz;
409 fC = cur;
410 }
411 else {
412 Double_t xu_factor = 100.; // empirical factor set by C.Xu
413 // in the first tilt version
414 r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2()*xu_factor;
415 r00+=(fCyy+2.0*h01*fCzy+h01*h01*fCzz);
416 r01+=(fCzy+h01*fCzz);
417 det=r00*r11 - r01*r01;
418 tmp=r00; r00=r11/det; r11=tmp/det; r01=-r01/det;
419
420 k00=fCyy*r00+fCzy*(r01+h01*r00),k01=fCyy*r01+fCzy*(r11+h01*r01);
421 k10=fCzy*r00+fCzz*(r01+h01*r00),k11=fCzy*r01+fCzz*(r11+h01*r01);
422 k20=fCey*r00+fCez*(r01+h01*r00),k21=fCey*r01+fCez*(r11+h01*r01);
423 k30=fCty*r00+fCtz*(r01+h01*r00),k31=fCty*r01+fCtz*(r11+h01*r01);
424 k40=fCcy*r00+fCcz*(r01+h01*r00),k41=fCcy*r01+fCcz*(r11+h01*r01);
425
426 dy=c->GetY() - fY; dz=c->GetZ() - fZ;
427 dy=dy+h01*dz;
428
429 cur=fC + k40*dy + k41*dz; eta=fE + k20*dy + k21*dz;
430 if (TMath::Abs(cur*fX-eta) >= 0.99999) {
431 Int_t n=GetNumberOfClusters();
432 if (n>4) cerr<<n<<" AliTRDtrack warning: Filtering failed !\n";
433 return 0;
434 }
435 fY += k00*dy + k01*dz;
436 fZ += k10*dy + k11*dz;
437 fE = eta;
438 fT += k30*dy + k31*dz;
439 fC = cur;
440
441 k01+=h01*k00;
442 k11+=h01*k10;
443 k21+=h01*k20;
444 k31+=h01*k30;
445 k41+=h01*k40;
446 }
447
46d29e70 448 fCyy-=k00*fCyy+k01*fCzy; fCzy-=k00*c01+k01*fCzz;
b3a5a838 449 fCey-=k00*c02+k01*c12; fCty-=k00*c03+k01*c13;
450 fCcy-=k00*c04+k01*c14;
b8dc2353 451
46d29e70 452 fCzz-=k10*c01+k11*fCzz;
b3a5a838 453 fCez-=k10*c02+k11*c12; fCtz-=k10*c03+k11*c13;
454 fCcz-=k10*c04+k11*c14;
b8dc2353 455
b3a5a838 456 fCee-=k20*c02+k21*c12; fCte-=k20*c03+k21*c13;
457 fCce-=k20*c04+k21*c14;
b8dc2353 458
b3a5a838 459 fCtt-=k30*c03+k31*c13;
b8dc2353 460 fCct-=k40*c03+k41*c13;
461
462 fCcc-=k40*c04+k41*c14;
46d29e70 463
b8dc2353 464 Int_t n=GetNumberOfClusters();
5443e65e 465 fIndex[n]=index;
b8dc2353 466 SetNumberOfClusters(n+1);
fd621f36 467
b8dc2353 468 SetChi2(GetChi2()+chisq);
46d29e70 469 // cerr<<"in update: fIndex["<<fN<<"] = "<<index<<endl;
5443e65e 470
b8dc2353 471 return 1;
46d29e70 472}
473
fd621f36 474
46d29e70 475//_____________________________________________________________________________
476Int_t AliTRDtrack::Rotate(Double_t alpha)
477{
478 // Rotates track parameters in R*phi plane
479
480 fAlpha += alpha;
b3a5a838 481 if (fAlpha<-TMath::Pi()) fAlpha += 2*TMath::Pi();
b8dc2353 482 if (fAlpha>=TMath::Pi()) fAlpha -= 2*TMath::Pi();
46d29e70 483
484 Double_t x1=fX, y1=fY;
485 Double_t ca=cos(alpha), sa=sin(alpha);
486 Double_t r1=fC*fX - fE;
487
488 fX = x1*ca + y1*sa;
b8dc2353 489 fY =-x1*sa + y1*ca;
490 if((r1*r1) > 1) return 0;
46d29e70 491 fE=fE*ca + (fC*y1 + sqrt(1.- r1*r1))*sa;
492
493 Double_t r2=fC*fX - fE;
494 if (TMath::Abs(r2) >= 0.99999) {
b8dc2353 495 Int_t n=GetNumberOfClusters();
5443e65e 496 if (n>4) cerr<<n<<" AliTRDtrack warning: Rotation failed !\n";
46d29e70 497 return 0;
498 }
499
b8dc2353 500 if((r2*r2) > 1) return 0;
46d29e70 501 Double_t y0=fY + sqrt(1.- r2*r2)/fC;
502 if ((fY-y0)*fC >= 0.) {
b8dc2353 503 Int_t n=GetNumberOfClusters();
5443e65e 504 if (n>4) cerr<<n<<" AliTRDtrack warning: Rotation failed !!!\n";
46d29e70 505 return 0;
506 }
507
508 //f = F - 1
b3a5a838 509 Double_t f00=ca-1, f24=(y1 - r1*x1/sqrt(1.- r1*r1))*sa,
b8dc2353 510 f20=fC*sa, f22=(ca + sa*r1/sqrt(1.- r1*r1))-1;
46d29e70 511
512 //b = C*ft
b3a5a838 513 Double_t b00=fCyy*f00, b02=fCyy*f20+fCcy*f24+fCey*f22;
514 Double_t b10=fCzy*f00, b12=fCzy*f20+fCcz*f24+fCez*f22;
515 Double_t b20=fCey*f00, b22=fCey*f20+fCce*f24+fCee*f22;
516 Double_t b30=fCty*f00, b32=fCty*f20+fCct*f24+fCte*f22;
517 Double_t b40=fCcy*f00, b42=fCcy*f20+fCcc*f24+fCce*f22;
46d29e70 518
519 //a = f*b = f*C*ft
b3a5a838 520 Double_t a00=f00*b00, a02=f00*b02, a22=f20*b02+f24*b42+f22*b22;
46d29e70 521
46d29e70 522 //F*C*Ft = C + (a + b + bt)
523 fCyy += a00 + 2*b00;
524 fCzy += b10;
b3a5a838 525 fCey += a02+b20+b02;
526 fCty += b30;
527 fCcy += b40;
528 fCez += b12;
529 fCte += b32;
530 fCee += a22 + 2*b22;
531 fCce += b42;
46d29e70 532
b8dc2353 533 return 1;
46d29e70 534}
535
536
46d29e70 537//_____________________________________________________________________________
fd621f36 538Double_t AliTRDtrack::GetPredictedChi2(const AliTRDcluster *c, Double_t h01) const
46d29e70 539{
fd621f36 540
b8dc2353 541 Bool_t fNoTilt = kTRUE;
542 if(TMath::Abs(h01) > 0.003) fNoTilt = kFALSE;
543 Double_t chi2, dy, r00, r01, r11;
544
545 if(fNoTilt) {
546 dy=c->GetY() - fY;
547 r00=c->GetSigmaY2();
548 chi2 = (dy*dy)/r00;
46d29e70 549 }
b8dc2353 550 else {
551 r00=c->GetSigmaY2(); r01=0.; r11=c->GetSigmaZ2();
552 r00+=fCyy; r01+=fCzy; r11+=fCzz;
553
554 Double_t det=r00*r11 - r01*r01;
555 if (TMath::Abs(det) < 1.e-10) {
556 Int_t n=GetNumberOfClusters();
557 if (n>4) cerr<<n<<" AliTRDtrack warning: Singular matrix !\n";
558 return 1e10;
559 }
560 Double_t tmp=r00; r00=r11; r11=tmp; r01=-r01;
561 Double_t dy=c->GetY() - fY, dz=c->GetZ() - fZ;
562 dy=dy+h01*dz;
a819a5f7 563
b8dc2353 564 chi2 = (dy*r00*dy + 2*r01*dy*dz + dz*r11*dz)/det;
565 }
566 return chi2;
fd621f36 567}
46d29e70 568
569
570//_________________________________________________________________________
571void AliTRDtrack::GetPxPyPz(Double_t& px, Double_t& py, Double_t& pz) const
572{
573 // Returns reconstructed track momentum in the global system.
574
575 Double_t pt=TMath::Abs(GetPt()); // GeV/c
576 Double_t r=fC*fX-fE;
5443e65e 577
578 Double_t y0;
579 if(r > 1) { py = pt; px = 0; }
580 else if(r < -1) { py = -pt; px = 0; }
581 else {
582 y0=fY + sqrt(1.- r*r)/fC;
583 px=-pt*(fY-y0)*fC; //cos(phi);
584 py=-pt*(fE-fX*fC); //sin(phi);
585 }
46d29e70 586 pz=pt*fT;
587 Double_t tmp=px*TMath::Cos(fAlpha) - py*TMath::Sin(fAlpha);
588 py=px*TMath::Sin(fAlpha) + py*TMath::Cos(fAlpha);
589 px=tmp;
590
591}
592
5443e65e 593//_________________________________________________________________________
594void AliTRDtrack::GetGlobalXYZ(Double_t& x, Double_t& y, Double_t& z) const
46d29e70 595{
5443e65e 596 // Returns reconstructed track coordinates in the global system.
597
598 x = fX; y = fY; z = fZ;
599 Double_t tmp=x*TMath::Cos(fAlpha) - y*TMath::Sin(fAlpha);
600 y=x*TMath::Sin(fAlpha) + y*TMath::Cos(fAlpha);
601 x=tmp;
602
603}
3ab6f951 604
5443e65e 605//_________________________________________________________________________
606void AliTRDtrack::ResetCovariance() {
607 //
608 // Resets covariance matrix
609 //
46d29e70 610
5443e65e 611 fCyy*=10.;
b8dc2353 612 fCzy=0.; fCzz*=10.;
613 fCey=0.; fCez=0.; fCee*=10.;
614 fCty=0.; fCtz=0.; fCte=0.; fCtt*=10.;
615 fCcy=0.; fCcz=0.; fCce=0.; fCct=0.; fCcc*=10.;
5443e65e 616}
b8dc2353 617