]>
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 | |
4df45162 | 21 | // |
22 | // | |
23 | // | |
24 | // What do you need to know before starting analysis | |
25 | // (by Marian Ivanov: marian.ivanov@cern.ch) | |
26 | // | |
27 | // | |
28 | // AliESDtrack: | |
29 | // 1. What is the AliESDtrack | |
30 | // 2. What informations do we store | |
31 | // 3. How to use the information for analysis | |
32 | // | |
33 | // | |
34 | // 1.AliESDtrack is the container of the information about the track/particle | |
35 | // reconstructed during Barrel Tracking. | |
36 | // The track information is propagated from one tracking detector to | |
37 | // other using the functionality of AliESDtrack - Current parameters. | |
38 | // | |
39 | // No global fit model is used. | |
40 | // Barrel tracking use Kalman filtering technique, it gives optimal local | |
41 | // track parameters at given point under certian assumptions. | |
42 | // | |
43 | // Kalman filter take into account additional effect which are | |
44 | // difficult to handle using global fit. | |
45 | // Effects: | |
46 | // a.) Multiple scattering | |
47 | // b.) Energy loss | |
48 | // c.) Non homogenous magnetic field | |
49 | // | |
50 | // In general case, following barrel detectors are contributing to | |
51 | // the Kalman track information: | |
52 | // a. TPC | |
53 | // b. ITS | |
54 | // c. TRD | |
55 | // | |
56 | // In general 3 reconstruction itteration are performed: | |
57 | // 1. Find tracks - sequence TPC->ITS | |
58 | // 2. PropagateBack - sequence ITS->TPC->TRD -> Outer PID detectors | |
59 | // 3. Refit invward - sequence TRD->TPC->ITS | |
60 | // The current tracks are updated after each detector (see bellow). | |
61 | // In specical cases a track sanpshots are stored. | |
62 | // | |
63 | // | |
64 | // For some type of analysis (+visualization) track local parameters at | |
65 | // different position are neccesary. A snapshots during the track | |
66 | // propagation are created. | |
67 | // (See AliExternalTrackParam class for desctiption of variables and | |
68 | // functionality) | |
69 | // Snapshots: | |
70 | // a. Current parameters - class itself (AliExternalTrackParam) | |
71 | // Contributors: general case TRD->TPC->ITS | |
72 | // Preferable usage: Decission - primary or secondary track | |
73 | // NOTICE - By default the track parameters are stored at the DCA point | |
74 | // to the primary vertex. optimal for primary tracks, | |
75 | // far from optimal for secondary tracks. | |
76 | // b. Constrained parameters - Kalman information updated with | |
77 | // the Primary vertex information | |
78 | // Contributors: general case TRD->TPC->ITS | |
79 | // Preferable usage: Use only for tracks selected as primary | |
80 | // NOTICE - not real constrain - taken as additional measurement | |
81 | // with corresponding error | |
82 | // Function: | |
83 | // const AliExternalTrackParam *GetConstrainedParam() const {return fCp;} | |
84 | // c. Inner parameters - Track parameters at inner wall of the TPC | |
85 | // Contributors: general case TRD->TPC | |
86 | // function: | |
87 | // const AliExternalTrackParam *GetInnerParam() const { return fIp;} | |
88 | // | |
89 | // d. TPCinnerparam - contributors - TPC only | |
90 | // Contributors: TPC | |
91 | // Preferable usage: Requested for HBT study | |
92 | // (smaller correlations as using also ITS information) | |
93 | // NOTICE - the track parameters are propagated to the DCA to | |
94 | // to primary vertex | |
95 | // Optimal for primary, far from optimal for secondary tracks | |
96 | // Function: | |
97 | // const AliExternalTrackParam *GetTPCInnerParam() const {return fTPCInner;} | |
98 | // | |
99 | // e. Outer parameters - | |
100 | // Contributors- general case - ITS-> TPC -> TRD | |
101 | // The last point - Outer parameters radius is determined | |
102 | // e.a) Local inclination angle bigger than threshold - | |
103 | // Low momenta tracks | |
104 | // e.a) Catastrofic energy losss in material | |
105 | // e.b) Not further improvement (no space points) | |
106 | // Usage: | |
107 | // a.) Tracking: Starting parameter for Refit inward | |
108 | // b.) Visualization | |
109 | // c.) QA | |
110 | // NOTICE: Should be not used for the physic analysis | |
111 | // Function: | |
112 | // const AliExternalTrackParam *GetOuterParam() const { return fOp;} | |
113 | // | |
ae982df3 | 114 | //----------------------------------------------------------------- |
115 | ||
e1e6896f | 116 | #include <TMath.h> |
49edfa08 | 117 | #include <TParticle.h> |
c180f65d | 118 | #include <TDatabasePDG.h> |
4c3dc2a0 | 119 | #include <TMatrixD.h> |
ae982df3 | 120 | |
49d13e89 | 121 | #include "AliESDVertex.h" |
ae982df3 | 122 | #include "AliESDtrack.h" |
95621324 | 123 | #include "AliESDEvent.h" |
ae982df3 | 124 | #include "AliKalmanTrack.h" |
4f6e22bd | 125 | #include "AliVTrack.h" |
5f7789fc | 126 | #include "AliLog.h" |
15e85efa | 127 | #include "AliTrackPointArray.h" |
0c19adf7 | 128 | #include "TPolyMarker3D.h" |
4c3dc2a0 | 129 | #include "AliTrackerBase.h" |
40b4e5ea | 130 | #include "AliTPCdEdxInfo.h" |
e546b023 | 131 | #include "AliPoolsSet.h" |
ae982df3 | 132 | |
133 | ClassImp(AliESDtrack) | |
134 | ||
e546b023 | 135 | AliPoolsSet* AliESDtrack::fgPools = 0; |
136 | ||
562dd0b4 | 137 | void SetPIDValues(Double_t * dest, const Double_t * src, Int_t n) { |
d27bbc79 | 138 | // This function copies "n" PID weights from "scr" to "dest" |
139 | // and normalizes their sum to 1 thus producing conditional probabilities. | |
140 | // The negative weights are set to 0. | |
141 | // In case all the weights are non-positive they are replaced by | |
142 | // uniform probabilities | |
143 | ||
144 | if (n<=0) return; | |
145 | ||
146 | Float_t uniform = 1./(Float_t)n; | |
147 | ||
148 | Float_t sum = 0; | |
149 | for (Int_t i=0; i<n; i++) | |
150 | if (src[i]>=0) { | |
151 | sum+=src[i]; | |
152 | dest[i] = src[i]; | |
153 | } | |
154 | else { | |
155 | dest[i] = 0; | |
156 | } | |
157 | ||
158 | if(sum>0) | |
159 | for (Int_t i=0; i<n; i++) dest[i] /= sum; | |
160 | else | |
161 | for (Int_t i=0; i<n; i++) dest[i] = uniform; | |
162 | } | |
163 | ||
ae982df3 | 164 | //_______________________________________________________________________ |
165 | AliESDtrack::AliESDtrack() : | |
c9ec41e8 | 166 | AliExternalTrackParam(), |
562dd0b4 | 167 | fCp(0), |
168 | fIp(0), | |
169 | fTPCInner(0), | |
170 | fOp(0), | |
c38d443f | 171 | fHMPIDp(0), |
59c31692 | 172 | fFriendTrack(NULL), |
9f638f03 | 173 | fTPCFitMap(159),//number of padrows |
562dd0b4 | 174 | fTPCClusterMap(159),//number of padrows |
175 | fTPCSharedMap(159),//number of padrows | |
90e48c0c | 176 | fFlags(0), |
90e48c0c | 177 | fID(0), |
562dd0b4 | 178 | fLabel(0), |
179 | fITSLabel(0), | |
180 | fTPCLabel(0), | |
181 | fTRDLabel(0), | |
ab37ab1e | 182 | fTOFCalChannel(-1), |
ce3f4882 | 183 | fTOFindex(-1), |
562dd0b4 | 184 | fHMPIDqn(0), |
81aa7a0d | 185 | fHMPIDcluIdx(-1), |
f1cedef3 | 186 | fCaloIndex(kEMCALNoMatch), |
562dd0b4 | 187 | fHMPIDtrkTheta(0), |
188 | fHMPIDtrkPhi(0), | |
189 | fHMPIDsignal(0), | |
90e48c0c | 190 | fTrackLength(0), |
d7ddf1e9 | 191 | fdTPC(0),fzTPC(0), |
192 | fCddTPC(0),fCdzTPC(0),fCzzTPC(0), | |
436dfe39 | 193 | fCchi2TPC(0), |
49d13e89 | 194 | fD(0),fZ(0), |
195 | fCdd(0),fCdz(0),fCzz(0), | |
562dd0b4 | 196 | fCchi2(0), |
90e48c0c | 197 | fITSchi2(0), |
90e48c0c | 198 | fTPCchi2(0), |
949840f6 | 199 | fTPCchi2Iter1(0), |
562dd0b4 | 200 | fTRDchi2(0), |
201 | fTOFchi2(0), | |
202 | fHMPIDchi2(0), | |
b5b2b4db | 203 | fGlobalChi2(0), |
562dd0b4 | 204 | fITSsignal(0), |
90e48c0c | 205 | fTPCsignal(0), |
e1d4c1b5 | 206 | fTPCsignalS(0), |
40b4e5ea | 207 | fTPCdEdxInfo(0), |
90e48c0c | 208 | fTRDsignal(0), |
90e48c0c | 209 | fTRDQuality(0), |
23d49657 | 210 | fTRDBudget(0), |
ab37ab1e | 211 | fTOFsignal(99999), |
212 | fTOFsignalToT(99999), | |
213 | fTOFsignalRaw(99999), | |
214 | fTOFsignalDz(999), | |
215 | fTOFsignalDx(999), | |
216 | fTOFdeltaBC(999), | |
217 | fTOFl0l1(999), | |
f1cedef3 | 218 | fCaloDx(0), |
219 | fCaloDz(0), | |
562dd0b4 | 220 | fHMPIDtrkX(0), |
221 | fHMPIDtrkY(0), | |
222 | fHMPIDmipX(0), | |
223 | fHMPIDmipY(0), | |
224 | fTPCncls(0), | |
225 | fTPCnclsF(0), | |
226 | fTPCsignalN(0), | |
949840f6 | 227 | fTPCnclsIter1(0), |
228 | fTPCnclsFIter1(0), | |
562dd0b4 | 229 | fITSncls(0), |
230 | fITSClusterMap(0), | |
25015f7a | 231 | fITSSharedMap(0), |
562dd0b4 | 232 | fTRDncls(0), |
233 | fTRDncls0(0), | |
ed15ef4f | 234 | fTRDntracklets(0), |
6984f7c1 | 235 | fTRDnSlices(0), |
6dc21f57 | 236 | fTRDslices(0x0), |
95621324 | 237 | fVertexID(-2),// -2 means an orphan track |
4c3dc2a0 | 238 | fESDEvent(0), |
239 | fCacheNCrossedRows(-10), | |
240 | fCacheChi2TPCConstrainedVsGlobal(-10), | |
241 | fCacheChi2TPCConstrainedVsGlobalVertex(0) | |
ae982df3 | 242 | { |
243 | // | |
244 | // The default ESD constructor | |
245 | // | |
e546b023 | 246 | if (!OnlineMode()) { |
247 | AliClonesPool* poolFr = fgPools ? fgPools->GetPoolTrFriend() : 0; | |
248 | if (poolFr) { fFriendTrack = new(poolFr->NextFreeSlot()) AliESDfriendTrack(); poolFr->RegisterClone(fFriendTrack);} | |
249 | else fFriendTrack = new AliESDfriendTrack(); | |
250 | } | |
251 | // | |
252 | for (int i=kNITSchi2Std;i--;) fITSchi2Std[i] = 0; | |
253 | for (int i=AliPID::kSPECIES;i--;) { | |
4a78b8c5 | 254 | fTrackTime[i]=0.; |
562dd0b4 | 255 | fR[i]=0.; |
256 | fITSr[i]=0.; | |
257 | fTPCr[i]=0.; | |
258 | fTRDr[i]=0.; | |
259 | fTOFr[i]=0.; | |
260 | fHMPIDr[i]=0.; | |
2bad268c | 261 | } |
ac2f7574 | 262 | |
e546b023 | 263 | for (int i=3;i--;) fKinkIndexes[i]=0; |
264 | for (int i=3;i--;) fV0Indexes[i]=0; | |
265 | for (int i=kTRDnPlanes;i--;) fTRDTimBin[i]=0; | |
266 | for (int i=4;i--;) {fITSdEdxSamples[i]=0.;} | |
267 | for (int i=4;i--;) {fTPCPoints[i]=0;} | |
268 | for (int i=3;i--;) {fTOFLabel[i]=-1;} | |
269 | for (int i=10;i--;) {fTOFInfo[i]=0;} | |
270 | for (int i=12;i--;) {fITSModule[i]=-1;} | |
c4d11b15 | 271 | } |
272 | ||
59c31692 | 273 | bool AliESDtrack::fgkOnlineMode=false; |
274 | ||
c4d11b15 | 275 | //_______________________________________________________________________ |
90e48c0c | 276 | AliESDtrack::AliESDtrack(const AliESDtrack& track): |
c9ec41e8 | 277 | AliExternalTrackParam(track), |
562dd0b4 | 278 | fCp(0), |
279 | fIp(0), | |
280 | fTPCInner(0), | |
281 | fOp(0), | |
c38d443f | 282 | fHMPIDp(0), |
562dd0b4 | 283 | fFriendTrack(0), |
9f638f03 | 284 | fTPCFitMap(track.fTPCFitMap), |
562dd0b4 | 285 | fTPCClusterMap(track.fTPCClusterMap), |
286 | fTPCSharedMap(track.fTPCSharedMap), | |
90e48c0c | 287 | fFlags(track.fFlags), |
90e48c0c | 288 | fID(track.fID), |
562dd0b4 | 289 | fLabel(track.fLabel), |
290 | fITSLabel(track.fITSLabel), | |
291 | fTPCLabel(track.fTPCLabel), | |
292 | fTRDLabel(track.fTRDLabel), | |
293 | fTOFCalChannel(track.fTOFCalChannel), | |
294 | fTOFindex(track.fTOFindex), | |
295 | fHMPIDqn(track.fHMPIDqn), | |
296 | fHMPIDcluIdx(track.fHMPIDcluIdx), | |
f1cedef3 | 297 | fCaloIndex(track.fCaloIndex), |
562dd0b4 | 298 | fHMPIDtrkTheta(track.fHMPIDtrkTheta), |
299 | fHMPIDtrkPhi(track.fHMPIDtrkPhi), | |
300 | fHMPIDsignal(track.fHMPIDsignal), | |
90e48c0c | 301 | fTrackLength(track.fTrackLength), |
d7ddf1e9 | 302 | fdTPC(track.fdTPC),fzTPC(track.fzTPC), |
303 | fCddTPC(track.fCddTPC),fCdzTPC(track.fCdzTPC),fCzzTPC(track.fCzzTPC), | |
436dfe39 | 304 | fCchi2TPC(track.fCchi2TPC), |
49d13e89 | 305 | fD(track.fD),fZ(track.fZ), |
306 | fCdd(track.fCdd),fCdz(track.fCdz),fCzz(track.fCzz), | |
90e48c0c | 307 | fCchi2(track.fCchi2), |
90e48c0c | 308 | fITSchi2(track.fITSchi2), |
90e48c0c | 309 | fTPCchi2(track.fTPCchi2), |
949840f6 | 310 | fTPCchi2Iter1(track.fTPCchi2Iter1), |
562dd0b4 | 311 | fTRDchi2(track.fTRDchi2), |
312 | fTOFchi2(track.fTOFchi2), | |
313 | fHMPIDchi2(track.fHMPIDchi2), | |
b5b2b4db | 314 | fGlobalChi2(track.fGlobalChi2), |
562dd0b4 | 315 | fITSsignal(track.fITSsignal), |
90e48c0c | 316 | fTPCsignal(track.fTPCsignal), |
e1d4c1b5 | 317 | fTPCsignalS(track.fTPCsignalS), |
40b4e5ea | 318 | fTPCdEdxInfo(0), |
90e48c0c | 319 | fTRDsignal(track.fTRDsignal), |
90e48c0c | 320 | fTRDQuality(track.fTRDQuality), |
23d49657 | 321 | fTRDBudget(track.fTRDBudget), |
90e48c0c | 322 | fTOFsignal(track.fTOFsignal), |
85324138 | 323 | fTOFsignalToT(track.fTOFsignalToT), |
d321691a | 324 | fTOFsignalRaw(track.fTOFsignalRaw), |
325 | fTOFsignalDz(track.fTOFsignalDz), | |
a5d9ff0f | 326 | fTOFsignalDx(track.fTOFsignalDx), |
d86081b1 | 327 | fTOFdeltaBC(track.fTOFdeltaBC), |
328 | fTOFl0l1(track.fTOFl0l1), | |
f1cedef3 | 329 | fCaloDx(track.fCaloDx), |
330 | fCaloDz(track.fCaloDz), | |
f4b3bbb7 | 331 | fHMPIDtrkX(track.fHMPIDtrkX), |
332 | fHMPIDtrkY(track.fHMPIDtrkY), | |
333 | fHMPIDmipX(track.fHMPIDmipX), | |
334 | fHMPIDmipY(track.fHMPIDmipY), | |
562dd0b4 | 335 | fTPCncls(track.fTPCncls), |
336 | fTPCnclsF(track.fTPCnclsF), | |
337 | fTPCsignalN(track.fTPCsignalN), | |
949840f6 | 338 | fTPCnclsIter1(track.fTPCnclsIter1), |
339 | fTPCnclsFIter1(track.fTPCnclsIter1), | |
562dd0b4 | 340 | fITSncls(track.fITSncls), |
341 | fITSClusterMap(track.fITSClusterMap), | |
25015f7a | 342 | fITSSharedMap(track.fITSSharedMap), |
562dd0b4 | 343 | fTRDncls(track.fTRDncls), |
344 | fTRDncls0(track.fTRDncls0), | |
ed15ef4f | 345 | fTRDntracklets(track.fTRDntracklets), |
6984f7c1 | 346 | fTRDnSlices(track.fTRDnSlices), |
6dc21f57 | 347 | fTRDslices(0x0), |
95621324 | 348 | fVertexID(track.fVertexID), |
4c3dc2a0 | 349 | fESDEvent(track.fESDEvent), |
350 | fCacheNCrossedRows(track.fCacheNCrossedRows), | |
351 | fCacheChi2TPCConstrainedVsGlobal(track.fCacheChi2TPCConstrainedVsGlobal), | |
352 | fCacheChi2TPCConstrainedVsGlobalVertex(track.fCacheChi2TPCConstrainedVsGlobalVertex) | |
90e48c0c | 353 | { |
c4d11b15 | 354 | // |
355 | //copy constructor | |
356 | // | |
e400c4a6 | 357 | for (Int_t i=kNITSchi2Std;i--;) fITSchi2Std[i] = track.fTrackTime[i]; |
e546b023 | 358 | for (Int_t i=AliPID::kSPECIES;i--;) { |
359 | fTrackTime[i]=track.fTrackTime[i]; | |
360 | fR[i]=track.fR[i]; | |
361 | fITSr[i]=track.fITSr[i]; | |
362 | fTPCr[i]=track.fTPCr[i]; | |
363 | } | |
364 | for (Int_t i=4;i--;) fITSdEdxSamples[i]=track.fITSdEdxSamples[i]; | |
365 | for (Int_t i=4;i--;) fTPCPoints[i]=track.fTPCPoints[i]; | |
366 | for (Int_t i=3;i--;) fKinkIndexes[i]=track.fKinkIndexes[i]; | |
367 | for (Int_t i=3;i--;) fV0Indexes[i]=track.fV0Indexes[i]; | |
c4d11b15 | 368 | // |
e546b023 | 369 | for (Int_t i=kTRDnPlanes;i--;) fTRDTimBin[i]=track.fTRDTimBin[i]; |
370 | AliPoolN* poolN = fgPools ? fgPools->GetPoolN() : 0; | |
371 | if (fTRDnSlices) { | |
372 | if (poolN) fTRDslices = poolN->BookD32(fTRDnSlices,&fTRDslices); | |
373 | else fTRDslices = new Double32_t[fTRDnSlices]; | |
374 | for (Int_t i=fTRDnSlices;i--;) fTRDslices[i] = track.fTRDslices[i]; | |
375 | } | |
c4d11b15 | 376 | // |
e546b023 | 377 | for (Int_t i=AliPID::kSPECIES;i--;) { |
378 | fTRDr[i]=track.fTRDr[i]; | |
379 | fTOFr[i]=track.fTOFr[i]; | |
380 | fHMPIDr[i]=track.fHMPIDr[i]; | |
381 | } | |
382 | for (Int_t i=3;i--;) fTOFLabel[i]=track.fTOFLabel[i]; | |
383 | for (Int_t i=10;i--;) fTOFInfo[i]=track.fTOFInfo[i]; | |
384 | for (Int_t i=12;i--;) fITSModule[i]=track.fITSModule[i]; | |
385 | ||
386 | ||
387 | AliClonesPool* poolETP = fgPools ? fgPools->GetPoolExtTrPar() : 0; | |
388 | if (poolETP) { | |
389 | if (track.fCp) {fCp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*track.fCp); poolETP->RegisterClone(fCp);} | |
390 | if (track.fIp) {fIp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*track.fIp); poolETP->RegisterClone(fIp);} | |
391 | if (track.fOp) {fOp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*track.fOp); poolETP->RegisterClone(fOp);} | |
392 | if (track.fHMPIDp) {fHMPIDp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*track.fHMPIDp); poolETP->RegisterClone(fHMPIDp);} | |
393 | if (track.fTPCInner) {fTPCInner = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*track.fTPCInner); poolETP->RegisterClone(fTPCInner);} | |
394 | } | |
395 | else { | |
396 | if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp); | |
397 | if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp); | |
398 | if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp); | |
399 | if (track.fHMPIDp) fHMPIDp=new AliExternalTrackParam(*track.fHMPIDp); | |
400 | if (track.fTPCInner) fTPCInner=new AliExternalTrackParam(*track.fTPCInner); | |
401 | } | |
c4d11b15 | 402 | // |
e546b023 | 403 | if (track.fTPCdEdxInfo) { |
404 | AliClonesPool* pooldEdx = fgPools ? fgPools->GetPoolTPCdEdx() : 0; | |
405 | if (pooldEdx) {fTPCdEdxInfo = new(pooldEdx->NextFreeSlot()) AliTPCdEdxInfo(*track.fTPCdEdxInfo); pooldEdx->RegisterClone(fTPCdEdxInfo);} | |
406 | else fTPCdEdxInfo = new AliTPCdEdxInfo(*track.fTPCdEdxInfo); | |
eab5961e | 407 | } |
e546b023 | 408 | // |
409 | if (track.fFriendTrack) { | |
410 | AliClonesPool* poolFr = fgPools ? fgPools->GetPoolTrFriend() : 0; | |
411 | if (poolFr) {fFriendTrack = new(poolFr->NextFreeSlot()) AliESDfriendTrack(*(track.fFriendTrack)); poolFr->RegisterClone(fFriendTrack);} | |
412 | else fFriendTrack = new AliESDfriendTrack(*(track.fFriendTrack)); | |
6984f7c1 | 413 | } |
e546b023 | 414 | } |
6984f7c1 | 415 | |
e546b023 | 416 | //_______________________________________________________________________ |
417 | AliESDtrack::AliESDtrack(AliESDtrack* track, Bool_t detach) : | |
418 | AliExternalTrackParam(*track), | |
419 | fCp(0), | |
420 | fIp(0), | |
421 | fTPCInner(0), | |
422 | fOp(0), | |
423 | fHMPIDp(0), | |
424 | fFriendTrack(0), | |
425 | fTPCFitMap(track->fTPCFitMap), | |
426 | fTPCClusterMap(track->fTPCClusterMap), | |
427 | fTPCSharedMap(track->fTPCSharedMap), | |
428 | fFlags(track->fFlags), | |
429 | fID(track->fID), | |
430 | fLabel(track->fLabel), | |
431 | fITSLabel(track->fITSLabel), | |
432 | fTPCLabel(track->fTPCLabel), | |
433 | fTRDLabel(track->fTRDLabel), | |
434 | fTOFCalChannel(track->fTOFCalChannel), | |
435 | fTOFindex(track->fTOFindex), | |
436 | fHMPIDqn(track->fHMPIDqn), | |
437 | fHMPIDcluIdx(track->fHMPIDcluIdx), | |
438 | fCaloIndex(track->fCaloIndex), | |
439 | fHMPIDtrkTheta(track->fHMPIDtrkTheta), | |
440 | fHMPIDtrkPhi(track->fHMPIDtrkPhi), | |
441 | fHMPIDsignal(track->fHMPIDsignal), | |
442 | fTrackLength(track->fTrackLength), | |
443 | fdTPC(track->fdTPC),fzTPC(track->fzTPC), | |
444 | fCddTPC(track->fCddTPC),fCdzTPC(track->fCdzTPC),fCzzTPC(track->fCzzTPC), | |
445 | fCchi2TPC(track->fCchi2TPC), | |
446 | fD(track->fD),fZ(track->fZ), | |
447 | fCdd(track->fCdd),fCdz(track->fCdz),fCzz(track->fCzz), | |
448 | fCchi2(track->fCchi2), | |
449 | fITSchi2(track->fITSchi2), | |
450 | fTPCchi2(track->fTPCchi2), | |
451 | fTPCchi2Iter1(track->fTPCchi2Iter1), | |
452 | fTRDchi2(track->fTRDchi2), | |
453 | fTOFchi2(track->fTOFchi2), | |
454 | fHMPIDchi2(track->fHMPIDchi2), | |
455 | fGlobalChi2(track->fGlobalChi2), | |
456 | fITSsignal(track->fITSsignal), | |
457 | fTPCsignal(track->fTPCsignal), | |
458 | fTPCsignalS(track->fTPCsignalS), | |
459 | fTPCdEdxInfo(0), | |
460 | fTRDsignal(track->fTRDsignal), | |
461 | fTRDQuality(track->fTRDQuality), | |
462 | fTRDBudget(track->fTRDBudget), | |
463 | fTOFsignal(track->fTOFsignal), | |
464 | fTOFsignalToT(track->fTOFsignalToT), | |
465 | fTOFsignalRaw(track->fTOFsignalRaw), | |
466 | fTOFsignalDz(track->fTOFsignalDz), | |
467 | fTOFsignalDx(track->fTOFsignalDx), | |
468 | fTOFdeltaBC(track->fTOFdeltaBC), | |
469 | fTOFl0l1(track->fTOFl0l1), | |
470 | fCaloDx(track->fCaloDx), | |
471 | fCaloDz(track->fCaloDz), | |
472 | fHMPIDtrkX(track->fHMPIDtrkX), | |
473 | fHMPIDtrkY(track->fHMPIDtrkY), | |
474 | fHMPIDmipX(track->fHMPIDmipX), | |
475 | fHMPIDmipY(track->fHMPIDmipY), | |
476 | fTPCncls(track->fTPCncls), | |
477 | fTPCnclsF(track->fTPCnclsF), | |
478 | fTPCsignalN(track->fTPCsignalN), | |
479 | fTPCnclsIter1(track->fTPCnclsIter1), | |
480 | fTPCnclsFIter1(track->fTPCnclsIter1), | |
481 | fITSncls(track->fITSncls), | |
482 | fITSClusterMap(track->fITSClusterMap), | |
483 | fITSSharedMap(track->fITSSharedMap), | |
484 | fTRDncls(track->fTRDncls), | |
485 | fTRDncls0(track->fTRDncls0), | |
486 | fTRDntracklets(track->fTRDntracklets), | |
487 | fTRDnSlices(track->fTRDnSlices), | |
488 | fTRDslices(0x0), | |
489 | fVertexID(track->fVertexID), | |
490 | fESDEvent(track->fESDEvent), | |
491 | fCacheNCrossedRows(track->fCacheNCrossedRows), | |
492 | fCacheChi2TPCConstrainedVsGlobal(track->fCacheChi2TPCConstrainedVsGlobal), | |
493 | fCacheChi2TPCConstrainedVsGlobalVertex(track->fCacheChi2TPCConstrainedVsGlobalVertex) | |
494 | { | |
495 | // | |
496 | //semi-shallow copy constructor with transfer of most of pointers of the source. When detach is true, the dynamic content of | |
497 | //of source is set to 0 w/o deletion | |
498 | // | |
499 | for (Int_t i=kNITSchi2Std;i--;) fITSchi2Std[i] = track->fTrackTime[i]; | |
500 | for (Int_t i=AliPID::kSPECIES;i--;) { | |
501 | fTrackTime[i]=track->fTrackTime[i]; | |
502 | fR[i]=track->fR[i]; | |
503 | fITSr[i]=track->fITSr[i]; | |
504 | fTPCr[i]=track->fTPCr[i]; | |
505 | } | |
506 | for (Int_t i=4;i--;) fITSdEdxSamples[i]=track->fITSdEdxSamples[i]; | |
507 | for (Int_t i=4;i--;) fTPCPoints[i]=track->fTPCPoints[i]; | |
508 | for (Int_t i=3;i--;) fKinkIndexes[i]=track->fKinkIndexes[i]; | |
509 | for (Int_t i=3;i--;) fV0Indexes[i]=track->fV0Indexes[i]; | |
510 | // | |
511 | for (Int_t i=kTRDnPlanes;i--;) fTRDTimBin[i]=track->fTRDTimBin[i]; | |
512 | if (fTRDnSlices) fTRDslices = track->fTRDslices; | |
513 | // | |
514 | for (Int_t i=AliPID::kSPECIES;i--;) { | |
515 | fTRDr[i]=track->fTRDr[i]; | |
516 | fTOFr[i]=track->fTOFr[i]; | |
517 | fHMPIDr[i]=track->fHMPIDr[i]; | |
518 | } | |
519 | for (Int_t i=3;i--;) fTOFLabel[i]=track->fTOFLabel[i]; | |
520 | for (Int_t i=10;i--;) fTOFInfo[i]=track->fTOFInfo[i]; | |
521 | for (Int_t i=12;i--;) fITSModule[i]=track->fITSModule[i]; | |
522 | ||
523 | if (track->fCp) fCp = track->fCp; | |
524 | if (track->fIp) fIp = track->fIp; | |
525 | if (track->fOp) fOp = track->fOp; | |
526 | if (track->fTPCInner) fTPCInner = track->fTPCInner; | |
527 | if (track->fHMPIDp) fHMPIDp = track->fHMPIDp; | |
528 | // | |
529 | if (track->fTPCdEdxInfo) fTPCdEdxInfo = track->fTPCdEdxInfo; | |
530 | // | |
531 | if (track->fFriendTrack) fFriendTrack = track->fFriendTrack; | |
532 | // | |
533 | if (detach) { | |
534 | track->fTRDslices = 0; | |
535 | track->fTRDnSlices = 0; | |
536 | track->fCp = track->fIp = track->fTPCInner = track->fOp = track->fHMPIDp = 0; | |
537 | track->fTPCdEdxInfo = 0; | |
538 | track->fFriendTrack = 0; | |
539 | } | |
540 | // | |
ae982df3 | 541 | } |
15e85efa | 542 | |
4f6e22bd | 543 | //_______________________________________________________________________ |
544 | AliESDtrack::AliESDtrack(const AliVTrack *track) : | |
545 | AliExternalTrackParam(track), | |
546 | fCp(0), | |
547 | fIp(0), | |
548 | fTPCInner(0), | |
549 | fOp(0), | |
c38d443f | 550 | fHMPIDp(0), |
4f6e22bd | 551 | fFriendTrack(0), |
9f638f03 | 552 | fTPCFitMap(159),//number of padrows |
4f6e22bd | 553 | fTPCClusterMap(159),//number of padrows |
554 | fTPCSharedMap(159),//number of padrows | |
555 | fFlags(0), | |
556 | fID(), | |
557 | fLabel(0), | |
558 | fITSLabel(0), | |
559 | fTPCLabel(0), | |
560 | fTRDLabel(0), | |
ab37ab1e | 561 | fTOFCalChannel(-1), |
4f6e22bd | 562 | fTOFindex(-1), |
563 | fHMPIDqn(0), | |
81aa7a0d | 564 | fHMPIDcluIdx(-1), |
f1cedef3 | 565 | fCaloIndex(kEMCALNoMatch), |
4f6e22bd | 566 | fHMPIDtrkTheta(0), |
567 | fHMPIDtrkPhi(0), | |
568 | fHMPIDsignal(0), | |
569 | fTrackLength(0), | |
570 | fdTPC(0),fzTPC(0), | |
571 | fCddTPC(0),fCdzTPC(0),fCzzTPC(0), | |
572 | fCchi2TPC(0), | |
573 | fD(0),fZ(0), | |
574 | fCdd(0),fCdz(0),fCzz(0), | |
575 | fCchi2(0), | |
576 | fITSchi2(0), | |
577 | fTPCchi2(0), | |
949840f6 | 578 | fTPCchi2Iter1(0), |
4f6e22bd | 579 | fTRDchi2(0), |
580 | fTOFchi2(0), | |
581 | fHMPIDchi2(0), | |
b5b2b4db | 582 | fGlobalChi2(0), |
4f6e22bd | 583 | fITSsignal(0), |
584 | fTPCsignal(0), | |
585 | fTPCsignalS(0), | |
40b4e5ea | 586 | fTPCdEdxInfo(0), |
4f6e22bd | 587 | fTRDsignal(0), |
588 | fTRDQuality(0), | |
589 | fTRDBudget(0), | |
ab37ab1e | 590 | fTOFsignal(99999), |
591 | fTOFsignalToT(99999), | |
592 | fTOFsignalRaw(99999), | |
593 | fTOFsignalDz(999), | |
594 | fTOFsignalDx(999), | |
595 | fTOFdeltaBC(999), | |
596 | fTOFl0l1(999), | |
f1cedef3 | 597 | fCaloDx(0), |
598 | fCaloDz(0), | |
4f6e22bd | 599 | fHMPIDtrkX(0), |
600 | fHMPIDtrkY(0), | |
601 | fHMPIDmipX(0), | |
602 | fHMPIDmipY(0), | |
603 | fTPCncls(0), | |
604 | fTPCnclsF(0), | |
605 | fTPCsignalN(0), | |
949840f6 | 606 | fTPCnclsIter1(0), |
607 | fTPCnclsFIter1(0), | |
4f6e22bd | 608 | fITSncls(0), |
609 | fITSClusterMap(0), | |
25015f7a | 610 | fITSSharedMap(0), |
4f6e22bd | 611 | fTRDncls(0), |
612 | fTRDncls0(0), | |
ed15ef4f | 613 | fTRDntracklets(0), |
4f6e22bd | 614 | fTRDnSlices(0), |
6dc21f57 | 615 | fTRDslices(0x0), |
95621324 | 616 | fVertexID(-2), // -2 means an orphan track |
4c3dc2a0 | 617 | fESDEvent(0), |
618 | fCacheNCrossedRows(-10), | |
619 | fCacheChi2TPCConstrainedVsGlobal(-10), | |
620 | fCacheChi2TPCConstrainedVsGlobalVertex(0) | |
4f6e22bd | 621 | { |
622 | // | |
610e3088 | 623 | // ESD track from AliVTrack. |
624 | // This is not a copy constructor ! | |
4f6e22bd | 625 | // |
626 | ||
610e3088 | 627 | if (track->InheritsFrom("AliExternalTrackParam")) { |
628 | AliError("This is not a copy constructor. Use AliESDtrack(const AliESDtrack &) !"); | |
629 | AliWarning("Calling the default constructor..."); | |
630 | AliESDtrack(); | |
631 | return; | |
632 | } | |
633 | ||
4f6e22bd | 634 | // Reset all the arrays |
e546b023 | 635 | for (int i=kNITSchi2Std;i--;) fITSchi2Std[i] = 0; |
636 | for (int i=AliPID::kSPECIES;i--;) { | |
4f6e22bd | 637 | fTrackTime[i]=0.; |
638 | fR[i]=0.; | |
639 | fITSr[i]=0.; | |
640 | fTPCr[i]=0.; | |
641 | fTRDr[i]=0.; | |
642 | fTOFr[i]=0.; | |
643 | fHMPIDr[i]=0.; | |
644 | } | |
645 | ||
e546b023 | 646 | for (int i=3;i--;) fKinkIndexes[i]=0; |
647 | for (int i=3;i--;) fV0Indexes[i]=-1; | |
648 | for (int i=kTRDnPlanes;i--;) fTRDTimBin[i]=0; | |
649 | ||
650 | for (int i=4;i--;) {fITSdEdxSamples[i]=0.;} | |
651 | for (int i=4;i--;) {fTPCPoints[i]=0;} | |
652 | for (int i=3;i--;) {fTOFLabel[i]=-1;} | |
653 | for (int i=10;i--;) {fTOFInfo[i]=0;} | |
654 | for (int i=12;i--;) {fITSModule[i]=-1;} | |
4f6e22bd | 655 | |
656 | // Set the ID | |
657 | SetID(track->GetID()); | |
658 | ||
659 | // Set ITS cluster map | |
660 | fITSClusterMap=track->GetITSClusterMap(); | |
25015f7a | 661 | fITSSharedMap=0; |
4f6e22bd | 662 | |
d577eec9 | 663 | fITSncls=0; |
e546b023 | 664 | for(int i=6;i--;) if(HasPointOnITSLayer(i)) fITSncls++; |
665 | // | |
07cc7a48 | 666 | // Set TPC ncls |
667 | fTPCncls=track->GetTPCNcls(); | |
e546b023 | 668 | // |
4f6e22bd | 669 | // Set the combined PID |
670 | const Double_t *pid = track->PID(); | |
e546b023 | 671 | if(pid) for (int i=AliPID::kSPECIES;i--;) fR[i]=pid[i]; |
4f6e22bd | 672 | // AliESD track label |
673 | SetLabel(track->GetLabel()); | |
39ca41b3 | 674 | // Set the status |
675 | SetStatus(track->GetStatus()); | |
4f6e22bd | 676 | } |
677 | ||
49edfa08 | 678 | //_______________________________________________________________________ |
679 | AliESDtrack::AliESDtrack(TParticle * part) : | |
680 | AliExternalTrackParam(), | |
562dd0b4 | 681 | fCp(0), |
682 | fIp(0), | |
683 | fTPCInner(0), | |
684 | fOp(0), | |
c38d443f | 685 | fHMPIDp(0), |
562dd0b4 | 686 | fFriendTrack(0), |
9f638f03 | 687 | fTPCFitMap(159),//number of padrows |
562dd0b4 | 688 | fTPCClusterMap(159),//number of padrows |
689 | fTPCSharedMap(159),//number of padrows | |
49edfa08 | 690 | fFlags(0), |
49edfa08 | 691 | fID(0), |
562dd0b4 | 692 | fLabel(0), |
693 | fITSLabel(0), | |
694 | fTPCLabel(0), | |
695 | fTRDLabel(0), | |
ab37ab1e | 696 | fTOFCalChannel(-1), |
ce3f4882 | 697 | fTOFindex(-1), |
562dd0b4 | 698 | fHMPIDqn(0), |
81aa7a0d | 699 | fHMPIDcluIdx(-1), |
f1cedef3 | 700 | fCaloIndex(kEMCALNoMatch), |
562dd0b4 | 701 | fHMPIDtrkTheta(0), |
702 | fHMPIDtrkPhi(0), | |
703 | fHMPIDsignal(0), | |
49edfa08 | 704 | fTrackLength(0), |
d7ddf1e9 | 705 | fdTPC(0),fzTPC(0), |
706 | fCddTPC(0),fCdzTPC(0),fCzzTPC(0), | |
436dfe39 | 707 | fCchi2TPC(0), |
49edfa08 | 708 | fD(0),fZ(0), |
709 | fCdd(0),fCdz(0),fCzz(0), | |
562dd0b4 | 710 | fCchi2(0), |
49edfa08 | 711 | fITSchi2(0), |
49edfa08 | 712 | fTPCchi2(0), |
949840f6 | 713 | fTPCchi2Iter1(0), |
562dd0b4 | 714 | fTRDchi2(0), |
715 | fTOFchi2(0), | |
716 | fHMPIDchi2(0), | |
b5b2b4db | 717 | fGlobalChi2(0), |
562dd0b4 | 718 | fITSsignal(0), |
49edfa08 | 719 | fTPCsignal(0), |
49edfa08 | 720 | fTPCsignalS(0), |
40b4e5ea | 721 | fTPCdEdxInfo(0), |
49edfa08 | 722 | fTRDsignal(0), |
49edfa08 | 723 | fTRDQuality(0), |
724 | fTRDBudget(0), | |
ab37ab1e | 725 | fTOFsignal(99999), |
726 | fTOFsignalToT(99999), | |
727 | fTOFsignalRaw(99999), | |
728 | fTOFsignalDz(999), | |
729 | fTOFsignalDx(999), | |
730 | fTOFdeltaBC(999), | |
731 | fTOFl0l1(999), | |
f1cedef3 | 732 | fCaloDx(0), |
733 | fCaloDz(0), | |
562dd0b4 | 734 | fHMPIDtrkX(0), |
735 | fHMPIDtrkY(0), | |
736 | fHMPIDmipX(0), | |
737 | fHMPIDmipY(0), | |
738 | fTPCncls(0), | |
739 | fTPCnclsF(0), | |
740 | fTPCsignalN(0), | |
949840f6 | 741 | fTPCnclsIter1(0), |
742 | fTPCnclsFIter1(0), | |
562dd0b4 | 743 | fITSncls(0), |
744 | fITSClusterMap(0), | |
25015f7a | 745 | fITSSharedMap(0), |
562dd0b4 | 746 | fTRDncls(0), |
747 | fTRDncls0(0), | |
ed15ef4f | 748 | fTRDntracklets(0), |
6984f7c1 | 749 | fTRDnSlices(0), |
6dc21f57 | 750 | fTRDslices(0x0), |
95621324 | 751 | fVertexID(-2), // -2 means an orphan track |
4c3dc2a0 | 752 | fESDEvent(0), |
753 | fCacheNCrossedRows(-10), | |
754 | fCacheChi2TPCConstrainedVsGlobal(-10), | |
755 | fCacheChi2TPCConstrainedVsGlobalVertex(0) | |
49edfa08 | 756 | { |
757 | // | |
758 | // ESD track from TParticle | |
759 | // | |
760 | ||
761 | // Reset all the arrays | |
e546b023 | 762 | for (int i=kNITSchi2Std;i--;) fITSchi2Std[i] = 0; |
763 | for (int i=AliPID::kSPECIES;i--;) { | |
49edfa08 | 764 | fTrackTime[i]=0.; |
765 | fR[i]=0.; | |
766 | fITSr[i]=0.; | |
767 | fTPCr[i]=0.; | |
768 | fTRDr[i]=0.; | |
769 | fTOFr[i]=0.; | |
f4b3bbb7 | 770 | fHMPIDr[i]=0.; |
49edfa08 | 771 | } |
772 | ||
e546b023 | 773 | for (int i=3;i--;) fKinkIndexes[i]=0; |
774 | for (int i=3;i--;) fV0Indexes[i]=-1; | |
775 | for (int i=kTRDnPlanes;i--;) fTRDTimBin[i]=0; | |
776 | for (int i=4;i--;) fITSdEdxSamples[i]=0.; | |
777 | for (int i=4;i--;) fTPCPoints[i]=0; | |
778 | for (int i=3;i--;) fTOFLabel[i]=-1; | |
779 | for (int i=10;i--;) fTOFInfo[i]=0; | |
780 | for (int i=12;i--;) fITSModule[i]=-1; | |
49edfa08 | 781 | |
782 | // Calculate the AliExternalTrackParam content | |
783 | ||
784 | Double_t xref; | |
785 | Double_t alpha; | |
786 | Double_t param[5]; | |
787 | Double_t covar[15]; | |
788 | ||
789 | // Calculate alpha: the rotation angle of the corresponding local system (TPC sector) | |
790 | alpha = part->Phi()*180./TMath::Pi(); | |
791 | if (alpha<0) alpha+= 360.; | |
792 | if (alpha>360) alpha -= 360.; | |
793 | ||
794 | Int_t sector = (Int_t)(alpha/20.); | |
795 | alpha = 10. + 20.*sector; | |
796 | alpha /= 180; | |
797 | alpha *= TMath::Pi(); | |
798 | ||
799 | // Covariance matrix: no errors, the parameters are exact | |
e546b023 | 800 | for (int i=15;i--;) covar[i]=0.; |
49edfa08 | 801 | |
802 | // Get the vertex of origin and the momentum | |
803 | TVector3 ver(part->Vx(),part->Vy(),part->Vz()); | |
804 | TVector3 mom(part->Px(),part->Py(),part->Pz()); | |
805 | ||
806 | // Rotate to the local coordinate system (TPC sector) | |
807 | ver.RotateZ(-alpha); | |
808 | mom.RotateZ(-alpha); | |
809 | ||
810 | // X of the referense plane | |
811 | xref = ver.X(); | |
812 | ||
813 | Int_t pdgCode = part->GetPdgCode(); | |
814 | ||
815 | Double_t charge = | |
816 | TDatabasePDG::Instance()->GetParticle(pdgCode)->Charge(); | |
817 | ||
818 | param[0] = ver.Y(); | |
819 | param[1] = ver.Z(); | |
820 | param[2] = TMath::Sin(mom.Phi()); | |
821 | param[3] = mom.Pz()/mom.Pt(); | |
822 | param[4] = TMath::Sign(1/mom.Pt(),charge); | |
823 | ||
824 | // Set AliExternalTrackParam | |
825 | Set(xref, alpha, param, covar); | |
826 | ||
827 | // Set the PID | |
828 | Int_t indexPID = 99; | |
829 | ||
830 | switch (TMath::Abs(pdgCode)) { | |
831 | ||
832 | case 11: // electron | |
833 | indexPID = 0; | |
834 | break; | |
835 | ||
836 | case 13: // muon | |
837 | indexPID = 1; | |
838 | break; | |
839 | ||
840 | case 211: // pion | |
841 | indexPID = 2; | |
842 | break; | |
843 | ||
844 | case 321: // kaon | |
845 | indexPID = 3; | |
846 | break; | |
847 | ||
848 | case 2212: // proton | |
849 | indexPID = 4; | |
850 | break; | |
851 | ||
852 | default: | |
853 | break; | |
854 | } | |
855 | ||
856 | // If the particle is not e,mu,pi,K or p the PID probabilities are set to 0 | |
857 | if (indexPID < AliPID::kSPECIES) { | |
858 | fR[indexPID]=1.; | |
859 | fITSr[indexPID]=1.; | |
860 | fTPCr[indexPID]=1.; | |
861 | fTRDr[indexPID]=1.; | |
862 | fTOFr[indexPID]=1.; | |
f4b3bbb7 | 863 | fHMPIDr[indexPID]=1.; |
49edfa08 | 864 | |
865 | } | |
866 | // AliESD track label | |
867 | SetLabel(part->GetUniqueID()); | |
868 | ||
869 | } | |
870 | ||
e546b023 | 871 | //_______________________________________________________________________ |
872 | void AliESDtrack::Clear(Option_t* ) | |
873 | { | |
874 | // | |
875 | // clean dynamical part | |
876 | // | |
877 | //printf("Delete track\n"); | |
878 | AliClonesPool* poolETP = fgPools ? fgPools->GetPoolExtTrPar() : 0; | |
879 | fTPCFitMap.Clear(); | |
880 | fTPCClusterMap.Clear(); | |
881 | fTPCSharedMap.Clear(); | |
882 | if (poolETP) { | |
883 | if (fIp) poolETP->MarkSlotFree(fIp); | |
884 | if (fOp) poolETP->MarkSlotFree(fOp); | |
885 | if (fCp) poolETP->MarkSlotFree(fCp); | |
886 | if (fTPCInner) poolETP->MarkSlotFree(fTPCInner); | |
887 | if (fHMPIDp) poolETP->MarkSlotFree(fHMPIDp); | |
888 | } | |
889 | else { | |
890 | delete fIp; | |
891 | delete fTPCInner; | |
892 | delete fOp; | |
893 | delete fHMPIDp; | |
894 | delete fCp; | |
895 | } | |
896 | fIp = fOp = fCp = fTPCInner = fHMPIDp = 0; | |
897 | // | |
898 | if (fFriendTrack) { | |
899 | AliClonesPool* poolFr = fgPools ? fgPools->GetPoolTrFriend() : 0; | |
900 | if (poolFr) poolFr->MarkSlotFree(fFriendTrack); | |
901 | else delete fFriendTrack; | |
902 | fFriendTrack = 0; | |
903 | } | |
904 | if (fTPCdEdxInfo) { | |
905 | AliClonesPool* pooldEdx = fgPools ? fgPools->GetPoolTPCdEdx() : 0; | |
906 | if (pooldEdx) pooldEdx->MarkSlotFree(fTPCdEdxInfo); | |
907 | else delete fTPCdEdxInfo; | |
908 | fTPCdEdxInfo = 0; | |
909 | } | |
910 | if(fTRDnSlices) { | |
911 | AliPoolN* poolN = fgPools ? fgPools->GetPoolN() : 0; | |
912 | if (poolN) poolN->FreeSlot(&fTRDslices); | |
913 | else delete[] fTRDslices; | |
914 | fTRDslices = 0; | |
915 | } | |
916 | AliExternalTrackParam::Clear(); | |
917 | } | |
918 | ||
c4d11b15 | 919 | //_______________________________________________________________________ |
920 | AliESDtrack::~AliESDtrack(){ | |
921 | // | |
922 | // This is destructor according Coding Conventrions | |
923 | // | |
924 | //printf("Delete track\n"); | |
e546b023 | 925 | Clear(); |
926 | } | |
927 | ||
928 | //_______________________________________________________________________ | |
929 | AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source) | |
930 | { | |
732a24fe | 931 | |
932 | if(&source == this) return *this; | |
933 | AliExternalTrackParam::operator=(source); | |
934 | ||
e546b023 | 935 | AliClonesPool* poolETP = fgPools ? fgPools->GetPoolExtTrPar() : 0; |
936 | if (source.fCp) { // we have the trackparam: assign or copy construct | |
937 | if (fCp) *fCp = *source.fCp; | |
938 | else { | |
939 | if (poolETP) {fCp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*source.fCp); poolETP->RegisterClone(fCp);} | |
940 | else fCp = new AliExternalTrackParam(*source.fCp); | |
941 | } | |
732a24fe | 942 | } |
e546b023 | 943 | else { // no track param delete the old one |
944 | if (fCp) poolETP ? poolETP->MarkSlotFree(fCp) : delete fCp; fCp = 0; | |
732a24fe | 945 | } |
e546b023 | 946 | // |
947 | if (source.fIp) { // we have the trackparam: assign or copy construct | |
948 | if (fIp) *fIp = *source.fIp; | |
949 | else { | |
950 | if (poolETP) {fIp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*source.fIp); poolETP->RegisterClone(fIp);} | |
951 | else fIp = new AliExternalTrackParam(*source.fIp); | |
952 | } | |
732a24fe | 953 | } |
e546b023 | 954 | else { // no track param delete the old one |
955 | if (fIp) poolETP ? poolETP->MarkSlotFree(fIp) : delete fIp; fIp = 0; | |
732a24fe | 956 | } |
e546b023 | 957 | // |
958 | if (source.fTPCInner) { // we have the trackparam: assign or copy construct | |
959 | if (fTPCInner) *fTPCInner = *source.fTPCInner; | |
960 | else { | |
961 | if (poolETP) {fTPCInner = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*source.fTPCInner);poolETP->RegisterClone(fTPCInner);} | |
962 | else fTPCInner = new AliExternalTrackParam(*source.fTPCInner); | |
963 | } | |
732a24fe | 964 | } |
e546b023 | 965 | else { // no track param delete the old one |
966 | if (fTPCInner) poolETP ? poolETP->MarkSlotFree(fTPCInner) : delete fTPCInner; fTPCInner = 0; | |
732a24fe | 967 | } |
e546b023 | 968 | // |
969 | if (source.fOp) { // we have the trackparam: assign or copy construct | |
970 | if (fOp) *fOp = *source.fOp; | |
971 | else { | |
972 | if (poolETP) {fOp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*source.fOp); poolETP->RegisterClone(fOp);} | |
973 | else fOp = new AliExternalTrackParam(*source.fOp); | |
974 | } | |
40b4e5ea | 975 | } |
e546b023 | 976 | else { // no track param delete the old one |
977 | if (fOp) poolETP ? poolETP->MarkSlotFree(fOp) : delete fOp; fOp = 0; | |
732a24fe | 978 | } |
e546b023 | 979 | // |
980 | if (source.fHMPIDp) { // we have the trackparam: assign or copy construct | |
981 | if (fHMPIDp) *fHMPIDp = *source.fHMPIDp; | |
982 | else { | |
983 | if (poolETP) {fHMPIDp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*source.fHMPIDp); poolETP->RegisterClone(fHMPIDp);} | |
984 | else fHMPIDp = new AliExternalTrackParam(*source.fHMPIDp); | |
985 | } | |
732a24fe | 986 | } |
e546b023 | 987 | else { // no track param delete the old one |
988 | if (fHMPIDp) poolETP ? poolETP->MarkSlotFree(fHMPIDp) : delete fHMPIDp; fHMPIDp = 0; | |
c38d443f | 989 | } |
e546b023 | 990 | // |
991 | AliClonesPool* pooldEdx = fgPools ? fgPools->GetPoolTPCdEdx() : 0; | |
992 | if (source.fTPCdEdxInfo) { | |
993 | if (fTPCdEdxInfo) *fTPCdEdxInfo = *source.fTPCdEdxInfo; | |
994 | else { | |
995 | if (pooldEdx) {fTPCdEdxInfo = new(pooldEdx->NextFreeSlot()) AliTPCdEdxInfo(*source.fTPCdEdxInfo); pooldEdx->RegisterClone(fTPCdEdxInfo);} | |
996 | else fTPCdEdxInfo = new AliTPCdEdxInfo(*source.fTPCdEdxInfo); | |
997 | } | |
c38d443f | 998 | } |
e546b023 | 999 | else { // no dedx info, delete the old one |
1000 | if (fTPCdEdxInfo) pooldEdx ? pooldEdx->MarkSlotFree(fTPCdEdxInfo) : delete fTPCdEdxInfo; fTPCdEdxInfo = 0; | |
1001 | } | |
1002 | // | |
732a24fe | 1003 | // copy also the friend track |
1004 | // use copy constructor | |
e546b023 | 1005 | AliClonesPool* poolFr = fgPools ? fgPools->GetPoolTrFriend() : 0; |
1006 | if (fFriendTrack) poolFr ? poolFr->MarkSlotFree(fFriendTrack) : delete fFriendTrack; fFriendTrack= 0; | |
1007 | if (source.fFriendTrack) { // we have the trackparam: assign or copy construct | |
1008 | if (poolFr) { | |
1009 | fFriendTrack = new(poolFr->NextFreeSlot()) AliESDfriendTrack(*source.fFriendTrack); | |
1010 | poolFr->RegisterClone(fFriendTrack); | |
1011 | } | |
1012 | else fFriendTrack = new AliESDfriendTrack(*source.fFriendTrack); | |
732a24fe | 1013 | } |
e546b023 | 1014 | // |
1015 | fTPCFitMap = source.fTPCFitMap; | |
732a24fe | 1016 | fTPCClusterMap = source.fTPCClusterMap; |
1017 | fTPCSharedMap = source.fTPCSharedMap; | |
1018 | // the simple stuff | |
1019 | fFlags = source.fFlags; | |
1020 | fID = source.fID; | |
1021 | fLabel = source.fLabel; | |
1022 | fITSLabel = source.fITSLabel; | |
e546b023 | 1023 | for(int i=12;i--;) fITSModule[i] = source.fITSModule[i]; |
732a24fe | 1024 | fTPCLabel = source.fTPCLabel; |
1025 | fTRDLabel = source.fTRDLabel; | |
e546b023 | 1026 | for(int i=3;i--;) fTOFLabel[i] = source.fTOFLabel[i]; |
732a24fe | 1027 | fTOFCalChannel = source.fTOFCalChannel; |
1028 | fTOFindex = source.fTOFindex; | |
1029 | fHMPIDqn = source.fHMPIDqn; | |
1030 | fHMPIDcluIdx = source.fHMPIDcluIdx; | |
f1cedef3 | 1031 | fCaloIndex = source.fCaloIndex; |
e400c4a6 | 1032 | for (int i=kNITSchi2Std;i--;) fITSchi2Std[i] = source.fITSchi2Std[i]; |
e546b023 | 1033 | for(int i=3;i--;) { |
732a24fe | 1034 | fKinkIndexes[i] = source.fKinkIndexes[i]; |
1035 | fV0Indexes[i] = source.fV0Indexes[i]; | |
1036 | } | |
e546b023 | 1037 | // |
1038 | for(int i=AliPID::kSPECIES;i--;) { | |
732a24fe | 1039 | fR[i] = source.fR[i]; |
1040 | fITSr[i] = source.fITSr[i]; | |
1041 | fTPCr[i] = source.fTPCr[i]; | |
1042 | fTRDr[i] = source.fTRDr[i]; | |
1043 | fTOFr[i] = source.fTOFr[i]; | |
1044 | fHMPIDr[i] = source.fHMPIDr[i]; | |
1045 | fTrackTime[i] = source.fTrackTime[i]; | |
1046 | } | |
e546b023 | 1047 | // |
732a24fe | 1048 | fHMPIDtrkTheta = source.fHMPIDtrkTheta; |
1049 | fHMPIDtrkPhi = source.fHMPIDtrkPhi; | |
1050 | fHMPIDsignal = source.fHMPIDsignal; | |
e546b023 | 1051 | // |
732a24fe | 1052 | fTrackLength = source. fTrackLength; |
d7ddf1e9 | 1053 | fdTPC = source.fdTPC; |
1054 | fzTPC = source.fzTPC; | |
1055 | fCddTPC = source.fCddTPC; | |
1056 | fCdzTPC = source.fCdzTPC; | |
1057 | fCzzTPC = source.fCzzTPC; | |
436dfe39 | 1058 | fCchi2TPC = source.fCchi2TPC; |
e546b023 | 1059 | // |
732a24fe | 1060 | fD = source.fD; |
1061 | fZ = source.fZ; | |
1062 | fCdd = source.fCdd; | |
1063 | fCdz = source.fCdz; | |
1064 | fCzz = source.fCzz; | |
732a24fe | 1065 | fCchi2 = source.fCchi2; |
e546b023 | 1066 | // |
732a24fe | 1067 | fITSchi2 = source.fITSchi2; |
1068 | fTPCchi2 = source.fTPCchi2; | |
949840f6 | 1069 | fTPCchi2Iter1 = source.fTPCchi2Iter1; |
732a24fe | 1070 | fTRDchi2 = source.fTRDchi2; |
1071 | fTOFchi2 = source.fTOFchi2; | |
1072 | fHMPIDchi2 = source.fHMPIDchi2; | |
e546b023 | 1073 | // |
b5b2b4db | 1074 | fGlobalChi2 = source.fGlobalChi2; |
e546b023 | 1075 | // |
732a24fe | 1076 | fITSsignal = source.fITSsignal; |
e546b023 | 1077 | for (Int_t i=4;i--;) fITSdEdxSamples[i]=source.fITSdEdxSamples[i]; |
732a24fe | 1078 | fTPCsignal = source.fTPCsignal; |
1079 | fTPCsignalS = source.fTPCsignalS; | |
e546b023 | 1080 | for(int i=4;i--;) fTPCPoints[i] = source.fTPCPoints[i]; |
732a24fe | 1081 | fTRDsignal = source.fTRDsignal; |
e546b023 | 1082 | for(int i=kTRDnPlanes;i--;) fTRDTimBin[i] = source.fTRDTimBin[i]; |
1083 | // | |
1084 | AliPoolN* poolN = fgPools ? fgPools->GetPoolN() : 0; | |
1085 | if (fTRDnSlices) { | |
1086 | if (poolN) poolN->FreeSlot(&fTRDslices); | |
1087 | else delete[] fTRDslices; | |
1088 | fTRDslices = 0; | |
732a24fe | 1089 | } |
e546b023 | 1090 | fTRDnSlices = source.fTRDnSlices; |
6984f7c1 | 1091 | if (fTRDnSlices) { |
e546b023 | 1092 | if (poolN) fTRDslices = poolN->BookD32(fTRDnSlices,&fTRDslices); |
1093 | else fTRDslices = new Double32_t[fTRDnSlices]; | |
1094 | fTRDslices = new Double32_t[fTRDnSlices]; | |
1095 | for(int j=fTRDnSlices;j--;) fTRDslices[j] = source.fTRDslices[j]; | |
6984f7c1 | 1096 | } |
e546b023 | 1097 | // |
732a24fe | 1098 | fTRDQuality = source.fTRDQuality; |
1099 | fTRDBudget = source.fTRDBudget; | |
1100 | fTOFsignal = source.fTOFsignal; | |
1101 | fTOFsignalToT = source.fTOFsignalToT; | |
1102 | fTOFsignalRaw = source.fTOFsignalRaw; | |
1103 | fTOFsignalDz = source.fTOFsignalDz; | |
a5d9ff0f | 1104 | fTOFsignalDx = source.fTOFsignalDx; |
d86081b1 | 1105 | fTOFdeltaBC = source.fTOFdeltaBC; |
1106 | fTOFl0l1 = source.fTOFl0l1; | |
e546b023 | 1107 | // |
1108 | for(int i=10;i--;) fTOFInfo[i] = source.fTOFInfo[i]; | |
1109 | // | |
732a24fe | 1110 | fHMPIDtrkX = source.fHMPIDtrkX; |
1111 | fHMPIDtrkY = source.fHMPIDtrkY; | |
1112 | fHMPIDmipX = source.fHMPIDmipX; | |
1113 | fHMPIDmipY = source.fHMPIDmipY; | |
1114 | ||
1115 | fTPCncls = source.fTPCncls; | |
1116 | fTPCnclsF = source.fTPCnclsF; | |
1117 | fTPCsignalN = source.fTPCsignalN; | |
949840f6 | 1118 | fTPCnclsIter1 = source.fTPCnclsIter1; |
1119 | fTPCnclsFIter1 = source.fTPCnclsFIter1; | |
732a24fe | 1120 | |
1121 | fITSncls = source.fITSncls; | |
1122 | fITSClusterMap = source.fITSClusterMap; | |
25015f7a | 1123 | fITSSharedMap = source.fITSSharedMap; |
732a24fe | 1124 | fTRDncls = source.fTRDncls; |
1125 | fTRDncls0 = source.fTRDncls0; | |
ed15ef4f | 1126 | fTRDntracklets = source.fTRDntracklets; |
6dc21f57 | 1127 | fVertexID = source.fVertexID; |
732a24fe | 1128 | return *this; |
1129 | } | |
1130 | ||
732a24fe | 1131 | void AliESDtrack::Copy(TObject &obj) const { |
1132 | ||
1133 | // this overwrites the virtual TOBject::Copy() | |
1134 | // to allow run time copying without casting | |
1135 | // in AliESDEvent | |
1136 | ||
1137 | if(this==&obj)return; | |
1138 | AliESDtrack *robj = dynamic_cast<AliESDtrack*>(&obj); | |
1139 | if(!robj)return; // not an AliESDtrack | |
1140 | *robj = *this; | |
1141 | ||
1142 | } | |
1143 | ||
00dce61a | 1144 | void AliESDtrack::AddCalibObject(TObject * object){ |
1145 | // | |
1146 | // add calib object to the list | |
1147 | // | |
e546b023 | 1148 | if (!fFriendTrack) { |
1149 | AliClonesPool* poolFr = fgPools ? fgPools->GetPoolTrFriend() : 0; | |
1150 | if (poolFr) { fFriendTrack = new(poolFr->NextFreeSlot()) AliESDfriendTrack(); poolFr->RegisterClone(fFriendTrack);} | |
1151 | else fFriendTrack = new AliESDfriendTrack(); | |
1152 | } | |
59c31692 | 1153 | if (!fFriendTrack) return; |
00dce61a | 1154 | fFriendTrack->AddCalibObject(object); |
1155 | } | |
1156 | ||
1157 | TObject * AliESDtrack::GetCalibObject(Int_t index){ | |
1158 | // | |
1159 | // return calib objct at given position | |
1160 | // | |
1161 | if (!fFriendTrack) return 0; | |
1162 | return fFriendTrack->GetCalibObject(index); | |
1163 | } | |
1164 | ||
1165 | ||
f12d42ce | 1166 | Bool_t AliESDtrack::FillTPCOnlyTrack(AliESDtrack &track){ |
b9ca886f | 1167 | |
1168 | // Fills the information of the TPC-only first reconstruction pass | |
1169 | // into the passed ESDtrack object. For consistency fTPCInner is also filled | |
1170 | // again | |
1171 | ||
5b305f70 | 1172 | // For data produced before r26675 |
1173 | // RelateToVertexTPC was not properly called during reco | |
1174 | // so you'll have to call it again, before FillTPCOnlyTrack | |
1175 | // Float_t p[2],cov[3]; | |
1176 | // track->GetImpactParametersTPC(p,cov); | |
1177 | // if(p[0]==0&&p[1]==0) // <- Default values | |
1178 | // track->RelateToVertexTPC(esd->GetPrimaryVertexTPC(),esd->GetMagneticField(),kVeryBig); | |
1179 | ||
1180 | ||
e546b023 | 1181 | if (!fTPCInner) return kFALSE; |
b9ca886f | 1182 | |
1183 | // fill the TPC track params to the global track parameters | |
1184 | track.Set(fTPCInner->GetX(),fTPCInner->GetAlpha(),fTPCInner->GetParameter(),fTPCInner->GetCovariance()); | |
1185 | track.fD = fdTPC; | |
1186 | track.fZ = fzTPC; | |
1187 | track.fCdd = fCddTPC; | |
1188 | track.fCdz = fCdzTPC; | |
1189 | track.fCzz = fCzzTPC; | |
e546b023 | 1190 | // |
1191 | AliClonesPool* poolETP = fgPools ? fgPools->GetPoolExtTrPar() : 0; | |
67ed91d3 | 1192 | // copy the inner params |
e546b023 | 1193 | if (track.fIp) *track.fIp = *fIp; |
1194 | else { | |
1195 | if (poolETP) {track.fIp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*fIp); poolETP->RegisterClone(track.fIp);} | |
1196 | else track.fIp = new AliExternalTrackParam(*fIp); | |
1197 | } | |
1198 | // | |
b9ca886f | 1199 | // copy the TPCinner parameters |
e546b023 | 1200 | if (track.fTPCInner) *track.fTPCInner = *fTPCInner; |
1201 | else { | |
1202 | if (poolETP) {track.fTPCInner = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*fTPCInner); poolETP->RegisterClone(track.fTPCInner);} | |
1203 | else track.fTPCInner = new AliExternalTrackParam(*fTPCInner); | |
1204 | } | |
b9ca886f | 1205 | track.fdTPC = fdTPC; |
1206 | track.fzTPC = fzTPC; | |
1207 | track.fCddTPC = fCddTPC; | |
1208 | track.fCdzTPC = fCdzTPC; | |
1209 | track.fCzzTPC = fCzzTPC; | |
436dfe39 | 1210 | track.fCchi2TPC = fCchi2TPC; |
b9ca886f | 1211 | |
b9ca886f | 1212 | // copy all other TPC specific parameters |
1213 | ||
1214 | // replace label by TPC label | |
1215 | track.fLabel = fTPCLabel; | |
1216 | track.fTPCLabel = fTPCLabel; | |
1217 | ||
1218 | track.fTPCchi2 = fTPCchi2; | |
949840f6 | 1219 | track.fTPCchi2Iter1 = fTPCchi2Iter1; |
b9ca886f | 1220 | track.fTPCsignal = fTPCsignal; |
1221 | track.fTPCsignalS = fTPCsignalS; | |
e546b023 | 1222 | for(int i=4;i--;) track.fTPCPoints[i] = fTPCPoints[i]; |
b9ca886f | 1223 | |
1224 | track.fTPCncls = fTPCncls; | |
1225 | track.fTPCnclsF = fTPCnclsF; | |
1226 | track.fTPCsignalN = fTPCsignalN; | |
949840f6 | 1227 | track.fTPCnclsIter1 = fTPCnclsIter1; |
1228 | track.fTPCnclsFIter1 = fTPCnclsFIter1; | |
b9ca886f | 1229 | |
1230 | // PID | |
e546b023 | 1231 | for(int i=AliPID::kSPECIES;i--;){ |
b9ca886f | 1232 | track.fTPCr[i] = fTPCr[i]; |
1233 | // combined PID is TPC only! | |
1234 | track.fR[i] = fTPCr[i]; | |
1235 | } | |
9f638f03 | 1236 | track.fTPCFitMap = fTPCFitMap; |
b9ca886f | 1237 | track.fTPCClusterMap = fTPCClusterMap; |
1238 | track.fTPCSharedMap = fTPCSharedMap; | |
e546b023 | 1239 | // |
b9ca886f | 1240 | // reset the flags |
1241 | track.fFlags = kTPCin; | |
1242 | track.fID = fID; | |
1243 | ||
b1cfce51 | 1244 | track.fFlags |= fFlags & kTPCpid; //copy the TPCpid status flag |
b9ca886f | 1245 | |
e546b023 | 1246 | for (Int_t i=3;i--;) track.fKinkIndexes[i] = fKinkIndexes[i]; |
b9ca886f | 1247 | |
1248 | return kTRUE; | |
e546b023 | 1249 | // |
b9ca886f | 1250 | } |
1251 | ||
9559cbc4 | 1252 | //_______________________________________________________________________ |
1253 | void AliESDtrack::MakeMiniESDtrack(){ | |
1254 | // Resets everything except | |
1255 | // fFlags: Reconstruction status flags | |
1256 | // fLabel: Track label | |
1257 | // fID: Unique ID of the track | |
d7ddf1e9 | 1258 | // Impact parameter information |
9559cbc4 | 1259 | // fR[AliPID::kSPECIES]: combined "detector response probability" |
8497bca0 | 1260 | // Running track parameters in the base class (AliExternalTrackParam) |
9559cbc4 | 1261 | |
1262 | fTrackLength = 0; | |
562dd0b4 | 1263 | |
e546b023 | 1264 | for (Int_t i=AliPID::kSPECIES;i--;) fTrackTime[i] = 0; |
1265 | // | |
1266 | AliClonesPool* poolETP = fgPools ? fgPools->GetPoolExtTrPar() : 0; | |
9559cbc4 | 1267 | // Reset track parameters constrained to the primary vertex |
e546b023 | 1268 | if (fCp) poolETP ? poolETP->MarkSlotFree(fCp) : delete fCp; fCp = 0; |
9559cbc4 | 1269 | // Reset track parameters at the inner wall of TPC |
e546b023 | 1270 | if (fIp) poolETP ? poolETP->MarkSlotFree(fIp) : delete fIp; fIp = 0; |
1271 | // Reset track TPC inner params | |
1272 | if (fTPCInner) poolETP ? poolETP->MarkSlotFree(fTPCInner) : delete fTPCInner; fTPCInner = 0; | |
9559cbc4 | 1273 | // Reset track parameters at the inner wall of the TRD |
e546b023 | 1274 | if (fOp) poolETP ? poolETP->MarkSlotFree(fOp) : delete fOp; fOp = 0; |
c38d443f | 1275 | // Reset track parameters at the HMPID |
e546b023 | 1276 | if (fHMPIDp) poolETP ? poolETP->MarkSlotFree(fHMPIDp) : delete fHMPIDp; fHMPIDp = 0; |
1277 | // | |
9559cbc4 | 1278 | // Reset ITS track related information |
1279 | fITSchi2 = 0; | |
9559cbc4 | 1280 | fITSncls = 0; |
62665e7f | 1281 | fITSClusterMap=0; |
25015f7a | 1282 | fITSSharedMap=0; |
9559cbc4 | 1283 | fITSsignal = 0; |
e546b023 | 1284 | for (Int_t i=4;i--;) fITSdEdxSamples[i] = 0.; |
1285 | for (Int_t i=AliPID::kSPECIES;i--;) fITSr[i]=0; | |
9559cbc4 | 1286 | fITSLabel = 0; |
9559cbc4 | 1287 | |
1288 | // Reset TPC related track information | |
1289 | fTPCchi2 = 0; | |
949840f6 | 1290 | fTPCchi2Iter1 = 0; |
9559cbc4 | 1291 | fTPCncls = 0; |
e1d4c1b5 | 1292 | fTPCnclsF = 0; |
949840f6 | 1293 | fTPCnclsIter1 = 0; |
9f638f03 | 1294 | fTPCnclsFIter1 = 0; |
1295 | fTPCFitMap = 0; | |
9559cbc4 | 1296 | fTPCClusterMap = 0; |
eb7f6854 | 1297 | fTPCSharedMap = 0; |
9559cbc4 | 1298 | fTPCsignal= 0; |
e1d4c1b5 | 1299 | fTPCsignalS= 0; |
1300 | fTPCsignalN= 0; | |
e546b023 | 1301 | for (Int_t i=AliPID::kSPECIES;i--;) fTPCr[i]=0; |
9559cbc4 | 1302 | fTPCLabel=0; |
e546b023 | 1303 | for (Int_t i=4;i--;) fTPCPoints[i] = 0; |
1304 | for (Int_t i=3;i--;) fKinkIndexes[i] = 0; | |
1305 | for (Int_t i=3;i--;) fV0Indexes[i] = 0; | |
9559cbc4 | 1306 | |
1307 | // Reset TRD related track information | |
1308 | fTRDchi2 = 0; | |
1309 | fTRDncls = 0; | |
1310 | fTRDncls0 = 0; | |
9559cbc4 | 1311 | fTRDsignal = 0; |
e546b023 | 1312 | for (Int_t i=kTRDnPlanes;i--;) fTRDTimBin[i] = 0; |
1313 | for (Int_t i=AliPID::kSPECIES;i--;) fTRDr[i] = 0; | |
9559cbc4 | 1314 | fTRDLabel = 0; |
9559cbc4 | 1315 | fTRDQuality = 0; |
ed15ef4f | 1316 | fTRDntracklets = 0; |
e546b023 | 1317 | if(fTRDnSlices) { |
1318 | AliPoolN* poolN = fgPools ? fgPools->GetPoolN() : 0; | |
1319 | if (poolN) poolN->FreeSlot(&fTRDslices); | |
1320 | else delete[] fTRDslices; | |
1321 | fTRDslices = 0; | |
1322 | } | |
6984f7c1 | 1323 | fTRDnSlices=0; |
23d49657 | 1324 | fTRDBudget = 0; |
9559cbc4 | 1325 | |
1326 | // Reset TOF related track information | |
1327 | fTOFchi2 = 0; | |
ce3f4882 | 1328 | fTOFindex = -1; |
ab37ab1e | 1329 | fTOFsignal = 99999; |
1330 | fTOFCalChannel = -1; | |
1331 | fTOFsignalToT = 99999; | |
1332 | fTOFsignalRaw = 99999; | |
1333 | fTOFsignalDz = 999; | |
1334 | fTOFsignalDx = 999; | |
1335 | fTOFdeltaBC = 999; | |
1336 | fTOFl0l1 = 999; | |
e546b023 | 1337 | for (Int_t i=AliPID::kSPECIES;i--;) fTOFr[i] = 0; |
1338 | for (Int_t i=3;i--;) fTOFLabel[i] = -1; | |
1339 | for (Int_t i=10;i--;) fTOFInfo[i] = 0; | |
9559cbc4 | 1340 | |
f4b3bbb7 | 1341 | // Reset HMPID related track information |
1342 | fHMPIDchi2 = 0; | |
562dd0b4 | 1343 | fHMPIDqn = 0; |
81aa7a0d | 1344 | fHMPIDcluIdx = -1; |
f4b3bbb7 | 1345 | fHMPIDsignal = 0; |
e546b023 | 1346 | for (Int_t i=AliPID::kSPECIES;i--;) fHMPIDr[i] = 0; |
562dd0b4 | 1347 | fHMPIDtrkTheta = 0; |
1348 | fHMPIDtrkPhi = 0; | |
1349 | fHMPIDtrkX = 0; | |
1350 | fHMPIDtrkY = 0; | |
1351 | fHMPIDmipX = 0; | |
1352 | fHMPIDmipY = 0; | |
f1cedef3 | 1353 | fCaloIndex = kEMCALNoMatch; |
9559cbc4 | 1354 | |
b5b2b4db | 1355 | // reset global track chi2 |
1356 | fGlobalChi2 = 0; | |
1357 | ||
6dc21f57 | 1358 | fVertexID = -2; // an orphan track |
e546b023 | 1359 | // |
1360 | AliClonesPool* poolFr = fgPools ? fgPools->GetPoolTrFriend() : 0; | |
1361 | poolFr ? poolFr->MarkSlotFree(fFriendTrack) : delete fFriendTrack; fFriendTrack = 0; | |
1362 | // | |
9559cbc4 | 1363 | } |
ec729fb0 | 1364 | |
bf7942ff | 1365 | //_______________________________________________________________________ |
1366 | Int_t AliESDtrack::GetPID() const | |
1367 | { | |
1368 | // Returns the particle most probable id | |
e546b023 | 1369 | int i; |
1370 | for (i=0;i<AliPID::kSPECIES-1;i++) if (fR[i] != fR[i+1]) break; | |
bf7942ff | 1371 | // |
1372 | if (i == AliPID::kSPECIES-1) return AliPID::kPion; // If all the probabilities are equal, return the pion mass | |
1373 | // | |
ae982df3 | 1374 | Float_t max=0.; |
1375 | Int_t k=-1; | |
e546b023 | 1376 | for (i=0;i<AliPID::kSPECIES;i++) if (fR[i]>max) {k=i; max=fR[i];} |
bf7942ff | 1377 | // |
db3989b3 | 1378 | if (k==0) { // dE/dx "crossing points" in the TPC |
bf7942ff | 1379 | Double_t p=GetP(); |
1380 | if ((p>0.38)&&(p<0.48)) | |
1381 | if (fR[0]<fR[3]*10.) return AliPID::kKaon; | |
1382 | if ((p>0.75)&&(p<0.85)) | |
1383 | if (fR[0]<fR[4]*10.) return AliPID::kProton; | |
1384 | return AliPID::kElectron; | |
db3989b3 | 1385 | } |
bf7942ff | 1386 | if (k==1) return AliPID::kMuon; |
1387 | if (k==2||k==-1) return AliPID::kPion; | |
1388 | if (k==3) return AliPID::kKaon; | |
1389 | if (k==4) return AliPID::kProton; | |
1390 | AliWarning("Undefined PID !"); | |
1391 | return AliPID::kPion; | |
1392 | } | |
1393 | ||
1394 | //_______________________________________________________________________ | |
a512bf97 | 1395 | Int_t AliESDtrack::GetTOFBunchCrossing(Double_t b) const |
bf7942ff | 1396 | { |
1397 | // Returns the number of bunch crossings after trigger (assuming 25ns spacing) | |
bf7942ff | 1398 | const double kSpacing = 25e3; // min interbanch spacing |
1399 | const double kShift = 0; | |
3f2db92f | 1400 | Int_t bcid = kTOFBCNA; // defualt one |
a512bf97 | 1401 | if (!IsOn(kTOFout) || !IsOn(kESDpid)) return bcid; // no info |
1402 | // | |
1403 | double tdif = fTOFsignal; | |
1404 | if (IsOn(kTIME)) { // integrated time info is there | |
1405 | int pid = GetPID(); | |
1406 | tdif -= fTrackTime[pid]; | |
1407 | } | |
1408 | else { // assume integrated time info from TOF radius and momentum | |
1409 | const double kRTOF = 385.; | |
1410 | const double kCSpeed = 3.e-2; // cm/ps | |
1411 | double p = GetP(); | |
1412 | if (p<0.01) return bcid; | |
1413 | double m = GetMass(); | |
1414 | double curv = GetC(b); | |
1415 | double path = TMath::Abs(curv)>kAlmost0 ? // account for curvature | |
1416 | 2./curv*TMath::ASin(kRTOF*curv/2.)*TMath::Sqrt(1.+GetTgl()*GetTgl()) : kRTOF; | |
1417 | tdif -= path/kCSpeed*TMath::Sqrt(1.+m*m/(p*p)); | |
1418 | } | |
bf7942ff | 1419 | bcid = TMath::Nint((tdif - kShift)/kSpacing); |
1420 | return bcid; | |
ae982df3 | 1421 | } |
1422 | ||
6b5b49c9 | 1423 | //______________________________________________________________________________ |
1424 | Double_t AliESDtrack::M() const | |
1425 | { | |
2850a7f3 | 1426 | // Returns the assumed mass |
1427 | // (the pion mass, if the particle can't be identified properly). | |
9be82450 | 1428 | static Bool_t printerr=kTRUE; |
1429 | if (printerr) { | |
1430 | AliWarning("WARNING !!! ... THIS WILL BE PRINTED JUST ONCE !!!"); | |
1431 | printerr = kFALSE; | |
1432 | AliWarning("This is the ESD mass. Use it with care !"); | |
1433 | } | |
6b5b49c9 | 1434 | return GetMass(); |
1435 | } | |
1436 | ||
aad8d435 | 1437 | //______________________________________________________________________________ |
1438 | Double_t AliESDtrack::E() const | |
1439 | { | |
1440 | // Returns the energy of the particle given its assumed mass. | |
1441 | // Assumes the pion mass if the particle can't be identified properly. | |
1442 | ||
1443 | Double_t m = M(); | |
1444 | Double_t p = P(); | |
1445 | return TMath::Sqrt(p*p + m*m); | |
1446 | } | |
1447 | ||
1448 | //______________________________________________________________________________ | |
1449 | Double_t AliESDtrack::Y() const | |
1450 | { | |
1451 | // Returns the rapidity of a particle given its assumed mass. | |
1452 | // Assumes the pion mass if the particle can't be identified properly. | |
1453 | ||
1454 | Double_t e = E(); | |
1455 | Double_t pz = Pz(); | |
e03e4544 | 1456 | if (e != TMath::Abs(pz)) { // energy was not equal to pz |
aad8d435 | 1457 | return 0.5*TMath::Log((e+pz)/(e-pz)); |
1458 | } else { // energy was equal to pz | |
1459 | return -999.; | |
1460 | } | |
1461 | } | |
1462 | ||
ae982df3 | 1463 | //_______________________________________________________________________ |
c9ec41e8 | 1464 | Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){ |
ae982df3 | 1465 | // |
1466 | // This function updates track's running parameters | |
1467 | // | |
15614b8b | 1468 | Bool_t rc=kTRUE; |
1469 | ||
9b859005 | 1470 | SetStatus(flags); |
1471 | fLabel=t->GetLabel(); | |
1472 | ||
1473 | if (t->IsStartedTimeIntegral()) { | |
1474 | SetStatus(kTIME); | |
e546b023 | 1475 | Double_t times[10]; t->GetIntegratedTimes(times); SetIntegratedTimes(times); |
9b859005 | 1476 | SetIntegratedLength(t->GetIntegratedLength()); |
1477 | } | |
1478 | ||
6c94f330 | 1479 | Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); |
59c31692 | 1480 | if (fFriendTrack) { |
e546b023 | 1481 | if (flags==kITSout) fFriendTrack->SetITSOut(*t); |
1482 | if (flags==kTPCout) fFriendTrack->SetTPCOut(*t); | |
1483 | if (flags==kTRDrefit) fFriendTrack->SetTRDIn(*t); | |
59c31692 | 1484 | } |
e546b023 | 1485 | AliClonesPool* poolETP = fgPools ? fgPools->GetPoolExtTrPar() : 0; |
1486 | // | |
ae982df3 | 1487 | switch (flags) { |
e546b023 | 1488 | // |
6c3c2a50 | 1489 | case kITSin: |
1490 | fITSchi2Std[0] = t->GetChi2(); | |
1491 | // | |
1492 | case kITSout: | |
1493 | fITSchi2Std[1] = t->GetChi2(); | |
e546b023 | 1494 | case kITSrefit: |
6c3c2a50 | 1495 | fITSchi2Std[2] = t->GetChi2(); |
48704648 | 1496 | fITSClusterMap=0; |
ae982df3 | 1497 | fITSncls=t->GetNumberOfClusters(); |
59c31692 | 1498 | if (fFriendTrack) { |
e546b023 | 1499 | Int_t indexITS[AliESDfriendTrack::kMaxITScluster]; |
1500 | for (Int_t i=AliESDfriendTrack::kMaxITScluster;i--;) { | |
6d3a7bbf | 1501 | indexITS[i]=t->GetClusterIndex(i); |
62665e7f | 1502 | if (i<fITSncls) { |
6d3a7bbf | 1503 | Int_t l=(indexITS[i] & 0xf0000000) >> 28; |
e546b023 | 1504 | SETBIT(fITSClusterMap,l); |
62665e7f | 1505 | } |
e546b023 | 1506 | } |
1507 | fFriendTrack->SetITSIndices(indexITS,AliESDfriendTrack::kMaxITScluster); | |
62665e7f | 1508 | } |
e546b023 | 1509 | // |
ae982df3 | 1510 | fITSchi2=t->GetChi2(); |
ae982df3 | 1511 | fITSsignal=t->GetPIDsignal(); |
6e5b1b04 | 1512 | fITSLabel = t->GetLabel(); |
57483eb1 | 1513 | // keep in fOp the parameters outside ITS for ITS stand-alone tracks |
1514 | if (flags==kITSout) { | |
e546b023 | 1515 | if (!fOp) { |
1516 | if (poolETP) {fOp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*t); poolETP->RegisterClone(fOp);} | |
1517 | else fOp = new AliExternalTrackParam(*t); | |
1518 | } | |
1519 | else fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); | |
6d3a7bbf | 1520 | } |
ae982df3 | 1521 | break; |
e546b023 | 1522 | // |
9b859005 | 1523 | case kTPCin: case kTPCrefit: |
6e5b1b04 | 1524 | fTPCLabel = t->GetLabel(); |
949840f6 | 1525 | if (flags==kTPCin) { |
e546b023 | 1526 | if (poolETP) { fTPCInner = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*t); poolETP->RegisterClone(fTPCInner);} |
1527 | else fTPCInner = new AliExternalTrackParam(*t); | |
1528 | fTPCnclsIter1 = t->GetNumberOfClusters(); | |
1529 | fTPCchi2Iter1 = t->GetChi2(); | |
949840f6 | 1530 | } |
e546b023 | 1531 | if (!fIp) { |
1532 | if (poolETP) { fIp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*t); poolETP->RegisterClone(fIp);} | |
1533 | else fIp = new AliExternalTrackParam(*t); | |
6d3a7bbf | 1534 | } |
e546b023 | 1535 | else fIp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); |
1536 | // | |
5d6fb68d | 1537 | // Intentionally no break statement; need to set general TPC variables as well |
9b859005 | 1538 | case kTPCout: |
1d303a24 | 1539 | if (flags & kTPCout){ |
e546b023 | 1540 | if (!fOp) { |
1541 | if (poolETP) { fOp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*t); poolETP->RegisterClone(fOp);} | |
1542 | else fOp = new AliExternalTrackParam(*t); | |
1543 | } | |
1544 | else fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); | |
1d303a24 | 1545 | } |
e1d4c1b5 | 1546 | fTPCncls=t->GetNumberOfClusters(); |
ae982df3 | 1547 | fTPCchi2=t->GetChi2(); |
a866ac60 | 1548 | |
5d6fb68d | 1549 | if (fFriendTrack) { // Copy cluster indices |
e546b023 | 1550 | Int_t indexTPC[AliESDfriendTrack::kMaxTPCcluster]; |
1551 | for (Int_t i=AliESDfriendTrack::kMaxTPCcluster;i--;) indexTPC[i]=t->GetClusterIndex(i); | |
5d6fb68d | 1552 | fFriendTrack->SetTPCIndices(indexTPC,AliESDfriendTrack::kMaxTPCcluster); |
5d6fb68d | 1553 | } |
ae982df3 | 1554 | fTPCsignal=t->GetPIDsignal(); |
ae982df3 | 1555 | break; |
e546b023 | 1556 | // |
64130601 | 1557 | case kTRDin: case kTRDrefit: |
1558 | break; | |
1559 | case kTRDout: | |
51ad6848 | 1560 | fTRDLabel = t->GetLabel(); |
2f83b7a6 | 1561 | fTRDchi2 = t->GetChi2(); |
1562 | fTRDncls = t->GetNumberOfClusters(); | |
59c31692 | 1563 | if (fFriendTrack) { |
e546b023 | 1564 | Int_t indexTRD[AliESDfriendTrack::kMaxTRDcluster]; |
1565 | for (Int_t i=AliESDfriendTrack::kMaxTRDcluster;i--;) indexTRD[i] = -2; | |
1566 | for (Int_t i=6;i--;) indexTRD[i] = t->GetTrackletIndex(i); | |
6d3a7bbf | 1567 | fFriendTrack->SetTRDIndices(indexTRD,AliESDfriendTrack::kMaxTRDcluster); |
59c31692 | 1568 | } |
e546b023 | 1569 | // |
79e94bf8 | 1570 | fTRDsignal=t->GetPIDsignal(); |
1571 | break; | |
e546b023 | 1572 | // |
c4d11b15 | 1573 | case kTRDbackup: |
e546b023 | 1574 | if (!fOp) { |
1575 | if (poolETP) {fOp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*t); poolETP->RegisterClone(fOp);} | |
1576 | else fOp = new AliExternalTrackParam(*t); | |
1577 | } | |
1578 | else fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); | |
c4d11b15 | 1579 | fTRDncls0 = t->GetNumberOfClusters(); |
1580 | break; | |
e546b023 | 1581 | // |
c4d11b15 | 1582 | case kTOFin: |
1583 | break; | |
1584 | case kTOFout: | |
1585 | break; | |
d0862fea | 1586 | case kTRDStop: |
1587 | break; | |
c38d443f | 1588 | case kHMPIDout: |
e546b023 | 1589 | if (!fHMPIDp) { |
1590 | if (poolETP) {fHMPIDp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*t); poolETP->RegisterClone(fHMPIDp);} | |
1591 | else fHMPIDp = new AliExternalTrackParam(*t); | |
1592 | fHMPIDp=new AliExternalTrackParam(*t); | |
1593 | } | |
1594 | else fHMPIDp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); | |
c38d443f | 1595 | break; |
e546b023 | 1596 | // |
ae982df3 | 1597 | default: |
5f7789fc | 1598 | AliError("Wrong flag !"); |
ae982df3 | 1599 | return kFALSE; |
1600 | } | |
e546b023 | 1601 | // |
15614b8b | 1602 | return rc; |
ae982df3 | 1603 | } |
1604 | ||
1605 | //_______________________________________________________________________ | |
1606 | void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const { | |
1607 | //--------------------------------------------------------------------- | |
1608 | // This function returns external representation of the track parameters | |
1609 | //--------------------------------------------------------------------- | |
c9ec41e8 | 1610 | x=GetX(); |
e546b023 | 1611 | for (Int_t i=5;i--;) p[i]=GetParameter()[i]; |
15614b8b | 1612 | } |
1613 | ||
67c3dcbe | 1614 | //_______________________________________________________________________ |
a866ac60 | 1615 | void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const { |
67c3dcbe | 1616 | //--------------------------------------------------------------------- |
1617 | // This function returns external representation of the cov. matrix | |
1618 | //--------------------------------------------------------------------- | |
e546b023 | 1619 | for (Int_t i=15;i--;) cov[i]=AliExternalTrackParam::GetCovariance()[i]; |
67c3dcbe | 1620 | } |
1621 | ||
67c3dcbe | 1622 | //_______________________________________________________________________ |
c0b978f0 | 1623 | Bool_t AliESDtrack::GetConstrainedExternalParameters |
1624 | (Double_t &alpha, Double_t &x, Double_t p[5]) const { | |
67c3dcbe | 1625 | //--------------------------------------------------------------------- |
1626 | // This function returns the constrained external track parameters | |
1627 | //--------------------------------------------------------------------- | |
c0b978f0 | 1628 | if (!fCp) return kFALSE; |
1629 | alpha=fCp->GetAlpha(); | |
c9ec41e8 | 1630 | x=fCp->GetX(); |
e546b023 | 1631 | for (Int_t i=5;i--;) p[i]=fCp->GetParameter()[i]; |
c0b978f0 | 1632 | return kTRUE; |
67c3dcbe | 1633 | } |
c9ec41e8 | 1634 | |
67c3dcbe | 1635 | //_______________________________________________________________________ |
c0b978f0 | 1636 | Bool_t |
67c3dcbe | 1637 | AliESDtrack::GetConstrainedExternalCovariance(Double_t c[15]) const { |
1638 | //--------------------------------------------------------------------- | |
1639 | // This function returns the constrained external cov. matrix | |
1640 | //--------------------------------------------------------------------- | |
c0b978f0 | 1641 | if (!fCp) return kFALSE; |
e546b023 | 1642 | for (Int_t i=15;i--;) c[i]=fCp->GetCovariance()[i]; |
c0b978f0 | 1643 | return kTRUE; |
67c3dcbe | 1644 | } |
1645 | ||
c0b978f0 | 1646 | Bool_t |
1647 | AliESDtrack::GetInnerExternalParameters | |
1648 | (Double_t &alpha, Double_t &x, Double_t p[5]) const { | |
1649 | //--------------------------------------------------------------------- | |
c9ec41e8 | 1650 | // This function returns external representation of the track parameters |
1651 | // at the inner layer of TPC | |
9b859005 | 1652 | //--------------------------------------------------------------------- |
c0b978f0 | 1653 | if (!fIp) return kFALSE; |
1654 | alpha=fIp->GetAlpha(); | |
c9ec41e8 | 1655 | x=fIp->GetX(); |
e546b023 | 1656 | for (Int_t i=5;i--;) p[i]=fIp->GetParameter()[i]; |
c0b978f0 | 1657 | return kTRUE; |
9b859005 | 1658 | } |
1659 | ||
c0b978f0 | 1660 | Bool_t |
1661 | AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const { | |
c9ec41e8 | 1662 | //--------------------------------------------------------------------- |
1663 | // This function returns external representation of the cov. matrix | |
1664 | // at the inner layer of TPC | |
1665 | //--------------------------------------------------------------------- | |
c0b978f0 | 1666 | if (!fIp) return kFALSE; |
e546b023 | 1667 | for (Int_t i=15;i--;) cov[i]=fIp->GetCovariance()[i]; |
c0b978f0 | 1668 | return kTRUE; |
9b859005 | 1669 | } |
1670 | ||
d61ca12d | 1671 | void |
1672 | AliESDtrack::SetOuterParam(const AliExternalTrackParam *p, ULong_t flags) { | |
1673 | // | |
1674 | // This is a direct setter for the outer track parameters | |
1675 | // | |
1676 | SetStatus(flags); | |
e546b023 | 1677 | |
d61ca12d | 1678 | if (fOp) delete fOp; |
1679 | fOp=new AliExternalTrackParam(*p); | |
1680 | } | |
1681 | ||
c38d443f | 1682 | void |
1683 | AliESDtrack::SetOuterHmpParam(const AliExternalTrackParam *p, ULong_t flags) { | |
1684 | // | |
1685 | // This is a direct setter for the outer track parameters | |
1686 | // | |
1687 | SetStatus(flags); | |
e546b023 | 1688 | if (fHMPIDp) *fHMPIDp = *p; |
1689 | else { | |
1690 | AliClonesPool* poolETP = fgPools ? fgPools->GetPoolExtTrPar() : 0; | |
1691 | if (poolETP) {fHMPIDp = new(poolETP->NextFreeSlot()) AliExternalTrackParam(*p); poolETP->RegisterClone(fHMPIDp);} | |
1692 | else fHMPIDp = new AliExternalTrackParam(*p); | |
1693 | } | |
c38d443f | 1694 | } |
1695 | ||
c0b978f0 | 1696 | Bool_t |
1697 | AliESDtrack::GetOuterExternalParameters | |
1698 | (Double_t &alpha, Double_t &x, Double_t p[5]) const { | |
1699 | //--------------------------------------------------------------------- | |
c9ec41e8 | 1700 | // This function returns external representation of the track parameters |
1701 | // at the inner layer of TRD | |
a866ac60 | 1702 | //--------------------------------------------------------------------- |
c0b978f0 | 1703 | if (!fOp) return kFALSE; |
1704 | alpha=fOp->GetAlpha(); | |
c9ec41e8 | 1705 | x=fOp->GetX(); |
e546b023 | 1706 | for (Int_t i=5;i--;) p[i]=fOp->GetParameter()[i]; |
c0b978f0 | 1707 | return kTRUE; |
a866ac60 | 1708 | } |
c9ec41e8 | 1709 | |
c38d443f | 1710 | Bool_t |
1711 | AliESDtrack::GetOuterHmpExternalParameters | |
1712 | (Double_t &alpha, Double_t &x, Double_t p[5]) const { | |
1713 | //--------------------------------------------------------------------- | |
1714 | // This function returns external representation of the track parameters | |
1715 | // at the inner layer of TRD | |
1716 | //--------------------------------------------------------------------- | |
1717 | if (!fHMPIDp) return kFALSE; | |
1718 | alpha=fHMPIDp->GetAlpha(); | |
1719 | x=fHMPIDp->GetX(); | |
e546b023 | 1720 | for (Int_t i=5;i--;) p[i]=fHMPIDp->GetParameter()[i]; |
c38d443f | 1721 | return kTRUE; |
1722 | } | |
1723 | ||
c0b978f0 | 1724 | Bool_t |
1725 | AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const { | |
a866ac60 | 1726 | //--------------------------------------------------------------------- |
c9ec41e8 | 1727 | // This function returns external representation of the cov. matrix |
1728 | // at the inner layer of TRD | |
a866ac60 | 1729 | //--------------------------------------------------------------------- |
c0b978f0 | 1730 | if (!fOp) return kFALSE; |
e546b023 | 1731 | for (Int_t i=15;i--;) cov[i]=fOp->GetCovariance()[i]; |
c0b978f0 | 1732 | return kTRUE; |
a866ac60 | 1733 | } |
1734 | ||
c38d443f | 1735 | Bool_t |
1736 | AliESDtrack::GetOuterHmpExternalCovariance(Double_t cov[15]) const { | |
1737 | //--------------------------------------------------------------------- | |
1738 | // This function returns external representation of the cov. matrix | |
1739 | // at the inner layer of TRD | |
1740 | //--------------------------------------------------------------------- | |
1741 | if (!fHMPIDp) return kFALSE; | |
e546b023 | 1742 | for (Int_t i=15;i--;) cov[i]=fHMPIDp->GetCovariance()[i]; |
c38d443f | 1743 | return kTRUE; |
1744 | } | |
1745 | ||
98937d93 | 1746 | Int_t AliESDtrack::GetNcls(Int_t idet) const |
1747 | { | |
1748 | // Get number of clusters by subdetector index | |
1749 | // | |
1750 | Int_t ncls = 0; | |
1751 | switch(idet){ | |
1752 | case 0: | |
1753 | ncls = fITSncls; | |
1754 | break; | |
1755 | case 1: | |
1756 | ncls = fTPCncls; | |
1757 | break; | |
1758 | case 2: | |
1759 | ncls = fTRDncls; | |
1760 | break; | |
1761 | case 3: | |
ce3f4882 | 1762 | if (fTOFindex != -1) |
98937d93 | 1763 | ncls = 1; |
1764 | break; | |
81aa7a0d | 1765 | case 4: //PHOS |
1766 | break; | |
1767 | case 5: //HMPID | |
1768 | if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) { | |
1769 | if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) { | |
1770 | ncls = 1; | |
1771 | } | |
1772 | } | |
1773 | break; | |
98937d93 | 1774 | default: |
1775 | break; | |
1776 | } | |
1777 | return ncls; | |
1778 | } | |
1779 | ||
ef7253ac | 1780 | Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const |
98937d93 | 1781 | { |
1782 | // Get cluster index array by subdetector index | |
1783 | // | |
1784 | Int_t ncls = 0; | |
1785 | switch(idet){ | |
1786 | case 0: | |
1787 | ncls = GetITSclusters(idx); | |
1788 | break; | |
1789 | case 1: | |
ef7253ac | 1790 | ncls = GetTPCclusters(idx); |
98937d93 | 1791 | break; |
1792 | case 2: | |
1793 | ncls = GetTRDclusters(idx); | |
1794 | break; | |
1795 | case 3: | |
ce3f4882 | 1796 | if (fTOFindex != -1) { |
1797 | idx[0] = fTOFindex; | |
98937d93 | 1798 | ncls = 1; |
1799 | } | |
1800 | break; | |
313af949 | 1801 | case 4: //PHOS |
1802 | break; | |
1803 | case 5: | |
81aa7a0d | 1804 | if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) { |
1805 | if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) { | |
1806 | idx[0] = GetHMPIDcluIdx(); | |
1807 | ncls = 1; | |
1808 | } | |
313af949 | 1809 | } |
1810 | break; | |
1811 | case 6: //EMCAL | |
1812 | break; | |
98937d93 | 1813 | default: |
1814 | break; | |
1815 | } | |
1816 | return ncls; | |
1817 | } | |
1818 | ||
ae982df3 | 1819 | //_______________________________________________________________________ |
1820 | void AliESDtrack::GetIntegratedTimes(Double_t *times) const { | |
4427806c | 1821 | // Returns the array with integrated times for each particle hypothesis |
e546b023 | 1822 | for (Int_t i=AliPID::kSPECIES;i--;) times[i]=fTrackTime[i]; |
ae982df3 | 1823 | } |
1824 | ||
1825 | //_______________________________________________________________________ | |
1826 | void AliESDtrack::SetIntegratedTimes(const Double_t *times) { | |
4427806c | 1827 | // Sets the array with integrated times for each particle hypotesis |
e546b023 | 1828 | for (Int_t i=AliPID::kSPECIES;i--;) fTrackTime[i]=times[i]; |
ae982df3 | 1829 | } |
1830 | ||
c630aafd | 1831 | //_______________________________________________________________________ |
4427806c | 1832 | void AliESDtrack::SetITSpid(const Double_t *p) { |
1833 | // Sets values for the probability of each particle type (in ITS) | |
d27bbc79 | 1834 | SetPIDValues(fITSr,p,AliPID::kSPECIES); |
c630aafd | 1835 | SetStatus(AliESDtrack::kITSpid); |
1836 | } | |
1837 | ||
1838 | //_______________________________________________________________________ | |
1839 | void AliESDtrack::GetITSpid(Double_t *p) const { | |
4427806c | 1840 | // Gets the probability of each particle type (in ITS) |
e546b023 | 1841 | for (Int_t i=AliPID::kSPECIES;i--;) p[i]=fITSr[i]; |
c630aafd | 1842 | } |
1843 | ||
ae982df3 | 1844 | //_______________________________________________________________________ |
562dd0b4 | 1845 | Char_t AliESDtrack::GetITSclusters(Int_t *idx) const { |
ae982df3 | 1846 | //--------------------------------------------------------------------- |
1847 | // This function returns indices of the assgined ITS clusters | |
1848 | //--------------------------------------------------------------------- | |
59c31692 | 1849 | if (idx && fFriendTrack) { |
6d3a7bbf | 1850 | Int_t *index=fFriendTrack->GetITSindices(); |
e546b023 | 1851 | for (Int_t i=AliESDfriendTrack::kMaxITScluster;i--;) { |
6d3a7bbf | 1852 | if ( (i>=fITSncls) && (i<6) ) idx[i]=-1; |
1853 | else { | |
1854 | if (index) { | |
1855 | idx[i]=index[i]; | |
1856 | } | |
1857 | else idx[i]= -2; | |
1858 | } | |
1859 | } | |
15e85efa | 1860 | } |
ae982df3 | 1861 | return fITSncls; |
1862 | } | |
1863 | ||
89f1b176 | 1864 | //_______________________________________________________________________ |
1865 | Bool_t AliESDtrack::GetITSModuleIndexInfo(Int_t ilayer,Int_t &idet,Int_t &status, | |
1866 | Float_t &xloc,Float_t &zloc) const { | |
1867 | //---------------------------------------------------------------------- | |
1868 | // This function encodes in the module number also the status of cluster association | |
1869 | // "status" can have the following values: | |
1870 | // 1 "found" (cluster is associated), | |
1871 | // 2 "dead" (module is dead from OCDB), | |
1872 | // 3 "skipped" (module or layer forced to be skipped), | |
1873 | // 4 "outinz" (track out of z acceptance), | |
1874 | // 5 "nocls" (no clusters in the road), | |
1875 | // 6 "norefit" (cluster rejected during refit), | |
1876 | // 7 "deadzspd" (holes in z in SPD) | |
1877 | // Also given are the coordinates of the crossing point of track and module | |
1878 | // (in the local module ref. system) | |
1879 | // WARNING: THIS METHOD HAS TO BE SYNCHRONIZED WITH AliITStrackV2::GetModuleIndexInfo()! | |
1880 | //---------------------------------------------------------------------- | |
1881 | ||
1882 | if(fITSModule[ilayer]==-1) { | |
89f1b176 | 1883 | idet = -1; |
1884 | status=0; | |
1885 | xloc=-99.; zloc=-99.; | |
1886 | return kFALSE; | |
1887 | } | |
1888 | ||
1889 | Int_t module = fITSModule[ilayer]; | |
1890 | ||
1891 | idet = Int_t(module/1000000); | |
1892 | ||
1893 | module -= idet*1000000; | |
1894 | ||
1895 | status = Int_t(module/100000); | |
1896 | ||
1897 | module -= status*100000; | |
1898 | ||
1899 | Int_t signs = Int_t(module/10000); | |
1900 | ||
1901 | module-=signs*10000; | |
1902 | ||
1903 | Int_t xInt = Int_t(module/100); | |
1904 | module -= xInt*100; | |
1905 | ||
1906 | Int_t zInt = module; | |
1907 | ||
1908 | if(signs==1) { xInt*=1; zInt*=1; } | |
1909 | if(signs==2) { xInt*=1; zInt*=-1; } | |
1910 | if(signs==3) { xInt*=-1; zInt*=1; } | |
1911 | if(signs==4) { xInt*=-1; zInt*=-1; } | |
1912 | ||
1913 | xloc = 0.1*(Float_t)xInt; | |
1914 | zloc = 0.1*(Float_t)zInt; | |
1915 | ||
1916 | if(status==4) idet = -1; | |
1917 | ||
1918 | return kTRUE; | |
1919 | } | |
1920 | ||
ae982df3 | 1921 | //_______________________________________________________________________ |
562dd0b4 | 1922 | UShort_t AliESDtrack::GetTPCclusters(Int_t *idx) const { |
ae982df3 | 1923 | //--------------------------------------------------------------------- |
1924 | // This function returns indices of the assgined ITS clusters | |
1925 | //--------------------------------------------------------------------- | |
59c31692 | 1926 | if (idx && fFriendTrack) { |
15e85efa | 1927 | Int_t *index=fFriendTrack->GetTPCindices(); |
6d3a7bbf | 1928 | |
1929 | if (index){ | |
e546b023 | 1930 | for (Int_t i=AliESDfriendTrack::kMaxTPCcluster;i--;) idx[i]=index[i]; |
6d3a7bbf | 1931 | } |
1932 | else { | |
e546b023 | 1933 | for (Int_t i=AliESDfriendTrack::kMaxTPCcluster;i--;) idx[i]=-2; |
6d3a7bbf | 1934 | } |
15e85efa | 1935 | } |
ae982df3 | 1936 | return fTPCncls; |
1937 | } | |
8c6a71ab | 1938 | |
4c3dc2a0 | 1939 | //_______________________________________________________________________ |
1940 | Float_t AliESDtrack::GetTPCCrossedRows() const | |
1941 | { | |
1942 | // This function calls GetTPCClusterInfo with some default parameters which are used in the track selection and caches the outcome | |
1943 | // because GetTPCClusterInfo is quite time-consuming | |
1944 | ||
1945 | if (fCacheNCrossedRows > -1) | |
1946 | return fCacheNCrossedRows; | |
1947 | ||
1948 | fCacheNCrossedRows = GetTPCClusterInfo(2, 1); | |
1949 | return fCacheNCrossedRows; | |
1950 | } | |
1951 | ||
6a6f0c1f | 1952 | //_______________________________________________________________________ |
204022f3 | 1953 | Float_t AliESDtrack::GetTPCClusterInfo(Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1) const |
6a6f0c1f | 1954 | { |
1955 | // | |
1956 | // TPC cluster information | |
1957 | // type 0: get fraction of found/findable clusters with neighbourhood definition | |
1958 | // 1: findable clusters with neighbourhood definition | |
1959 | // 2: found clusters | |
1960 | // | |
1961 | // definition of findable clusters: | |
1962 | // a cluster is defined as findable if there is another cluster | |
1963 | // within +- nNeighbours pad rows. The idea is to overcome threshold | |
1964 | // effects with a very simple algorithm. | |
1965 | // | |
1966 | ||
1967 | if (type==2) return fTPCClusterMap.CountBits(); | |
1968 | ||
1969 | Int_t found=0; | |
1970 | Int_t findable=0; | |
1971 | Int_t last=-nNeighbours; | |
1972 | ||
59c31692 | 1973 | Int_t upperBound=fTPCClusterMap.GetNbits(); |
1974 | if (upperBound>row1) upperBound=row1; | |
e546b023 | 1975 | for (Int_t i=row0;i<upperBound; ++i){ |
6a6f0c1f | 1976 | //look to current row |
1977 | if (fTPCClusterMap[i]) { | |
1978 | last=i; | |
1979 | ++found; | |
1980 | ++findable; | |
1981 | continue; | |
1982 | } | |
1983 | //look to nNeighbours before | |
1984 | if ((i-last)<=nNeighbours) { | |
1985 | ++findable; | |
1986 | continue; | |
1987 | } | |
1988 | //look to nNeighbours after | |
1989 | for (Int_t j=i+1; j<i+1+nNeighbours; ++j){ | |
1990 | if (fTPCClusterMap[j]){ | |
1991 | ++findable; | |
1992 | break; | |
1993 | } | |
1994 | } | |
1995 | } | |
82cc468e | 1996 | if (type==1) return findable; |
1997 | ||
6a6f0c1f | 1998 | if (type==0){ |
82cc468e | 1999 | Float_t fraction=0; |
2000 | if (findable>0) | |
2001 | fraction=(Float_t)found/(Float_t)findable; | |
2002 | else | |
2003 | fraction=0; | |
2004 | return fraction; | |
2005 | } | |
2006 | return 0; // undefined type - default value | |
6a6f0c1f | 2007 | } |
2008 | ||
2009 | //_______________________________________________________________________ | |
562dd0b4 | 2010 | Double_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{ |
81e97e0d | 2011 | // |
2012 | // GetDensity of the clusters on given region between row0 and row1 | |
2013 | // Dead zone effect takin into acoount | |
2014 | // | |
59c31692 | 2015 | if (!fFriendTrack) return 0.0; |
81e97e0d | 2016 | Int_t good = 0; |
2017 | Int_t found = 0; | |
2018 | // | |
15e85efa | 2019 | Int_t *index=fFriendTrack->GetTPCindices(); |
81e97e0d | 2020 | for (Int_t i=row0;i<=row1;i++){ |
15e85efa | 2021 | Int_t idx = index[i]; |
2022 | if (idx!=-1) good++; // track outside of dead zone | |
2023 | if (idx>0) found++; | |
81e97e0d | 2024 | } |
2025 | Float_t density=0.5; | |
2026 | if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good); | |
2027 | return density; | |
2028 | } | |
c84a5e9e | 2029 | |
8c6a71ab | 2030 | //_______________________________________________________________________ |
2031 | void AliESDtrack::SetTPCpid(const Double_t *p) { | |
4427806c | 2032 | // Sets values for the probability of each particle type (in TPC) |
d27bbc79 | 2033 | SetPIDValues(fTPCr,p,AliPID::kSPECIES); |
8c6a71ab | 2034 | SetStatus(AliESDtrack::kTPCpid); |
2035 | } | |
2036 | ||
2037 | //_______________________________________________________________________ | |
2038 | void AliESDtrack::GetTPCpid(Double_t *p) const { | |
4427806c | 2039 | // Gets the probability of each particle type (in TPC) |
e546b023 | 2040 | for (Int_t i=AliPID::kSPECIES;i--;) p[i]=fTPCr[i]; |
8c6a71ab | 2041 | } |
2042 | ||
bb2ceb1f | 2043 | //_______________________________________________________________________ |
562dd0b4 | 2044 | UChar_t AliESDtrack::GetTRDclusters(Int_t *idx) const { |
bb2ceb1f | 2045 | //--------------------------------------------------------------------- |
2046 | // This function returns indices of the assgined TRD clusters | |
2047 | //--------------------------------------------------------------------- | |
59c31692 | 2048 | if (idx && fFriendTrack) { |
6d3a7bbf | 2049 | Int_t *index=fFriendTrack->GetTRDindices(); |
e546b023 | 2050 | if (index) for (Int_t i=AliESDfriendTrack::kMaxTRDcluster;i--;) idx[i]=index[i]; |
2051 | else for (Int_t i=AliESDfriendTrack::kMaxTRDcluster;i--;) idx[i]=-2; | |
15e85efa | 2052 | } |
bb2ceb1f | 2053 | return fTRDncls; |
2054 | } | |
2055 | ||
5bc3e158 | 2056 | //_______________________________________________________________________ |
2057 | UChar_t AliESDtrack::GetTRDtracklets(Int_t *idx) const { | |
0ad488b0 | 2058 | // |
2059 | // This function returns the number of TRD tracklets used in tracking | |
2060 | // and it fills the indices of these tracklets in the array "idx" as they | |
2061 | // are registered in the TRD track list. | |
2062 | // | |
2063 | // Caution : | |
2064 | // 1. The idx array has to be allocated with a size >= AliESDtrack::kTRDnPlanes | |
2065 | // 2. The idx array store not only the index but also the layer of the tracklet. | |
2066 | // Therefore tracks with TRD gaps contain default values for indices [-1] | |
2067 | ||
59c31692 | 2068 | if (!fFriendTrack) return 0; |
0ad488b0 | 2069 | if (!idx) return GetTRDntracklets(); |
6d3a7bbf | 2070 | Int_t *index=fFriendTrack->GetTRDindices(); |
2071 | Int_t n = 0; | |
e546b023 | 2072 | for (Int_t i=0;i<kTRDnPlanes;i++){ |
6d3a7bbf | 2073 | if (index){ |
2074 | if(index[i]>=0) n++; | |
2075 | idx[i]=index[i]; | |
2076 | } | |
2077 | else idx[i] = -2; | |
5bc3e158 | 2078 | } |
0ad488b0 | 2079 | return n; |
5bc3e158 | 2080 | } |
2081 | ||
c630aafd | 2082 | //_______________________________________________________________________ |
2083 | void AliESDtrack::SetTRDpid(const Double_t *p) { | |
4427806c | 2084 | // Sets values for the probability of each particle type (in TRD) |
d27bbc79 | 2085 | SetPIDValues(fTRDr,p,AliPID::kSPECIES); |
c630aafd | 2086 | SetStatus(AliESDtrack::kTRDpid); |
2087 | } | |
2088 | ||
2089 | //_______________________________________________________________________ | |
2090 | void AliESDtrack::GetTRDpid(Double_t *p) const { | |
4427806c | 2091 | // Gets the probability of each particle type (in TRD) |
e546b023 | 2092 | for (Int_t i=AliPID::kSPECIES;i--;) p[i]=fTRDr[i]; |
c630aafd | 2093 | } |
2094 | ||
79e94bf8 | 2095 | //_______________________________________________________________________ |
2096 | void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p) | |
2097 | { | |
4427806c | 2098 | // Sets the probability of particle type iSpecies to p (in TRD) |
79e94bf8 | 2099 | fTRDr[iSpecies] = p; |
2100 | } | |
2101 | ||
562dd0b4 | 2102 | Double_t AliESDtrack::GetTRDpid(Int_t iSpecies) const |
79e94bf8 | 2103 | { |
4427806c | 2104 | // Returns the probability of particle type iSpecies (in TRD) |
79e94bf8 | 2105 | return fTRDr[iSpecies]; |
2106 | } | |
2107 | ||
fae4c212 | 2108 | //____________________________________________________ |
2109 | Int_t AliESDtrack::GetNumberOfTRDslices() const | |
2110 | { | |
2111 | // built in backward compatibility | |
2112 | Int_t idx = fTRDnSlices - (kTRDnPlanes<<1); | |
2113 | return idx<18 ? fTRDnSlices/kTRDnPlanes : idx/kTRDnPlanes; | |
2114 | } | |
2115 | ||
2116 | //____________________________________________________ | |
2117 | Double_t AliESDtrack::GetTRDmomentum(Int_t plane, Double_t *sp) const | |
2118 | { | |
2119 | //Returns momentum estimation and optional its error (sp) | |
2120 | // in TRD layer "plane". | |
2121 | ||
2122 | if (!fTRDnSlices) { | |
ba8cee18 | 2123 | AliDebug(2, "No TRD info allocated for this track."); |
fae4c212 | 2124 | return -1.; |
2125 | } | |
2126 | if ((plane<0) || (plane>=kTRDnPlanes)) { | |
ba8cee18 | 2127 | AliWarning(Form("Request for TRD plane[%d] outside range.", plane)); |
fae4c212 | 2128 | return -1.; |
2129 | } | |
2130 | ||
2131 | Int_t idx = fTRDnSlices-(kTRDnPlanes<<1)+plane; | |
2132 | // Protection for backward compatibility | |
2133 | if(idx<(GetNumberOfTRDslices()*kTRDnPlanes)) return -1.; | |
2134 | ||
2135 | if(sp) (*sp) = fTRDslices[idx+kTRDnPlanes]; | |
2136 | return fTRDslices[idx]; | |
2137 | } | |
2138 | ||
2139 | //____________________________________________________ | |
2140 | Double_t AliESDtrack::GetTRDslice(Int_t plane, Int_t slice) const { | |
2141 | //Gets the charge from the slice of the plane | |
2142 | ||
2143 | if(!fTRDslices) { | |
2144 | //AliError("No TRD slices allocated for this track !"); | |
2145 | return -1.; | |
2146 | } | |
2147 | if ((plane<0) || (plane>=kTRDnPlanes)) { | |
2148 | AliError("Info for TRD plane not available !"); | |
2149 | return -1.; | |
2150 | } | |
2151 | Int_t ns=GetNumberOfTRDslices(); | |
2152 | if ((slice<-1) || (slice>=ns)) { | |
2153 | //AliError("Wrong TRD slice !"); | |
2154 | return -1.; | |
2155 | } | |
2156 | ||
2157 | if(slice>=0) return fTRDslices[plane*ns + slice]; | |
2158 | ||
2159 | // return average of the dEdx measurements | |
2160 | Double_t q=0.; Double32_t *s = &fTRDslices[plane*ns]; | |
e546b023 | 2161 | for (Int_t i=0;i<ns;i++, s++) if((*s)>0.) q+=(*s); |
fae4c212 | 2162 | return q/ns; |
2163 | } | |
2164 | ||
2165 | //____________________________________________________ | |
6984f7c1 | 2166 | void AliESDtrack::SetNumberOfTRDslices(Int_t n) { |
2167 | //Sets the number of slices used for PID | |
fae4c212 | 2168 | if (fTRDnSlices) return; |
fae4c212 | 2169 | fTRDnSlices=n; |
e546b023 | 2170 | AliPoolN* poolN = fgPools ? fgPools->GetPoolN() : 0; |
2171 | if (poolN) fTRDslices = poolN->BookD32(fTRDnSlices,&fTRDslices); | |
2172 | else fTRDslices = new Double32_t[fTRDnSlices]; | |
2173 | // | |
fae4c212 | 2174 | // set-up correctly the allocated memory |
2175 | memset(fTRDslices, 0, n*sizeof(Double32_t)); | |
e546b023 | 2176 | for (Int_t i=GetNumberOfTRDslices();i--;) fTRDslices[i]=-1.; |
6984f7c1 | 2177 | } |
2178 | ||
fae4c212 | 2179 | //____________________________________________________ |
6984f7c1 | 2180 | void AliESDtrack::SetTRDslice(Double_t q, Int_t plane, Int_t slice) { |
2181 | //Sets the charge q in the slice of the plane | |
fae4c212 | 2182 | if(!fTRDslices) { |
6984f7c1 | 2183 | AliError("No TRD slices allocated for this track !"); |
2184 | return; | |
2185 | } | |
6984f7c1 | 2186 | if ((plane<0) || (plane>=kTRDnPlanes)) { |
fae4c212 | 2187 | AliError("Info for TRD plane not allocated !"); |
6984f7c1 | 2188 | return; |
2189 | } | |
fae4c212 | 2190 | Int_t ns=GetNumberOfTRDslices(); |
6984f7c1 | 2191 | if ((slice<0) || (slice>=ns)) { |
2192 | AliError("Wrong TRD slice !"); | |
2193 | return; | |
2194 | } | |
2195 | Int_t n=plane*ns + slice; | |
2196 | fTRDslices[n]=q; | |
2197 | } | |
2198 | ||
6984f7c1 | 2199 | |
fae4c212 | 2200 | //____________________________________________________ |
2201 | void AliESDtrack::SetTRDmomentum(Double_t p, Int_t plane, Double_t *sp) | |
2202 | { | |
2203 | if(!fTRDslices) { | |
2204 | AliError("No TRD slices allocated for this track !"); | |
2205 | return; | |
6984f7c1 | 2206 | } |
fae4c212 | 2207 | if ((plane<0) || (plane>=kTRDnPlanes)) { |
2208 | AliError("Info for TRD plane not allocated !"); | |
2209 | return; | |
6984f7c1 | 2210 | } |
2211 | ||
fae4c212 | 2212 | Int_t idx = fTRDnSlices-(kTRDnPlanes<<1)+plane; |
2213 | // Protection for backward compatibility | |
2214 | if(idx<GetNumberOfTRDslices()*kTRDnPlanes) return; | |
6984f7c1 | 2215 | |
fae4c212 | 2216 | if(sp) fTRDslices[idx+kTRDnPlanes] = (*sp); |
2217 | fTRDslices[idx] = p; | |
6984f7c1 | 2218 | } |
2219 | ||
2220 | ||
c630aafd | 2221 | //_______________________________________________________________________ |
2222 | void AliESDtrack::SetTOFpid(const Double_t *p) { | |
4427806c | 2223 | // Sets the probability of each particle type (in TOF) |
d27bbc79 | 2224 | SetPIDValues(fTOFr,p,AliPID::kSPECIES); |
c630aafd | 2225 | SetStatus(AliESDtrack::kTOFpid); |
2226 | } | |
2227 | ||
51ad6848 | 2228 | //_______________________________________________________________________ |
2229 | void AliESDtrack::SetTOFLabel(const Int_t *p) { | |
2230 | // Sets (in TOF) | |
e546b023 | 2231 | for (Int_t i=3;i--;) fTOFLabel[i]=p[i]; |
51ad6848 | 2232 | } |
2233 | ||
c630aafd | 2234 | //_______________________________________________________________________ |
2235 | void AliESDtrack::GetTOFpid(Double_t *p) const { | |
4427806c | 2236 | // Gets probabilities of each particle type (in TOF) |
e546b023 | 2237 | for (Int_t i=AliPID::kSPECIES;i--;) p[i]=fTOFr[i]; |
c630aafd | 2238 | } |
2239 | ||
51ad6848 | 2240 | //_______________________________________________________________________ |
2241 | void AliESDtrack::GetTOFLabel(Int_t *p) const { | |
2242 | // Gets (in TOF) | |
e546b023 | 2243 | for (Int_t i=3;i--;) p[i]=fTOFLabel[i]; |
51ad6848 | 2244 | } |
2245 | ||
2246 | //_______________________________________________________________________ | |
2247 | void AliESDtrack::GetTOFInfo(Float_t *info) const { | |
2248 | // Gets (in TOF) | |
e546b023 | 2249 | for (Int_t i=10;i--;) info[i]=fTOFInfo[i]; |
51ad6848 | 2250 | } |
2251 | ||
2252 | //_______________________________________________________________________ | |
2253 | void AliESDtrack::SetTOFInfo(Float_t*info) { | |
2254 | // Gets (in TOF) | |
e546b023 | 2255 | for (Int_t i=10;i--;) fTOFInfo[i]=info[i]; |
51ad6848 | 2256 | } |
2257 | ||
4a78b8c5 | 2258 | |
2259 | ||
4a78b8c5 | 2260 | //_______________________________________________________________________ |
f4b3bbb7 | 2261 | void AliESDtrack::SetHMPIDpid(const Double_t *p) { |
2262 | // Sets the probability of each particle type (in HMPID) | |
2263 | SetPIDValues(fHMPIDr,p,AliPID::kSPECIES); | |
2264 | SetStatus(AliESDtrack::kHMPIDpid); | |
4a78b8c5 | 2265 | } |
2266 | ||
3876bdbf | 2267 | //_______________________________________________________________________ |
e546b023 | 2268 | void AliESDtrack::SetTPCdEdxInfo(AliTPCdEdxInfo * dEdxInfo) |
2269 | { | |
2270 | // add TPC dedx info | |
2271 | if (fTPCdEdxInfo) { | |
2272 | AliClonesPool* pooldEdx = fgPools ? fgPools->GetPoolTPCdEdx() : 0; | |
2273 | pooldEdx ? pooldEdx->MarkSlotFree(fTPCdEdxInfo) : delete fTPCdEdxInfo; | |
2274 | } | |
3876bdbf | 2275 | fTPCdEdxInfo = dEdxInfo; |
2276 | } | |
2277 | ||
4a78b8c5 | 2278 | //_______________________________________________________________________ |
f4b3bbb7 | 2279 | void AliESDtrack::GetHMPIDpid(Double_t *p) const { |
2280 | // Gets probabilities of each particle type (in HMPID) | |
e546b023 | 2281 | for (Int_t i=AliPID::kSPECIES;i--;) p[i]=fHMPIDr[i]; |
4a78b8c5 | 2282 | } |
2283 | ||
8c6a71ab | 2284 | //_______________________________________________________________________ |
2285 | void AliESDtrack::SetESDpid(const Double_t *p) { | |
4427806c | 2286 | // Sets the probability of each particle type for the ESD track |
d27bbc79 | 2287 | SetPIDValues(fR,p,AliPID::kSPECIES); |
8c6a71ab | 2288 | SetStatus(AliESDtrack::kESDpid); |
2289 | } | |
2290 | ||
2291 | //_______________________________________________________________________ | |
2292 | void AliESDtrack::GetESDpid(Double_t *p) const { | |
4427806c | 2293 | // Gets probability of each particle type for the ESD track |
e546b023 | 2294 | for (Int_t i=AliPID::kSPECIES;i--;) p[i]=fR[i]; |
8c6a71ab | 2295 | } |
2296 | ||
d7ddf1e9 | 2297 | //_______________________________________________________________________ |
436dfe39 | 2298 | Bool_t AliESDtrack::RelateToVertexTPC(const AliESDVertex *vtx, |
2299 | Double_t b, Double_t maxd, AliExternalTrackParam *cParam) { | |
d7ddf1e9 | 2300 | // |
436dfe39 | 2301 | // Try to relate the TPC-only track parameters to the vertex "vtx", |
d7ddf1e9 | 2302 | // if the (rough) transverse impact parameter is not bigger then "maxd". |
2303 | // Magnetic field is "b" (kG). | |
2304 | // | |
2305 | // a) The TPC-only paramters are extapolated to the DCA to the vertex. | |
2306 | // b) The impact parameters and their covariance matrix are calculated. | |
436dfe39 | 2307 | // c) An attempt to constrain the TPC-only params to the vertex is done. |
2308 | // The constrained params are returned via "cParam". | |
d7ddf1e9 | 2309 | // |
436dfe39 | 2310 | // In the case of success, the returned value is kTRUE |
2311 | // otherwise, it's kFALSE) | |
2312 | // | |
d7ddf1e9 | 2313 | |
2314 | if (!fTPCInner) return kFALSE; | |
2315 | if (!vtx) return kFALSE; | |
2316 | ||
2317 | Double_t dz[2],cov[3]; | |
2318 | if (!fTPCInner->PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE; | |
2319 | ||
2320 | fdTPC = dz[0]; | |
2321 | fzTPC = dz[1]; | |
2322 | fCddTPC = cov[0]; | |
2323 | fCdzTPC = cov[1]; | |
2324 | fCzzTPC = cov[2]; | |
2325 | ||
436dfe39 | 2326 | Double_t covar[6]; vtx->GetCovMatrix(covar); |
2327 | Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]}; | |
2328 | Double_t c[3]={covar[2],0.,covar[5]}; | |
2329 | ||
2330 | Double_t chi2=GetPredictedChi2(p,c); | |
2331 | if (chi2>kVeryBig) return kFALSE; | |
2332 | ||
2333 | fCchi2TPC=chi2; | |
2334 | ||
2335 | if (!cParam) return kTRUE; | |
2336 | ||
2337 | *cParam = *fTPCInner; | |
2338 | if (!cParam->Update(p,c)) return kFALSE; | |
2339 | ||
d7ddf1e9 | 2340 | return kTRUE; |
2341 | } | |
2342 | ||
266a0f9b | 2343 | //_______________________________________________________________________ |
2344 | Bool_t AliESDtrack::RelateToVertexTPCBxByBz(const AliESDVertex *vtx, | |
2345 | Double_t b[3], Double_t maxd, AliExternalTrackParam *cParam) { | |
2346 | // | |
2347 | // Try to relate the TPC-only track parameters to the vertex "vtx", | |
2348 | // if the (rough) transverse impact parameter is not bigger then "maxd". | |
2349 | // | |
2350 | // All three components of the magnetic field ,"b[3]" (kG), | |
2351 | // are taken into account. | |
2352 | // | |
2353 | // a) The TPC-only paramters are extapolated to the DCA to the vertex. | |
2354 | // b) The impact parameters and their covariance matrix are calculated. | |
2355 | // c) An attempt to constrain the TPC-only params to the vertex is done. | |
2356 | // The constrained params are returned via "cParam". | |
2357 | // | |
2358 | // In the case of success, the returned value is kTRUE | |
2359 | // otherwise, it's kFALSE) | |
2360 | // | |
2361 | ||
2362 | if (!fTPCInner) return kFALSE; | |
2363 | if (!vtx) return kFALSE; | |
2364 | ||
2365 | Double_t dz[2],cov[3]; | |
2366 | if (!fTPCInner->PropagateToDCABxByBz(vtx, b, maxd, dz, cov)) return kFALSE; | |
2367 | ||
2368 | fdTPC = dz[0]; | |
2369 | fzTPC = dz[1]; | |
2370 | fCddTPC = cov[0]; | |
2371 | fCdzTPC = cov[1]; | |
2372 | fCzzTPC = cov[2]; | |
2373 | ||
2374 | Double_t covar[6]; vtx->GetCovMatrix(covar); | |
2375 | Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]}; | |
2376 | Double_t c[3]={covar[2],0.,covar[5]}; | |
2377 | ||
2378 | Double_t chi2=GetPredictedChi2(p,c); | |
2379 | if (chi2>kVeryBig) return kFALSE; | |
2380 | ||
2381 | fCchi2TPC=chi2; | |
2382 | ||
2383 | if (!cParam) return kTRUE; | |
2384 | ||
2385 | *cParam = *fTPCInner; | |
2386 | if (!cParam->Update(p,c)) return kFALSE; | |
2387 | ||
2388 | return kTRUE; | |
2389 | } | |
2390 | ||
49d13e89 | 2391 | //_______________________________________________________________________ |
436dfe39 | 2392 | Bool_t AliESDtrack::RelateToVertex(const AliESDVertex *vtx, |
2393 | Double_t b, Double_t maxd, AliExternalTrackParam *cParam) { | |
49d13e89 | 2394 | // |
2395 | // Try to relate this track to the vertex "vtx", | |
2396 | // if the (rough) transverse impact parameter is not bigger then "maxd". | |
2397 | // Magnetic field is "b" (kG). | |
2398 | // | |
2399 | // a) The track gets extapolated to the DCA to the vertex. | |
2400 | // b) The impact parameters and their covariance matrix are calculated. | |
2401 | // c) An attempt to constrain this track to the vertex is done. | |
436dfe39 | 2402 | // The constrained params are returned via "cParam". |
49d13e89 | 2403 | // |
436dfe39 | 2404 | // In the case of success, the returned value is kTRUE |
2405 | // (otherwise, it's kFALSE) | |
49d13e89 | 2406 | // |
b5d34a4c | 2407 | |
2408 | if (!vtx) return kFALSE; | |
2409 | ||
e99a34df | 2410 | Double_t dz[2],cov[3]; |
2411 | if (!PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE; | |
2412 | ||
2413 | fD = dz[0]; | |
2414 | fZ = dz[1]; | |
2415 | fCdd = cov[0]; | |
2416 | fCdz = cov[1]; | |
2417 | fCzz = cov[2]; | |
49d13e89 | 2418 | |
e99a34df | 2419 | Double_t covar[6]; vtx->GetCovMatrix(covar); |
2420 | Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]}; | |
2421 | Double_t c[3]={covar[2],0.,covar[5]}; | |
3231f9e5 | 2422 | |
e99a34df | 2423 | Double_t chi2=GetPredictedChi2(p,c); |
436dfe39 | 2424 | if (chi2>kVeryBig) return kFALSE; |
2425 | ||
2426 | fCchi2=chi2; | |
49d13e89 | 2427 | |
436dfe39 | 2428 | |
266a0f9b | 2429 | //--- Could now these lines be removed ? --- |
2430 | delete fCp; | |
2431 | fCp=new AliExternalTrackParam(*this); | |
2432 | ||
2433 | if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;} | |
2434 | //---------------------------------------- | |
2435 | ||
2436 | fVertexID = vtx->GetID(); | |
2437 | ||
2438 | if (!cParam) return kTRUE; | |
2439 | ||
2440 | *cParam = *this; | |
2441 | if (!cParam->Update(p,c)) return kFALSE; | |
2442 | ||
2443 | return kTRUE; | |
2444 | } | |
2445 | ||
2446 | //_______________________________________________________________________ | |
2447 | Bool_t AliESDtrack::RelateToVertexBxByBz(const AliESDVertex *vtx, | |
2448 | Double_t b[3], Double_t maxd, AliExternalTrackParam *cParam) { | |
2449 | // | |
2450 | // Try to relate this track to the vertex "vtx", | |
2451 | // if the (rough) transverse impact parameter is not bigger then "maxd". | |
2452 | // Magnetic field is "b" (kG). | |
2453 | // | |
2454 | // a) The track gets extapolated to the DCA to the vertex. | |
2455 | // b) The impact parameters and their covariance matrix are calculated. | |
2456 | // c) An attempt to constrain this track to the vertex is done. | |
2457 | // The constrained params are returned via "cParam". | |
2458 | // | |
2459 | // In the case of success, the returned value is kTRUE | |
2460 | // (otherwise, it's kFALSE) | |
2461 | // | |
2462 | ||
2463 | if (!vtx) return kFALSE; | |
2464 | ||
2465 | Double_t dz[2],cov[3]; | |
2466 | if (!PropagateToDCABxByBz(vtx, b, maxd, dz, cov)) return kFALSE; | |
2467 | ||
2468 | fD = dz[0]; | |
2469 | fZ = dz[1]; | |
2470 | fCdd = cov[0]; | |
2471 | fCdz = cov[1]; | |
2472 | fCzz = cov[2]; | |
2473 | ||
2474 | Double_t covar[6]; vtx->GetCovMatrix(covar); | |
2475 | Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]}; | |
2476 | Double_t c[3]={covar[2],0.,covar[5]}; | |
2477 | ||
2478 | Double_t chi2=GetPredictedChi2(p,c); | |
2479 | if (chi2>kVeryBig) return kFALSE; | |
2480 | ||
2481 | fCchi2=chi2; | |
2482 | ||
2483 | ||
436dfe39 | 2484 | //--- Could now these lines be removed ? --- |
e99a34df | 2485 | delete fCp; |
2486 | fCp=new AliExternalTrackParam(*this); | |
49d13e89 | 2487 | |
e99a34df | 2488 | if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;} |
436dfe39 | 2489 | //---------------------------------------- |
2490 | ||
6dc21f57 | 2491 | fVertexID = vtx->GetID(); |
436dfe39 | 2492 | |
2493 | if (!cParam) return kTRUE; | |
2494 | ||
2495 | *cParam = *this; | |
2496 | if (!cParam->Update(p,c)) return kFALSE; | |
2497 | ||
49d13e89 | 2498 | return kTRUE; |
2499 | } | |
2500 | ||
ac2f7574 | 2501 | //_______________________________________________________________________ |
2502 | void AliESDtrack::Print(Option_t *) const { | |
2503 | // Prints info on the track | |
b9ca886f | 2504 | AliExternalTrackParam::Print(); |
5f7789fc | 2505 | printf("ESD track info\n") ; |
304864ab | 2506 | Double_t p[AliPID::kSPECIESN] ; |
ac2f7574 | 2507 | Int_t index = 0 ; |
2508 | if( IsOn(kITSpid) ){ | |
2509 | printf("From ITS: ") ; | |
2510 | GetITSpid(p) ; | |
304864ab | 2511 | for(index = 0 ; index < AliPID::kSPECIES; index++) |
ac2f7574 | 2512 | printf("%f, ", p[index]) ; |
2513 | printf("\n signal = %f\n", GetITSsignal()) ; | |
2514 | } | |
2515 | if( IsOn(kTPCpid) ){ | |
2516 | printf("From TPC: ") ; | |
2517 | GetTPCpid(p) ; | |
304864ab | 2518 | for(index = 0 ; index < AliPID::kSPECIES; index++) |
ac2f7574 | 2519 | printf("%f, ", p[index]) ; |
2520 | printf("\n signal = %f\n", GetTPCsignal()) ; | |
2521 | } | |
2522 | if( IsOn(kTRDpid) ){ | |
2523 | printf("From TRD: ") ; | |
2524 | GetTRDpid(p) ; | |
304864ab | 2525 | for(index = 0 ; index < AliPID::kSPECIES; index++) |
ac2f7574 | 2526 | printf("%f, ", p[index]) ; |
6984f7c1 | 2527 | printf("\n signal = %f\n", GetTRDsignal()) ; |
ac2f7574 | 2528 | } |
2529 | if( IsOn(kTOFpid) ){ | |
2530 | printf("From TOF: ") ; | |
2531 | GetTOFpid(p) ; | |
304864ab | 2532 | for(index = 0 ; index < AliPID::kSPECIES; index++) |
ac2f7574 | 2533 | printf("%f, ", p[index]) ; |
2534 | printf("\n signal = %f\n", GetTOFsignal()) ; | |
2535 | } | |
f4b3bbb7 | 2536 | if( IsOn(kHMPIDpid) ){ |
2537 | printf("From HMPID: ") ; | |
2538 | GetHMPIDpid(p) ; | |
304864ab | 2539 | for(index = 0 ; index < AliPID::kSPECIES; index++) |
ac2f7574 | 2540 | printf("%f, ", p[index]) ; |
f4b3bbb7 | 2541 | printf("\n signal = %f\n", GetHMPIDsignal()) ; |
ac2f7574 | 2542 | } |
ac2f7574 | 2543 | } |
6c94f330 | 2544 | |
0c19adf7 | 2545 | |
2546 | // | |
2547 | // Draw functionality | |
2548 | // Origin: Marian Ivanov, Marian.Ivanov@cern.ch | |
2549 | // | |
2550 | void AliESDtrack::FillPolymarker(TPolyMarker3D *pol, Float_t magF, Float_t minR, Float_t maxR, Float_t stepR){ | |
2551 | // | |
2552 | // Fill points in the polymarker | |
2553 | // | |
2554 | TObjArray arrayRef; | |
2555 | arrayRef.AddLast(new AliExternalTrackParam(*this)); | |
2556 | if (fIp) arrayRef.AddLast(new AliExternalTrackParam(*fIp)); | |
2557 | if (fOp) arrayRef.AddLast(new AliExternalTrackParam(*fOp)); | |
c38d443f | 2558 | if (fHMPIDp) arrayRef.AddLast(new AliExternalTrackParam(*fHMPIDp)); |
0c19adf7 | 2559 | // |
2560 | Double_t mpos[3]={0,0,0}; | |
2561 | Int_t entries=arrayRef.GetEntries(); | |
e546b023 | 2562 | for (Int_t i=entries;i--;){ |
0c19adf7 | 2563 | Double_t pos[3]; |
2564 | ((AliExternalTrackParam*)arrayRef.At(i))->GetXYZ(pos); | |
2565 | mpos[0]+=pos[0]/entries; | |
2566 | mpos[1]+=pos[1]/entries; | |
2567 | mpos[2]+=pos[2]/entries; | |
2568 | } | |
2569 | // Rotate to the mean position | |
2570 | // | |
2571 | Float_t fi= TMath::ATan2(mpos[1],mpos[0]); | |
2572 | for (Int_t i=0;i<entries;i++){ | |
2573 | Bool_t res = ((AliExternalTrackParam*)arrayRef.At(i))->Rotate(fi); | |
2574 | if (!res) delete arrayRef.RemoveAt(i); | |
2575 | } | |
2576 | Int_t counter=0; | |
2577 | for (Double_t r=minR; r<maxR; r+=stepR){ | |
2578 | Double_t sweight=0; | |
2579 | Double_t mlpos[3]={0,0,0}; | |
2580 | for (Int_t i=0;i<entries;i++){ | |
2581 | Double_t point[3]={0,0,0}; | |
2582 | AliExternalTrackParam *param = ((AliExternalTrackParam*)arrayRef.At(i)); | |
2583 | if (!param) continue; | |
2584 | if (param->GetXYZAt(r,magF,point)){ | |
2585 | Double_t weight = 1./(10.+(r-param->GetX())*(r-param->GetX())); | |
2586 | sweight+=weight; | |
2587 | mlpos[0]+=point[0]*weight; | |
2588 | mlpos[1]+=point[1]*weight; | |
2589 | mlpos[2]+=point[2]*weight; | |
2590 | } | |
2591 | } | |
2592 | if (sweight>0){ | |
2593 | mlpos[0]/=sweight; | |
2594 | mlpos[1]/=sweight; | |
2595 | mlpos[2]/=sweight; | |
2596 | pol->SetPoint(counter,mlpos[0],mlpos[1], mlpos[2]); | |
047640da | 2597 | // printf("xyz\t%f\t%f\t%f\n",mlpos[0], mlpos[1],mlpos[2]); |
0c19adf7 | 2598 | counter++; |
2599 | } | |
2600 | } | |
2601 | } | |
1d4882da | 2602 | |
2603 | //_______________________________________________________________________ | |
2604 | void AliESDtrack::SetITSdEdxSamples(const Double_t s[4]) { | |
2605 | // | |
2606 | // Store the dE/dx samples measured by the two SSD and two SDD layers. | |
2607 | // These samples are corrected for the track segment length. | |
2608 | // | |
e546b023 | 2609 | for (Int_t i=4;i--;) fITSdEdxSamples[i]=s[i]; |
1d4882da | 2610 | } |
2611 | ||
2612 | //_______________________________________________________________________ | |
2613 | void AliESDtrack::GetITSdEdxSamples(Double_t *s) const { | |
2614 | // | |
2615 | // Get the dE/dx samples measured by the two SSD and two SDD layers. | |
2616 | // These samples are corrected for the track segment length. | |
2617 | // | |
e546b023 | 2618 | for (Int_t i=4;i--;) s[i]=fITSdEdxSamples[i]; |
1d4882da | 2619 | } |
949840f6 | 2620 | |
2621 | ||
2622 | UShort_t AliESDtrack::GetTPCnclsS(Int_t i0,Int_t i1) const{ | |
2623 | // | |
beb01154 | 2624 | // get number of shared TPC clusters |
949840f6 | 2625 | // |
2626 | return fTPCSharedMap.CountBits(i0)-fTPCSharedMap.CountBits(i1); | |
2627 | } | |
beb01154 | 2628 | |
2629 | UShort_t AliESDtrack::GetTPCncls(Int_t i0,Int_t i1) const{ | |
2630 | // | |
2631 | // get number of TPC clusters | |
2632 | // | |
2633 | return fTPCClusterMap.CountBits(i0)-fTPCClusterMap.CountBits(i1); | |
2634 | } | |
4c3dc2a0 | 2635 | |
2636 | //____________________________________________________________________ | |
2637 | Double_t AliESDtrack::GetChi2TPCConstrainedVsGlobal(const AliESDVertex* vtx) const | |
2638 | { | |
2639 | // Calculates the chi2 between the TPC track (TPCinner) constrained to the primary vertex and the global track | |
2640 | // | |
2641 | // Returns -1 in case the calculation failed | |
2642 | // | |
2643 | // Value is cached as a non-persistent member. | |
2644 | // | |
2645 | // Code adapted from original code by GSI group (Jacek, Marian, Michael) | |
2646 | ||
2647 | // cache, ignoring that a different vertex might be passed | |
2648 | if (fCacheChi2TPCConstrainedVsGlobalVertex == vtx) | |
2649 | return fCacheChi2TPCConstrainedVsGlobal; | |
2650 | ||
2651 | fCacheChi2TPCConstrainedVsGlobal = -1; | |
2652 | fCacheChi2TPCConstrainedVsGlobalVertex = vtx; | |
2653 | ||
2654 | Double_t x[3]; | |
2655 | GetXYZ(x); | |
2656 | Double_t b[3]; | |
2657 | AliTrackerBase::GetBxByBz(x,b); | |
2658 | ||
2659 | if (!fTPCInner) { | |
2660 | AliWarning("Could not get TPC Inner Param."); | |
2661 | return fCacheChi2TPCConstrainedVsGlobal; | |
2662 | } | |
2663 | ||
2664 | // clone for constraining | |
e546b023 | 2665 | AliExternalTrackParam tpcInnerC(*fTPCInner); |
4c3dc2a0 | 2666 | |
2667 | // transform to the track reference frame | |
e546b023 | 2668 | Bool_t isOK = tpcInnerC.Rotate(GetAlpha()); |
2669 | isOK &= tpcInnerC.PropagateTo(GetX(), b[2]); | |
4c3dc2a0 | 2670 | if (!isOK) { |
4c3dc2a0 | 2671 | AliWarning("Rotation/Propagation of track failed.") ; |
2672 | return fCacheChi2TPCConstrainedVsGlobal; | |
2673 | } | |
2674 | ||
2675 | // constrain TPCinner | |
e546b023 | 2676 | isOK = tpcInnerC.ConstrainToVertex(vtx, b); |
4c3dc2a0 | 2677 | |
2678 | // transform to the track reference frame | |
e546b023 | 2679 | isOK &= tpcInnerC.Rotate(GetAlpha()); |
2680 | isOK &= tpcInnerC.PropagateTo(GetX(), b[2]); | |
4c3dc2a0 | 2681 | |
2682 | if (!isOK) { | |
2683 | AliWarning("ConstrainTPCInner failed.") ; | |
4c3dc2a0 | 2684 | return fCacheChi2TPCConstrainedVsGlobal; |
2685 | } | |
2686 | ||
2687 | // calculate chi2 between vi and vj vectors | |
2688 | // with covi and covj covariance matrices | |
2689 | // chi2ij = (vi-vj)^(T)*(covi+covj)^(-1)*(vi-vj) | |
2690 | TMatrixD deltaT(5,1); | |
2691 | TMatrixD delta(1,5); | |
2692 | TMatrixD covarM(5,5); | |
2693 | ||
e546b023 | 2694 | for (Int_t ipar=0;ipar<5;ipar++) { |
2695 | deltaT(ipar,0) = tpcInnerC.GetParameter()[ipar] - GetParameter()[ipar]; | |
2696 | delta(0,ipar) = tpcInnerC.GetParameter()[ipar] - GetParameter()[ipar]; | |
4c3dc2a0 | 2697 | |
2698 | for (Int_t jpar=0; jpar<5; jpar++) { | |
2699 | Int_t index = GetIndex(ipar,jpar); | |
e546b023 | 2700 | covarM(ipar,jpar) = GetCovariance()[index]+tpcInnerC.GetCovariance()[index]; |
4c3dc2a0 | 2701 | } |
2702 | } | |
2703 | // chi2 distance TPC constrained and TPC+ITS | |
2704 | TMatrixD covarMInv = covarM.Invert(); | |
2705 | TMatrixD mat2 = covarMInv*deltaT; | |
2706 | TMatrixD chi2 = delta*mat2; | |
e546b023 | 2707 | // |
4c3dc2a0 | 2708 | fCacheChi2TPCConstrainedVsGlobal = chi2(0,0); |
2709 | return fCacheChi2TPCConstrainedVsGlobal; | |
2710 | } | |
e546b023 | 2711 | |
2712 | void AliESDtrack::ReleaseESDfriendTrackGently() | |
2713 | { | |
2714 | // remove friend track | |
2715 | if (!fFriendTrack) return; | |
2716 | AliClonesPool* poolFr = fgPools->GetPoolTrFriend(); | |
2717 | poolFr ? poolFr->MarkSlotFree(fFriendTrack) : delete fFriendTrack; | |
2718 | fFriendTrack=0; | |
2719 | } | |
2720 | ||
2721 | void AliESDtrack::PrintTmp() | |
2722 | { | |
2723 | } | |
6d3c4556 | 2724 | |
2725 | void AliESDtrack::SetFriendTrack(const AliESDfriendTrack *t) | |
2726 | { | |
2727 | //attach fr. track | |
2728 | if (fFriendTrack) { | |
2729 | AliClonesPool* poolFr = fgPools ? fgPools->GetPoolTrFriend() : 0; | |
2730 | if (poolFr) poolFr->MarkSlotFree(fFriendTrack); | |
2731 | else delete fFriendTrack; | |
2732 | fFriendTrack = 0; | |
2733 | } | |
2734 | if (t) fFriendTrack=new AliESDfriendTrack(*t); | |
2735 | } |