]>
Commit | Line | Data |
---|---|---|
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 | ||
e1e6896f | 23 | #include <TMath.h> |
ae982df3 | 24 | |
49d13e89 | 25 | #include "AliESDVertex.h" |
ae982df3 | 26 | #include "AliESDtrack.h" |
27 | #include "AliKalmanTrack.h" | |
5f7789fc | 28 | #include "AliLog.h" |
15e85efa | 29 | #include "AliTrackPointArray.h" |
ae982df3 | 30 | |
31 | ClassImp(AliESDtrack) | |
32 | ||
d27bbc79 | 33 | void SetPIDValues(Float_t * dest, const Double_t * src, Int_t n) { |
34 | // This function copies "n" PID weights from "scr" to "dest" | |
35 | // and normalizes their sum to 1 thus producing conditional probabilities. | |
36 | // The negative weights are set to 0. | |
37 | // In case all the weights are non-positive they are replaced by | |
38 | // uniform probabilities | |
39 | ||
40 | if (n<=0) return; | |
41 | ||
42 | Float_t uniform = 1./(Float_t)n; | |
43 | ||
44 | Float_t sum = 0; | |
45 | for (Int_t i=0; i<n; i++) | |
46 | if (src[i]>=0) { | |
47 | sum+=src[i]; | |
48 | dest[i] = src[i]; | |
49 | } | |
50 | else { | |
51 | dest[i] = 0; | |
52 | } | |
53 | ||
54 | if(sum>0) | |
55 | for (Int_t i=0; i<n; i++) dest[i] /= sum; | |
56 | else | |
57 | for (Int_t i=0; i<n; i++) dest[i] = uniform; | |
58 | } | |
59 | ||
ae982df3 | 60 | //_______________________________________________________________________ |
61 | AliESDtrack::AliESDtrack() : | |
c9ec41e8 | 62 | AliExternalTrackParam(), |
90e48c0c | 63 | fFlags(0), |
64 | fLabel(0), | |
65 | fID(0), | |
66 | fTrackLength(0), | |
49d13e89 | 67 | fD(0),fZ(0), |
68 | fCdd(0),fCdz(0),fCzz(0), | |
90e48c0c | 69 | fStopVertex(0), |
c9ec41e8 | 70 | fCp(0), |
90e48c0c | 71 | fCchi2(1e10), |
c9ec41e8 | 72 | fIp(0), |
73 | fOp(0), | |
90e48c0c | 74 | fITSchi2(0), |
75 | fITSncls(0), | |
76 | fITSsignal(0), | |
77 | fITSLabel(0), | |
78 | fITSFakeRatio(0), | |
90e48c0c | 79 | fTPCchi2(0), |
80 | fTPCncls(0), | |
e1d4c1b5 | 81 | fTPCnclsF(0), |
90e48c0c | 82 | fTPCClusterMap(159),//number of padrows |
83 | fTPCsignal(0), | |
e1d4c1b5 | 84 | fTPCsignalN(0), |
85 | fTPCsignalS(0), | |
90e48c0c | 86 | fTPCLabel(0), |
87 | fTRDchi2(0), | |
88 | fTRDncls(0), | |
89 | fTRDncls0(0), | |
90 | fTRDsignal(0), | |
91 | fTRDLabel(0), | |
92 | fTRDQuality(0), | |
23d49657 | 93 | fTRDBudget(0), |
90e48c0c | 94 | fTOFchi2(0), |
95 | fTOFindex(0), | |
85324138 | 96 | fTOFCalChannel(-1), |
90e48c0c | 97 | fTOFsignal(-1), |
85324138 | 98 | fTOFsignalToT(0), |
90e48c0c | 99 | fRICHchi2(1e10), |
100 | fRICHncls(0), | |
101 | fRICHindex(0), | |
102 | fRICHsignal(-1), | |
2714766e | 103 | fRICHtheta(-1), |
104 | fRICHphi(-1), | |
105 | fRICHdx(-1), | |
106 | fRICHdy(-1), | |
107 | fRICHmipX(-1), | |
108 | fRICHmipY(-1), | |
15e85efa | 109 | fPoints(0), |
110 | fFriendTrack(new AliESDfriendTrack()) | |
ae982df3 | 111 | { |
112 | // | |
113 | // The default ESD constructor | |
114 | // | |
6238d7a9 | 115 | Int_t i; |
116 | for (i=0; i<AliPID::kSPECIES; i++) { | |
4a78b8c5 | 117 | fTrackTime[i]=0.; |
118 | fR[i]=1.; | |
119 | fITSr[i]=1.; | |
120 | fTPCr[i]=1.; | |
121 | fTRDr[i]=1.; | |
122 | fTOFr[i]=1.; | |
4a78b8c5 | 123 | fRICHr[i]=1.; |
2bad268c | 124 | } |
ac2f7574 | 125 | |
ef7253ac | 126 | for (i=0; i<3; i++) { fKinkIndexes[i]=0;} |
127 | for (i=0; i<3; i++) { fV0Indexes[i]=-1;} | |
eab5961e | 128 | for (i=0;i<kNPlane;i++) {fTRDsignals[i]=0.; fTRDTimBin[i]=-1;} |
c9ec41e8 | 129 | for (i=0;i<4;i++) {fTPCPoints[i]=-1;} |
130 | for (i=0;i<3;i++) {fTOFLabel[i]=-1;} | |
131 | for (i=0;i<10;i++) {fTOFInfo[i]=-1;} | |
c4d11b15 | 132 | } |
133 | ||
134 | //_______________________________________________________________________ | |
90e48c0c | 135 | AliESDtrack::AliESDtrack(const AliESDtrack& track): |
c9ec41e8 | 136 | AliExternalTrackParam(track), |
90e48c0c | 137 | fFlags(track.fFlags), |
138 | fLabel(track.fLabel), | |
139 | fID(track.fID), | |
140 | fTrackLength(track.fTrackLength), | |
49d13e89 | 141 | fD(track.fD),fZ(track.fZ), |
142 | fCdd(track.fCdd),fCdz(track.fCdz),fCzz(track.fCzz), | |
90e48c0c | 143 | fStopVertex(track.fStopVertex), |
c9ec41e8 | 144 | fCp(0), |
90e48c0c | 145 | fCchi2(track.fCchi2), |
c9ec41e8 | 146 | fIp(0), |
147 | fOp(0), | |
90e48c0c | 148 | fITSchi2(track.fITSchi2), |
149 | fITSncls(track.fITSncls), | |
150 | fITSsignal(track.fITSsignal), | |
151 | fITSLabel(track.fITSLabel), | |
152 | fITSFakeRatio(track.fITSFakeRatio), | |
90e48c0c | 153 | fTPCchi2(track.fTPCchi2), |
154 | fTPCncls(track.fTPCncls), | |
e1d4c1b5 | 155 | fTPCnclsF(track.fTPCnclsF), |
90e48c0c | 156 | fTPCClusterMap(track.fTPCClusterMap), |
157 | fTPCsignal(track.fTPCsignal), | |
e1d4c1b5 | 158 | fTPCsignalN(track.fTPCsignalN), |
159 | fTPCsignalS(track.fTPCsignalS), | |
90e48c0c | 160 | fTPCLabel(track.fTPCLabel), |
161 | fTRDchi2(track.fTRDchi2), | |
162 | fTRDncls(track.fTRDncls), | |
163 | fTRDncls0(track.fTRDncls0), | |
164 | fTRDsignal(track.fTRDsignal), | |
165 | fTRDLabel(track.fTRDLabel), | |
166 | fTRDQuality(track.fTRDQuality), | |
23d49657 | 167 | fTRDBudget(track.fTRDBudget), |
90e48c0c | 168 | fTOFchi2(track.fTOFchi2), |
169 | fTOFindex(track.fTOFindex), | |
85324138 | 170 | fTOFCalChannel(track.fTOFCalChannel), |
90e48c0c | 171 | fTOFsignal(track.fTOFsignal), |
85324138 | 172 | fTOFsignalToT(track.fTOFsignalToT), |
90e48c0c | 173 | fRICHchi2(track.fRICHchi2), |
174 | fRICHncls(track.fRICHncls), | |
175 | fRICHindex(track.fRICHindex), | |
176 | fRICHsignal(track.fRICHsignal), | |
177 | fRICHtheta(track.fRICHtheta), | |
178 | fRICHphi(track.fRICHphi), | |
179 | fRICHdx(track.fRICHdx), | |
6238d7a9 | 180 | fRICHdy(track.fRICHdy), |
181 | fRICHmipX(track.fRICHmipX), | |
15e85efa | 182 | fRICHmipY(track.fRICHmipY), |
183 | fPoints(0), | |
184 | fFriendTrack(new AliESDfriendTrack(*(track.fFriendTrack))) | |
90e48c0c | 185 | { |
c4d11b15 | 186 | // |
187 | //copy constructor | |
188 | // | |
ef7253ac | 189 | for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i]=track.fTrackTime[i]; |
190 | for (Int_t i=0;i<AliPID::kSPECIES;i++) fR[i]=track.fR[i]; | |
c4d11b15 | 191 | // |
304864ab | 192 | for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i]; |
c4d11b15 | 193 | // |
304864ab | 194 | for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i]; |
51ad6848 | 195 | for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];} |
196 | for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];} | |
197 | for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];} | |
c4d11b15 | 198 | // |
eab5961e | 199 | for (Int_t i=0;i<kNPlane;i++) { |
200 | fTRDsignals[i]=track.fTRDsignals[i]; | |
201 | fTRDTimBin[i]=track.fTRDTimBin[i]; | |
202 | } | |
304864ab | 203 | for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i]=track.fTRDr[i]; |
304864ab | 204 | for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i]=track.fTOFr[i]; |
51ad6848 | 205 | for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i]; |
206 | for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i]; | |
304864ab | 207 | for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i]=track.fRICHr[i]; |
c9ec41e8 | 208 | |
209 | if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp); | |
210 | if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp); | |
211 | if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp); | |
15e85efa | 212 | |
213 | if (track.fPoints) fPoints=new AliTrackPointArray(*(track.fPoints)); | |
ae982df3 | 214 | } |
15e85efa | 215 | |
c4d11b15 | 216 | //_______________________________________________________________________ |
217 | AliESDtrack::~AliESDtrack(){ | |
218 | // | |
219 | // This is destructor according Coding Conventrions | |
220 | // | |
221 | //printf("Delete track\n"); | |
c9ec41e8 | 222 | delete fIp; |
223 | delete fOp; | |
224 | delete fCp; | |
15e85efa | 225 | delete fFriendTrack; |
98937d93 | 226 | delete fPoints; |
c4d11b15 | 227 | } |
ae982df3 | 228 | |
9559cbc4 | 229 | //_______________________________________________________________________ |
230 | void AliESDtrack::MakeMiniESDtrack(){ | |
231 | // Resets everything except | |
232 | // fFlags: Reconstruction status flags | |
233 | // fLabel: Track label | |
234 | // fID: Unique ID of the track | |
235 | // fD: Impact parameter in XY-plane | |
236 | // fZ: Impact parameter in Z | |
237 | // fR[AliPID::kSPECIES]: combined "detector response probability" | |
238 | // Running track parameters | |
239 | // fRalpha: track rotation angle | |
240 | // fRx: X-coordinate of the track reference plane | |
241 | // fRp[5]: external track parameters | |
242 | // fRc[15]: external cov. matrix of the track parameters | |
243 | ||
244 | fTrackLength = 0; | |
245 | for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0; | |
246 | fStopVertex = 0; | |
247 | ||
248 | // Reset track parameters constrained to the primary vertex | |
c9ec41e8 | 249 | fCp = 0; |
9559cbc4 | 250 | fCchi2 = 0; |
251 | ||
252 | // Reset track parameters at the inner wall of TPC | |
c9ec41e8 | 253 | fIp = 0; |
9559cbc4 | 254 | |
255 | // Reset track parameters at the inner wall of the TRD | |
c9ec41e8 | 256 | fOp = 0; |
9559cbc4 | 257 | |
258 | // Reset ITS track related information | |
259 | fITSchi2 = 0; | |
9559cbc4 | 260 | fITSncls = 0; |
9559cbc4 | 261 | fITSsignal = 0; |
ef7253ac | 262 | for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=0; |
9559cbc4 | 263 | fITSLabel = 0; |
264 | fITSFakeRatio = 0; | |
9559cbc4 | 265 | |
266 | // Reset TPC related track information | |
267 | fTPCchi2 = 0; | |
268 | fTPCncls = 0; | |
e1d4c1b5 | 269 | fTPCnclsF = 0; |
9559cbc4 | 270 | fTPCClusterMap = 0; |
271 | fTPCsignal= 0; | |
e1d4c1b5 | 272 | fTPCsignalS= 0; |
273 | fTPCsignalN= 0; | |
9559cbc4 | 274 | for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0; |
275 | fTPCLabel=0; | |
276 | for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0; | |
277 | for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0; | |
278 | for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0; | |
279 | ||
280 | // Reset TRD related track information | |
281 | fTRDchi2 = 0; | |
282 | fTRDncls = 0; | |
283 | fTRDncls0 = 0; | |
9559cbc4 | 284 | fTRDsignal = 0; |
285 | for (Int_t i=0;i<kNPlane;i++) { | |
286 | fTRDsignals[i] = 0; | |
287 | fTRDTimBin[i] = 0; | |
288 | } | |
289 | for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0; | |
290 | fTRDLabel = 0; | |
9559cbc4 | 291 | fTRDQuality = 0; |
23d49657 | 292 | fTRDBudget = 0; |
9559cbc4 | 293 | |
294 | // Reset TOF related track information | |
295 | fTOFchi2 = 0; | |
296 | fTOFindex = 0; | |
297 | fTOFsignal = 0; | |
85324138 | 298 | fTOFCalChannel = -1; |
299 | fTOFsignalToT = 0; | |
9559cbc4 | 300 | for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0; |
301 | for (Int_t i=0;i<3;i++) fTOFLabel[i] = 0; | |
302 | for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0; | |
303 | ||
9559cbc4 | 304 | // Reset RICH related track information |
305 | fRICHchi2 = 0; | |
306 | fRICHncls = 0; | |
307 | fRICHindex = 0; | |
308 | fRICHsignal = 0; | |
309 | for (Int_t i=0;i<AliPID::kSPECIES;i++) fRICHr[i] = 0; | |
310 | fRICHtheta = 0; | |
311 | fRICHphi = 0; | |
312 | fRICHdx = 0; | |
313 | fRICHdy = 0; | |
314 | ||
15e85efa | 315 | delete fFriendTrack; fFriendTrack = 0; |
316 | delete fPoints; fPoints = 0; | |
9559cbc4 | 317 | } |
ae982df3 | 318 | //_______________________________________________________________________ |
4a78b8c5 | 319 | Double_t AliESDtrack::GetMass() const { |
4427806c | 320 | // Returns the mass of the most probable particle type |
ae982df3 | 321 | Float_t max=0.; |
322 | Int_t k=-1; | |
304864ab | 323 | for (Int_t i=0; i<AliPID::kSPECIES; i++) { |
ae982df3 | 324 | if (fR[i]>max) {k=i; max=fR[i];} |
325 | } | |
db3989b3 | 326 | if (k==0) { // dE/dx "crossing points" in the TPC |
327 | Double_t p=GetP(); | |
328 | if ((p>0.38)&&(p<0.48)) | |
304864ab | 329 | if (fR[0]<fR[3]*10.) return AliPID::ParticleMass(AliPID::kKaon); |
db3989b3 | 330 | if ((p>0.75)&&(p<0.85)) |
304864ab | 331 | if (fR[0]<fR[4]*10.) return AliPID::ParticleMass(AliPID::kProton); |
db3989b3 | 332 | return 0.00051; |
333 | } | |
304864ab | 334 | if (k==1) return AliPID::ParticleMass(AliPID::kMuon); |
335 | if (k==2||k==-1) return AliPID::ParticleMass(AliPID::kPion); | |
336 | if (k==3) return AliPID::ParticleMass(AliPID::kKaon); | |
337 | if (k==4) return AliPID::ParticleMass(AliPID::kProton); | |
5f7789fc | 338 | AliWarning("Undefined mass !"); |
304864ab | 339 | return AliPID::ParticleMass(AliPID::kPion); |
ae982df3 | 340 | } |
341 | ||
342 | //_______________________________________________________________________ | |
c9ec41e8 | 343 | Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){ |
ae982df3 | 344 | // |
345 | // This function updates track's running parameters | |
346 | // | |
15e85efa | 347 | Int_t *index=0; |
15614b8b | 348 | Bool_t rc=kTRUE; |
349 | ||
9b859005 | 350 | SetStatus(flags); |
351 | fLabel=t->GetLabel(); | |
352 | ||
353 | if (t->IsStartedTimeIntegral()) { | |
354 | SetStatus(kTIME); | |
355 | Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times); | |
356 | SetIntegratedLength(t->GetIntegratedLength()); | |
357 | } | |
358 | ||
c9ec41e8 | 359 | Set(*t); |
e1d4c1b5 | 360 | |
ae982df3 | 361 | switch (flags) { |
ad2f1f2b | 362 | |
9b859005 | 363 | case kITSin: case kITSout: case kITSrefit: |
15e85efa | 364 | index=fFriendTrack->GetITSindices(); |
365 | for (Int_t i=0;i<AliESDfriendTrack::kMaxITScluster;i++) | |
366 | index[i]=t->GetClusterIndex(i); | |
ae982df3 | 367 | fITSncls=t->GetNumberOfClusters(); |
368 | fITSchi2=t->GetChi2(); | |
ae982df3 | 369 | fITSsignal=t->GetPIDsignal(); |
6e5b1b04 | 370 | fITSLabel = t->GetLabel(); |
babd135a | 371 | fITSFakeRatio = t->GetFakeRatio(); |
ae982df3 | 372 | break; |
ad2f1f2b | 373 | |
9b859005 | 374 | case kTPCin: case kTPCrefit: |
6e5b1b04 | 375 | fTPCLabel = t->GetLabel(); |
c9ec41e8 | 376 | if (!fIp) fIp=new AliExternalTrackParam(*t); |
377 | else fIp->Set(*t); | |
9b859005 | 378 | case kTPCout: |
15e85efa | 379 | index=fFriendTrack->GetTPCindices(); |
1d303a24 | 380 | if (flags & kTPCout){ |
381 | if (!fOp) fOp=new AliExternalTrackParam(*t); | |
382 | else fOp->Set(*t); | |
383 | } | |
e1d4c1b5 | 384 | fTPCncls=t->GetNumberOfClusters(); |
ae982df3 | 385 | fTPCchi2=t->GetChi2(); |
a866ac60 | 386 | |
387 | {//prevrow must be declared in separate namespace, otherwise compiler cries: | |
388 | //"jump to case label crosses initialization of `Int_t prevrow'" | |
389 | Int_t prevrow = -1; | |
6e5b1b04 | 390 | // for (Int_t i=0;i<fTPCncls;i++) |
15e85efa | 391 | for (Int_t i=0;i<AliESDfriendTrack::kMaxTPCcluster;i++) |
a866ac60 | 392 | { |
15e85efa | 393 | index[i]=t->GetClusterIndex(i); |
394 | Int_t idx = index[i]; | |
a866ac60 | 395 | |
15e85efa | 396 | if (idx<0) continue; |
9fe5b2ff | 397 | |
a866ac60 | 398 | // Piotr's Cluster Map for HBT |
399 | // ### please change accordingly if cluster array is changing | |
400 | // to "New TPC Tracking" style (with gaps in array) | |
a866ac60 | 401 | Int_t sect = (idx&0xff000000)>>24; |
402 | Int_t row = (idx&0x00ff0000)>>16; | |
403 | if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors | |
404 | ||
405 | fTPCClusterMap.SetBitNumber(row,kTRUE); | |
406 | ||
407 | //Fill the gap between previous row and this row with 0 bits | |
408 | //In case ### pleas change it as well - just set bit 0 in case there | |
409 | //is no associated clusters for current "i" | |
410 | if (prevrow < 0) | |
411 | { | |
412 | prevrow = row;//if previous bit was not assigned yet == this is the first one | |
413 | } | |
414 | else | |
415 | { //we don't know the order (inner to outer or reverse) | |
416 | //just to be save in case it is going to change | |
417 | Int_t n = 0, m = 0; | |
418 | if (prevrow < row) | |
419 | { | |
420 | n = prevrow; | |
421 | m = row; | |
422 | } | |
423 | else | |
424 | { | |
425 | n = row; | |
426 | m = prevrow; | |
427 | } | |
428 | ||
429 | for (Int_t j = n+1; j < m; j++) | |
430 | { | |
431 | fTPCClusterMap.SetBitNumber(j,kFALSE); | |
432 | } | |
433 | prevrow = row; | |
434 | } | |
435 | // End Of Piotr's Cluster Map for HBT | |
436 | } | |
437 | } | |
ae982df3 | 438 | fTPCsignal=t->GetPIDsignal(); |
ae982df3 | 439 | break; |
9b859005 | 440 | |
23904d16 | 441 | case kTRDout: case kTRDin: case kTRDrefit: |
15e85efa | 442 | index=fFriendTrack->GetTRDindices(); |
51ad6848 | 443 | fTRDLabel = t->GetLabel(); |
79e94bf8 | 444 | fTRDncls=t->GetNumberOfClusters(); |
445 | fTRDchi2=t->GetChi2(); | |
15e85efa | 446 | for (Int_t i=0;i<fTRDncls;i++) index[i]=t->GetClusterIndex(i); |
79e94bf8 | 447 | fTRDsignal=t->GetPIDsignal(); |
448 | break; | |
c4d11b15 | 449 | case kTRDbackup: |
c9ec41e8 | 450 | if (!fOp) fOp=new AliExternalTrackParam(*t); |
451 | else fOp->Set(*t); | |
c4d11b15 | 452 | fTRDncls0 = t->GetNumberOfClusters(); |
453 | break; | |
454 | case kTOFin: | |
455 | break; | |
456 | case kTOFout: | |
457 | break; | |
d0862fea | 458 | case kTRDStop: |
459 | break; | |
ae982df3 | 460 | default: |
5f7789fc | 461 | AliError("Wrong flag !"); |
ae982df3 | 462 | return kFALSE; |
463 | } | |
464 | ||
15614b8b | 465 | return rc; |
ae982df3 | 466 | } |
467 | ||
468 | //_______________________________________________________________________ | |
469 | void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const { | |
470 | //--------------------------------------------------------------------- | |
471 | // This function returns external representation of the track parameters | |
472 | //--------------------------------------------------------------------- | |
c9ec41e8 | 473 | x=GetX(); |
474 | for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i]; | |
15614b8b | 475 | } |
476 | ||
67c3dcbe | 477 | //_______________________________________________________________________ |
a866ac60 | 478 | void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const { |
67c3dcbe | 479 | //--------------------------------------------------------------------- |
480 | // This function returns external representation of the cov. matrix | |
481 | //--------------------------------------------------------------------- | |
c9ec41e8 | 482 | for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i]; |
67c3dcbe | 483 | } |
484 | ||
67c3dcbe | 485 | //_______________________________________________________________________ |
c0b978f0 | 486 | Bool_t AliESDtrack::GetConstrainedExternalParameters |
487 | (Double_t &alpha, Double_t &x, Double_t p[5]) const { | |
67c3dcbe | 488 | //--------------------------------------------------------------------- |
489 | // This function returns the constrained external track parameters | |
490 | //--------------------------------------------------------------------- | |
c0b978f0 | 491 | if (!fCp) return kFALSE; |
492 | alpha=fCp->GetAlpha(); | |
c9ec41e8 | 493 | x=fCp->GetX(); |
494 | for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i]; | |
c0b978f0 | 495 | return kTRUE; |
67c3dcbe | 496 | } |
c9ec41e8 | 497 | |
67c3dcbe | 498 | //_______________________________________________________________________ |
c0b978f0 | 499 | Bool_t |
67c3dcbe | 500 | AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const { |
501 | //--------------------------------------------------------------------- | |
502 | // This function returns the constrained external cov. matrix | |
503 | //--------------------------------------------------------------------- | |
c0b978f0 | 504 | if (!fCp) return kFALSE; |
c9ec41e8 | 505 | for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i]; |
c0b978f0 | 506 | return kTRUE; |
67c3dcbe | 507 | } |
508 | ||
c0b978f0 | 509 | Bool_t |
510 | AliESDtrack::GetInnerExternalParameters | |
511 | (Double_t &alpha, Double_t &x, Double_t p[5]) const { | |
512 | //--------------------------------------------------------------------- | |
c9ec41e8 | 513 | // This function returns external representation of the track parameters |
514 | // at the inner layer of TPC | |
9b859005 | 515 | //--------------------------------------------------------------------- |
c0b978f0 | 516 | if (!fIp) return kFALSE; |
517 | alpha=fIp->GetAlpha(); | |
c9ec41e8 | 518 | x=fIp->GetX(); |
519 | for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i]; | |
c0b978f0 | 520 | return kTRUE; |
9b859005 | 521 | } |
522 | ||
c0b978f0 | 523 | Bool_t |
524 | AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const { | |
c9ec41e8 | 525 | //--------------------------------------------------------------------- |
526 | // This function returns external representation of the cov. matrix | |
527 | // at the inner layer of TPC | |
528 | //--------------------------------------------------------------------- | |
c0b978f0 | 529 | if (!fIp) return kFALSE; |
c9ec41e8 | 530 | for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i]; |
c0b978f0 | 531 | return kTRUE; |
9b859005 | 532 | } |
533 | ||
c0b978f0 | 534 | Bool_t |
535 | AliESDtrack::GetOuterExternalParameters | |
536 | (Double_t &alpha, Double_t &x, Double_t p[5]) const { | |
537 | //--------------------------------------------------------------------- | |
c9ec41e8 | 538 | // This function returns external representation of the track parameters |
539 | // at the inner layer of TRD | |
a866ac60 | 540 | //--------------------------------------------------------------------- |
c0b978f0 | 541 | if (!fOp) return kFALSE; |
542 | alpha=fOp->GetAlpha(); | |
c9ec41e8 | 543 | x=fOp->GetX(); |
544 | for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i]; | |
c0b978f0 | 545 | return kTRUE; |
a866ac60 | 546 | } |
c9ec41e8 | 547 | |
c0b978f0 | 548 | Bool_t |
549 | AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const { | |
a866ac60 | 550 | //--------------------------------------------------------------------- |
c9ec41e8 | 551 | // This function returns external representation of the cov. matrix |
552 | // at the inner layer of TRD | |
a866ac60 | 553 | //--------------------------------------------------------------------- |
c0b978f0 | 554 | if (!fOp) return kFALSE; |
c9ec41e8 | 555 | for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[i]; |
c0b978f0 | 556 | return kTRUE; |
a866ac60 | 557 | } |
558 | ||
98937d93 | 559 | Int_t AliESDtrack::GetNcls(Int_t idet) const |
560 | { | |
561 | // Get number of clusters by subdetector index | |
562 | // | |
563 | Int_t ncls = 0; | |
564 | switch(idet){ | |
565 | case 0: | |
566 | ncls = fITSncls; | |
567 | break; | |
568 | case 1: | |
569 | ncls = fTPCncls; | |
570 | break; | |
571 | case 2: | |
572 | ncls = fTRDncls; | |
573 | break; | |
574 | case 3: | |
575 | if (fTOFindex != 0) | |
576 | ncls = 1; | |
577 | break; | |
578 | default: | |
579 | break; | |
580 | } | |
581 | return ncls; | |
582 | } | |
583 | ||
ef7253ac | 584 | Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const |
98937d93 | 585 | { |
586 | // Get cluster index array by subdetector index | |
587 | // | |
588 | Int_t ncls = 0; | |
589 | switch(idet){ | |
590 | case 0: | |
591 | ncls = GetITSclusters(idx); | |
592 | break; | |
593 | case 1: | |
ef7253ac | 594 | ncls = GetTPCclusters(idx); |
98937d93 | 595 | break; |
596 | case 2: | |
597 | ncls = GetTRDclusters(idx); | |
598 | break; | |
599 | case 3: | |
600 | if (fTOFindex != 0) { | |
601 | idx[0] = GetTOFcluster(); | |
602 | ncls = 1; | |
603 | } | |
604 | break; | |
605 | default: | |
606 | break; | |
607 | } | |
608 | return ncls; | |
609 | } | |
610 | ||
ae982df3 | 611 | //_______________________________________________________________________ |
612 | void AliESDtrack::GetIntegratedTimes(Double_t *times) const { | |
4427806c | 613 | // Returns the array with integrated times for each particle hypothesis |
304864ab | 614 | for (Int_t i=0; i<AliPID::kSPECIES; i++) times[i]=fTrackTime[i]; |
ae982df3 | 615 | } |
616 | ||
617 | //_______________________________________________________________________ | |
618 | void AliESDtrack::SetIntegratedTimes(const Double_t *times) { | |
4427806c | 619 | // Sets the array with integrated times for each particle hypotesis |
304864ab | 620 | for (Int_t i=0; i<AliPID::kSPECIES; i++) fTrackTime[i]=times[i]; |
ae982df3 | 621 | } |
622 | ||
c630aafd | 623 | //_______________________________________________________________________ |
4427806c | 624 | void AliESDtrack::SetITSpid(const Double_t *p) { |
625 | // Sets values for the probability of each particle type (in ITS) | |
d27bbc79 | 626 | SetPIDValues(fITSr,p,AliPID::kSPECIES); |
c630aafd | 627 | SetStatus(AliESDtrack::kITSpid); |
628 | } | |
629 | ||
630 | //_______________________________________________________________________ | |
631 | void AliESDtrack::GetITSpid(Double_t *p) const { | |
4427806c | 632 | // Gets the probability of each particle type (in ITS) |
304864ab | 633 | for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fITSr[i]; |
c630aafd | 634 | } |
635 | ||
ae982df3 | 636 | //_______________________________________________________________________ |
ef7253ac | 637 | Int_t AliESDtrack::GetITSclusters(Int_t *idx) const { |
ae982df3 | 638 | //--------------------------------------------------------------------- |
639 | // This function returns indices of the assgined ITS clusters | |
640 | //--------------------------------------------------------------------- | |
15e85efa | 641 | if (idx!=0) { |
642 | Int_t *index=fFriendTrack->GetITSindices(); | |
643 | for (Int_t i=0; i<AliESDfriendTrack::kMaxITScluster; i++) idx[i]=index[i]; | |
644 | } | |
ae982df3 | 645 | return fITSncls; |
646 | } | |
647 | ||
648 | //_______________________________________________________________________ | |
05e445cd | 649 | Int_t AliESDtrack::GetTPCclusters(Int_t *idx) const { |
ae982df3 | 650 | //--------------------------------------------------------------------- |
651 | // This function returns indices of the assgined ITS clusters | |
652 | //--------------------------------------------------------------------- | |
15e85efa | 653 | if (idx!=0) { |
654 | Int_t *index=fFriendTrack->GetTPCindices(); | |
655 | for (Int_t i=0; i<AliESDfriendTrack::kMaxTPCcluster; i++) idx[i]=index[i]; | |
656 | } | |
ae982df3 | 657 | return fTPCncls; |
658 | } | |
8c6a71ab | 659 | |
81e97e0d | 660 | Float_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{ |
661 | // | |
662 | // GetDensity of the clusters on given region between row0 and row1 | |
663 | // Dead zone effect takin into acoount | |
664 | // | |
665 | Int_t good = 0; | |
666 | Int_t found = 0; | |
667 | // | |
15e85efa | 668 | Int_t *index=fFriendTrack->GetTPCindices(); |
81e97e0d | 669 | for (Int_t i=row0;i<=row1;i++){ |
15e85efa | 670 | Int_t idx = index[i]; |
671 | if (idx!=-1) good++; // track outside of dead zone | |
672 | if (idx>0) found++; | |
81e97e0d | 673 | } |
674 | Float_t density=0.5; | |
675 | if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good); | |
676 | return density; | |
677 | } | |
c84a5e9e | 678 | |
8c6a71ab | 679 | //_______________________________________________________________________ |
680 | void AliESDtrack::SetTPCpid(const Double_t *p) { | |
4427806c | 681 | // Sets values for the probability of each particle type (in TPC) |
d27bbc79 | 682 | SetPIDValues(fTPCr,p,AliPID::kSPECIES); |
8c6a71ab | 683 | SetStatus(AliESDtrack::kTPCpid); |
684 | } | |
685 | ||
686 | //_______________________________________________________________________ | |
687 | void AliESDtrack::GetTPCpid(Double_t *p) const { | |
4427806c | 688 | // Gets the probability of each particle type (in TPC) |
304864ab | 689 | for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTPCr[i]; |
8c6a71ab | 690 | } |
691 | ||
bb2ceb1f | 692 | //_______________________________________________________________________ |
ef7253ac | 693 | Int_t AliESDtrack::GetTRDclusters(Int_t *idx) const { |
bb2ceb1f | 694 | //--------------------------------------------------------------------- |
695 | // This function returns indices of the assgined TRD clusters | |
696 | //--------------------------------------------------------------------- | |
15e85efa | 697 | if (idx!=0) { |
698 | Int_t *index=fFriendTrack->GetTRDindices(); | |
699 | for (Int_t i=0; i<AliESDfriendTrack::kMaxTRDcluster; i++) idx[i]=index[i]; | |
700 | } | |
bb2ceb1f | 701 | return fTRDncls; |
702 | } | |
703 | ||
c630aafd | 704 | //_______________________________________________________________________ |
705 | void AliESDtrack::SetTRDpid(const Double_t *p) { | |
4427806c | 706 | // Sets values for the probability of each particle type (in TRD) |
d27bbc79 | 707 | SetPIDValues(fTRDr,p,AliPID::kSPECIES); |
c630aafd | 708 | SetStatus(AliESDtrack::kTRDpid); |
709 | } | |
710 | ||
711 | //_______________________________________________________________________ | |
712 | void AliESDtrack::GetTRDpid(Double_t *p) const { | |
4427806c | 713 | // Gets the probability of each particle type (in TRD) |
304864ab | 714 | for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTRDr[i]; |
c630aafd | 715 | } |
716 | ||
79e94bf8 | 717 | //_______________________________________________________________________ |
718 | void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p) | |
719 | { | |
4427806c | 720 | // Sets the probability of particle type iSpecies to p (in TRD) |
79e94bf8 | 721 | fTRDr[iSpecies] = p; |
722 | } | |
723 | ||
724 | Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const | |
725 | { | |
4427806c | 726 | // Returns the probability of particle type iSpecies (in TRD) |
79e94bf8 | 727 | return fTRDr[iSpecies]; |
728 | } | |
729 | ||
c630aafd | 730 | //_______________________________________________________________________ |
731 | void AliESDtrack::SetTOFpid(const Double_t *p) { | |
4427806c | 732 | // Sets the probability of each particle type (in TOF) |
d27bbc79 | 733 | SetPIDValues(fTOFr,p,AliPID::kSPECIES); |
c630aafd | 734 | SetStatus(AliESDtrack::kTOFpid); |
735 | } | |
736 | ||
51ad6848 | 737 | //_______________________________________________________________________ |
738 | void AliESDtrack::SetTOFLabel(const Int_t *p) { | |
739 | // Sets (in TOF) | |
740 | for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i]; | |
741 | } | |
742 | ||
c630aafd | 743 | //_______________________________________________________________________ |
744 | void AliESDtrack::GetTOFpid(Double_t *p) const { | |
4427806c | 745 | // Gets probabilities of each particle type (in TOF) |
304864ab | 746 | for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fTOFr[i]; |
c630aafd | 747 | } |
748 | ||
51ad6848 | 749 | //_______________________________________________________________________ |
750 | void AliESDtrack::GetTOFLabel(Int_t *p) const { | |
751 | // Gets (in TOF) | |
752 | for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i]; | |
753 | } | |
754 | ||
755 | //_______________________________________________________________________ | |
756 | void AliESDtrack::GetTOFInfo(Float_t *info) const { | |
757 | // Gets (in TOF) | |
758 | for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i]; | |
759 | } | |
760 | ||
761 | //_______________________________________________________________________ | |
762 | void AliESDtrack::SetTOFInfo(Float_t*info) { | |
763 | // Gets (in TOF) | |
764 | for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i]; | |
765 | } | |
766 | ||
4a78b8c5 | 767 | |
768 | ||
4a78b8c5 | 769 | //_______________________________________________________________________ |
770 | void AliESDtrack::SetRICHpid(const Double_t *p) { | |
771 | // Sets the probability of each particle type (in RICH) | |
d27bbc79 | 772 | SetPIDValues(fRICHr,p,AliPID::kSPECIES); |
4a78b8c5 | 773 | SetStatus(AliESDtrack::kRICHpid); |
774 | } | |
775 | ||
776 | //_______________________________________________________________________ | |
777 | void AliESDtrack::GetRICHpid(Double_t *p) const { | |
778 | // Gets probabilities of each particle type (in RICH) | |
304864ab | 779 | for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fRICHr[i]; |
4a78b8c5 | 780 | } |
781 | ||
782 | ||
783 | ||
8c6a71ab | 784 | //_______________________________________________________________________ |
785 | void AliESDtrack::SetESDpid(const Double_t *p) { | |
4427806c | 786 | // Sets the probability of each particle type for the ESD track |
d27bbc79 | 787 | SetPIDValues(fR,p,AliPID::kSPECIES); |
8c6a71ab | 788 | SetStatus(AliESDtrack::kESDpid); |
789 | } | |
790 | ||
791 | //_______________________________________________________________________ | |
792 | void AliESDtrack::GetESDpid(Double_t *p) const { | |
4427806c | 793 | // Gets probability of each particle type for the ESD track |
304864ab | 794 | for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i]=fR[i]; |
8c6a71ab | 795 | } |
796 | ||
49d13e89 | 797 | //_______________________________________________________________________ |
798 | Bool_t AliESDtrack::RelateToVertex | |
799 | (const AliESDVertex *vtx, Double_t b, Double_t maxd) { | |
800 | // | |
801 | // Try to relate this track to the vertex "vtx", | |
802 | // if the (rough) transverse impact parameter is not bigger then "maxd". | |
803 | // Magnetic field is "b" (kG). | |
804 | // | |
805 | // a) The track gets extapolated to the DCA to the vertex. | |
806 | // b) The impact parameters and their covariance matrix are calculated. | |
807 | // c) An attempt to constrain this track to the vertex is done. | |
808 | // | |
809 | // In the case of success, the returned value is kTRUE | |
810 | // (otherwise, it's kFALSE) | |
811 | // | |
812 | Double_t alpha=GetAlpha(); | |
813 | Double_t sn=TMath::Sin(alpha), cs=TMath::Cos(alpha); | |
814 | Double_t x=GetX(), y=GetParameter()[0], snp=GetParameter()[2]; | |
815 | Double_t xv= vtx->GetXv()*cs + vtx->GetYv()*sn; | |
816 | Double_t yv=-vtx->GetXv()*sn + vtx->GetYv()*cs, zv=vtx->GetZv(); | |
817 | x-=xv; y-=yv; | |
818 | ||
819 | //Estimate the impact parameter neglecting the track curvature | |
820 | Double_t d=TMath::Abs(x*snp - y*TMath::Sqrt(1.- snp*snp)); | |
821 | if (d > maxd) return kFALSE; | |
822 | ||
823 | //Propagate to the DCA | |
824 | Double_t crv=0.299792458e-3*b*GetParameter()[4]; | |
825 | Double_t tgfv=-(crv*x - snp)/(crv*y + TMath::Sqrt(1.-snp*snp)); | |
f54395bf | 826 | sn=tgfv/TMath::Sqrt(1.+ tgfv*tgfv); |
827 | if (TMath::Abs(tgfv)>0.) cs = sn/tgfv; | |
828 | else cs=1.; | |
49d13e89 | 829 | |
830 | x = xv*cs + yv*sn; | |
831 | yv=-xv*sn + yv*cs; xv=x; | |
832 | ||
833 | if (!Propagate(alpha+TMath::ASin(sn),xv,b)) return kFALSE; | |
834 | ||
835 | fD = GetParameter()[0] - yv; | |
836 | fZ = GetParameter()[1] - zv; | |
837 | ||
838 | Double_t cov[6]; vtx->GetCovMatrix(cov); | |
839 | fCdd = GetCovariance()[0] + cov[2]; // neglecting non-diagonals | |
840 | fCdz = GetCovariance()[1]; // in the vertex's | |
841 | fCzz = GetCovariance()[2] + cov[5]; // covariance matrix | |
842 | ||
843 | {//Try to constrain | |
844 | Double_t p[2]={yv,zv}, c[3]={cov[2],0.,cov[5]}; | |
845 | Double_t chi2=GetPredictedChi2(p,c); | |
846 | ||
847 | if (chi2>77.) return kFALSE; | |
848 | ||
849 | AliExternalTrackParam tmp(*this); | |
850 | if (!tmp.Update(p,c)) return kFALSE; | |
851 | ||
852 | fCchi2=chi2; | |
853 | if (!fCp) fCp=new AliExternalTrackParam(); | |
854 | new (fCp) AliExternalTrackParam(tmp); | |
855 | } | |
856 | ||
857 | return kTRUE; | |
858 | } | |
859 | ||
15e85efa | 860 | void AliESDtrack::SetTrackPointArray(AliTrackPointArray *points) { |
861 | fPoints=points; | |
862 | //fFriendTrack->SetTrackPointArray(points); | |
863 | } | |
864 | const AliTrackPointArray *AliESDtrack::GetTrackPointArray() const { | |
865 | return fPoints; | |
866 | //return fFriendTrack->GetTrackPointArray(); | |
867 | } | |
868 | ||
ac2f7574 | 869 | //_______________________________________________________________________ |
870 | void AliESDtrack::Print(Option_t *) const { | |
871 | // Prints info on the track | |
872 | ||
5f7789fc | 873 | printf("ESD track info\n") ; |
304864ab | 874 | Double_t p[AliPID::kSPECIESN] ; |
ac2f7574 | 875 | Int_t index = 0 ; |
876 | if( IsOn(kITSpid) ){ | |
877 | printf("From ITS: ") ; | |
878 | GetITSpid(p) ; | |
304864ab | 879 | for(index = 0 ; index < AliPID::kSPECIES; index++) |
ac2f7574 | 880 | printf("%f, ", p[index]) ; |
881 | printf("\n signal = %f\n", GetITSsignal()) ; | |
882 | } | |
883 | if( IsOn(kTPCpid) ){ | |
884 | printf("From TPC: ") ; | |
885 | GetTPCpid(p) ; | |
304864ab | 886 | for(index = 0 ; index < AliPID::kSPECIES; index++) |
ac2f7574 | 887 | printf("%f, ", p[index]) ; |
888 | printf("\n signal = %f\n", GetTPCsignal()) ; | |
889 | } | |
890 | if( IsOn(kTRDpid) ){ | |
891 | printf("From TRD: ") ; | |
892 | GetTRDpid(p) ; | |
304864ab | 893 | for(index = 0 ; index < AliPID::kSPECIES; index++) |
ac2f7574 | 894 | printf("%f, ", p[index]) ; |
895 | printf("\n signal = %f\n", GetTRDsignal()) ; | |
896 | } | |
897 | if( IsOn(kTOFpid) ){ | |
898 | printf("From TOF: ") ; | |
899 | GetTOFpid(p) ; | |
304864ab | 900 | for(index = 0 ; index < AliPID::kSPECIES; index++) |
ac2f7574 | 901 | printf("%f, ", p[index]) ; |
902 | printf("\n signal = %f\n", GetTOFsignal()) ; | |
903 | } | |
904 | if( IsOn(kRICHpid) ){ | |
038834e7 | 905 | printf("From RICH: ") ; |
ac2f7574 | 906 | GetRICHpid(p) ; |
304864ab | 907 | for(index = 0 ; index < AliPID::kSPECIES; index++) |
ac2f7574 | 908 | printf("%f, ", p[index]) ; |
909 | printf("\n signal = %f\n", GetRICHsignal()) ; | |
910 | } | |
ac2f7574 | 911 | } |