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