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