Official Numbering for salts in St345 as described in ref Alice-int-2003-038 emds...
[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
0fa7dfa7 16/* $Id$ */
46d29e70 17
a2cb5b3d 18#include <Riostream.h>
5443e65e 19#include <TObject.h>
46d29e70 20
46d29e70 21#include "AliTRDgeometry.h"
22#include "AliTRDcluster.h"
23#include "AliTRDtrack.h"
3c625a9b 24#include "AliTRDclusterCorrection.h"
b3a5a838 25
46d29e70 26ClassImp(AliTRDtrack)
27
46d29e70 28//_____________________________________________________________________________
29
a819a5f7 30AliTRDtrack::AliTRDtrack(const AliTRDcluster *c, UInt_t index,
5443e65e 31 const Double_t xx[5], const Double_t cc[15],
8206377c 32 Double_t xref, Double_t alpha) : AliKalmanTrack()
33{
46d29e70 34 //-----------------------------------------------------------------
35 // This is the main track constructor.
36 //-----------------------------------------------------------------
5443e65e 37
38 fSeedLab = -1;
46d29e70 39
40 fAlpha=alpha;
5443e65e 41 if (fAlpha<-TMath::Pi()) fAlpha += 2*TMath::Pi();
42 if (fAlpha>=TMath::Pi()) fAlpha -= 2*TMath::Pi();
43
46d29e70 44 fX=xref;
45
b3a5a838 46 fY=xx[0]; fZ=xx[1]; fE=xx[2]; fT=xx[3]; fC=xx[4];
46d29e70 47
48 fCyy=cc[0];
49 fCzy=cc[1]; fCzz=cc[2];
b3a5a838 50 fCey=cc[3]; fCez=cc[4]; fCee=cc[5];
51 fCty=cc[6]; fCtz=cc[7]; fCte=cc[8]; fCtt=cc[9];
b8dc2353 52 fCcy=cc[10]; fCcz=cc[11]; fCce=cc[12]; fCct=cc[13]; fCcc=cc[14];
53
5443e65e 54 fIndex[0]=index;
55 SetNumberOfClusters(1);
56
57 fdEdx=0.;
eab5961e 58 for (Int_t i=0;i<kNPlane;i++){
59 fdEdxPlane[i] = 0.;
60 fTimBinPlane[i] = -1;
61 }
a2b90f83 62
b3a5a838 63 fLhElectron = 0.0;
9c9d2487 64 fNWrong = 0;
65 fNRotate = 0;
3c625a9b 66 fStopped = 0;
4f1c04d3 67 fNCross =0;
68 fNLast =0;
69 fChi2Last=0;
70 fNExpected=0;
71 fNExpectedLast=0;
72 fNdedx=0;
5443e65e 73 Double_t q = TMath::Abs(c->GetQ());
a819a5f7 74 Double_t s = fX*fC - fE, t=fT;
5443e65e 75 if(s*s < 1) q *= TMath::Sqrt((1-s*s)/(1+t*t));
76
77 fdQdl[0] = q;
0d5b5c27 78
79 // initialisation [SR, GSI 18.02.2003] (i startd for 1)
8206377c 80 for(UInt_t i=1; i<kMAXCLUSTERSPERTRACK; i++) {
0d5b5c27 81 fdQdl[i] = 0;
82 fIndex[i] = 0;
46e2d86c 83 fIndexBackup[i] = 0; //bacup indexes MI
0d5b5c27 84 }
16d9fbba 85 fBackupTrack =0;
46d29e70 86}
87
88//_____________________________________________________________________________
5443e65e 89AliTRDtrack::AliTRDtrack(const AliTRDtrack& t) : AliKalmanTrack(t) {
46d29e70 90 //
91 // Copy constructor.
92 //
b8dc2353 93
5443e65e 94 SetLabel(t.GetLabel());
95 fSeedLab=t.GetSeedLabel();
46d29e70 96
5443e65e 97 SetChi2(t.GetChi2());
46d29e70 98 fdEdx=t.fdEdx;
eab5961e 99 for (Int_t i=0;i<kNPlane;i++){
100 fdEdxPlane[i] = t.fdEdxPlane[i];
101 fTimBinPlane[i] = t.fTimBinPlane[i];
102 }
46d29e70 103
b3a5a838 104 fLhElectron = 0.0;
9c9d2487 105 fNWrong = t.fNWrong;
106 fNRotate = t.fNRotate;
3c625a9b 107 fStopped = t.fStopped;
4f1c04d3 108 fNCross = t.fNCross;
109 fNExpected = t.fNExpected;
110 fNExpectedLast = t.fNExpectedLast;
111 fNdedx = t.fNdedx;
112 fNLast = t.fNLast;
113 fChi2Last = t.fChi2Last;
114 fBackupTrack =0;
46d29e70 115 fAlpha=t.fAlpha;
116 fX=t.fX;
117
4f1c04d3 118
b8dc2353 119 fY=t.fY; fZ=t.fZ; fE=t.fE; fT=t.fT; fC=t.fC;
46d29e70 120
121 fCyy=t.fCyy;
122 fCzy=t.fCzy; fCzz=t.fCzz;
b3a5a838 123 fCey=t.fCey; fCez=t.fCez; fCee=t.fCee;
124 fCty=t.fCty; fCtz=t.fCtz; fCte=t.fCte; fCtt=t.fCtt;
b8dc2353 125 fCcy=t.fCcy; fCcz=t.fCcz; fCce=t.fCce; fCct=t.fCct; fCcc=t.fCcc;
46d29e70 126
5443e65e 127 Int_t n=t.GetNumberOfClusters();
128 SetNumberOfClusters(n);
129 for (Int_t i=0; i<n; i++) {
a819a5f7 130 fIndex[i]=t.fIndex[i];
46e2d86c 131 fIndexBackup[i]=t.fIndex[i]; // MI - backup indexes
a819a5f7 132 fdQdl[i]=t.fdQdl[i];
133 }
b8dc2353 134
0d5b5c27 135 // initialisation (i starts from n) [SR, GSI, 18.02.2003]
8206377c 136 for(UInt_t i=n; i<kMAXCLUSTERSPERTRACK; i++) {
0d5b5c27 137 fdQdl[i] = 0;
138 fIndex[i] = 0;
46e2d86c 139 fIndexBackup[i] = 0; //MI backup indexes
0d5b5c27 140 }
5443e65e 141}
142
143//_____________________________________________________________________________
b3a5a838 144AliTRDtrack::AliTRDtrack(const AliKalmanTrack& t, Double_t alpha)
145 :AliKalmanTrack(t) {
5443e65e 146 //
147 // Constructor from AliTPCtrack or AliITStrack .
148 //
149
150 SetLabel(t.GetLabel());
151 SetChi2(0.);
b8dc2353 152 SetMass(t.GetMass());
5443e65e 153 SetNumberOfClusters(0);
154
bbc6cd2c 155 fdEdx=t.GetPIDsignal();
eab5961e 156 for (Int_t i=0;i<kNPlane;i++){
157 fdEdxPlane[i] = 0.0;
158 fTimBinPlane[i] = -1;
159 }
5443e65e 160
b3a5a838 161 fLhElectron = 0.0;
9c9d2487 162 fNWrong = 0;
163 fNRotate = 0;
3c625a9b 164 fStopped = 0;
4f1c04d3 165 fNExpected=0;
166 fNExpectedLast=0;
167 fNdedx =0;
168 fNCross =0;
169 fNLast =0;
170 fChi2Last =0;
171 fBackupTrack =0;
b3a5a838 172
5443e65e 173 fAlpha = alpha;
174 if (fAlpha < -TMath::Pi()) fAlpha += 2*TMath::Pi();
175 else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi();
176
177 Double_t x, p[5]; t.GetExternalParameters(x,p);
178
179 fX=x;
180
181 x = GetConvConst();
182
b8dc2353 183 fY=p[0];
184 fZ=p[1];
b3a5a838 185 fT=p[3];
186 fC=p[4]/x;
b8dc2353 187 fE=fC*fX - p[2];
5443e65e 188
189 //Conversion of the covariance matrix
190 Double_t c[15]; t.GetExternalCovariance(c);
79e94bf8 191
192 c[10]/=x; c[11]/=x; c[12]/=x; c[13]/=x; c[14]/=x*x;
193
194 Double_t c22=fX*fX*c[14] - 2*fX*c[12] + c[5];
195 Double_t c32=fX*c[13] - c[8];
196 Double_t c20=fX*c[10] - c[3], c21=fX*c[11] - c[4], c42=fX*c[14] - c[12];
197
198 fCyy=c[0 ];
199 fCzy=c[1 ]; fCzz=c[2 ];
200 fCey=c20; fCez=c21; fCee=c22;
201 fCty=c[6 ]; fCtz=c[7 ]; fCte=c32; fCtt=c[9 ];
202 fCcy=c[10]; fCcz=c[11]; fCce=c42; fCct=c[13]; fCcc=c[14];
203
204 // Initialization [SR, GSI, 18.02.2003]
8206377c 205 for(UInt_t i=0; i<kMAXCLUSTERSPERTRACK; i++) {
79e94bf8 206 fdQdl[i] = 0;
207 fIndex[i] = 0;
46e2d86c 208 fIndexBackup[i] = 0; // MI backup indexes
79e94bf8 209 }
4f1c04d3 210
79e94bf8 211}
8206377c 212
79e94bf8 213//_____________________________________________________________________________
214AliTRDtrack::AliTRDtrack(const AliESDtrack& t)
215 :AliKalmanTrack() {
216 //
217 // Constructor from AliESDtrack
218 //
219
220 SetLabel(t.GetLabel());
221 SetChi2(0.);
222 SetMass(t.GetMass());
1e9bb598 223 SetNumberOfClusters(t.GetTRDclusters(fIndex));
46e2d86c 224 Int_t ncl = t.GetTRDclusters(fIndexBackup);
8206377c 225 for (UInt_t i=ncl;i<kMAXCLUSTERSPERTRACK;i++) {
46e2d86c 226 fIndexBackup[i]=0;
227 fIndex[i] = 0; //MI store indexes
228 }
c73b3eb3 229 fdEdx=t.GetTRDsignal();
eab5961e 230 for (Int_t i=0;i<kNPlane;i++){
231 fdEdxPlane[i] = t.GetTRDsignals(i);
232 fTimBinPlane[i] = t.GetTRDTimBin(i);
233 }
79e94bf8 234
235 fLhElectron = 0.0;
236 fNWrong = 0;
3c625a9b 237 fStopped = 0;
79e94bf8 238 fNRotate = 0;
4f1c04d3 239 fNExpected =0;
240 fNExpectedLast=0;
241 fNdedx = 0;
242 fNCross =0;
243 fNLast =0;
244 fChi2Last =0;
245 fBackupTrack =0;
79e94bf8 246
247 fAlpha = t.GetAlpha();
248 if (fAlpha < -TMath::Pi()) fAlpha += 2*TMath::Pi();
249 else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi();
250
251 Double_t x, p[5]; t.GetExternalParameters(x,p);
c5a8e3df 252 //Conversion of the covariance matrix
253 Double_t c[15]; t.GetExternalCovariance(c);
25cde026 254 if (t.GetStatus()&AliESDtrack::kTRDbackup){
f4e9508c 255 t.GetTRDExternalParameters(x,fAlpha,p,c);
256 if (fAlpha < -TMath::Pi()) fAlpha += 2*TMath::Pi();
257 else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi();
c5a8e3df 258 }
79e94bf8 259
260 fX=x;
261
262 x = GetConvConst();
263
264 fY=p[0];
265 fZ=p[1];
266 fT=p[3];
267 fC=p[4]/x;
268 fE=fC*fX - p[2];
269
5443e65e 270
271 c[10]/=x; c[11]/=x; c[12]/=x; c[13]/=x; c[14]/=x*x;
272
273 Double_t c22=fX*fX*c[14] - 2*fX*c[12] + c[5];
274 Double_t c32=fX*c[13] - c[8];
275 Double_t c20=fX*c[10] - c[3], c21=fX*c[11] - c[4], c42=fX*c[14] - c[12];
276
b8dc2353 277 fCyy=c[0 ];
278 fCzy=c[1 ]; fCzz=c[2 ];
279 fCey=c20; fCez=c21; fCee=c22;
280 fCty=c[6 ]; fCtz=c[7 ]; fCte=c32; fCtt=c[9 ];
281 fCcy=c[10]; fCcz=c[11]; fCce=c42; fCct=c[13]; fCcc=c[14];
5443e65e 282
0d5b5c27 283 // Initialization [SR, GSI, 18.02.2003]
8206377c 284 for(UInt_t i=0; i<kMAXCLUSTERSPERTRACK; i++) {
0d5b5c27 285 fdQdl[i] = 0;
46e2d86c 286 // fIndex[i] = 0; //MI store indexes
0d5b5c27 287 }
c630aafd 288
289 if ((t.GetStatus()&AliESDtrack::kTIME) == 0) return;
290 StartTimeIntegral();
291 Double_t times[10]; t.GetIntegratedTimes(times); SetIntegratedTimes(times);
292 SetIntegratedLength(t.GetIntegratedLength());
293
16d9fbba 294}
295
8206377c 296//_____________________________________________________________________________
16d9fbba 297AliTRDtrack::~AliTRDtrack()
298{
299 //
8206377c 300 // TRD track destructor
16d9fbba 301 //
eab5961e 302
16d9fbba 303 if (fBackupTrack) delete fBackupTrack;
304 fBackupTrack=0;
eab5961e 305
16d9fbba 306}
9c9d2487 307
8206377c 308//_____________________________________________________________________________
309Float_t AliTRDtrack::StatusForTOF()
4f1c04d3 310{
8206377c 311 //
312 // Returns a status flag for TOF
313 //
314
4f1c04d3 315 Int_t status=0;
316 if (GetNumberOfClusters()<20) return 0; //
317 if (fN>110&&fChi2/(Float_t(fN))<3) return 3; //gold
318 if (fNLast>30&&fChi2Last/(Float_t(fNLast))<3) return 3; //gold
319 if (fNLast>20&&fChi2Last/(Float_t(fNLast))<2) return 3; //gold
320 if (fNLast/(fNExpectedLast+3.)>0.8 && fChi2Last/Float_t(fNLast)<5&&fNLast>20) return 2; //silber
321 if (fNLast>5 &&((fNLast+1.)/(fNExpectedLast+1.))>0.8&&fChi2Last/(fNLast-5.)<6) return 1;
322 //
323
324 return status;
325}
326
5443e65e 327//____________________________________________________________________________
328void AliTRDtrack::GetExternalParameters(Double_t& xr, Double_t x[5]) const {
329 //
330 // This function returns external TRD track representation
331 //
332 xr=fX;
333 x[0]=GetY();
334 x[1]=GetZ();
335 x[2]=GetSnp();
336 x[3]=GetTgl();
b8dc2353 337 x[4]=Get1Pt();
5443e65e 338}
339
340//_____________________________________________________________________________
341void AliTRDtrack::GetExternalCovariance(Double_t cc[15]) const {
342 //
343 // This function returns external representation of the covriance matrix.
344 //
345 Double_t a=GetConvConst();
346
b3a5a838 347 Double_t c22=fX*fX*fCcc-2*fX*fCce+fCee;
348 Double_t c32=fX*fCct-fCte;
349 Double_t c20=fX*fCcy-fCey, c21=fX*fCcz-fCez, c42=fX*fCcc-fCce;
5443e65e 350
351 cc[0 ]=fCyy;
352 cc[1 ]=fCzy; cc[2 ]=fCzz;
353 cc[3 ]=c20; cc[4 ]=c21; cc[5 ]=c22;
354 cc[6 ]=fCty; cc[7 ]=fCtz; cc[8 ]=c32; cc[9 ]=fCtt;
b8dc2353 355 cc[10]=fCcy*a; cc[11]=fCcz*a; cc[12]=c42*a; cc[13]=fCct*a; cc[14]=fCcc*a*a;
356
5443e65e 357}
358
46d29e70 359//_____________________________________________________________________________
8206377c 360void AliTRDtrack::GetCovariance(Double_t cc[15]) const
361{
362 //
363 // Returns the covariance matrix
364 //
b8dc2353 365
46d29e70 366 cc[0]=fCyy;
367 cc[1]=fCzy; cc[2]=fCzz;
b3a5a838 368 cc[3]=fCey; cc[4]=fCez; cc[5]=fCee;
369 cc[6]=fCcy; cc[7]=fCcz; cc[8]=fCce; cc[9]=fCcc;
370 cc[10]=fCty; cc[11]=fCtz; cc[12]=fCte; cc[13]=fCct; cc[14]=fCtt;
b8dc2353 371
46d29e70 372}
373
374//_____________________________________________________________________________
2a941f4e 375Int_t AliTRDtrack::Compare(const TObject *o) const {
46d29e70 376
5443e65e 377// Compares tracks according to their Y2 or curvature
46d29e70 378
379 AliTRDtrack *t=(AliTRDtrack*)o;
380 // Double_t co=t->GetSigmaY2();
381 // Double_t c =GetSigmaY2();
382
383 Double_t co=TMath::Abs(t->GetC());
384 Double_t c =TMath::Abs(GetC());
385
386 if (c>co) return 1;
387 else if (c<co) return -1;
388 return 0;
389}
390
391//_____________________________________________________________________________
a819a5f7 392void AliTRDtrack::CookdEdx(Double_t low, Double_t up) {
393 //-----------------------------------------------------------------
394 // Calculates dE/dX within the "low" and "up" cuts.
395 //-----------------------------------------------------------------
5443e65e 396
a819a5f7 397 Int_t i;
4f1c04d3 398 //Int_t nc=GetNumberOfClusters();
399 Int_t nc=fNdedx;
400 if (nc<10) {
401 SetdEdx(0);
402 return;
403 }
a819a5f7 404
8206377c 405 Float_t sorted[kMAXCLUSTERSPERTRACK];
5443e65e 406 for (i=0; i < nc; i++) {
407 sorted[i]=fdQdl[i];
408 }
eab5961e 409 /*
a819a5f7 410 Int_t swap;
5443e65e 411
a819a5f7 412 do {
413 swap=0;
414 for (i=0; i<nc-1; i++) {
415 if (sorted[i]<=sorted[i+1]) continue;
416 Float_t tmp=sorted[i];
417 sorted[i]=sorted[i+1]; sorted[i+1]=tmp;
418 swap++;
419 }
420 } while (swap);
eab5961e 421 */
a819a5f7 422 Int_t nl=Int_t(low*nc), nu=Int_t(up*nc);
423 Float_t dedx=0;
eab5961e 424 //for (i=nl; i<=nu; i++) dedx += sorted[i];
425 //dedx /= (nu-nl+1);
426 for (i=0; i<nc; i++) dedx += sorted[i]; // ADDED by PS
427 if((nu-nl)) dedx /= (nu-nl); // ADDED by PS
5443e65e 428
a819a5f7 429 SetdEdx(dedx);
430}
431
a819a5f7 432//_____________________________________________________________________________
b3a5a838 433Int_t AliTRDtrack::PropagateTo(Double_t xk,Double_t x0,Double_t rho)
46d29e70 434{
435 // Propagates a track of particle with mass=pm to a reference plane
436 // defined by x=xk through media of density=rho and radiationLength=x0
437
9c9d2487 438 if (xk == fX) return 1;
439
3c625a9b 440 if (TMath::Abs(fC*xk - fE) >= 0.90000) {
441 // Int_t n=GetNumberOfClusters();
442 //if (n>4) cerr << n << " AliTRDtrack: Propagation failed, \tPt = "
443 // << GetPt() << "\t" << GetLabel() << "\t" << GetMass() << endl;
46d29e70 444 return 0;
445 }
446
0d5b5c27 447 // track Length measurement [SR, GSI, 17.02.2003]
448 Double_t oldX = fX, oldY = fY, oldZ = fZ;
449
46d29e70 450 Double_t x1=fX, x2=x1+(xk-x1), dx=x2-x1, y1=fY, z1=fZ;
5443e65e 451 Double_t c1=fC*x1 - fE;
452 if((c1*c1) > 1) return 0;
453 Double_t r1=sqrt(1.- c1*c1);
b8dc2353 454 Double_t c2=fC*x2 - fE;
5443e65e 455 if((c2*c2) > 1) return 0;
456 Double_t r2=sqrt(1.- c2*c2);
46d29e70 457
458 fY += dx*(c1+c2)/(r1+r2);
459 fZ += dx*(c1+c2)/(c1*r2 + c2*r1)*fT;
460
461 //f = F - 1
462 Double_t rr=r1+r2, cc=c1+c2, xx=x1+x2;
b3a5a838 463 Double_t f02=-dx*(2*rr + cc*(c1/r1 + c2/r2))/(rr*rr);
464 Double_t f04= dx*(rr*xx + cc*(c1*x1/r1+c2*x2/r2))/(rr*rr);
46d29e70 465 Double_t cr=c1*r2+c2*r1;
b3a5a838 466 Double_t f12=-dx*fT*(2*cr + cc*(c2*c1/r1-r1 + c1*c2/r2-r2))/(cr*cr);
467 Double_t f13= dx*cc/cr;
b8dc2353 468 Double_t f14=dx*fT*(cr*xx-cc*(r1*x2-c2*c1*x1/r1+r2*x1-c1*c2*x2/r2))/(cr*cr);
46d29e70 469
470 //b = C*ft
b3a5a838 471 Double_t b00=f02*fCey + f04*fCcy, b01=f12*fCey + f14*fCcy + f13*fCty;
472 Double_t b10=f02*fCez + f04*fCcz, b11=f12*fCez + f14*fCcz + f13*fCtz;
473 Double_t b20=f02*fCee + f04*fCce, b21=f12*fCee + f14*fCce + f13*fCte;
474 Double_t b30=f02*fCte + f04*fCct, b31=f12*fCte + f14*fCct + f13*fCtt;
475 Double_t b40=f02*fCce + f04*fCcc, b41=f12*fCce + f14*fCcc + f13*fCct;
46d29e70 476
477 //a = f*b = f*C*ft
b3a5a838 478 Double_t a00=f02*b20+f04*b40,a01=f02*b21+f04*b41,a11=f12*b21+f14*b41+f13*b31;
46d29e70 479
480 //F*C*Ft = C + (a + b + bt)
481 fCyy += a00 + 2*b00;
482 fCzy += a01 + b01 + b10;
b3a5a838 483 fCey += b20;
484 fCty += b30;
485 fCcy += b40;
46d29e70 486 fCzz += a11 + 2*b11;
b3a5a838 487 fCez += b21;
488 fCtz += b31;
b8dc2353 489 fCcz += b41;
46d29e70 490
b8dc2353 491 fX=x2;
46d29e70 492
493 //Multiple scattering ******************
46d29e70 494 Double_t d=sqrt((x1-fX)*(x1-fX)+(y1-fY)*(y1-fY)+(z1-fZ)*(z1-fZ));
b8dc2353 495 Double_t p2=(1.+ GetTgl()*GetTgl())/(Get1Pt()*Get1Pt());
b3a5a838 496 Double_t beta2=p2/(p2 + GetMass()*GetMass());
b8dc2353 497 Double_t theta2=14.1*14.1/(beta2*p2*1e6)*d/x0*rho;
46d29e70 498
499 Double_t ey=fC*fX - fE, ez=fT;
500 Double_t xz=fC*ez, zz1=ez*ez+1, xy=fE+ey;
3c625a9b 501
46d29e70 502 fCee += (2*ey*ez*ez*fE+1-ey*ey+ez*ez+fE*fE*ez*ez)*theta2;
503 fCte += ez*zz1*xy*theta2;
504 fCtt += zz1*zz1*theta2;
b3a5a838 505 fCce += xz*ez*xy*theta2;
506 fCct += xz*zz1*theta2;
507 fCcc += xz*xz*theta2;
3c625a9b 508 /*
509 Double_t dc22 = (1-ey*ey+xz*xz*fX*fX)*theta2;
510 Double_t dc32 = (xz*fX*zz1)*theta2;
511 Double_t dc33 = (zz1*zz1)*theta2;
512 Double_t dc42 = (xz*fX*xz)*theta2;
513 Double_t dc43 = (zz1*xz)*theta2;
514 Double_t dc44 = (xz*xz)*theta2;
515 fCee += dc22;
516 fCte += dc32;
517 fCtt += dc33;
518 fCce += dc42;
519 fCct += dc43;
520 fCcc += dc44;
521 */
46d29e70 522 //Energy losses************************
b8dc2353 523 if((5940*beta2/(1-beta2+1e-10) - beta2) < 0) return 0;
5443e65e 524
b8dc2353 525 Double_t dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2+1e-10)) - beta2)*d*rho;
526 if (x1 < x2) dE=-dE;
527 cc=fC;
b3a5a838 528 fC*=(1.- sqrt(p2+GetMass()*GetMass())/p2*dE);
b8dc2353 529 fE+=fX*(fC-cc);
46d29e70 530
0d5b5c27 531 // track time measurement [SR, GSI 17.02.2002]
0fa7dfa7 532 if (x1 < x2)
0d5b5c27 533 if (IsStartedTimeIntegral()) {
534 Double_t l2 = (fX-oldX)*(fX-oldX) + (fY-oldY)*(fY-oldY) + (fZ-oldZ)*(fZ-oldZ);
535 AddTimeStep(TMath::Sqrt(l2));
536 }
537
b8dc2353 538 return 1;
46d29e70 539}
540
46d29e70 541//_____________________________________________________________________________
fd621f36 542Int_t AliTRDtrack::Update(const AliTRDcluster *c, Double_t chisq, UInt_t index, Double_t h01)
46d29e70 543{
544 // Assignes found cluster to the track and updates track information
545
b8dc2353 546 Bool_t fNoTilt = kTRUE;
547 if(TMath::Abs(h01) > 0.003) fNoTilt = kFALSE;
46e2d86c 548 // add angular effect to the error contribution - MI
3c625a9b 549 Float_t tangent2 = (fC*fX-fE)*(fC*fX-fE);
550 if (tangent2 < 0.90000){
46e2d86c 551 tangent2 = tangent2/(1.-tangent2);
552 }
553 Float_t errang = tangent2*0.04; //
554 Float_t padlength = TMath::Sqrt(c->GetSigmaZ2()*12.);
fd621f36 555
46e2d86c 556 Double_t r00=c->GetSigmaY2() +errang, r01=0., r11=c->GetSigmaZ2()*100.;
b8dc2353 557 r00+=fCyy; r01+=fCzy; r11+=fCzz;
46d29e70 558 Double_t det=r00*r11 - r01*r01;
559 Double_t tmp=r00; r00=r11/det; r11=tmp/det; r01=-r01/det;
560
b8dc2353 561 Double_t k00=fCyy*r00+fCzy*r01, k01=fCyy*r01+fCzy*r11;
562 Double_t k10=fCzy*r00+fCzz*r01, k11=fCzy*r01+fCzz*r11;
563 Double_t k20=fCey*r00+fCez*r01, k21=fCey*r01+fCez*r11;
564 Double_t k30=fCty*r00+fCtz*r01, k31=fCty*r01+fCtz*r11;
565 Double_t k40=fCcy*r00+fCcz*r01, k41=fCcy*r01+fCcz*r11;
46d29e70 566
567 Double_t dy=c->GetY() - fY, dz=c->GetZ() - fZ;
b3a5a838 568 Double_t cur=fC + k40*dy + k41*dz, eta=fE + k20*dy + k21*dz;
fd621f36 569
46d29e70 570
b8dc2353 571 if(fNoTilt) {
3c625a9b 572 if (TMath::Abs(cur*fX-eta) >= 0.90000) {
573 // Int_t n=GetNumberOfClusters();
574 //if (n>4) cerr<<n<<" AliTRDtrack warning: Filtering failed !\n";
b8dc2353 575 return 0;
576 }
577 fY += k00*dy + k01*dz;
578 fZ += k10*dy + k11*dz;
579 fE = eta;
9c9d2487 580 //fT += k30*dy + k31*dz;
b8dc2353 581 fC = cur;
582 }
583 else {
8206377c 584 Double_t xuFactor = 100.; // empirical factor set by C.Xu
b8dc2353 585 // in the first tilt version
46e2d86c 586 dy=c->GetY() - fY; dz=c->GetZ() - fZ;
587 dy=dy+h01*dz;
588 Float_t add=0;
589 if (TMath::Abs(dz)>padlength/2.){
3c625a9b 590 Float_t dy2 = c->GetY() - fY;
591 Float_t sign = (dz>0) ? -1.: 1.;
592 dy2+=h01*sign*padlength/2.;
593 dy = dy2;
594 add = 0;
46e2d86c 595 }
596
597
598
8206377c 599 r00=c->GetSigmaY2()+errang+add, r01=0., r11=c->GetSigmaZ2()*xuFactor;
b8dc2353 600 r00+=(fCyy+2.0*h01*fCzy+h01*h01*fCzz);
46e2d86c 601
b8dc2353 602 r01+=(fCzy+h01*fCzz);
603 det=r00*r11 - r01*r01;
604 tmp=r00; r00=r11/det; r11=tmp/det; r01=-r01/det;
605
606 k00=fCyy*r00+fCzy*(r01+h01*r00),k01=fCyy*r01+fCzy*(r11+h01*r01);
607 k10=fCzy*r00+fCzz*(r01+h01*r00),k11=fCzy*r01+fCzz*(r11+h01*r01);
608 k20=fCey*r00+fCez*(r01+h01*r00),k21=fCey*r01+fCez*(r11+h01*r01);
609 k30=fCty*r00+fCtz*(r01+h01*r00),k31=fCty*r01+fCtz*(r11+h01*r01);
610 k40=fCcy*r00+fCcz*(r01+h01*r00),k41=fCcy*r01+fCcz*(r11+h01*r01);
611
b8dc2353 612
613 cur=fC + k40*dy + k41*dz; eta=fE + k20*dy + k21*dz;
3c625a9b 614 if (TMath::Abs(cur*fX-eta) >= 0.90000) {
615 // Int_t n=GetNumberOfClusters();
616 //if (n>4) cerr<<n<<" AliTRDtrack warning: Filtering failed !\n";
b8dc2353 617 return 0;
618 }
619 fY += k00*dy + k01*dz;
620 fZ += k10*dy + k11*dz;
621 fE = eta;
46e2d86c 622 fT += k30*dy + k31*dz;
b8dc2353 623 fC = cur;
624
625 k01+=h01*k00;
626 k11+=h01*k10;
627 k21+=h01*k20;
628 k31+=h01*k30;
629 k41+=h01*k40;
46e2d86c 630
b8dc2353 631 }
46e2d86c 632 Double_t c01=fCzy, c02=fCey, c03=fCty, c04=fCcy;
633 Double_t c12=fCez, c13=fCtz, c14=fCcz;
634
b8dc2353 635
46d29e70 636 fCyy-=k00*fCyy+k01*fCzy; fCzy-=k00*c01+k01*fCzz;
b3a5a838 637 fCey-=k00*c02+k01*c12; fCty-=k00*c03+k01*c13;
638 fCcy-=k00*c04+k01*c14;
b8dc2353 639
46d29e70 640 fCzz-=k10*c01+k11*fCzz;
b3a5a838 641 fCez-=k10*c02+k11*c12; fCtz-=k10*c03+k11*c13;
642 fCcz-=k10*c04+k11*c14;
b8dc2353 643
b3a5a838 644 fCee-=k20*c02+k21*c12; fCte-=k20*c03+k21*c13;
645 fCce-=k20*c04+k21*c14;
b8dc2353 646
b3a5a838 647 fCtt-=k30*c03+k31*c13;
46e2d86c 648 fCct-=k40*c03+k41*c13;
649 //fCct-=k30*c04+k31*c14; // symmetric formula MI
b8dc2353 650
651 fCcc-=k40*c04+k41*c14;
46d29e70 652
b8dc2353 653 Int_t n=GetNumberOfClusters();
5443e65e 654 fIndex[n]=index;
b8dc2353 655 SetNumberOfClusters(n+1);
fd621f36 656
b8dc2353 657 SetChi2(GetChi2()+chisq);
46d29e70 658 // cerr<<"in update: fIndex["<<fN<<"] = "<<index<<endl;
5443e65e 659
b8dc2353 660 return 1;
46d29e70 661}
8206377c 662
46e2d86c 663//_____________________________________________________________________________
3c625a9b 664Int_t AliTRDtrack::UpdateMI(const AliTRDcluster *c, Double_t chisq, UInt_t index, Double_t h01,
4f1c04d3 665 Int_t /*plane*/)
46e2d86c 666{
667 // Assignes found cluster to the track and updates track information
668
669 Bool_t fNoTilt = kTRUE;
670 if(TMath::Abs(h01) > 0.003) fNoTilt = kFALSE;
3c625a9b 671 // add angular effect to the error contribution and make correction - MI
c5a8e3df 672 //AliTRDclusterCorrection *corrector = AliTRDclusterCorrection::GetCorrection();
3c625a9b 673 //
674 Double_t tangent2 = (fC*fX-fE)*(fC*fX-fE);
675 if (tangent2 < 0.90000){
46e2d86c 676 tangent2 = tangent2/(1.-tangent2);
677 }
3c625a9b 678 Double_t tangent = TMath::Sqrt(tangent2);
679 if ((fC*fX-fE)<0) tangent*=-1;
4f1c04d3 680 // Double_t correction = 0*plane;
681 Double_t errang = tangent2*0.04; //
682 Double_t errsys =0.025*0.025*20; //systematic error part
683 Float_t extend =1;
684 if (c->GetNPads()==4) extend=2;
685 //if (c->GetNPads()==5) extend=3;
686 //if (c->GetNPads()==6) extend=3;
687 //if (c->GetQ()<15) return 1;
688
c5a8e3df 689 /*
3c625a9b 690 if (corrector!=0){
691 //if (0){
692 correction = corrector->GetCorrection(plane,c->GetLocalTimeBin(),tangent);
693 if (TMath::Abs(correction)>0){
694 //if we have info
695 errang = corrector->GetSigma(plane,c->GetLocalTimeBin(),tangent);
696 errang *= errang;
697 errang += tangent2*0.04;
698 }
699 }
c5a8e3df 700 */
3c625a9b 701 //
4f1c04d3 702 // Double_t padlength = TMath::Sqrt(c->GetSigmaZ2()*12.);
46e2d86c 703
4f1c04d3 704 Double_t r00=(c->GetSigmaY2() +errang+errsys)*extend, r01=0., r11=c->GetSigmaZ2()*10000.;
46e2d86c 705 r00+=fCyy; r01+=fCzy; r11+=fCzz;
706 Double_t det=r00*r11 - r01*r01;
707 Double_t tmp=r00; r00=r11/det; r11=tmp/det; r01=-r01/det;
708
709 Double_t k00=fCyy*r00+fCzy*r01, k01=fCyy*r01+fCzy*r11;
710 Double_t k10=fCzy*r00+fCzz*r01, k11=fCzy*r01+fCzz*r11;
711 Double_t k20=fCey*r00+fCez*r01, k21=fCey*r01+fCez*r11;
712 Double_t k30=fCty*r00+fCtz*r01, k31=fCty*r01+fCtz*r11;
713 Double_t k40=fCcy*r00+fCcz*r01, k41=fCcy*r01+fCcz*r11;
714
715 Double_t dy=c->GetY() - fY, dz=c->GetZ() - fZ;
716 Double_t cur=fC + k40*dy + k41*dz, eta=fE + k20*dy + k21*dz;
717
718
719 if(fNoTilt) {
3c625a9b 720 if (TMath::Abs(cur*fX-eta) >= 0.90000) {
721 // Int_t n=GetNumberOfClusters();
722 //if (n>4) cerr<<n<<" AliTRDtrack warning: Filtering failed !\n";
46e2d86c 723 return 0;
724 }
725 fY += k00*dy + k01*dz;
726 fZ += k10*dy + k11*dz;
727 fE = eta;
728 //fT += k30*dy + k31*dz;
729 fC = cur;
730 }
731 else {
4f1c04d3 732 Double_t padlength = TMath::Sqrt(c->GetSigmaZ2()*12);
733
8206377c 734 Double_t xuFactor = 1000.; // empirical factor set by C.Xu
46e2d86c 735 // in the first tilt version
736 dy=c->GetY() - fY; dz=c->GetZ() - fZ;
4f1c04d3 737 //dy=dy+h01*dz+correction;
738
739 Double_t tiltdz = dz;
740 if (TMath::Abs(tiltdz)>padlength/2.) {
741 tiltdz = TMath::Sign(padlength/2,dz);
742 }
743 // dy=dy+h01*dz;
744 dy=dy+h01*tiltdz;
745
46e2d86c 746 Double_t add=0;
747 if (TMath::Abs(dz)>padlength/2.){
748 //Double_t dy2 = c->GetY() - fY;
749 //Double_t sign = (dz>0) ? -1.: 1.;
3c625a9b 750 //dy2-=h01*sign*padlength/2.;
46e2d86c 751 //dy = dy2;
4f1c04d3 752 add =1;
46e2d86c 753 }
4f1c04d3 754 Double_t s00 = (c->GetSigmaY2()+errang)*extend+errsys+add; // error pad
8206377c 755 Double_t s11 = c->GetSigmaZ2()*xuFactor; // error pad-row
46e2d86c 756 //
757 r00 = fCyy + 2*fCzy*h01 + fCzz*h01*h01+s00;
758 r01 = fCzy + fCzz*h01;
759 r11 = fCzz + s11;
760 det = r00*r11 - r01*r01;
761 // inverse matrix
762 tmp=r00; r00=r11/det; r11=tmp/det; r01=-r01/det;
763
764 // K matrix
765 k00=fCyy*r00+fCzy*(r01+h01*r00),k01=fCyy*r01+fCzy*(r11+h01*r01);
766 k10=fCzy*r00+fCzz*(r01+h01*r00),k11=fCzy*r01+fCzz*(r11+h01*r01);
767 k20=fCey*r00+fCez*(r01+h01*r00),k21=fCey*r01+fCez*(r11+h01*r01);
768 k30=fCty*r00+fCtz*(r01+h01*r00),k31=fCty*r01+fCtz*(r11+h01*r01);
769 k40=fCcy*r00+fCcz*(r01+h01*r00),k41=fCcy*r01+fCcz*(r11+h01*r01);
770 //
771 //Update measurement
772 cur=fC + k40*dy + k41*dz; eta=fE + k20*dy + k21*dz;
3c625a9b 773 if (TMath::Abs(cur*fX-eta) >= 0.90000) {
774 //Int_t n=GetNumberOfClusters();
775 // if (n>4) cerr<<n<<" AliTRDtrack warning: Filtering failed !\n";
46e2d86c 776 return 0;
777 }
778 fY += k00*dy + k01*dz;
779 fZ += k10*dy + k11*dz;
780 fE = eta;
781 fT += k30*dy + k31*dz;
782 fC = cur;
783
784 k01+=h01*k00;
785 k11+=h01*k10;
786 k21+=h01*k20;
787 k31+=h01*k30;
788 k41+=h01*k40;
789
790 }
791 //Update covariance
792 //
793 //
794 Double_t oldyy = fCyy, oldzz = fCzz; //, oldee=fCee, oldcc =fCcc;
795 Double_t oldzy = fCzy, oldey = fCey, oldty=fCty, oldcy =fCcy;
796 Double_t oldez = fCez, oldtz = fCtz, oldcz=fCcz;
797 //Double_t oldte = fCte, oldce = fCce;
798 //Double_t oldct = fCct;
799
800 fCyy-=k00*oldyy+k01*oldzy;
801 fCzy-=k10*oldyy+k11*oldzy;
802 fCey-=k20*oldyy+k21*oldzy;
803 fCty-=k30*oldyy+k31*oldzy;
804 fCcy-=k40*oldyy+k41*oldzy;
805 //
806 fCzz-=k10*oldzy+k11*oldzz;
807 fCez-=k20*oldzy+k21*oldzz;
808 fCtz-=k30*oldzy+k31*oldzz;
809 fCcz-=k40*oldzy+k41*oldzz;
810 //
811 fCee-=k20*oldey+k21*oldez;
812 fCte-=k30*oldey+k31*oldez;
813 fCce-=k40*oldey+k41*oldez;
814 //
815 fCtt-=k30*oldty+k31*oldtz;
816 fCct-=k40*oldty+k41*oldtz;
817 //
818 fCcc-=k40*oldcy+k41*oldcz;
819 //
820
821 Int_t n=GetNumberOfClusters();
822 fIndex[n]=index;
823 SetNumberOfClusters(n+1);
824
825 SetChi2(GetChi2()+chisq);
826 // cerr<<"in update: fIndex["<<fN<<"] = "<<index<<endl;
827
828 return 1;
829}
46d29e70 830
831//_____________________________________________________________________________
832Int_t AliTRDtrack::Rotate(Double_t alpha)
833{
834 // Rotates track parameters in R*phi plane
9c9d2487 835
836 fNRotate++;
46d29e70 837
838 fAlpha += alpha;
b3a5a838 839 if (fAlpha<-TMath::Pi()) fAlpha += 2*TMath::Pi();
b8dc2353 840 if (fAlpha>=TMath::Pi()) fAlpha -= 2*TMath::Pi();
46d29e70 841
842 Double_t x1=fX, y1=fY;
843 Double_t ca=cos(alpha), sa=sin(alpha);
844 Double_t r1=fC*fX - fE;
845
846 fX = x1*ca + y1*sa;
b8dc2353 847 fY =-x1*sa + y1*ca;
848 if((r1*r1) > 1) return 0;
46d29e70 849 fE=fE*ca + (fC*y1 + sqrt(1.- r1*r1))*sa;
850
851 Double_t r2=fC*fX - fE;
3c625a9b 852 if (TMath::Abs(r2) >= 0.90000) {
b8dc2353 853 Int_t n=GetNumberOfClusters();
5443e65e 854 if (n>4) cerr<<n<<" AliTRDtrack warning: Rotation failed !\n";
46d29e70 855 return 0;
856 }
857
b8dc2353 858 if((r2*r2) > 1) return 0;
46d29e70 859 Double_t y0=fY + sqrt(1.- r2*r2)/fC;
860 if ((fY-y0)*fC >= 0.) {
b8dc2353 861 Int_t n=GetNumberOfClusters();
5443e65e 862 if (n>4) cerr<<n<<" AliTRDtrack warning: Rotation failed !!!\n";
46d29e70 863 return 0;
864 }
865
866 //f = F - 1
b3a5a838 867 Double_t f00=ca-1, f24=(y1 - r1*x1/sqrt(1.- r1*r1))*sa,
b8dc2353 868 f20=fC*sa, f22=(ca + sa*r1/sqrt(1.- r1*r1))-1;
46d29e70 869
870 //b = C*ft
b3a5a838 871 Double_t b00=fCyy*f00, b02=fCyy*f20+fCcy*f24+fCey*f22;
872 Double_t b10=fCzy*f00, b12=fCzy*f20+fCcz*f24+fCez*f22;
873 Double_t b20=fCey*f00, b22=fCey*f20+fCce*f24+fCee*f22;
874 Double_t b30=fCty*f00, b32=fCty*f20+fCct*f24+fCte*f22;
875 Double_t b40=fCcy*f00, b42=fCcy*f20+fCcc*f24+fCce*f22;
46d29e70 876
877 //a = f*b = f*C*ft
b3a5a838 878 Double_t a00=f00*b00, a02=f00*b02, a22=f20*b02+f24*b42+f22*b22;
46d29e70 879
46d29e70 880 //F*C*Ft = C + (a + b + bt)
881 fCyy += a00 + 2*b00;
882 fCzy += b10;
b3a5a838 883 fCey += a02+b20+b02;
884 fCty += b30;
885 fCcy += b40;
886 fCez += b12;
887 fCte += b32;
888 fCee += a22 + 2*b22;
889 fCce += b42;
46d29e70 890
b8dc2353 891 return 1;
46d29e70 892}
893
46d29e70 894//_____________________________________________________________________________
fd621f36 895Double_t AliTRDtrack::GetPredictedChi2(const AliTRDcluster *c, Double_t h01) const
46d29e70 896{
8206377c 897 //
898 // Returns the predicted chi^2
899 //
900
b8dc2353 901 Bool_t fNoTilt = kTRUE;
902 if(TMath::Abs(h01) > 0.003) fNoTilt = kFALSE;
903 Double_t chi2, dy, r00, r01, r11;
904
905 if(fNoTilt) {
906 dy=c->GetY() - fY;
907 r00=c->GetSigmaY2();
908 chi2 = (dy*dy)/r00;
46d29e70 909 }
b8dc2353 910 else {
4f1c04d3 911 Double_t padlength = TMath::Sqrt(c->GetSigmaZ2()*12);
912 //
b8dc2353 913 r00=c->GetSigmaY2(); r01=0.; r11=c->GetSigmaZ2();
914 r00+=fCyy; r01+=fCzy; r11+=fCzz;
915
916 Double_t det=r00*r11 - r01*r01;
917 if (TMath::Abs(det) < 1.e-10) {
918 Int_t n=GetNumberOfClusters();
919 if (n>4) cerr<<n<<" AliTRDtrack warning: Singular matrix !\n";
920 return 1e10;
921 }
922 Double_t tmp=r00; r00=r11; r11=tmp; r01=-r01;
923 Double_t dy=c->GetY() - fY, dz=c->GetZ() - fZ;
4f1c04d3 924 Double_t tiltdz = dz;
925 if (TMath::Abs(tiltdz)>padlength/2.) {
926 tiltdz = TMath::Sign(padlength/2,dz);
927 }
928 // dy=dy+h01*dz;
929 dy=dy+h01*tiltdz;
a819a5f7 930
b8dc2353 931 chi2 = (dy*r00*dy + 2*r01*dy*dz + dz*r11*dz)/det;
932 }
933 return chi2;
46d29e70 934
8206377c 935}
46d29e70 936
937//_________________________________________________________________________
938void AliTRDtrack::GetPxPyPz(Double_t& px, Double_t& py, Double_t& pz) const
939{
940 // Returns reconstructed track momentum in the global system.
941
942 Double_t pt=TMath::Abs(GetPt()); // GeV/c
943 Double_t r=fC*fX-fE;
5443e65e 944
945 Double_t y0;
946 if(r > 1) { py = pt; px = 0; }
947 else if(r < -1) { py = -pt; px = 0; }
948 else {
949 y0=fY + sqrt(1.- r*r)/fC;
950 px=-pt*(fY-y0)*fC; //cos(phi);
951 py=-pt*(fE-fX*fC); //sin(phi);
952 }
46d29e70 953 pz=pt*fT;
954 Double_t tmp=px*TMath::Cos(fAlpha) - py*TMath::Sin(fAlpha);
955 py=px*TMath::Sin(fAlpha) + py*TMath::Cos(fAlpha);
956 px=tmp;
957
958}
959
5443e65e 960//_________________________________________________________________________
961void AliTRDtrack::GetGlobalXYZ(Double_t& x, Double_t& y, Double_t& z) const
46d29e70 962{
5443e65e 963 // Returns reconstructed track coordinates in the global system.
964
965 x = fX; y = fY; z = fZ;
966 Double_t tmp=x*TMath::Cos(fAlpha) - y*TMath::Sin(fAlpha);
967 y=x*TMath::Sin(fAlpha) + y*TMath::Cos(fAlpha);
968 x=tmp;
969
970}
3ab6f951 971
5443e65e 972//_________________________________________________________________________
973void AliTRDtrack::ResetCovariance() {
974 //
975 // Resets covariance matrix
976 //
46d29e70 977
5443e65e 978 fCyy*=10.;
b8dc2353 979 fCzy=0.; fCzz*=10.;
980 fCey=0.; fCez=0.; fCee*=10.;
981 fCty=0.; fCtz=0.; fCte=0.; fCtt*=10.;
982 fCcy=0.; fCcz=0.; fCce=0.; fCct=0.; fCcc*=10.;
5443e65e 983}
b8dc2353 984
8206377c 985//_________________________________________________________________________
46e2d86c 986void AliTRDtrack::ResetCovariance(Float_t mult) {
987 //
988 // Resets covariance matrix
989 //
990
991 fCyy*=mult;
4f1c04d3 992 fCzy*=0.; fCzz*=1.;
3c625a9b 993 fCey*=0.; fCez*=0.; fCee*=mult;
4f1c04d3 994 fCty*=0.; fCtz*=0.; fCte*=0.; fCtt*=1.;
3c625a9b 995 fCcy*=0.; fCcz*=0.; fCce*=0.; fCct*=0.; fCcc*=mult;
46e2d86c 996}
16d9fbba 997
8206377c 998//_________________________________________________________________________
16d9fbba 999void AliTRDtrack::MakeBackupTrack()
1000{
1001 //
8206377c 1002 // Creates a backup track
16d9fbba 1003 //
8206377c 1004
16d9fbba 1005 if (fBackupTrack) delete fBackupTrack;
1006 fBackupTrack = new AliTRDtrack(*this);
4f1c04d3 1007
1008}
1009
8206377c 1010//_________________________________________________________________________
1011Int_t AliTRDtrack::GetProlongation(Double_t xk, Double_t &y, Double_t &z)
1012{
4f1c04d3 1013 //
1014 // Find prolongation at given x
1015 // return 0 if not exist
8206377c 1016 //
4f1c04d3 1017
1018 Double_t c1=fC*fX - fE;
1019 if (TMath::Abs(c1)>1.) return 0;
1020 Double_t r1=TMath::Sqrt(1.- c1*c1);
1021 Double_t c2=fC*xk - fE;
1022 if (TMath::Abs(c2)>1.) return 0;
1023 Double_t r2=TMath::Sqrt(1.- c2*c2);
1024 y =fY + (xk-fX)*(c1+c2)/(r1+r2);
1025 z =fZ + (xk-fX)*(c1+c2)/(c1*r2 + c2*r1)*fT;
1026
1027 return 1;
1028
16d9fbba 1029}