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