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