1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.7 2001/05/28 17:07:58 hristov
19 Last minute changes; ExB correction in AliTRDclusterizerV1; taking into account of material in G10 TEC frames and material between TEC planes (C.Blume,S.Sedykh)
21 Revision 1.4 2000/12/08 16:07:02 cblume
22 Update of the tracking by Sergei
24 Revision 1.3 2000/10/15 23:40:01 cblume
27 Revision 1.2 2000/10/06 16:49:46 cblume
30 Revision 1.1.2.1 2000/09/22 14:47:52 cblume
40 #include "AliTRDgeometry.h"
41 #include "AliTRDcluster.h"
42 #include "AliTRDtrack.h"
47 //_____________________________________________________________________________
49 AliTRDtrack::AliTRDtrack(const AliTRDcluster *c, UInt_t index,
50 const Double_t xx[5], const Double_t cc[15], Double_t xref, Double_t alpha) {
51 //-----------------------------------------------------------------
52 // This is the main track constructor.
53 //-----------------------------------------------------------------
61 fY=xx[0]; fZ=xx[1]; fC=xx[2]; fE=xx[3]; fT=xx[4];
64 fCzy=cc[1]; fCzz=cc[2];
65 fCcy=cc[3]; fCcz=cc[4]; fCcc=cc[5];
66 fCey=cc[6]; fCez=cc[7]; fCec=cc[8]; fCee=cc[9];
67 fCty=cc[10]; fCtz=cc[11]; fCtc=cc[12]; fCte=cc[13]; fCtt=cc[14];
72 Float_t q = c->GetQ();
73 Double_t s = fX*fC - fE, t=fT;
74 q *= TMath::Sqrt((1-s*s)/(1+t*t));
78 //_____________________________________________________________________________
79 AliTRDtrack::AliTRDtrack(const AliTRDtrack& t) {
92 fY=t.fY; fZ=t.fZ; fC=t.fC; fE=t.fE; fT=t.fT;
95 fCzy=t.fCzy; fCzz=t.fCzz;
96 fCcy=t.fCcy; fCcz=t.fCcz; fCcc=t.fCcc;
97 fCey=t.fCey; fCez=t.fCez; fCec=t.fCec; fCee=t.fCee;
98 fCty=t.fCty; fCtz=t.fCtz; fCtc=t.fCtc; fCte=t.fCte; fCtt=t.fCtt;
101 for (Int_t i=0; i<fN; i++) {
102 fIndex[i]=t.fIndex[i];
107 //_____________________________________________________________________________
108 void AliTRDtrack::GetCovariance(Double_t cc[15]) const {
110 cc[1]=fCzy; cc[2]=fCzz;
111 cc[3]=fCcy; cc[4]=fCcz; cc[5]=fCcc;
112 cc[6]=fCey; cc[7]=fCez; cc[8]=fCec; cc[9]=fCee;
113 cc[10]=fCty; cc[11]=fCtz; cc[12]=fCtc; cc[13]=fCte; cc[14]=fCtt;
116 //_____________________________________________________________________________
117 Int_t AliTRDtrack::Compare(const TObject *o) const {
119 // Compares tracks according to their Y2
121 AliTRDtrack *t=(AliTRDtrack*)o;
122 // Double_t co=t->GetSigmaY2();
123 // Double_t c =GetSigmaY2();
125 Double_t co=TMath::Abs(t->GetC());
126 Double_t c =TMath::Abs(GetC());
129 else if (c<co) return -1;
133 //_____________________________________________________________________________
134 void AliTRDtrack::CookdEdx(Double_t low, Double_t up) {
135 //-----------------------------------------------------------------
136 // Calculates dE/dX within the "low" and "up" cuts.
137 //-----------------------------------------------------------------
139 Int_t nc=GetNclusters();
142 for (i=0; i<200; i++) sorted[i]=fdQdl[i];
147 for (i=0; i<nc-1; i++) {
148 if (sorted[i]<=sorted[i+1]) continue;
149 Float_t tmp=sorted[i];
150 sorted[i]=sorted[i+1]; sorted[i+1]=tmp;
155 Int_t nl=Int_t(low*nc), nu=Int_t(up*nc);
157 for (i=nl; i<=nu; i++) dedx += sorted[i];
164 //_____________________________________________________________________________
165 Int_t AliTRDtrack::PropagateTo(Double_t xk,Double_t x0,Double_t rho,Double_t pm)
167 // Propagates a track of particle with mass=pm to a reference plane
168 // defined by x=xk through media of density=rho and radiationLength=x0
170 if (TMath::Abs(fC*xk - fE) >= 0.99999) {
171 if (fN>4) cerr<<fN<<" AliTRDtrack warning: Propagation failed !\n";
175 Double_t x1=fX, x2=x1+(xk-x1), dx=x2-x1, y1=fY, z1=fZ;
176 Double_t c1=fC*x1 - fE, r1=sqrt(1.- c1*c1);
177 Double_t c2=fC*x2 - fE, r2=sqrt(1.- c2*c2);
179 fY += dx*(c1+c2)/(r1+r2);
180 fZ += dx*(c1+c2)/(c1*r2 + c2*r1)*fT;
183 Double_t rr=r1+r2, cc=c1+c2, xx=x1+x2;
184 Double_t f02= dx*(rr*xx + cc*(c1*x1/r1+c2*x2/r2))/(rr*rr);
185 Double_t f03=-dx*(2*rr + cc*(c1/r1 + c2/r2))/(rr*rr);
186 Double_t cr=c1*r2+c2*r1;
187 Double_t f12= dx*fT*(cr*xx-cc*(r1*x2-c2*c1*x1/r1+r2*x1-c1*c2*x2/r2))/(cr*cr);
188 Double_t f13=-dx*fT*(2*cr + cc*(c2*c1/r1-r1 + c1*c2/r2-r2))/(cr*cr);
189 Double_t f14= dx*cc/cr;
192 Double_t b00=f02*fCcy + f03*fCey, b01=f12*fCcy + f13*fCey + f14*fCty;
193 Double_t b10=f02*fCcz + f03*fCez, b11=f12*fCcz + f13*fCez + f14*fCtz;
194 Double_t b20=f02*fCcc + f03*fCec, b21=f12*fCcc + f13*fCec + f14*fCtc;
195 Double_t b30=f02*fCec + f03*fCee, b31=f12*fCec + f13*fCee + f14*fCte;
196 Double_t b40=f02*fCtc + f03*fCte, b41=f12*fCtc + f13*fCte + f14*fCtt;
199 Double_t a00=f02*b20+f03*b30,a01=f02*b21+f03*b31,a11=f12*b21+f13*b31+f14*b41;
201 //F*C*Ft = C + (a + b + bt)
203 fCzy += a01 + b01 + b10;
215 //Multiple scattering ******************
217 Double_t d=sqrt((x1-fX)*(x1-fX)+(y1-fY)*(y1-fY)+(z1-fZ)*(z1-fZ));
218 Double_t p2=GetPt()*GetPt()*(1.+fT*fT);
219 Double_t beta2=p2/(p2 + pm*pm);
221 Double_t ey=fC*fX - fE, ez=fT;
222 Double_t xz=fC*ez, zz1=ez*ez+1, xy=fE+ey;
224 Double_t theta2=14.1*14.1/(beta2*p2*1e6)*d/x0*rho;
225 fCcc += xz*xz*theta2;
226 fCec += xz*ez*xy*theta2;
227 fCtc += xz*zz1*theta2;
228 fCee += (2*ey*ez*ez*fE+1-ey*ey+ez*ez+fE*fE*ez*ez)*theta2;
229 fCte += ez*zz1*xy*theta2;
230 fCtt += zz1*zz1*theta2;
233 //Energy losses************************
235 Double_t dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2)) - beta2)*d*rho;
237 fC*=(1.- sqrt(p2+pm*pm)/p2*dE);
238 //fE*=(1.- sqrt(p2+pm*pm)/p2*dE);
245 //_____________________________________________________________________________
246 void AliTRDtrack::Update(const AliTRDcluster *c, Double_t chisq, UInt_t index)
248 // Assignes found cluster to the track and updates track information
250 Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2();
251 r00+=fCyy; r01+=fCzy; r11+=fCzz;
252 Double_t det=r00*r11 - r01*r01;
253 Double_t tmp=r00; r00=r11/det; r11=tmp/det; r01=-r01/det;
255 Double_t k00=fCyy*r00+fCzy*r01, k01=fCyy*r01+fCzy*r11;
256 Double_t k10=fCzy*r00+fCzz*r01, k11=fCzy*r01+fCzz*r11;
257 Double_t k20=fCcy*r00+fCcz*r01, k21=fCcy*r01+fCcz*r11;
258 Double_t k30=fCey*r00+fCez*r01, k31=fCey*r01+fCez*r11;
259 Double_t k40=fCty*r00+fCtz*r01, k41=fCty*r01+fCtz*r11;
261 Double_t dy=c->GetY() - fY, dz=c->GetZ() - fZ;
262 Double_t cur=fC + k20*dy + k21*dz, eta=fE + k30*dy + k31*dz;
263 if (TMath::Abs(cur*fX-eta) >= 0.99999) {
264 if (fN>4) cerr<<fN<<" AliTRDtrack warning: Filtering failed !\n";
268 fY += k00*dy + k01*dz;
269 fZ += k10*dy + k11*dz;
272 fT += k40*dy + k41*dz;
274 Double_t c01=fCzy, c02=fCcy, c03=fCey, c04=fCty;
275 Double_t c12=fCcz, c13=fCez, c14=fCtz;
277 fCyy-=k00*fCyy+k01*fCzy; fCzy-=k00*c01+k01*fCzz;
278 fCcy-=k00*c02+k01*c12; fCey-=k00*c03+k01*c13;
279 fCty-=k00*c04+k01*c14;
281 fCzz-=k10*c01+k11*fCzz;
282 fCcz-=k10*c02+k11*c12; fCez-=k10*c03+k11*c13;
283 fCtz-=k10*c04+k11*c14;
285 fCcc-=k20*c02+k21*c12; fCec-=k20*c03+k21*c13;
286 fCtc-=k20*c04+k21*c14;
288 fCee-=k30*c03+k31*c13;
289 fCte-=k30*c04+k31*c14;
291 fCtt-=k40*c04+k41*c14;
295 Float_t q = c->GetQ();
296 Double_t s = fX*fC - fE, t=fT;
297 q *= TMath::Sqrt((1-s*s)/(1+t*t));
302 // cerr<<"in update: fIndex["<<fN<<"] = "<<index<<endl;
305 //_____________________________________________________________________________
306 Int_t AliTRDtrack::Rotate(Double_t alpha)
308 // Rotates track parameters in R*phi plane
312 Double_t x1=fX, y1=fY;
313 Double_t ca=cos(alpha), sa=sin(alpha);
314 Double_t r1=fC*fX - fE;
318 fE=fE*ca + (fC*y1 + sqrt(1.- r1*r1))*sa;
320 Double_t r2=fC*fX - fE;
321 if (TMath::Abs(r2) >= 0.99999) {
322 if (fN>4) cerr<<fN<<" AliTRDtrack warning: Rotation failed !\n";
326 Double_t y0=fY + sqrt(1.- r2*r2)/fC;
327 if ((fY-y0)*fC >= 0.) {
328 if (fN>4) cerr<<fN<<" AliTRDtrack warning: Rotation failed !!!\n";
333 Double_t f00=ca-1, f32=(y1 - r1*x1/sqrt(1.- r1*r1))*sa,
334 f30=fC*sa, f33=(ca + sa*r1/sqrt(1.- r1*r1))-1;
337 Double_t b00=fCyy*f00, b03=fCyy*f30+fCcy*f32+fCey*f33;
338 Double_t b10=fCzy*f00, b13=fCzy*f30+fCcz*f32+fCez*f33;
339 Double_t b20=fCcy*f00, b23=fCcy*f30+fCcc*f32+fCec*f33;
340 Double_t b30=fCey*f00, b33=fCey*f30+fCec*f32+fCee*f33;
341 Double_t b40=fCty*f00, b43=fCty*f30+fCtc*f32+fCte*f33;
344 Double_t a00=f00*b00, a03=f00*b03, a33=f30*b03+f32*b23+f33*b33;
346 // *** Double_t dy2=fCyy;
348 //F*C*Ft = C + (a + b + bt)
359 // *** fCyy+=dy2*sa*sa*r1*r1/(1.- r1*r1);
360 // *** fCzz+=d2y*sa*sa*fT*fT/(1.- r1*r1);
366 //_____________________________________________________________________________
367 Double_t AliTRDtrack::GetPredictedChi2(const AliTRDcluster *c) const
370 Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2();
371 r00+=fCyy; r01+=fCzy; r11+=fCzz;
373 Double_t det=r00*r11 - r01*r01;
374 if (TMath::Abs(det) < 1.e-10) {
375 if (fN>4) cerr<<fN<<" AliTRDtrack warning: Singular matrix !\n";
378 Double_t tmp=r00; r00=r11; r11=tmp; r01=-r01;
380 Double_t dy=c->GetY() - fY, dz=c->GetZ() - fZ;
382 return (dy*r00*dy + 2*r01*dy*dz + dz*r11*dz)/det;
385 Double_t dy=c->GetY() - fY;
386 Double_t r00=c->GetSigmaY2();
393 //_________________________________________________________________________
394 void AliTRDtrack::GetPxPyPz(Double_t& px, Double_t& py, Double_t& pz) const
396 // Returns reconstructed track momentum in the global system.
398 Double_t pt=TMath::Abs(GetPt()); // GeV/c
400 Double_t y0=fY + sqrt(1.- r*r)/fC;
401 px=-pt*(fY-y0)*fC; //cos(phi);
402 py=-pt*(fE-fX*fC); //sin(phi);
404 Double_t tmp=px*TMath::Cos(fAlpha) - py*TMath::Sin(fAlpha);
405 py=px*TMath::Sin(fAlpha) + py*TMath::Cos(fAlpha);
410 //____________________________________________________________________________
411 void AliTRDtrack::Streamer(TBuffer &R__b)
415 if (R__b.IsReading()) {
416 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
417 TObject::Streamer(R__b);
444 for (i=0; i<fN; i++) R__b >> fIndex[i];
445 for (i=0; i<fN; i++) R__b >> fdQdl[i];
447 R__b.WriteVersion(AliTRDtrack::IsA());
448 TObject::Streamer(R__b);
475 for (i=0; i<fN; i++) R__b << fIndex[i];
476 for (i=0; i<fN; i++) R__b << fdQdl[i];