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