ae982df3 |
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 | **************************************************************************/ |
ae982df3 |
15 | //----------------------------------------------------------------- |
16 | // Implementation of the ESD track class |
4427806c |
17 | // ESD = Event Summary Data |
15614b8b |
18 | // This is the class to deal with during the phisics analysis of data |
4427806c |
19 | // Origin: Iouri Belikov, CERN |
20 | // e-mail: Jouri.Belikov@cern.ch |
ae982df3 |
21 | //----------------------------------------------------------------- |
22 | |
23 | #include "TMath.h" |
24 | |
25 | #include "AliESDtrack.h" |
26 | #include "AliKalmanTrack.h" |
5f7789fc |
27 | #include "AliLog.h" |
ae982df3 |
28 | |
29 | ClassImp(AliESDtrack) |
30 | |
31 | //_______________________________________________________________________ |
32 | AliESDtrack::AliESDtrack() : |
2bad268c |
33 | fFlags(0), |
34 | fLabel(0), |
35 | fTrackLength(0), |
36 | fStopVertex(0), |
37 | fRalpha(0), |
38 | fRx(0), |
a866ac60 |
39 | fCalpha(0), |
40 | fCx(0), |
67c3dcbe |
41 | fCchi2(1e10), |
a866ac60 |
42 | fIalpha(0), |
43 | fIx(0), |
c4d11b15 |
44 | fTalpha(0), |
45 | fTx(0), |
a866ac60 |
46 | fOalpha(0), |
47 | fOx(0), |
2bad268c |
48 | fITSchi2(0), |
ae982df3 |
49 | fITSncls(0), |
2bad268c |
50 | fITSsignal(0), |
2bad268c |
51 | fTPCchi2(0), |
05e445cd |
52 | fTPCncls(0), |
a866ac60 |
53 | fTPCClusterMap(159),//number of padrows |
2bad268c |
54 | fTPCsignal(0), |
55 | fTRDchi2(0), |
56 | fTRDncls(0), |
c4d11b15 |
57 | fTRDncls0(0), |
2bad268c |
58 | fTRDsignal(0), |
59 | fTOFchi2(0), |
ea776286 |
60 | fTOFindex(0), |
4a78b8c5 |
61 | fTOFsignal(-1), |
62 | fPHOSsignal(-1), |
704be597 |
63 | fEMCALsignal(-1), |
4a78b8c5 |
64 | fRICHsignal(-1) |
ae982df3 |
65 | { |
66 | // |
67 | // The default ESD constructor |
68 | // |
2bad268c |
69 | for (Int_t i=0; i<kSPECIES; i++) { |
4a78b8c5 |
70 | fTrackTime[i]=0.; |
71 | fR[i]=1.; |
72 | fITSr[i]=1.; |
73 | fTPCr[i]=1.; |
74 | fTRDr[i]=1.; |
75 | fTOFr[i]=1.; |
4a78b8c5 |
76 | fRICHr[i]=1.; |
2bad268c |
77 | } |
ac2f7574 |
78 | |
704be597 |
79 | for (Int_t i=0; i<kSPECIESN; i++) { |
80 | fPHOSr[i] = 1.; |
81 | fEMCALr[i] = 1.; |
82 | } |
83 | |
ac2f7574 |
84 | |
4a78b8c5 |
85 | fPHOSpos[0]=fPHOSpos[1]=fPHOSpos[2]=0.; |
704be597 |
86 | fEMCALpos[0]=fEMCALpos[1]=fEMCALpos[2]=0.; |
bb2ceb1f |
87 | Int_t i; |
15614b8b |
88 | for (i=0; i<5; i++) { |
89 | fRp[i]=fCp[i]=fIp[i]=fOp[i]=fXp[i]=fTp[i]=0.; |
90 | } |
91 | for (i=0; i<15; i++) { |
92 | fRc[i]=fCc[i]=fIc[i]=fOc[i]=fXc[i]=fTc[i]=0.; |
93 | } |
a866ac60 |
94 | for (i=0; i<6; i++) { fITSindex[i]=0; } |
95 | for (i=0; i<180; i++){ fTPCindex[i]=0; } |
c4d11b15 |
96 | for (i=0; i<130; i++) { fTRDindex[i]=0; } |
6e5b1b04 |
97 | fTPCLabel = 0; |
98 | fTRDLabel = 0; |
99 | fITSLabel = 0; |
c4d11b15 |
100 | fITStrack = 0; |
101 | fTRDtrack = 0; |
102 | } |
103 | |
104 | //_______________________________________________________________________ |
105 | |
106 | AliESDtrack::AliESDtrack(const AliESDtrack& track):TObject(track){ |
107 | // |
108 | //copy constructor |
109 | // |
110 | fFlags = track.fFlags; |
111 | fLabel =track.fLabel; |
112 | fTrackLength =track.fTrackLength; |
113 | for (Int_t i=0;i<kSPECIES;i++) fTrackTime[i] =track.fTrackTime[i]; |
114 | for (Int_t i=0;i<kSPECIES;i++) fR[i] =track.fR[i]; |
115 | fStopVertex =track.fStopVertex; |
116 | // |
117 | fRalpha =track.fRalpha; |
118 | fRx =track.fRx; |
119 | for (Int_t i=0;i<5;i++) fRp[i] =track.fRp[i]; |
120 | for (Int_t i=0;i<15;i++) fRc[i] =track.fRc[i]; |
121 | // |
122 | fCalpha =track.fCalpha; |
123 | fCx =track.fCx; |
124 | for (Int_t i=0;i<5;i++) fCp[i] =track.fCp[i]; |
125 | for (Int_t i=0;i<15;i++) fCc[i] =track.fCc[i]; |
126 | fCchi2 =track.fCchi2; |
127 | // |
128 | fIalpha =track.fIalpha; |
129 | fIx =track.fIx; |
130 | for (Int_t i=0;i<5;i++) fIp[i] =track.fIp[i]; |
131 | for (Int_t i=0;i<15;i++) fIc[i] =track.fIc[i]; |
132 | // |
133 | fTalpha =track.fTalpha; |
134 | fTx =track.fTx; |
135 | for (Int_t i=0;i<5;i++) fTp[i] =track.fTp[i]; |
136 | for (Int_t i=0;i<15;i++) fTc[i] =track.fTc[i]; |
137 | // |
138 | fOalpha =track.fOalpha; |
139 | fOx =track.fOx; |
140 | for (Int_t i=0;i<5;i++) fOp[i] =track.fOp[i]; |
141 | for (Int_t i=0;i<15;i++) fOc[i] =track.fOc[i]; |
142 | // |
143 | fXalpha =track.fXalpha; |
144 | fXx =track.fXx; |
145 | for (Int_t i=0;i<5;i++) fXp[i] =track.fXp[i]; |
146 | for (Int_t i=0;i<15;i++) fXc[i] =track.fXc[i]; |
147 | // |
148 | fITSchi2 =track.fITSchi2; |
149 | for (Int_t i=0;i<12;i++) fITSchi2MIP[i] =track.fITSchi2MIP[i]; |
150 | fITSncls =track.fITSncls; |
151 | for (Int_t i=0;i<6;i++) fITSindex[i]=track.fITSindex[i]; |
152 | fITSsignal =track.fITSsignal; |
153 | for (Int_t i=0;i<kSPECIES;i++) fITSr[i]=track.fITSr[i]; |
154 | fITSLabel =track.fITSLabel; |
155 | fITSFakeRatio =track.fITSFakeRatio; |
156 | fITStrack =0; //coping separatelly - in user code |
157 | // |
158 | fTPCchi2 =track.fTPCchi2; |
159 | fTPCncls =track.fTPCncls; |
160 | for (Int_t i=0;i<180;i++) fTPCindex[i]=track.fTPCindex[i]; |
161 | fTPCClusterMap=track.fTPCClusterMap; |
162 | fTPCsignal=track.fTPCsignal; |
163 | for (Int_t i=0;i<kSPECIES;i++) fTPCr[i]=track.fTPCr[i]; |
164 | fTPCLabel=track.fTPCLabel; |
165 | // |
166 | fTRDchi2=track.fTRDchi2; |
167 | fTRDncls=track.fTRDncls; |
168 | fTRDncls0=track.fTRDncls0; |
169 | for (Int_t i=0;i<130;i++) fTRDindex[i]=track.fTRDindex[i]; |
170 | fTRDsignal=track.fTRDsignal; |
171 | for (Int_t i=0;i<kSPECIES;i++) fTRDr[i]=track.fTRDr[i]; |
172 | fTRDLabel=track.fTRDLabel; |
173 | fTRDtrack=0; |
174 | // |
175 | fTOFchi2=track.fTOFchi2; |
176 | fTOFindex=track.fTOFindex; |
177 | fTOFsignal=track.fTOFsignal; |
178 | for (Int_t i=0;i<kSPECIES;i++) fTOFr[i]=track.fTOFr[i]; |
179 | // |
180 | for (Int_t i=0;i<3;i++) fPHOSpos[i]=track.fPHOSpos[i]; |
181 | fPHOSsignal=track.fPHOSsignal; |
4162b1d0 |
182 | for (Int_t i=0;i<kSPECIESN;i++) fPHOSr[i]=track.fPHOSr[i]; |
c4d11b15 |
183 | // |
184 | for (Int_t i=0;i<3;i++) fEMCALpos[i]=track.fEMCALpos[i]; |
185 | fEMCALsignal=track.fEMCALsignal; |
4162b1d0 |
186 | for (Int_t i=0;i<kSPECIESN;i++) fEMCALr[i]=track.fEMCALr[i]; |
c4d11b15 |
187 | // |
188 | fRICHsignal=track.fRICHsignal; |
189 | for (Int_t i=0;i<kSPECIES;i++) fRICHr[i]=track.fRICHr[i]; |
190 | |
ac2f7574 |
191 | |
ae982df3 |
192 | } |
c4d11b15 |
193 | //_______________________________________________________________________ |
194 | AliESDtrack::~AliESDtrack(){ |
195 | // |
196 | // This is destructor according Coding Conventrions |
197 | // |
198 | //printf("Delete track\n"); |
3fd96ae3 |
199 | delete fITStrack; |
200 | delete fTRDtrack; |
c4d11b15 |
201 | } |
ae982df3 |
202 | |
203 | //_______________________________________________________________________ |
4a78b8c5 |
204 | Double_t AliESDtrack::GetMass() const { |
4427806c |
205 | // Returns the mass of the most probable particle type |
ae982df3 |
206 | Float_t max=0.; |
207 | Int_t k=-1; |
208 | for (Int_t i=0; i<kSPECIES; i++) { |
209 | if (fR[i]>max) {k=i; max=fR[i];} |
210 | } |
db3989b3 |
211 | if (k==0) { // dE/dx "crossing points" in the TPC |
212 | Double_t p=GetP(); |
213 | if ((p>0.38)&&(p<0.48)) |
214 | if (fR[0]<fR[3]*10.) return 0.49368; |
215 | if ((p>0.75)&&(p<0.85)) |
216 | if (fR[0]<fR[4]*10.) return 0.93827; |
217 | return 0.00051; |
218 | } |
c4d11b15 |
219 | if (k==1) return 0.10566; |
ae982df3 |
220 | if (k==2||k==-1) return 0.13957; |
221 | if (k==3) return 0.49368; |
222 | if (k==4) return 0.93827; |
5f7789fc |
223 | AliWarning("Undefined mass !"); |
ae982df3 |
224 | return 0.13957; |
225 | } |
226 | |
227 | //_______________________________________________________________________ |
15614b8b |
228 | Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags) { |
ae982df3 |
229 | // |
230 | // This function updates track's running parameters |
231 | // |
15614b8b |
232 | Bool_t rc=kTRUE; |
233 | |
9b859005 |
234 | SetStatus(flags); |
235 | fLabel=t->GetLabel(); |
236 | |
237 | if (t->IsStartedTimeIntegral()) { |
238 | SetStatus(kTIME); |
239 | Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times); |
240 | SetIntegratedLength(t->GetIntegratedLength()); |
241 | } |
242 | |
243 | fRalpha=t->GetAlpha(); |
244 | t->GetExternalParameters(fRx,fRp); |
245 | t->GetExternalCovariance(fRc); |
246 | |
ae982df3 |
247 | switch (flags) { |
ad2f1f2b |
248 | |
9b859005 |
249 | case kITSin: case kITSout: case kITSrefit: |
ae982df3 |
250 | fITSncls=t->GetNumberOfClusters(); |
251 | fITSchi2=t->GetChi2(); |
252 | for (Int_t i=0;i<fITSncls;i++) fITSindex[i]=t->GetClusterIndex(i); |
253 | fITSsignal=t->GetPIDsignal(); |
6e5b1b04 |
254 | fITSLabel = t->GetLabel(); |
babd135a |
255 | fITSFakeRatio = t->GetFakeRatio(); |
ae982df3 |
256 | break; |
ad2f1f2b |
257 | |
9b859005 |
258 | case kTPCin: case kTPCrefit: |
6e5b1b04 |
259 | fTPCLabel = t->GetLabel(); |
9b859005 |
260 | fIalpha=fRalpha; |
261 | fIx=fRx; |
262 | { |
263 | Int_t i; |
264 | for (i=0; i<5; i++) fIp[i]=fRp[i]; |
265 | for (i=0; i<15;i++) fIc[i]=fRc[i]; |
266 | } |
267 | case kTPCout: |
a866ac60 |
268 | |
ae982df3 |
269 | fTPCncls=t->GetNumberOfClusters(); |
270 | fTPCchi2=t->GetChi2(); |
a866ac60 |
271 | |
272 | {//prevrow must be declared in separate namespace, otherwise compiler cries: |
273 | //"jump to case label crosses initialization of `Int_t prevrow'" |
274 | Int_t prevrow = -1; |
6e5b1b04 |
275 | // for (Int_t i=0;i<fTPCncls;i++) |
276 | for (Int_t i=0;i<160;i++) |
a866ac60 |
277 | { |
278 | fTPCindex[i]=t->GetClusterIndex(i); |
279 | |
280 | // Piotr's Cluster Map for HBT |
281 | // ### please change accordingly if cluster array is changing |
282 | // to "New TPC Tracking" style (with gaps in array) |
283 | Int_t idx = fTPCindex[i]; |
284 | Int_t sect = (idx&0xff000000)>>24; |
285 | Int_t row = (idx&0x00ff0000)>>16; |
286 | if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors |
287 | |
288 | fTPCClusterMap.SetBitNumber(row,kTRUE); |
289 | |
290 | //Fill the gap between previous row and this row with 0 bits |
291 | //In case ### pleas change it as well - just set bit 0 in case there |
292 | //is no associated clusters for current "i" |
293 | if (prevrow < 0) |
294 | { |
295 | prevrow = row;//if previous bit was not assigned yet == this is the first one |
296 | } |
297 | else |
298 | { //we don't know the order (inner to outer or reverse) |
299 | //just to be save in case it is going to change |
300 | Int_t n = 0, m = 0; |
301 | if (prevrow < row) |
302 | { |
303 | n = prevrow; |
304 | m = row; |
305 | } |
306 | else |
307 | { |
308 | n = row; |
309 | m = prevrow; |
310 | } |
311 | |
312 | for (Int_t j = n+1; j < m; j++) |
313 | { |
314 | fTPCClusterMap.SetBitNumber(j,kFALSE); |
315 | } |
316 | prevrow = row; |
317 | } |
318 | // End Of Piotr's Cluster Map for HBT |
319 | } |
320 | } |
ae982df3 |
321 | fTPCsignal=t->GetPIDsignal(); |
322 | {Double_t mass=t->GetMass(); // preliminary mass setting |
323 | if (mass>0.5) fR[4]=1.; // used by |
324 | else if (mass<0.4) fR[2]=1.; // the ITS reconstruction |
a866ac60 |
325 | else fR[3]=1.;} |
326 | // |
ae982df3 |
327 | break; |
9b859005 |
328 | |
672b5f43 |
329 | case kTRDout: |
15614b8b |
330 | //requested by the PHOS/EMCAL ("temporary solution") |
331 | fOalpha=t->GetAlpha(); |
332 | fOx=460.; |
333 | rc=GetExternalParametersAt(fOx,fOp); |
334 | t->GetExternalCovariance(fOc); //can be done better |
335 | |
336 | fXalpha=t->GetAlpha(); |
337 | fXx=450.; |
338 | rc=GetExternalParametersAt(fXx,fXp); |
339 | t->GetExternalCovariance(fXc); //can be done better |
340 | |
672b5f43 |
341 | case kTRDin: case kTRDrefit: |
6e5b1b04 |
342 | fTRDLabel = t->GetLabel(); |
c4d11b15 |
343 | |
79e94bf8 |
344 | fTRDncls=t->GetNumberOfClusters(); |
345 | fTRDchi2=t->GetChi2(); |
bb2ceb1f |
346 | for (Int_t i=0;i<fTRDncls;i++) fTRDindex[i]=t->GetClusterIndex(i); |
79e94bf8 |
347 | fTRDsignal=t->GetPIDsignal(); |
348 | break; |
c4d11b15 |
349 | case kTRDbackup: |
350 | t->GetExternalParameters(fTx,fTp); |
351 | t->GetExternalCovariance(fTc); |
352 | fTRDncls0 = t->GetNumberOfClusters(); |
353 | break; |
354 | case kTOFin: |
355 | break; |
356 | case kTOFout: |
357 | break; |
d0862fea |
358 | case kTRDStop: |
359 | break; |
ae982df3 |
360 | default: |
5f7789fc |
361 | AliError("Wrong flag !"); |
ae982df3 |
362 | return kFALSE; |
363 | } |
364 | |
15614b8b |
365 | return rc; |
ae982df3 |
366 | } |
367 | |
67c3dcbe |
368 | //_______________________________________________________________________ |
369 | void |
5ccd1720 |
370 | AliESDtrack::SetConstrainedTrackParams(const AliKalmanTrack *t, Double_t chi2) { |
67c3dcbe |
371 | // |
372 | // This function sets the constrained track parameters |
373 | // |
db3989b3 |
374 | Int_t i; |
375 | Double_t x,buf[15]; |
67c3dcbe |
376 | fCalpha=t->GetAlpha(); |
db3989b3 |
377 | t->GetExternalParameters(x,buf); fCx=x; |
378 | for (i=0; i<5; i++) fCp[i]=buf[i]; |
379 | t->GetExternalCovariance(buf); |
380 | for (i=0; i<15; i++) fCc[i]=buf[i]; |
67c3dcbe |
381 | fCchi2=chi2; |
382 | } |
383 | |
384 | |
ae982df3 |
385 | //_______________________________________________________________________ |
386 | void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const { |
387 | //--------------------------------------------------------------------- |
388 | // This function returns external representation of the track parameters |
389 | //--------------------------------------------------------------------- |
390 | x=fRx; |
391 | for (Int_t i=0; i<5; i++) p[i]=fRp[i]; |
392 | } |
15614b8b |
393 | |
394 | //_______________________________________________________________________ |
395 | Bool_t AliESDtrack::GetExternalParametersAt(Double_t x, Double_t p[5]) const { |
396 | //--------------------------------------------------------------------- |
397 | // This function returns external representation of the track parameters |
398 | // at the position given by the first argument |
399 | //--------------------------------------------------------------------- |
400 | Double_t dx=x-fRx; |
401 | Double_t f1=fRp[2], f2=f1 + dx*fRp[4]/AliKalmanTrack::GetConvConst(); |
402 | |
403 | if (TMath::Abs(f2) >= 0.9999) return kFALSE; |
404 | |
405 | Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2); |
406 | p[0] = fRp[0] + dx*(f1+f2)/(r1+r2); |
407 | p[1] = fRp[1] + dx*(f1+f2)/(f1*r2 + f2*r1)*fRp[3]; |
408 | p[2] = f2; |
409 | p[3] = fRp[3]; |
410 | p[4] = fRp[4]; |
411 | |
412 | return kTRUE; |
413 | } |
414 | |
67c3dcbe |
415 | //_______________________________________________________________________ |
a866ac60 |
416 | void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const { |
67c3dcbe |
417 | //--------------------------------------------------------------------- |
418 | // This function returns external representation of the cov. matrix |
419 | //--------------------------------------------------------------------- |
a866ac60 |
420 | for (Int_t i=0; i<15; i++) cov[i]=fRc[i]; |
67c3dcbe |
421 | } |
422 | |
423 | |
424 | //_______________________________________________________________________ |
425 | void |
426 | AliESDtrack::GetConstrainedExternalParameters(Double_t &x, Double_t p[5])const{ |
427 | //--------------------------------------------------------------------- |
428 | // This function returns the constrained external track parameters |
429 | //--------------------------------------------------------------------- |
430 | x=fCx; |
431 | for (Int_t i=0; i<5; i++) p[i]=fCp[i]; |
432 | } |
433 | //_______________________________________________________________________ |
434 | void |
435 | AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const { |
436 | //--------------------------------------------------------------------- |
437 | // This function returns the constrained external cov. matrix |
438 | //--------------------------------------------------------------------- |
439 | for (Int_t i=0; i<15; i++) c[i]=fCc[i]; |
440 | } |
441 | |
ae982df3 |
442 | |
443 | Double_t AliESDtrack::GetP() const { |
444 | //--------------------------------------------------------------------- |
445 | // This function returns the track momentum |
b322ab2f |
446 | // Results for (nearly) straight tracks are meaningless ! |
ae982df3 |
447 | //--------------------------------------------------------------------- |
2157f4f2 |
448 | if (TMath::Abs(fRp[4])<=0) return 0; |
ae982df3 |
449 | Double_t pt=1./TMath::Abs(fRp[4]); |
5bc70ad8 |
450 | return pt*TMath::Sqrt(1.+ fRp[3]*fRp[3]); |
ae982df3 |
451 | } |
452 | |
67c3dcbe |
453 | void AliESDtrack::GetConstrainedPxPyPz(Double_t *p) const { |
454 | //--------------------------------------------------------------------- |
455 | // This function returns the constrained global track momentum components |
b322ab2f |
456 | // Results for (nearly) straight tracks are meaningless ! |
67c3dcbe |
457 | //--------------------------------------------------------------------- |
2157f4f2 |
458 | if (TMath::Abs(fCp[4])<=0) { |
459 | p[0]=p[1]=p[2]=0; |
460 | return; |
461 | } |
b322ab2f |
462 | if (TMath::Abs(fCp[2]) > 0.999999) { |
463 | p[0]=p[1]=p[2]=0; |
464 | return; |
465 | } |
67c3dcbe |
466 | Double_t pt=1./TMath::Abs(fCp[4]); |
b322ab2f |
467 | Double_t cs=TMath::Cos(fCalpha), sn=TMath::Sin(fCalpha); |
468 | Double_t r=TMath::Sqrt(1-fCp[2]*fCp[2]); |
469 | p[0]=pt*(r*cs - fCp[2]*sn); p[1]=pt*(fCp[2]*cs + r*sn); p[2]=pt*fCp[3]; |
67c3dcbe |
470 | } |
b322ab2f |
471 | |
67c3dcbe |
472 | void AliESDtrack::GetConstrainedXYZ(Double_t *xyz) const { |
473 | //--------------------------------------------------------------------- |
474 | // This function returns the global track position |
475 | //--------------------------------------------------------------------- |
b322ab2f |
476 | Double_t cs=TMath::Cos(fCalpha), sn=TMath::Sin(fCalpha); |
477 | xyz[0]=fCx*cs - fCp[0]*sn; xyz[1]=fCx*sn + fCp[0]*cs; xyz[2]=fCp[1]; |
67c3dcbe |
478 | } |
479 | |
ae982df3 |
480 | void AliESDtrack::GetPxPyPz(Double_t *p) const { |
481 | //--------------------------------------------------------------------- |
482 | // This function returns the global track momentum components |
b322ab2f |
483 | // Results for (nearly) straight tracks are meaningless ! |
ae982df3 |
484 | //--------------------------------------------------------------------- |
2157f4f2 |
485 | if (TMath::Abs(fRp[4])<=0) { |
b322ab2f |
486 | p[0]=p[1]=p[2]=0; |
487 | return; |
488 | } |
489 | if (TMath::Abs(fRp[2]) > 0.999999) { |
490 | p[0]=p[1]=p[2]=0; |
491 | return; |
2157f4f2 |
492 | } |
ae982df3 |
493 | Double_t pt=1./TMath::Abs(fRp[4]); |
b322ab2f |
494 | Double_t cs=TMath::Cos(fRalpha), sn=TMath::Sin(fRalpha); |
495 | Double_t r=TMath::Sqrt(1-fRp[2]*fRp[2]); |
496 | p[0]=pt*(r*cs - fRp[2]*sn); p[1]=pt*(fRp[2]*cs + r*sn); p[2]=pt*fRp[3]; |
ae982df3 |
497 | } |
b322ab2f |
498 | |
ae982df3 |
499 | void AliESDtrack::GetXYZ(Double_t *xyz) const { |
500 | //--------------------------------------------------------------------- |
501 | // This function returns the global track position |
502 | //--------------------------------------------------------------------- |
b322ab2f |
503 | Double_t cs=TMath::Cos(fRalpha), sn=TMath::Sin(fRalpha); |
504 | xyz[0]=fRx*cs - fRp[0]*sn; xyz[1]=fRx*sn + fRp[0]*cs; xyz[2]=fRp[1]; |
ae982df3 |
505 | } |
506 | |
b322ab2f |
507 | void AliESDtrack::GetCovariance(Double_t cv[21]) const { |
508 | //--------------------------------------------------------------------- |
509 | // This function returns the global covariance matrix of the track params |
510 | // |
511 | // Cov(x,x) ... : cv[0] |
512 | // Cov(y,x) ... : cv[1] cv[2] |
513 | // Cov(z,x) ... : cv[3] cv[4] cv[5] |
514 | // Cov(px,x)... : cv[6] cv[7] cv[8] cv[9] |
515 | // Cov(py,y)... : cv[10] cv[11] cv[12] cv[13] cv[14] |
516 | // Cov(pz,z)... : cv[15] cv[16] cv[17] cv[18] cv[19] cv[20] |
517 | // |
518 | // Results for (nearly) straight tracks are meaningless ! |
519 | //--------------------------------------------------------------------- |
520 | if (TMath::Abs(fRp[4])<=0) { |
521 | for (Int_t i=0; i<21; i++) cv[i]=0.; |
522 | return; |
523 | } |
524 | if (TMath::Abs(fRp[2]) > 0.999999) { |
525 | for (Int_t i=0; i<21; i++) cv[i]=0.; |
526 | return; |
527 | } |
528 | Double_t pt=1./TMath::Abs(fRp[4]); |
529 | Double_t cs=TMath::Cos(fRalpha), sn=TMath::Sin(fRalpha); |
530 | Double_t r=TMath::Sqrt(1-fRp[2]*fRp[2]); |
531 | |
532 | Double_t m00=-sn, m10=cs; |
533 | Double_t m23=-pt*(sn + fRp[2]*cs/r), m43=-pt*pt*(r*cs - fRp[2]*sn); |
534 | Double_t m24= pt*(cs - fRp[2]*sn/r), m44=-pt*pt*(r*sn + fRp[2]*cs); |
535 | Double_t m35=pt, m45=-pt*pt*fRp[3]; |
536 | |
537 | cv[0]=fRc[0]*m00*m00; |
538 | cv[1]=fRc[0]*m00*m10; |
539 | cv[2]=fRc[0]*m10*m10; |
540 | cv[3]=fRc[1]*m00; |
541 | cv[4]=fRc[1]*m10; |
542 | cv[5]=fRc[2]; |
543 | cv[6]=m00*(fRc[3]*m23+fRc[10]*m43); |
544 | cv[7]=m10*(fRc[3]*m23+fRc[10]*m43); |
545 | cv[8]=fRc[4]*m23+fRc[11]*m43; |
546 | cv[9]=m23*(fRc[5]*m23+fRc[12]*m43)+m43*(fRc[12]*m23+fRc[14]*m43); |
547 | cv[10]=m00*(fRc[3]*m24+fRc[10]*m44); |
548 | cv[11]=m10*(fRc[3]*m24+fRc[10]*m44); |
549 | cv[12]=fRc[4]*m24+fRc[11]*m44; |
550 | cv[13]=m23*(fRc[5]*m24+fRc[12]*m44)+m43*(fRc[12]*m24+fRc[14]*m44); |
551 | cv[14]=m24*(fRc[5]*m24+fRc[12]*m44)+m44*(fRc[12]*m24+fRc[14]*m44); |
552 | cv[15]=m00*(fRc[6]*m35+fRc[10]*m45); |
553 | cv[16]=m10*(fRc[6]*m35+fRc[10]*m45); |
554 | cv[17]=fRc[7]*m35+fRc[11]*m45; |
555 | cv[18]=m23*(fRc[8]*m35+fRc[12]*m45)+m43*(fRc[13]*m35+fRc[14]*m45); |
556 | cv[19]=m24*(fRc[8]*m35+fRc[12]*m45)+m44*(fRc[13]*m35+fRc[14]*m45); |
557 | cv[20]=m35*(fRc[9]*m35+fRc[13]*m45)+m45*(fRc[13]*m35+fRc[14]*m45); |
558 | } |
67c3dcbe |
559 | |
9b859005 |
560 | void AliESDtrack::GetInnerPxPyPz(Double_t *p) const { |
561 | //--------------------------------------------------------------------- |
562 | // This function returns the global track momentum components |
563 | // af the entrance of the TPC |
564 | //--------------------------------------------------------------------- |
e964f790 |
565 | if (fIx==0) {p[0]=p[1]=p[2]=0.; return;} |
9b859005 |
566 | Double_t phi=TMath::ASin(fIp[2]) + fIalpha; |
567 | Double_t pt=1./TMath::Abs(fIp[4]); |
568 | p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fIp[3]; |
569 | } |
570 | |
571 | void AliESDtrack::GetInnerXYZ(Double_t *xyz) const { |
572 | //--------------------------------------------------------------------- |
573 | // This function returns the global track position |
574 | // af the entrance of the TPC |
575 | //--------------------------------------------------------------------- |
e964f790 |
576 | if (fIx==0) {xyz[0]=xyz[1]=xyz[2]=0.; return;} |
9b859005 |
577 | Double_t phi=TMath::ATan2(fIp[0],fIx) + fIalpha; |
578 | Double_t r=TMath::Sqrt(fIx*fIx + fIp[0]*fIp[0]); |
579 | xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fIp[1]; |
580 | } |
581 | |
a866ac60 |
582 | void AliESDtrack::GetInnerExternalParameters(Double_t &x, Double_t p[5]) const |
583 | { |
584 | //skowron |
585 | //--------------------------------------------------------------------- |
586 | // This function returns external representation of the track parameters at Inner Layer of TPC |
587 | //--------------------------------------------------------------------- |
588 | x=fIx; |
589 | for (Int_t i=0; i<5; i++) p[i]=fIp[i]; |
590 | } |
591 | void AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const |
592 | { |
593 | //skowron |
594 | //--------------------------------------------------------------------- |
595 | // This function returns external representation of the cov. matrix at Inner Layer of TPC |
596 | //--------------------------------------------------------------------- |
597 | for (Int_t i=0; i<15; i++) cov[i]=fIc[i]; |
598 | |
599 | } |
600 | |
c4d11b15 |
601 | void AliESDtrack::GetTRDExternalParameters(Double_t &x, Double_t p[5], Double_t cov[15]) const |
602 | { |
603 | // |
604 | //this function returns TRD parameters |
605 | // |
606 | x=fTx; |
607 | for (Int_t i=0; i<5; i++) p[i]=fTp[i]; |
608 | for (Int_t i=0; i<15; i++) cov[i]=fTc[i]; |
609 | } |
610 | |
3fd96ae3 |
611 | void AliESDtrack::GetOuterPxPyPzPHOS(Double_t *p) const { |
672b5f43 |
612 | //--------------------------------------------------------------------- |
613 | // This function returns the global track momentum components |
614 | // af the radius of the PHOS |
615 | //--------------------------------------------------------------------- |
704be597 |
616 | p[0]=p[1]=p[2]=0. ; |
3fd96ae3 |
617 | if (fOx==0) |
618 | return; |
619 | Double_t phi=TMath::ASin(fOp[2]) + fOalpha; |
620 | Double_t pt=1./TMath::Abs(fOp[4]); |
621 | p[0]=pt*TMath::Cos(phi); |
622 | p[1]=pt*TMath::Sin(phi); |
623 | p[2]=pt*fOp[3]; |
624 | } |
625 | void AliESDtrack::GetOuterPxPyPzEMCAL(Double_t *p) const { |
626 | //--------------------------------------------------------------------- |
627 | // This function returns the global track momentum components |
628 | // af the radius of the EMCAL |
629 | //--------------------------------------------------------------------- |
630 | if (fXx==0) |
631 | return; |
632 | Double_t phi=TMath::ASin(fXp[2]) + fXalpha; |
633 | Double_t pt=1./TMath::Abs(fXp[4]); |
634 | p[0]=pt*TMath::Cos(phi); |
635 | p[1]=pt*TMath::Sin(phi); |
636 | p[2]=pt*fXp[3]; |
672b5f43 |
637 | } |
638 | |
3fd96ae3 |
639 | void AliESDtrack::GetOuterXYZPHOS(Double_t *xyz) const { |
672b5f43 |
640 | //--------------------------------------------------------------------- |
641 | // This function returns the global track position |
3fd96ae3 |
642 | // af the radius of the PHOS |
704be597 |
643 | //--------------------------------------------------------------------- |
644 | xyz[0]=xyz[1]=xyz[2]=0.; |
3fd96ae3 |
645 | if (fOx==0) |
646 | return; |
647 | Double_t phi=TMath::ATan2(fOp[0],fOx) + fOalpha; |
648 | Double_t r=TMath::Sqrt(fOx*fOx + fOp[0]*fOp[0]); |
649 | xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fOp[1]; |
650 | } |
651 | void AliESDtrack::GetOuterXYZEMCAL(Double_t *xyz) const { |
652 | //--------------------------------------------------------------------- |
653 | // This function returns the global track position |
654 | // af the radius of the EMCAL |
655 | //--------------------------------------------------------------------- |
656 | if (fXx==0) |
657 | return; |
658 | Double_t phi=TMath::ATan2(fXp[0],fOx) + fXalpha; |
659 | Double_t r=TMath::Sqrt(fXx*fXx + fXp[0]*fXp[0]); |
660 | xyz[0]=r*TMath::Cos(phi); |
661 | xyz[1]=r*TMath::Sin(phi); |
662 | xyz[2]=fXp[1]; |
663 | } |
672b5f43 |
664 | |
ae982df3 |
665 | //_______________________________________________________________________ |
666 | void AliESDtrack::GetIntegratedTimes(Double_t *times) const { |
4427806c |
667 | // Returns the array with integrated times for each particle hypothesis |
ae982df3 |
668 | for (Int_t i=0; i<kSPECIES; i++) times[i]=fTrackTime[i]; |
669 | } |
670 | |
671 | //_______________________________________________________________________ |
672 | void AliESDtrack::SetIntegratedTimes(const Double_t *times) { |
4427806c |
673 | // Sets the array with integrated times for each particle hypotesis |
ae982df3 |
674 | for (Int_t i=0; i<kSPECIES; i++) fTrackTime[i]=times[i]; |
675 | } |
676 | |
c630aafd |
677 | //_______________________________________________________________________ |
4427806c |
678 | void AliESDtrack::SetITSpid(const Double_t *p) { |
679 | // Sets values for the probability of each particle type (in ITS) |
c630aafd |
680 | for (Int_t i=0; i<kSPECIES; i++) fITSr[i]=p[i]; |
681 | SetStatus(AliESDtrack::kITSpid); |
682 | } |
683 | |
babd135a |
684 | void AliESDtrack::SetITSChi2MIP(const Float_t *chi2mip){ |
c4d11b15 |
685 | for (Int_t i=0; i<12; i++) fITSchi2MIP[i]=chi2mip[i]; |
babd135a |
686 | } |
c630aafd |
687 | //_______________________________________________________________________ |
688 | void AliESDtrack::GetITSpid(Double_t *p) const { |
4427806c |
689 | // Gets the probability of each particle type (in ITS) |
c630aafd |
690 | for (Int_t i=0; i<kSPECIES; i++) p[i]=fITSr[i]; |
691 | } |
692 | |
ae982df3 |
693 | //_______________________________________________________________________ |
694 | Int_t AliESDtrack::GetITSclusters(UInt_t *idx) const { |
695 | //--------------------------------------------------------------------- |
696 | // This function returns indices of the assgined ITS clusters |
697 | //--------------------------------------------------------------------- |
698 | for (Int_t i=0; i<fITSncls; i++) idx[i]=fITSindex[i]; |
699 | return fITSncls; |
700 | } |
701 | |
702 | //_______________________________________________________________________ |
05e445cd |
703 | Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const { |
ae982df3 |
704 | //--------------------------------------------------------------------- |
705 | // This function returns indices of the assgined ITS clusters |
706 | //--------------------------------------------------------------------- |
d1420ddf |
707 | if (idx!=0) |
708 | for (Int_t i=0; i<180; i++) idx[i]=fTPCindex[i]; // MI I prefer some constant |
ae982df3 |
709 | return fTPCncls; |
710 | } |
8c6a71ab |
711 | |
712 | //_______________________________________________________________________ |
713 | void AliESDtrack::SetTPCpid(const Double_t *p) { |
4427806c |
714 | // Sets values for the probability of each particle type (in TPC) |
8c6a71ab |
715 | for (Int_t i=0; i<kSPECIES; i++) fTPCr[i]=p[i]; |
716 | SetStatus(AliESDtrack::kTPCpid); |
717 | } |
718 | |
719 | //_______________________________________________________________________ |
720 | void AliESDtrack::GetTPCpid(Double_t *p) const { |
4427806c |
721 | // Gets the probability of each particle type (in TPC) |
8c6a71ab |
722 | for (Int_t i=0; i<kSPECIES; i++) p[i]=fTPCr[i]; |
723 | } |
724 | |
bb2ceb1f |
725 | //_______________________________________________________________________ |
726 | Int_t AliESDtrack::GetTRDclusters(UInt_t *idx) const { |
727 | //--------------------------------------------------------------------- |
728 | // This function returns indices of the assgined TRD clusters |
729 | //--------------------------------------------------------------------- |
d1420ddf |
730 | if (idx!=0) |
c4d11b15 |
731 | for (Int_t i=0; i<130; i++) idx[i]=fTRDindex[i]; // MI I prefer some constant |
bb2ceb1f |
732 | return fTRDncls; |
733 | } |
734 | |
c630aafd |
735 | //_______________________________________________________________________ |
736 | void AliESDtrack::SetTRDpid(const Double_t *p) { |
4427806c |
737 | // Sets values for the probability of each particle type (in TRD) |
c630aafd |
738 | for (Int_t i=0; i<kSPECIES; i++) fTRDr[i]=p[i]; |
739 | SetStatus(AliESDtrack::kTRDpid); |
740 | } |
741 | |
742 | //_______________________________________________________________________ |
743 | void AliESDtrack::GetTRDpid(Double_t *p) const { |
4427806c |
744 | // Gets the probability of each particle type (in TRD) |
c630aafd |
745 | for (Int_t i=0; i<kSPECIES; i++) p[i]=fTRDr[i]; |
746 | } |
747 | |
79e94bf8 |
748 | //_______________________________________________________________________ |
749 | void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p) |
750 | { |
4427806c |
751 | // Sets the probability of particle type iSpecies to p (in TRD) |
79e94bf8 |
752 | fTRDr[iSpecies] = p; |
753 | } |
754 | |
755 | Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const |
756 | { |
4427806c |
757 | // Returns the probability of particle type iSpecies (in TRD) |
79e94bf8 |
758 | return fTRDr[iSpecies]; |
759 | } |
760 | |
c630aafd |
761 | //_______________________________________________________________________ |
762 | void AliESDtrack::SetTOFpid(const Double_t *p) { |
4427806c |
763 | // Sets the probability of each particle type (in TOF) |
c630aafd |
764 | for (Int_t i=0; i<kSPECIES; i++) fTOFr[i]=p[i]; |
765 | SetStatus(AliESDtrack::kTOFpid); |
766 | } |
767 | |
768 | //_______________________________________________________________________ |
769 | void AliESDtrack::GetTOFpid(Double_t *p) const { |
4427806c |
770 | // Gets probabilities of each particle type (in TOF) |
c630aafd |
771 | for (Int_t i=0; i<kSPECIES; i++) p[i]=fTOFr[i]; |
772 | } |
773 | |
4a78b8c5 |
774 | |
775 | |
776 | //_______________________________________________________________________ |
777 | void AliESDtrack::SetPHOSpid(const Double_t *p) { |
778 | // Sets the probability of each particle type (in PHOS) |
ac2f7574 |
779 | for (Int_t i=0; i<kSPECIESN; i++) fPHOSr[i]=p[i]; |
4a78b8c5 |
780 | SetStatus(AliESDtrack::kPHOSpid); |
781 | } |
782 | |
783 | //_______________________________________________________________________ |
784 | void AliESDtrack::GetPHOSpid(Double_t *p) const { |
785 | // Gets probabilities of each particle type (in PHOS) |
ac2f7574 |
786 | for (Int_t i=0; i<kSPECIESN; i++) p[i]=fPHOSr[i]; |
4a78b8c5 |
787 | } |
788 | |
704be597 |
789 | //_______________________________________________________________________ |
790 | void AliESDtrack::SetEMCALpid(const Double_t *p) { |
791 | // Sets the probability of each particle type (in EMCAL) |
792 | for (Int_t i=0; i<kSPECIESN; i++) fEMCALr[i]=p[i]; |
793 | SetStatus(AliESDtrack::kEMCALpid); |
794 | } |
795 | |
796 | //_______________________________________________________________________ |
797 | void AliESDtrack::GetEMCALpid(Double_t *p) const { |
798 | // Gets probabilities of each particle type (in EMCAL) |
799 | for (Int_t i=0; i<kSPECIESN; i++) p[i]=fEMCALr[i]; |
800 | } |
4a78b8c5 |
801 | |
802 | //_______________________________________________________________________ |
803 | void AliESDtrack::SetRICHpid(const Double_t *p) { |
804 | // Sets the probability of each particle type (in RICH) |
805 | for (Int_t i=0; i<kSPECIES; i++) fRICHr[i]=p[i]; |
806 | SetStatus(AliESDtrack::kRICHpid); |
807 | } |
808 | |
809 | //_______________________________________________________________________ |
810 | void AliESDtrack::GetRICHpid(Double_t *p) const { |
811 | // Gets probabilities of each particle type (in RICH) |
812 | for (Int_t i=0; i<kSPECIES; i++) p[i]=fRICHr[i]; |
813 | } |
814 | |
815 | |
816 | |
8c6a71ab |
817 | //_______________________________________________________________________ |
818 | void AliESDtrack::SetESDpid(const Double_t *p) { |
4427806c |
819 | // Sets the probability of each particle type for the ESD track |
8c6a71ab |
820 | for (Int_t i=0; i<kSPECIES; i++) fR[i]=p[i]; |
821 | SetStatus(AliESDtrack::kESDpid); |
822 | } |
823 | |
824 | //_______________________________________________________________________ |
825 | void AliESDtrack::GetESDpid(Double_t *p) const { |
4427806c |
826 | // Gets probability of each particle type for the ESD track |
8c6a71ab |
827 | for (Int_t i=0; i<kSPECIES; i++) p[i]=fR[i]; |
828 | } |
829 | |
ac2f7574 |
830 | //_______________________________________________________________________ |
831 | void AliESDtrack::Print(Option_t *) const { |
832 | // Prints info on the track |
833 | |
5f7789fc |
834 | printf("ESD track info\n") ; |
ac2f7574 |
835 | Double_t p[kSPECIESN] ; |
836 | Int_t index = 0 ; |
837 | if( IsOn(kITSpid) ){ |
838 | printf("From ITS: ") ; |
839 | GetITSpid(p) ; |
840 | for(index = 0 ; index < kSPECIES; index++) |
841 | printf("%f, ", p[index]) ; |
842 | printf("\n signal = %f\n", GetITSsignal()) ; |
843 | } |
844 | if( IsOn(kTPCpid) ){ |
845 | printf("From TPC: ") ; |
846 | GetTPCpid(p) ; |
847 | for(index = 0 ; index < kSPECIES; index++) |
848 | printf("%f, ", p[index]) ; |
849 | printf("\n signal = %f\n", GetTPCsignal()) ; |
850 | } |
851 | if( IsOn(kTRDpid) ){ |
852 | printf("From TRD: ") ; |
853 | GetTRDpid(p) ; |
854 | for(index = 0 ; index < kSPECIES; index++) |
855 | printf("%f, ", p[index]) ; |
856 | printf("\n signal = %f\n", GetTRDsignal()) ; |
857 | } |
858 | if( IsOn(kTOFpid) ){ |
859 | printf("From TOF: ") ; |
860 | GetTOFpid(p) ; |
861 | for(index = 0 ; index < kSPECIES; index++) |
862 | printf("%f, ", p[index]) ; |
863 | printf("\n signal = %f\n", GetTOFsignal()) ; |
864 | } |
865 | if( IsOn(kRICHpid) ){ |
866 | printf("From TOF: ") ; |
867 | GetRICHpid(p) ; |
868 | for(index = 0 ; index < kSPECIES; index++) |
869 | printf("%f, ", p[index]) ; |
870 | printf("\n signal = %f\n", GetRICHsignal()) ; |
871 | } |
872 | if( IsOn(kPHOSpid) ){ |
873 | printf("From PHOS: ") ; |
874 | GetPHOSpid(p) ; |
875 | for(index = 0 ; index < kSPECIESN; index++) |
876 | printf("%f, ", p[index]) ; |
877 | printf("\n signal = %f\n", GetPHOSsignal()) ; |
878 | } |
704be597 |
879 | if( IsOn(kEMCALpid) ){ |
880 | printf("From EMCAL: ") ; |
881 | GetEMCALpid(p) ; |
882 | for(index = 0 ; index < kSPECIESN; index++) |
883 | printf("%f, ", p[index]) ; |
884 | printf("\n signal = %f\n", GetEMCALsignal()) ; |
885 | } |
ac2f7574 |
886 | } |