AliRoot Core  ee782a0 (ee782a0)
AliESDtrack.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 //-----------------------------------------------------------------
16 // Implementation of the ESD track class
17 // ESD = Event Summary Data
18 // This is the class to deal with during the phisics analysis of data
19 // Origin: Iouri Belikov, CERN
20 // e-mail: Jouri.Belikov@cern.ch
21 //
22 //
23 //
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 // Content:
37 // a.) Track parameters and covariance - AliExternalTrackParam - snapshots along trajectory at differnt tracking steps
38 // current, fIp, fTPCinner, fCp, fOp, fHMPIDp, + friendTrack (fITSout, fTPCout, fTRDin)
39 // b.) Flags - per detector status bits
40 // c.) Track fit quality -chi2, number of clusters
41 // d.) Detector PID information
42 // d.) Different detector specific information (e.g number of tracklets in TRD, TOF cluster descriptor ...)
43 //
44 //
45 // The track information is propagated from one tracking detector to
46 // other using the functionality of AliESDtrack (AliExternalTrackParam - current parameters)
47 //
48 // Barrel tracking uses Kalman filtering technique (no global fit model is used). Kalman provides optimal local
49 // track parameters estimate at given position under certian assumptions.
50 // Following approximations were used:
51 // a.) gaussian Multiple scattering
52 // b.) gaussian energy loss
53 // c.) gaussian error of the space point residuals
54 //
55 // Kalman filter take into account following effects which are
56 // difficult to handle using global fit:
57 // a.) Multiple scattering
58 // b.) Energy loss
59 // c.) Non homogenous magnetic field
60 //
61 // In general case, following barrel detectors are contributing to
62 // the Kalman track information:
63 // a. TPC
64 // b. ITS
65 // c. TRD
66 //
67 // Track findind/fitting procedure is done in 3 steps:
68 // 1. Cluster2Track(in) - inward sequence TPC->ITS
69 // 2. PropagateBack(out) - outward sequence ITS->TPC->TRD -> Outer PID detectors
70 // 3. RefitInward(refit) - inward sequence TRD->TPC->ITS
71 // After each recosntruction step detector status is updated in the data member fFlags
72 // fFlags|=k<DetectorName><step> where step={1:in,2:out,3:refit,}
73 // For some of detectors a special flags were implemented. Declaration of list of all flags can be find in $ALICE_ROOT/STEER/STEERBase/AliVTrack.h
74 //
75 //
76 // The current track parameter is updated after each detector (see bellow).
77 // In specical cases a track snapshots (AliExternalTrackParam) are stored
78 //
79 //
80 //
81 // For some type of analysis (+visualization) track local parameters at
82 // different position are neccesary. A snapshots during the track
83 // propagation are created and stored either in track itself (for analysis purposes) or assiciated friend track (for calibration and debugging purposes)
84 // (See AliExternalTrackParam class for desctiption of variables and functionality)
85 // Snapshots:
86 // a.) Current parameters (AliESDtrack itself)
87 // Description: as obtained in the last succesfull tracking step
88 // Contributors: best case TRD->TPC->ITS after RefitInward
89 // Recomended way to get track parameters. It includes all of the information.
90 // NOTICE - By default the track parameters are stored at the DCA point to the primary vertex.
91 // Optimal for primary tracks, far from optimal for deeply secondary tracks.
92 // To get optimal track parameters at the secondary vertex, OnTheFly V0s with associated track parameters should be used
93 //
94 // b.) Constrained parameters (fCp)
95 // Description:
96 // Kalman track updated with the Primary vertex information with corresponding error (soft constraint - see http://en.wikipedia.org/wiki/Constraint_(mathematics)#Hard_and_soft_constraints)
97 // Function:
98 // const AliExternalTrackParam *GetConstrainedParam() const {return fCp;}
99 // Contributors: best case TRD->TPC->ITS after RefitInward
100 // Recommended usage: Use only for tracks selected as primary (check GetConstrainedChi2())
101 // NOTICE - not real constraint only soft constraint
102 //
103 // c.) Inner parameters (fIp) -
104 // Description: Track parameters at inner wall of the TPC
105 // Function:
106 // const AliExternalTrackParam *GetInnerParam() const { return fIp;}
107 // Contributors: general case TRD->TPC (during RefitInward)
108 // Recomended usage: To provide momenta for the TPC PID and to estimate quality of the track determination for further
109 //
110 // d.) TPCinnerParam (fTPCinner):
111 // Description: TPC only parameters at DCA to the primary vertex (corrected for the material between TPC and vertex)
112 // Function:
113 // const AliExternalTrackParam *GetTPCInnerParam() const {return fTPCInner;}
114 // Contributors: TPC only from in step 1 (Cluster2Tracks)
115 // Recomended usage: Requested for HBT study
116 // (smaller correlations as using also ITS information)
117 // NOTICE: Optimal for primary, far from optimal for secondary tracks (similar to track parameters a.)
118 // ! We should always use the c.) fIp in case of the TPC PID analysis, or undo material budget correction!
119 //
120 // e.) Outer parameters - (fOp)
121 // Description: track parameters during PropagateBack in the last sucessfull propagation
122 // Reason to generate backup OuterParameters
123 // a.) Local inclination angle bigger than threshold -
124 // Low momenta tracks
125 // b.) Catastrofic (large relative>~20 %)energy loss in material outside of the TPC
126 // c.) No additional space points contributing to track
127 // Function:
128 // const AliExternalTrackParam *GetOuterParam() const { return fOp;}
129 // Contributors: general case - ITS-> TPC -> TRD ( during PropagateBack )
130 // Recomended usage:
131 // a.) Tracking: Starting parameter for Refit inward
132 // b.) Visualization
133 // c.) QA
134 // NOTICE: Should be not used for the physic analysis
135 // Function:
136 // const AliExternalTrackParam *GetOuterParam() const { return fOp;}
137 //
138 //-----------------------------------------------------------------
139 
140 #include <TMath.h>
141 #include <TParticle.h>
142 #include <TDatabasePDG.h>
143 #include <TMatrixD.h>
144 
145 #include "AliESDVertex.h"
146 #include "AliESDtrack.h"
147 #include "AliESDEvent.h"
148 #include "AliKalmanTrack.h"
149 #include "AliVTrack.h"
150 #include "AliLog.h"
151 #include "AliTrackPointArray.h"
152 #include "TPolyMarker3D.h"
153 #include "AliTrackerBase.h"
154 #include "AliTPCdEdxInfo.h"
155 #include "AliDetectorPID.h"
156 #include "TTreeStream.h"
157 #include "TObjArray.h"
158 
159 ClassImp(AliESDtrack)
160 
161 Bool_t AliESDtrack::fgTrackEMuAsPi = kTRUE;
162 
163 void SetPIDValues(Double_t * dest, const Double_t * src, Int_t n) {
164  // This function copies "n" PID weights from "scr" to "dest"
165  // and normalizes their sum to 1 thus producing conditional probabilities.
166  // The negative weights are set to 0.
167  // In case all the weights are non-positive they are replaced by
168  // uniform probabilities
169 
170  if (n<=0) return;
171 
172  Float_t uniform = 1./(Float_t)n;
173 
174  Float_t sum = 0;
175  for (Int_t i=0; i<n; i++)
176  if (src[i]>=0) {
177  sum+=src[i];
178  dest[i] = src[i];
179  }
180  else {
181  dest[i] = 0;
182  }
183 
184  if(sum>0)
185  for (Int_t i=0; i<n; i++) dest[i] /= sum;
186  else
187  for (Int_t i=0; i<n; i++) dest[i] = uniform;
188 }
189 
190 //_______________________________________________________________________
193  fCp(0),
194  fIp(0),
195  fTPCInner(0),
196  fOp(0),
197  fHMPIDp(0),
198  fFriendTrack(NULL),
199  fTPCFitMap(159),//number of padrows
200  fTPCClusterMap(159),//number of padrows
201  fTPCSharedMap(159),//number of padrows
202  fFrTrackID(0),
203  fFlags(0),
204  fID(0),
205  fLabel(0),
206  fITSLabel(0),
207  fTPCLabel(0),
208  fTRDLabel(0),
209  fTOFLabel(NULL),
210  fTOFCalChannel(-1),
211  fTOFindex(-1),
212  fHMPIDqn(0),
213  fHMPIDcluIdx(-1),
214  fCaloIndex(kEMCALNoMatch),
215  fR(0),
216  fITSr(0),
217  fTPCr(0),
218  fTRDr(0),
219  fTOFr(0),
220  fHMPIDr(0),
221  fHMPIDtrkTheta(0),
222  fHMPIDtrkPhi(0),
223  fHMPIDsignal(0),
224  fTrackTime(0),
225  fTrackLength(0),
226  fdTPC(0),fzTPC(0),
227  fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
228  fCchi2TPC(0),
229  fD(0),fZ(0),
230  fCdd(0),fCdz(0),fCzz(0),
231  fCchi2(0),
232  fITSchi2(0),
233  fTPCchi2(0),
234  fTPCchi2Iter1(0),
235  fTRDchi2(0),
236  fTOFchi2(0),
237  fHMPIDchi2(0),
238  fGlobalChi2(0),
239  fITSsignal(0),
240  fITSsignalTuned(0),
241  fTPCsignal(0),
242  fTPCsignalTuned(0),
243  fTPCsignalS(0),
244  fTPCdEdxInfo(0),
245  fTRDsignal(0),
246  fTRDQuality(0),
247  fTRDBudget(0),
248  fTOFsignal(99999),
249  fTOFsignalTuned(99999),
250  fTOFsignalToT(99999),
251  fTOFsignalRaw(99999),
252  fTOFsignalDz(999),
253  fTOFsignalDx(999),
254  fTOFdeltaBC(999),
255  fTOFl0l1(999),
256  fCaloDx(0),
257  fCaloDz(0),
258  fHMPIDtrkX(0),
259  fHMPIDtrkY(0),
260  fHMPIDmipX(0),
261  fHMPIDmipY(0),
262  fTPCncls(0),
263  fTPCnclsF(0),
264  fTPCsignalN(0),
265  fTPCnclsIter1(0),
266  fTPCnclsFIter1(0),
267  fITSncls(0),
268  fITSClusterMap(0),
269  fITSSharedMap(0),
270  fTRDncls(0),
271  fTRDncls0(0),
272  fTRDntracklets(0),
273  fTRDNchamberdEdx(0),
274  fTRDNclusterdEdx(0),
275  fTRDnSlices(0),
276  fTRDslices(0x0),
277  fVertexID(-2),// -2 means an orphan track
278  fPIDForTracking(AliPID::kPion),
279  fPIDForTrackingIn(AliPID::kPion),
280  fESDEvent(0),
281  fCacheNCrossedRows(-10),
282  fCacheChi2TPCConstrainedVsGlobal(-10),
283  fCacheChi2TPCConstrainedVsGlobalVertex(0),
284  fDetectorPID(0x0),
285  fTrackPhiOnEMCal(-999),
286  fTrackEtaOnEMCal(-999),
287  fTrackPtOnEMCal(-999),
288  fNtofClusters(0),
289  fTOFcluster(NULL)
290 {
291  //
292  // The default ESD constructor
293  //
295 
296  Int_t i;
297  for (i=kNITSchi2Std;i--;) fITSchi2Std[i] = 0;
298 
299  for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
300  for (i=0; i<3; i++) { fV0Indexes[i]=0;}
301  for (i=0;i<kTRDnPlanes;i++) {
302  fTRDTimBin[i]=0;
303  }
304  for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
305  for (i=0;i<4;i++) {fTPCPoints[i]=0;}
306  for (i=0;i<10;i++) {fTOFInfo[i]=0;}
307  for (i=0;i<12;i++) {fITSModule[i]=-1;}
308 }
309 
310 bool AliESDtrack::fgkOnlineMode=false;
311 
312 //_______________________________________________________________________
314  AliExternalTrackParam(track),
315  fCp(0),
316  fIp(0),
317  fTPCInner(0),
318  fOp(0),
319  fHMPIDp(0),
320  fFriendTrack(0),
321  fTPCFitMap(track.fTPCFitMap),
324  fFrTrackID(track.fFrTrackID),
325  fFlags(track.fFlags),
326  fID(track.fID),
327  fLabel(track.fLabel),
328  fITSLabel(track.fITSLabel),
329  fTPCLabel(track.fTPCLabel),
330  fTRDLabel(track.fTRDLabel),
331  fTOFLabel(NULL),
333  fTOFindex(track.fTOFindex),
334  fHMPIDqn(track.fHMPIDqn),
335  fHMPIDcluIdx(track.fHMPIDcluIdx),
336  fCaloIndex(track.fCaloIndex),
337  fR(0),
338  fITSr(0),
339  fTPCr(0),
340  fTRDr(0),
341  fTOFr(0),
342  fHMPIDr(0),
344  fHMPIDtrkPhi(track.fHMPIDtrkPhi),
345  fHMPIDsignal(track.fHMPIDsignal),
346  fTrackTime(NULL),
347  fTrackLength(track.fTrackLength),
348  fdTPC(track.fdTPC),fzTPC(track.fzTPC),
349  fCddTPC(track.fCddTPC),fCdzTPC(track.fCdzTPC),fCzzTPC(track.fCzzTPC),
350  fCchi2TPC(track.fCchi2TPC),
351  fD(track.fD),fZ(track.fZ),
352  fCdd(track.fCdd),fCdz(track.fCdz),fCzz(track.fCzz),
353  fCchi2(track.fCchi2),
354  fITSchi2(track.fITSchi2),
355  fTPCchi2(track.fTPCchi2),
357  fTRDchi2(track.fTRDchi2),
358  fTOFchi2(track.fTOFchi2),
359  fHMPIDchi2(track.fHMPIDchi2),
360  fGlobalChi2(track.fGlobalChi2),
361  fITSsignal(track.fITSsignal),
363  fTPCsignal(track.fTPCsignal),
365  fTPCsignalS(track.fTPCsignalS),
366  fTPCdEdxInfo(0),
367  fTRDsignal(track.fTRDsignal),
368  fTRDQuality(track.fTRDQuality),
369  fTRDBudget(track.fTRDBudget),
370  fTOFsignal(track.fTOFsignal),
374  fTOFsignalDz(track.fTOFsignalDz),
375  fTOFsignalDx(track.fTOFsignalDx),
376  fTOFdeltaBC(track.fTOFdeltaBC),
377  fTOFl0l1(track.fTOFl0l1),
378  fCaloDx(track.fCaloDx),
379  fCaloDz(track.fCaloDz),
380  fHMPIDtrkX(track.fHMPIDtrkX),
381  fHMPIDtrkY(track.fHMPIDtrkY),
382  fHMPIDmipX(track.fHMPIDmipX),
383  fHMPIDmipY(track.fHMPIDmipY),
384  fTPCncls(track.fTPCncls),
385  fTPCnclsF(track.fTPCnclsF),
386  fTPCsignalN(track.fTPCsignalN),
389  fITSncls(track.fITSncls),
392  fTRDncls(track.fTRDncls),
393  fTRDncls0(track.fTRDncls0),
397  fTRDnSlices(track.fTRDnSlices),
398  fTRDslices(0x0),
399  fVertexID(track.fVertexID),
400  fPIDForTracking(AliPID::kPion),
401  fPIDForTrackingIn(AliPID::kPion),
402  fESDEvent(track.fESDEvent),
406  fDetectorPID(0x0),
411  fTOFcluster(NULL)
412 {
413  //
414  //copy constructor
415  //
416  for (Int_t i=kNITSchi2Std;i--;) fITSchi2Std[i] = track.fITSchi2Std[i];
417 
418  if(track.fTrackTime){
419  fTrackTime = new Double32_t[AliPID::kSPECIESC];
420  for (Int_t i=0;i<AliPID::kSPECIESC;i++) fTrackTime[i]=track.fTrackTime[i];
421  }
422 
423  if (track.fR) {
424  fR = new Double32_t[AliPID::kSPECIES];
425  for (Int_t i=AliPID::kSPECIES;i--;) fR[i]=track.fR[i];
426  }
427  if (track.fITSr) {
428  fITSr = new Double32_t[AliPID::kSPECIES];
429  for (Int_t i=AliPID::kSPECIES;i--;) fITSr[i]=track.fITSr[i];
430  }
431  //
432  if (track.fTPCr) {
433  fTPCr = new Double32_t[AliPID::kSPECIES];
434  for (Int_t i=AliPID::kSPECIES;i--;) fTPCr[i]=track.fTPCr[i];
435  }
436 
437  for (Int_t i=0;i<4;i++) {fITSdEdxSamples[i]=track.fITSdEdxSamples[i];}
438  for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
439  for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
440  for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
441  //
442  for (Int_t i=0;i<kTRDnPlanes;i++) {
443  fTRDTimBin[i]=track.fTRDTimBin[i];
444  }
445 
446  if (fTRDnSlices) {
447  fTRDslices=new Double32_t[fTRDnSlices];
448  for (Int_t i=0; i<fTRDnSlices; i++) fTRDslices[i]=track.fTRDslices[i];
449  }
450 
451  if (track.fDetectorPID) fDetectorPID = new AliDetectorPID(*track.fDetectorPID);
452 
453  if (track.fTRDr) {
454  fTRDr = new Double32_t[AliPID::kSPECIES];
455  for (Int_t i=AliPID::kSPECIES;i--;) fTRDr[i]=track.fTRDr[i];
456  }
457 
458  if (track.fTOFr) {
459  fTOFr = new Double32_t[AliPID::kSPECIES];
460  for (Int_t i=AliPID::kSPECIES;i--;) fTOFr[i]=track.fTOFr[i];
461  }
462 
463  if(track.fTOFLabel){
464  if(!fTOFLabel) fTOFLabel = new Int_t[3];
465  for (Int_t i=0;i<3;i++) fTOFLabel[i]=track.fTOFLabel[i];
466  }
467 
468  for (Int_t i=0;i<10;i++) fTOFInfo[i]=track.fTOFInfo[i];
469  for (Int_t i=0;i<12;i++) fITSModule[i]=track.fITSModule[i];
470 
471  if (track.fHMPIDr) {
472  fHMPIDr = new Double32_t[AliPID::kSPECIES];
473  for (Int_t i=AliPID::kSPECIES;i--;) fHMPIDr[i]=track.fHMPIDr[i];
474  }
475 
476  if (track.fCp) fCp=new AliExternalTrackParam(*track.fCp);
477  if (track.fIp) fIp=new AliExternalTrackParam(*track.fIp);
478  if (track.fTPCInner) fTPCInner=new AliExternalTrackParam(*track.fTPCInner);
479  if (track.fOp) fOp=new AliExternalTrackParam(*track.fOp);
480  if (track.fHMPIDp) fHMPIDp=new AliExternalTrackParam(*track.fHMPIDp);
481  if (track.fTPCdEdxInfo) fTPCdEdxInfo = new AliTPCdEdxInfo(*track.fTPCdEdxInfo);
482 
483 
484  if (track.fFriendTrack) fFriendTrack=new AliESDfriendTrack(*(track.fFriendTrack));
485 
486  if(fNtofClusters > 0){
487  fTOFcluster = new Int_t[fNtofClusters];
488  for(Int_t i=0;i < fNtofClusters;i++) fTOFcluster[i] = track.fTOFcluster[i];
489  }
490 }
491 
492 //_______________________________________________________________________
494  AliExternalTrackParam(track),
495  fCp(0),
496  fIp(0),
497  fTPCInner(0),
498  fOp(0),
499  fHMPIDp(0),
500  fFriendTrack(0),
501  fTPCFitMap(159),//number of padrows
502  fTPCClusterMap(159),//number of padrows
503  fTPCSharedMap(159),//number of padrows
504  fFrTrackID(0),
505  fFlags(0),
506  fID(),
507  fLabel(0),
508  fITSLabel(0),
509  fTPCLabel(0),
510  fTRDLabel(0),
511  fTOFLabel(NULL),
512  fTOFCalChannel(-1),
513  fTOFindex(-1),
514  fHMPIDqn(0),
515  fHMPIDcluIdx(-1),
517  fR(0),
518  fITSr(0),
519  fTPCr(0),
520  fTRDr(0),
521  fTOFr(0),
522  fHMPIDr(0),
523  fHMPIDtrkTheta(0),
524  fHMPIDtrkPhi(0),
525  fHMPIDsignal(0),
526  fTrackTime(NULL),
527  fTrackLength(0),
528  fdTPC(0),fzTPC(0),
529  fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
530  fCchi2TPC(0),
531  fD(0),fZ(0),
532  fCdd(0),fCdz(0),fCzz(0),
533  fCchi2(0),
534  fITSchi2(0),
535  fTPCchi2(0),
536  fTPCchi2Iter1(0),
537  fTRDchi2(0),
538  fTOFchi2(0),
539  fHMPIDchi2(0),
540  fGlobalChi2(0),
541  fITSsignal(0),
542  fITSsignalTuned(0),
543  fTPCsignal(0),
544  fTPCsignalTuned(0),
545  fTPCsignalS(0),
546  fTPCdEdxInfo(0),
547  fTRDsignal(0),
548  fTRDQuality(0),
549  fTRDBudget(0),
550  fTOFsignal(99999),
551  fTOFsignalTuned(99999),
552  fTOFsignalToT(99999),
553  fTOFsignalRaw(99999),
554  fTOFsignalDz(999),
555  fTOFsignalDx(999),
556  fTOFdeltaBC(999),
557  fTOFl0l1(999),
558  fCaloDx(0),
559  fCaloDz(0),
560  fHMPIDtrkX(0),
561  fHMPIDtrkY(0),
562  fHMPIDmipX(0),
563  fHMPIDmipY(0),
564  fTPCncls(0),
565  fTPCnclsF(0),
566  fTPCsignalN(0),
567  fTPCnclsIter1(0),
568  fTPCnclsFIter1(0),
569  fITSncls(0),
570  fITSClusterMap(0),
571  fITSSharedMap(0),
572  fTRDncls(0),
573  fTRDncls0(0),
574  fTRDntracklets(0),
575  fTRDNchamberdEdx(0),
576  fTRDNclusterdEdx(0),
577  fTRDnSlices(0),
578  fTRDslices(0x0),
579  fVertexID(-2), // -2 means an orphan track
582  fESDEvent(0),
583  fCacheNCrossedRows(-10),
586  fDetectorPID(0x0),
587  fTrackPhiOnEMCal(-999),
588  fTrackEtaOnEMCal(-999),
589  fTrackPtOnEMCal(-999),
590  fNtofClusters(0),
591  fTOFcluster(NULL)
592 {
593  //
594  // ESD track from AliVTrack.
595  // This is not a copy constructor !
596  //
597 
598  if (track->InheritsFrom("AliExternalTrackParam")) {
599  AliError("This is not a copy constructor. Use AliESDtrack(const AliESDtrack &) !");
600  AliWarning("Calling the default constructor...");
601  AliESDtrack();
602  return;
603  }
604 
605  // Reset all the arrays
606  Int_t i;
607  for (i=kNITSchi2Std;i--;) fITSchi2Std[i] = 0;
608 
609  for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
610  for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
611  for (i=0;i<kTRDnPlanes;i++) {
612  fTRDTimBin[i]=0;
613  }
614  for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
615  for (i=0;i<4;i++) {fTPCPoints[i]=0;}
616  for (i=0;i<10;i++) {fTOFInfo[i]=0;}
617  for (i=0;i<12;i++) {fITSModule[i]=-1;}
618 
619 
620  // Set ITS cluster map
622  fITSSharedMap=0;
623  fITSchi2=track->GetITSchi2();
624  fITSncls=0;
625  for(i=0; i<6; i++) {
626  if(HasPointOnITSLayer(i)) fITSncls++;
627  }
628 
629  // Set TPC ncls
630  fTPCncls=track->GetTPCNcls();
631  fTPCnclsF=track->GetTPCNclsF();
632  // TPC cluster maps
633  const TBits* bmap = track->GetTPCClusterMapPtr();
634  if (bmap) SetTPCClusterMap(*bmap);
635  bmap = GetTPCFitMapPtr();
636  if (bmap) SetTPCFitMap(*bmap);
637  bmap = GetTPCSharedMapPtr();
638  if (bmap) SetTPCSharedMap(*bmap);
639  // Set TPC chi2
640  fTPCchi2 = track->GetTPCchi2();
641 
642  // Impact parameters
643  if (track->InheritsFrom("AliAODTrack")) {
644  Float_t ip[2], ipCov[3];
645  track->GetImpactParameters(ip,ipCov);
646  fD = ip[0];
647  fZ = ip[1];
648  fCdd = ipCov[0];
649  fCdz = ipCov[1];
650  fCzz = ipCov[2];
651  }
652 
653  //
654  // Set the combined PID
655  const Double_t *pid = track->PID();
656  if(pid) {
657  fR = new Double32_t[AliPID::kSPECIES];
658  for (i=AliPID::kSPECIES; i--;) fR[i]=pid[i];
659  }
660  //
661  // calo matched cluster id
663  // AliESD track label
664  //
665  // PID info
666  fITSsignal = track->GetITSsignal();
668  double itsdEdx[4];
669  track->GetITSdEdxSamples(itsdEdx);
670  SetITSdEdxSamples(itsdEdx);
671  //
672  SetTPCsignal(track->GetTPCsignal(),fTPCsignalS,track->GetTPCsignalN()); // No signalS in AODPi
673 
674  AliTPCdEdxInfo dEdxInfo;
675  if (track->GetTPCdEdxInfo( dEdxInfo )) SetTPCdEdxInfo(new AliTPCdEdxInfo(dEdxInfo));
676  //
677  SetTRDsignal(track->GetTRDsignal());
678  int ntrdsl = track->GetNumberOfTRDslices();
679  if (ntrdsl>0) {
680  SetNumberOfTRDslices((ntrdsl+2)*kTRDnPlanes);
681  for (int ipl=kTRDnPlanes;ipl--;){
682  for (int isl=ntrdsl;isl--;) SetTRDslice(track->GetTRDslice(ipl,isl),ipl,isl);
683  Double_t sp, p = track->GetTRDmomentum(ipl, &sp);
684  SetTRDmomentum(p, ipl, &sp);
685  }
686  }
687  //
688  fTRDncls = track->GetTRDncls();
689  fTRDntracklets &= 0xff & track->GetTRDntrackletsPID();
690  fTRDchi2 = track->GetTRDchi2();
691  //
692  SetTOFsignal(track->GetTOFsignal());
693  Double_t expt[AliPID::kSPECIESC];
695  SetIntegratedTimes(expt);
696  //
698  //
699  SetLabel(track->GetLabel());
700  // Set the status
701  SetStatus(track->GetStatus());
702  //
703  // Set the ID
704  SetID(track->GetID());
705  //
706 }
707 
708 //_______________________________________________________________________
709 AliESDtrack::AliESDtrack(TParticle * part) :
711  fCp(0),
712  fIp(0),
713  fTPCInner(0),
714  fOp(0),
715  fHMPIDp(0),
716  fFriendTrack(0),
717  fTPCFitMap(159),//number of padrows
718  fTPCClusterMap(159),//number of padrows
719  fTPCSharedMap(159),//number of padrows
720  fFrTrackID(0),
721  fFlags(0),
722  fID(0),
723  fLabel(0),
724  fITSLabel(0),
725  fTPCLabel(0),
726  fTRDLabel(0),
727  fTOFLabel(NULL),
728  fTOFCalChannel(-1),
729  fTOFindex(-1),
730  fHMPIDqn(0),
731  fHMPIDcluIdx(-1),
733  fR(0),
734  fITSr(0),
735  fTPCr(0),
736  fTRDr(0),
737  fTOFr(0),
738  fHMPIDr(0),
739  fHMPIDtrkTheta(0),
740  fHMPIDtrkPhi(0),
741  fHMPIDsignal(0),
742  fTrackTime(NULL),
743  fTrackLength(0),
744  fdTPC(0),fzTPC(0),
745  fCddTPC(0),fCdzTPC(0),fCzzTPC(0),
746  fCchi2TPC(0),
747  fD(0),fZ(0),
748  fCdd(0),fCdz(0),fCzz(0),
749  fCchi2(0),
750  fITSchi2(0),
751  fTPCchi2(0),
752  fTPCchi2Iter1(0),
753  fTRDchi2(0),
754  fTOFchi2(0),
755  fHMPIDchi2(0),
756  fGlobalChi2(0),
757  fITSsignal(0),
758  fITSsignalTuned(0),
759  fTPCsignal(0),
760  fTPCsignalTuned(0),
761  fTPCsignalS(0),
762  fTPCdEdxInfo(0),
763  fTRDsignal(0),
764  fTRDQuality(0),
765  fTRDBudget(0),
766  fTOFsignal(99999),
767  fTOFsignalTuned(99999),
768  fTOFsignalToT(99999),
769  fTOFsignalRaw(99999),
770  fTOFsignalDz(999),
771  fTOFsignalDx(999),
772  fTOFdeltaBC(999),
773  fTOFl0l1(999),
774  fCaloDx(0),
775  fCaloDz(0),
776  fHMPIDtrkX(0),
777  fHMPIDtrkY(0),
778  fHMPIDmipX(0),
779  fHMPIDmipY(0),
780  fTPCncls(0),
781  fTPCnclsF(0),
782  fTPCsignalN(0),
783  fTPCnclsIter1(0),
784  fTPCnclsFIter1(0),
785  fITSncls(0),
786  fITSClusterMap(0),
787  fITSSharedMap(0),
788  fTRDncls(0),
789  fTRDncls0(0),
790  fTRDntracklets(0),
791  fTRDNchamberdEdx(0),
792  fTRDNclusterdEdx(0),
793  fTRDnSlices(0),
794  fTRDslices(0x0),
795  fVertexID(-2), // -2 means an orphan track
796  fPIDForTracking(AliPID::kPion),
797  fPIDForTrackingIn(AliPID::kPion),
798  fESDEvent(0),
799  fCacheNCrossedRows(-10),
802  fDetectorPID(0x0),
803  fTrackPhiOnEMCal(-999),
804  fTrackEtaOnEMCal(-999),
805  fTrackPtOnEMCal(-999),
806  fNtofClusters(0),
807  fTOFcluster(NULL)
808 {
809  //
810  // ESD track from TParticle
811  //
812 
813  // Reset all the arrays
814  Int_t i;
815  for (i=kNITSchi2Std;i--;) fITSchi2Std[i] = 0;
816 
817  for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
818  for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
819  for (i=0;i<kTRDnPlanes;i++) {
820  fTRDTimBin[i]=0;
821  }
822  for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
823  for (i=0;i<4;i++) {fTPCPoints[i]=0;}
824  for (i=0;i<10;i++) {fTOFInfo[i]=0;}
825  for (i=0;i<12;i++) {fITSModule[i]=-1;}
826 
827  // Calculate the AliExternalTrackParam content
828 
829  Double_t xref;
830  Double_t alpha;
831  Double_t param[5];
832  Double_t covar[15];
833 
834  // Calculate alpha: the rotation angle of the corresponding local system (TPC sector)
835  alpha = part->Phi()*180./TMath::Pi();
836  if (alpha<0) alpha+= 360.;
837  if (alpha>360) alpha -= 360.;
838 
839  Int_t sector = (Int_t)(alpha/20.);
840  alpha = 10. + 20.*sector;
841  alpha /= 180;
842  alpha *= TMath::Pi();
843 
844  // Covariance matrix: no errors, the parameters are exact
845  for (i=0; i<15; i++) covar[i]=0.;
846 
847  // Get the vertex of origin and the momentum
848  TVector3 ver(part->Vx(),part->Vy(),part->Vz());
849  TVector3 mom(part->Px(),part->Py(),part->Pz());
850 
851  // Rotate to the local coordinate system (TPC sector)
852  ver.RotateZ(-alpha);
853  mom.RotateZ(-alpha);
854 
855  // X of the referense plane
856  xref = ver.X();
857 
858  Int_t pdgCode = part->GetPdgCode();
859 
860  Double_t charge =
861  TDatabasePDG::Instance()->GetParticle(pdgCode)->Charge();
862 
863  param[0] = ver.Y();
864  param[1] = ver.Z();
865  param[2] = TMath::Sin(mom.Phi());
866  param[3] = mom.Pz()/mom.Pt();
867  param[4] = TMath::Sign(1/mom.Pt(),charge);
868 
869  // Set AliExternalTrackParam
870  Set(xref, alpha, param, covar);
871 
872  // Set the PID
873  Int_t indexPID = 99;
874  if (pdgCode<0) pdgCode = -pdgCode;
875  for (i=0;i<AliPID::kSPECIESC;i++) if (pdgCode==AliPID::ParticleCode(i)) {indexPID = i; break;}
876 
877  if (indexPID < AliPID::kSPECIESC) fPIDForTrackingIn = fPIDForTracking = indexPID;
878 
879  // AliESD track label
880  SetLabel(part->GetUniqueID());
881 
882 }
883 
884 //_______________________________________________________________________
886  //
887  // This is destructor according Coding Conventrions
888  //
889  //printf("Delete track\n");
890  delete fIp;
891  delete fTPCInner;
892  delete fOp;
893  delete fHMPIDp;
894  delete fCp;
895  delete fFriendTrack;
896  delete fTPCdEdxInfo;
897  if(fTRDnSlices)
898  delete[] fTRDslices;
899 
900  //Reset cached values - needed for TClonesArray in AliESDInputHandler
901  fCacheNCrossedRows = -10.;
904 
905  if(fTOFcluster)
906  delete[] fTOFcluster;
907  fTOFcluster = NULL;
908  fNtofClusters=0;
909 
910  delete fDetectorPID;
911 
912  delete[] fR;
913  delete[] fITSr;
914  delete[] fTPCr;
915  delete[] fTRDr;
916  delete[] fTOFr;
917  delete[] fHMPIDr;
918  //
919  if(fTrackTime) delete[] fTrackTime;
920  if(fTOFLabel) delete[] fTOFLabel;
921 }
922 
923 //_______________________________________________________________________
925 {
926  // == operator
927 
928  if(&source == this) return *this;
930 
931 
932  if(source.fCp){
933  // we have the trackparam: assign or copy construct
934  if(fCp)*fCp = *source.fCp;
935  else fCp = new AliExternalTrackParam(*source.fCp);
936  }
937  else{
938  // no track param delete the old one
939  delete fCp;
940  fCp = 0;
941  }
942 
943  if(source.fIp){
944  // we have the trackparam: assign or copy construct
945  if(fIp)*fIp = *source.fIp;
946  else fIp = new AliExternalTrackParam(*source.fIp);
947  }
948  else{
949  // no track param delete the old one
950  delete fIp;
951  fIp = 0;
952  }
953 
954 
955  if(source.fTPCInner){
956  // we have the trackparam: assign or copy construct
957  if(fTPCInner) *fTPCInner = *source.fTPCInner;
958  else fTPCInner = new AliExternalTrackParam(*source.fTPCInner);
959  }
960  else{
961  // no track param delete the old one
962  delete fTPCInner;
963  fTPCInner = 0;
964  }
965 
966  if(source.fTPCdEdxInfo) {
967  if(fTPCdEdxInfo) *fTPCdEdxInfo = *source.fTPCdEdxInfo;
969  }
970 
971  if(source.fOp){
972  // we have the trackparam: assign or copy construct
973  if(fOp) *fOp = *source.fOp;
974  else fOp = new AliExternalTrackParam(*source.fOp);
975  }
976  else{
977  // no track param delete the old one
978  delete fOp;
979  fOp = 0;
980  }
981 
982 
983  if(source.fHMPIDp){
984  // we have the trackparam: assign or copy construct
985  if(fHMPIDp) *fHMPIDp = *source.fHMPIDp;
986  else fHMPIDp = new AliExternalTrackParam(*source.fHMPIDp);
987  }
988  else{
989  // no track param delete the old one
990  delete fHMPIDp;
991  fHMPIDp = 0;
992  }
993 
994  // copy also the friend track
995  // use copy constructor
996  if(source.fFriendTrack){
997  // we have the trackparam: assign or copy construct
999  }
1000  else{
1001  // no track param delete the old one
1002  delete fFriendTrack; fFriendTrack= 0;
1003  }
1004 
1005  fTPCFitMap = source.fTPCFitMap;
1006  fTPCClusterMap = source.fTPCClusterMap;
1007  fTPCSharedMap = source.fTPCSharedMap;
1008  // the simple stuff
1009  fFrTrackID = source.fFrTrackID;
1010  fFlags = source.fFlags;
1011  fID = source.fID;
1012  fLabel = source.fLabel;
1013  fITSLabel = source.fITSLabel;
1014  for(int i = 0; i< 12;++i){
1015  fITSModule[i] = source.fITSModule[i];
1016  }
1017  fTPCLabel = source.fTPCLabel;
1018  fTRDLabel = source.fTRDLabel;
1019  if(source.fTOFLabel){
1020  if(!fTOFLabel) fTOFLabel = new Int_t[3];
1021  for(int i = 0; i< 3;++i){
1022  fTOFLabel[i] = source.fTOFLabel[i];
1023  }
1024  }
1025  fTOFCalChannel = source.fTOFCalChannel;
1026  fTOFindex = source.fTOFindex;
1027  fHMPIDqn = source.fHMPIDqn;
1028  fHMPIDcluIdx = source.fHMPIDcluIdx;
1029  fCaloIndex = source.fCaloIndex;
1030  for (int i=kNITSchi2Std;i--;) fITSchi2Std[i] = source.fITSchi2Std[i];
1031  for(int i = 0; i< 3;++i){
1032  fKinkIndexes[i] = source.fKinkIndexes[i];
1033  fV0Indexes[i] = source.fV0Indexes[i];
1034  }
1035 
1036  if (source.fR) {
1037  if (!fR) fR = new Double32_t[AliPID::kSPECIES];
1038  for (Int_t i=AliPID::kSPECIES;i--;) fR[i]=source.fR[i];
1039  }
1040  else {delete[] fR; fR = 0;}
1041 
1042  if (source.fITSr) {
1043  if (!fITSr) fITSr = new Double32_t[AliPID::kSPECIES];
1044  for (Int_t i=AliPID::kSPECIES;i--;) fITSr[i]=source.fITSr[i];
1045  }
1046  else {delete[] fITSr; fITSr = 0;}
1047  //
1048  if (source.fTPCr) {
1049  if (!fTPCr) fTPCr = new Double32_t[AliPID::kSPECIES];
1050  for (Int_t i=AliPID::kSPECIES;i--;) fTPCr[i]=source.fTPCr[i];
1051  }
1052  else {delete[] fTPCr; fTPCr = 0;}
1053 
1054  if (source.fTRDr) {
1055  if (!fTRDr) fTRDr = new Double32_t[AliPID::kSPECIES];
1056  for (Int_t i=AliPID::kSPECIES;i--;) fTRDr[i]=source.fTRDr[i];
1057  }
1058  else {delete[] fTRDr; fTRDr = 0;}
1059 
1060  if (source.fTOFr) {
1061  if (!fTOFr) fTOFr = new Double32_t[AliPID::kSPECIES];
1062  for (Int_t i=AliPID::kSPECIES;i--;) fTOFr[i]=source.fTOFr[i];
1063  }
1064  else {delete[] fTOFr; fTOFr = 0;}
1065 
1066  if (source.fHMPIDr) {
1067  if (!fHMPIDr) fHMPIDr = new Double32_t[AliPID::kSPECIES];
1068  for (Int_t i=AliPID::kSPECIES;i--;) fHMPIDr[i]=source.fHMPIDr[i];
1069  }
1070  else {delete[] fHMPIDr; fHMPIDr = 0;}
1071 
1074 
1075  fHMPIDtrkTheta = source.fHMPIDtrkTheta;
1076  fHMPIDtrkPhi = source.fHMPIDtrkPhi;
1077  fHMPIDsignal = source.fHMPIDsignal;
1078 
1079 
1080  if(fTrackTime){
1081  delete[] fTrackTime;
1082  }
1083  if(source.fTrackTime){
1084  fTrackTime = new Double32_t[AliPID::kSPECIESC];
1085  for(Int_t i=0;i < AliPID::kSPECIESC;i++)
1086  fTrackTime[i] = source.fTrackTime[i];
1087  }
1088 
1089  fTrackLength = source. fTrackLength;
1090  fdTPC = source.fdTPC;
1091  fzTPC = source.fzTPC;
1092  fCddTPC = source.fCddTPC;
1093  fCdzTPC = source.fCdzTPC;
1094  fCzzTPC = source.fCzzTPC;
1095  fCchi2TPC = source.fCchi2TPC;
1096 
1097  fD = source.fD;
1098  fZ = source.fZ;
1099  fCdd = source.fCdd;
1100  fCdz = source.fCdz;
1101  fCzz = source.fCzz;
1102  fCchi2 = source.fCchi2;
1103 
1104  fITSchi2 = source.fITSchi2;
1105  fTPCchi2 = source.fTPCchi2;
1106  fTPCchi2Iter1 = source.fTPCchi2Iter1;
1107  fTRDchi2 = source.fTRDchi2;
1108  fTOFchi2 = source.fTOFchi2;
1109  fHMPIDchi2 = source.fHMPIDchi2;
1110 
1111  fGlobalChi2 = source.fGlobalChi2;
1112 
1113  fITSsignal = source.fITSsignal;
1115  for (Int_t i=0;i<4;i++) {fITSdEdxSamples[i]=source.fITSdEdxSamples[i];}
1116  fTPCsignal = source.fTPCsignal;
1118  fTPCsignalS = source.fTPCsignalS;
1119  for(int i = 0; i< 4;++i){
1120  fTPCPoints[i] = source.fTPCPoints[i];
1121  }
1122  fTRDsignal = source.fTRDsignal;
1125 
1126  for(int i = 0;i < kTRDnPlanes;++i){
1127  fTRDTimBin[i] = source.fTRDTimBin[i];
1128  }
1129 
1130  if(fTRDnSlices)
1131  delete[] fTRDslices;
1132  fTRDslices=0;
1133  fTRDnSlices=source.fTRDnSlices;
1134  if (fTRDnSlices) {
1135  fTRDslices=new Double32_t[fTRDnSlices];
1136  for(int j = 0;j < fTRDnSlices;++j) fTRDslices[j] = source.fTRDslices[j];
1137  }
1138 
1139  fTRDQuality = source.fTRDQuality;
1140  fTRDBudget = source.fTRDBudget;
1141  fTOFsignal = source.fTOFsignal;
1143  fTOFsignalToT = source.fTOFsignalToT;
1144  fTOFsignalRaw = source.fTOFsignalRaw;
1145  fTOFsignalDz = source.fTOFsignalDz;
1146  fTOFsignalDx = source.fTOFsignalDx;
1147  fTOFdeltaBC = source.fTOFdeltaBC;
1148  fTOFl0l1 = source.fTOFl0l1;
1149 
1150  for(int i = 0;i<10;++i){
1151  fTOFInfo[i] = source.fTOFInfo[i];
1152  }
1153 
1154  fHMPIDtrkX = source.fHMPIDtrkX;
1155  fHMPIDtrkY = source.fHMPIDtrkY;
1156  fHMPIDmipX = source.fHMPIDmipX;
1157  fHMPIDmipY = source.fHMPIDmipY;
1158 
1159  fTPCncls = source.fTPCncls;
1160  fTPCnclsF = source.fTPCnclsF;
1161  fTPCsignalN = source.fTPCsignalN;
1162  fTPCnclsIter1 = source.fTPCnclsIter1;
1163  fTPCnclsFIter1 = source.fTPCnclsFIter1;
1164 
1165  fITSncls = source.fITSncls;
1166  fITSClusterMap = source.fITSClusterMap;
1167  fITSSharedMap = source.fITSSharedMap;
1168  fTRDncls = source.fTRDncls;
1169  fTRDncls0 = source.fTRDncls0;
1170  fTRDntracklets = source.fTRDntracklets;
1171  fVertexID = source.fVertexID;
1174 
1178 
1179  delete fDetectorPID;
1180  fDetectorPID=0x0;
1181  if (source.fDetectorPID) fDetectorPID = new AliDetectorPID(*source.fDetectorPID);
1182 
1186 
1187  if(fTOFcluster){
1188  delete[] fTOFcluster;
1189  }
1190  fNtofClusters = source.fNtofClusters;
1191  if(fNtofClusters > 0){
1192  fTOFcluster = new Int_t[fNtofClusters];
1193  for(Int_t i=0;i < fNtofClusters;i++) fTOFcluster[i] = source.fTOFcluster[i];
1194  }
1195 
1196  return *this;
1197 }
1198 
1199 
1200 
1201 void AliESDtrack::Copy(TObject &obj) const {
1202 
1203  // this overwrites the virtual TOBject::Copy()
1204  // to allow run time copying without casting
1205  // in AliESDEvent
1206 
1207  if(this==&obj)return;
1208  AliESDtrack *robj = dynamic_cast<AliESDtrack*>(&obj);
1209  if(!robj)return; // not an AliESDtrack
1210  *robj = *this;
1211 
1212 }
1213 
1214 
1215 
1216 void AliESDtrack::AddCalibObject(TObject * object){
1217  //
1218  // add calib object to the list
1219  //
1221  if (!fFriendTrack) return;
1222  fFriendTrack->AddCalibObject(object);
1223 }
1224 
1225 TObject * AliESDtrack::GetCalibObject(Int_t index){
1226  //
1227  // return calib objct at given position
1228  //
1229  if (!fFriendTrack) return 0;
1230  return fFriendTrack->GetCalibObject(index);
1231 }
1232 
1233 
1235 
1236  // Fills the information of the TPC-only first reconstruction pass
1237  // into the passed ESDtrack object. For consistency fTPCInner is also filled
1238  // again
1239 
1240 
1241 
1242  // For data produced before r26675
1243  // RelateToVertexTPC was not properly called during reco
1244  // so you'll have to call it again, before FillTPCOnlyTrack
1245  // Float_t p[2],cov[3];
1246  // track->GetImpactParametersTPC(p,cov);
1247  // if(p[0]==0&&p[1]==0) // <- Default values
1248  // track->RelateToVertexTPC(esd->GetPrimaryVertexTPC(),esd->GetMagneticField(),kVeryBig);
1249 
1250 
1251  if(!fTPCInner)return kFALSE;
1252 
1253  // fill the TPC track params to the global track parameters
1255  track.fD = fdTPC;
1256  track.fZ = fzTPC;
1257  track.fCdd = fCddTPC;
1258  track.fCdz = fCdzTPC;
1259  track.fCzz = fCzzTPC;
1260 
1261  // copy the inner params
1262  if(track.fIp) *track.fIp = *fIp;
1263  else track.fIp = new AliExternalTrackParam(*fIp);
1264 
1265  // copy the TPCinner parameters
1266  if(track.fTPCInner) *track.fTPCInner = *fTPCInner;
1267  else track.fTPCInner = new AliExternalTrackParam(*fTPCInner);
1268  track.fdTPC = fdTPC;
1269  track.fzTPC = fzTPC;
1270  track.fCddTPC = fCddTPC;
1271  track.fCdzTPC = fCdzTPC;
1272  track.fCzzTPC = fCzzTPC;
1273  track.fCchi2TPC = fCchi2TPC;
1274 
1275  // copy all other TPC specific parameters
1276 
1277  // replace label by TPC label
1278  track.fLabel = fTPCLabel;
1279  track.fTPCLabel = fTPCLabel;
1280 
1281  track.fTPCchi2 = fTPCchi2;
1282  track.fTPCchi2Iter1 = fTPCchi2Iter1;
1283  track.fTPCsignal = fTPCsignal;
1285  track.fTPCsignalS = fTPCsignalS;
1286  for(int i = 0;i<4;++i)track.fTPCPoints[i] = fTPCPoints[i];
1287 
1288  track.fTPCncls = fTPCncls;
1289  track.fTPCnclsF = fTPCnclsF;
1290  track.fTPCsignalN = fTPCsignalN;
1291  track.fTPCnclsIter1 = fTPCnclsIter1;
1292  track.fTPCnclsFIter1 = fTPCnclsFIter1;
1293 
1294  // PID
1295  if (fTPCr) {
1296  if (!track.fTPCr) track.fTPCr = new Double32_t[AliPID::kSPECIES];
1297  for(int i=AliPID::kSPECIES;i--;) track.fTPCr[i] = fTPCr[i];
1298  }
1299  //
1300  if (fR) {
1301  if (!track.fR) track.fR = new Double32_t[AliPID::kSPECIES];
1302  for(int i=AliPID::kSPECIES;i--;) track.fR[i] = fR[i];
1303  }
1304 
1305  track.fTPCFitMap = fTPCFitMap;
1307  track.fTPCSharedMap = fTPCSharedMap;
1308 
1309 
1310  // reset the flags
1311  track.fFlags = kTPCin;
1312  track.fID = fID;
1313 
1314  track.fFlags |= fFlags & kTPCpid; //copy the TPCpid status flag
1315 
1316  for (Int_t i=0;i<3;i++) track.fKinkIndexes[i] = fKinkIndexes[i];
1317 
1318  return kTRUE;
1319 
1320 }
1321 
1322 //_______________________________________________________________________
1324  // Resets everything except
1325  // fFlags: Reconstruction status flags
1326  // fLabel: Track label
1327  // fID: Unique ID of the track
1328  // Impact parameter information
1329  // fR[AliPID::kSPECIES]: combined "detector response probability"
1330  // Running track parameters in the base class (AliExternalTrackParam)
1331 
1332  fTrackLength = 0;
1333 
1334  if(fTrackTime)
1335  for (Int_t i=0;i<AliPID::kSPECIESC;i++) fTrackTime[i] = 0;
1336 
1337  // Reset track parameters constrained to the primary vertex
1338  delete fCp;fCp = 0;
1339 
1340  // Reset track parameters at the inner wall of TPC
1341  delete fIp;fIp = 0;
1342  delete fTPCInner;fTPCInner=0;
1343  // Reset track parameters at the inner wall of the TRD
1344  delete fOp;fOp = 0;
1345  // Reset track parameters at the HMPID
1346  delete fHMPIDp;fHMPIDp = 0;
1347 
1348 
1349  // Reset ITS track related information
1350  fITSchi2 = 0;
1351  fITSncls = 0;
1352  fITSClusterMap=0;
1353  fITSSharedMap=0;
1354  fITSsignal = 0;
1355  fITSsignalTuned = 0;
1356  for (Int_t i=0;i<4;i++) fITSdEdxSamples[i] = 0.;
1357  if (fITSr) for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=0;
1358  fITSLabel = 0;
1359 
1360  // Reset TPC related track information
1361  fTPCchi2 = 0;
1362  fTPCchi2Iter1 = 0;
1363  fTPCncls = 0;
1364  fTPCnclsF = 0;
1365  fTPCnclsIter1 = 0;
1366  fTPCnclsFIter1 = 0;
1367  fTPCFitMap = 0;
1368  fTPCClusterMap = 0;
1369  fTPCSharedMap = 0;
1370  fTPCsignal= 0;
1371  fTPCsignalTuned= 0;
1372  fTPCsignalS= 0;
1373  fTPCsignalN= 0;
1374  if (fTPCr) for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i] = 0;
1375  fTPCLabel=0;
1376  for (Int_t i=0;i<4;i++) fTPCPoints[i] = 0;
1377  for (Int_t i=0; i<3;i++) fKinkIndexes[i] = 0;
1378  for (Int_t i=0; i<3;i++) fV0Indexes[i] = 0;
1379 
1380  // Reset TRD related track information
1381  fTRDchi2 = 0;
1382  fTRDncls = 0;
1383  fTRDncls0 = 0;
1384  fTRDsignal = 0;
1385  fTRDNchamberdEdx = 0;
1386  fTRDNclusterdEdx = 0;
1387 
1388  for (Int_t i=0;i<kTRDnPlanes;i++) {
1389  fTRDTimBin[i] = 0;
1390  }
1391  if (fTRDr) for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
1392  fTRDLabel = 0;
1393  fTRDQuality = 0;
1394  fTRDntracklets = 0;
1395  if(fTRDnSlices)
1396  delete[] fTRDslices;
1397  fTRDslices=0x0;
1398  fTRDnSlices=0;
1399  fTRDBudget = 0;
1400 
1401  // Reset TOF related track information
1402  fTOFchi2 = 0;
1403  fTOFindex = -1;
1404  fTOFsignal = 99999;
1405  fTOFCalChannel = -1;
1406  fTOFsignalToT = 99999;
1407  fTOFsignalRaw = 99999;
1408  fTOFsignalDz = 999;
1409  fTOFsignalDx = 999;
1410  fTOFdeltaBC = 999;
1411  fTOFl0l1 = 999;
1412  if (fTOFr) for (Int_t i=0;i<AliPID::kSPECIES;i++) fTOFr[i] = 0;
1413  for (Int_t i=0;i<10;i++) fTOFInfo[i] = 0;
1414 
1415  // Reset HMPID related track information
1416  fHMPIDchi2 = 0;
1417  fHMPIDqn = 0;
1418  fHMPIDcluIdx = -1;
1419  fHMPIDsignal = 0;
1420  if (fHMPIDr) for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i] = 0;
1421  fHMPIDtrkTheta = 0;
1422  fHMPIDtrkPhi = 0;
1423  fHMPIDtrkX = 0;
1424  fHMPIDtrkY = 0;
1425  fHMPIDmipX = 0;
1426  fHMPIDmipY = 0;
1428 
1429  // reset global track chi2
1430  fGlobalChi2 = 0;
1431 
1432  fVertexID = -2; // an orphan track
1434  //
1435  delete fFriendTrack; fFriendTrack = 0;
1436 }
1437 
1438 //_______________________________________________________________________
1439 Int_t AliESDtrack::GetPID(Bool_t tpcOnly) const
1440 {
1441  // Returns the particle most probable id. For backward compatibility first the prob. arrays
1442  // will be checked, but normally the GetPIDForTracking will be returned
1443  Int_t i;
1444  const Double32_t *prob = 0;
1445  if (tpcOnly) { // check if TPCpid is valid
1446  if (!fTPCr) return GetPIDForTracking();
1447  prob = fTPCr;
1448  for (i=0; i<AliPID::kSPECIES-1; i++) if (prob[i] != prob[i+1]) break;
1449  if (i == AliPID::kSPECIES-1) prob = 0; // not valid, try with combined pid
1450  }
1451  if (!prob) { // either requested TPCpid is not valid or comb.pid is requested
1452  if (!fR) return GetPIDForTracking();
1453  prob = fR;
1454  for (i=0; i<AliPID::kSPECIES-1; i++) if (prob[i] != prob[i+1]) break;
1455  if (i == AliPID::kSPECIES-1) return GetPIDForTracking(); // If all the probabilities are equal, return the pion mass
1456  }
1457  //
1458  Float_t max=0.;
1459  Int_t k=-1;
1460  for (i=0; i<AliPID::kSPECIES; i++) if (prob[i]>max) {k=i; max=prob[i];}
1461  //
1462  if (k==0) { // dE/dx "crossing points" in the TPC
1463  /*
1464  Double_t p=GetP();
1465  if ((p>0.38)&&(p<0.48))
1466  if (prob[0]<prob[3]*10.) return AliPID::kKaon;
1467  if ((p>0.75)&&(p<0.85))
1468  if (prob[0]<prob[4]*10.) return AliPID::kProton;
1469  */
1470  return AliPID::kElectron;
1471  }
1472  if (k==1) return AliPID::kMuon;
1473  if (k==2||k==-1) return AliPID::kPion;
1474  if (k==3) return AliPID::kKaon;
1475  if (k==4) return AliPID::kProton;
1476  // AliWarning("Undefined PID !");
1477  return GetPIDForTracking();
1478 }
1479 
1480 //_______________________________________________________________________
1481 Int_t AliESDtrack::GetTOFBunchCrossing(Double_t b, Bool_t pidTPConly) const
1482 {
1483  // Returns the number of bunch crossings after trigger (assuming 25ns spacing)
1484  const double kSpacing = 25; // min interbanch spacing in ns
1485  if (!IsOn(kTOFout)) return kTOFBCNA;
1486  double tdif = GetTOFExpTDiff(b,pidTPConly);
1487  return TMath::Nint(tdif/kSpacing);
1488  //
1489 }
1490 
1491 //_______________________________________________________________________
1492 Double_t AliESDtrack::GetTOFExpTDiff(Double_t b, Bool_t pidTPConly) const
1493 {
1494  // Returns the time difference in ns between TOF signal and expected time
1495  const double kps2ns = 1e-3; // we need ns
1496  const double kNoInfo = kTOFBCNA*25; // no info
1497  if (!IsOn(kTOFout)) return kNoInfo; // no info
1498  //
1499  double tdif = GetTOFsignal();
1500  if (IsOn(kTIME)) { // integrated time info is there
1501  int pid = GetPID(pidTPConly);
1502  Double_t times[AliPID::kSPECIESC];
1503  // old esd has only AliPID::kSPECIES times
1505  tdif -= times[pid];
1506  }
1507  else { // assume integrated time info from TOF radius and momentum
1508  const double kRTOF = 385.;
1509  const double kCSpeed = 3.e-2; // cm/ps
1510  double p = GetP();
1511  if (p<0.01) return kNoInfo;
1512  double m = GetMass(pidTPConly);
1513  double curv = GetC(b);
1514  double path = TMath::Abs(curv)>kAlmost0 ? // account for curvature
1515  2./curv*TMath::ASin(kRTOF*curv/2.)*TMath::Sqrt(1.+GetTgl()*GetTgl()) : kRTOF;
1516  tdif -= path/kCSpeed*TMath::Sqrt(1.+m*m/(p*p));
1517  }
1518  return tdif*kps2ns;
1519 }
1520 
1521 //_______________________________________________________________________
1523 {
1524  // Returns the time difference in ns between TOF signal and expected time for given specii
1525  const double kps2ns = 1e-3; // we need ns
1526  const double kNoInfo = kTOFBCNA*25; // no info
1527  if (!IsOn(kTOFout)) return kNoInfo; // no info
1528  //
1529  double tdif = GetTOFsignal();
1530  if (IsOn(kTIME)) { // integrated time info is there
1531  Double_t times[AliPID::kSPECIESC];
1532  // old esd has only AliPID::kSPECIES times
1534  tdif -= times[specie];
1535  }
1536  else { // assume integrated time info from TOF radius and momentum
1537  const double kRTOF = 385.;
1538  const double kCSpeed = 3.e-2; // cm/ps
1539  double p = GetP();
1540  if (p<0.01) return kNoInfo;
1541  double m = GetMass(specie);
1542  double curv = GetC(b);
1543  double path = TMath::Abs(curv)>kAlmost0 ? // account for curvature
1544  2./curv*TMath::ASin(kRTOF*curv/2.)*TMath::Sqrt(1.+GetTgl()*GetTgl()) : kRTOF;
1545  tdif -= path/kCSpeed*TMath::Sqrt(1.+m*m/(p*p));
1546  }
1547  return tdif*kps2ns;
1548 }
1549 
1550 //______________________________________________________________________________
1551 Double_t AliESDtrack::M() const
1552 {
1553  // Returns the assumed mass
1554  // (the pion mass, if the particle can't be identified properly).
1555  static Bool_t printerr=kTRUE;
1556  if (printerr) {
1557  AliWarning("WARNING !!! ... THIS WILL BE PRINTED JUST ONCE !!!");
1558  printerr = kFALSE;
1559  AliWarning("This is the ESD mass. Use it with care !");
1560  }
1561  return GetMass();
1562 }
1563 
1564 //______________________________________________________________________________
1565 Double_t AliESDtrack::E() const
1566 {
1567  // Returns the energy of the particle given its assumed mass.
1568  // Assumes the pion mass if the particle can't be identified properly.
1569 
1570  Double_t m = M();
1571  Double_t p = P();
1572  return TMath::Sqrt(p*p + m*m);
1573 }
1574 
1575 //______________________________________________________________________________
1576 Double_t AliESDtrack::Y() const
1577 {
1578  // Returns the rapidity of a particle given its assumed mass.
1579  // Assumes the pion mass if the particle can't be identified properly.
1580 
1581  Double_t e = E();
1582  Double_t pz = Pz();
1583  if (e != TMath::Abs(pz)) { // energy was not equal to pz
1584  return 0.5*TMath::Log((e+pz)/(e-pz));
1585  } else { // energy was equal to pz
1586  return -999.;
1587  }
1588 }
1589 
1590 //_______________________________________________________________________
1591 Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong64_t flags){
1592  //
1593  // This function updates track's running parameters
1594  //
1595  Bool_t rc=kTRUE;
1596 
1597  SetStatus(flags);
1598  fLabel=t->GetLabel();
1599 
1600  if (t->IsStartedTimeIntegral()) {
1601  SetStatus(kTIME);
1602  Double_t times[AliPID::kSPECIESC];
1603  t->GetIntegratedTimes(times);
1604  SetIntegratedTimes(times);
1606  }
1607 
1608  Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1609  if (fFriendTrack) {
1610  if (flags==kITSout) fFriendTrack->SetITSOut(*t);
1611  if (flags==kTPCout) fFriendTrack->SetTPCOut(*t);
1612  if (flags==kTRDrefit) fFriendTrack->SetTRDIn(*t);
1613  }
1614 
1615  switch (flags) {
1616 
1617  case kITSin:
1618  fITSchi2Std[0] = t->GetChi2();
1619  //
1620  case kITSout:
1621  fITSchi2Std[1] = t->GetChi2();
1622  case kITSrefit:
1623  {
1624  fITSchi2Std[2] = t->GetChi2();
1625  fITSClusterMap=0;
1627  if (fFriendTrack) {
1628  Int_t indexITS[AliESDfriendTrack::kMaxITScluster];
1629  for (Int_t i=0;i<AliESDfriendTrack::kMaxITScluster;i++) {
1630  indexITS[i]=t->GetClusterIndex(i);
1631 
1632  if (i<fITSncls) {
1633  Int_t l=(indexITS[i] & 0xf0000000) >> 28;
1634  SETBIT(fITSClusterMap,l);
1635  }
1636  }
1637  fFriendTrack->SetITSIndices(indexITS,AliESDfriendTrack::kMaxITScluster);
1638  }
1639 
1640  fITSchi2=t->GetChi2();
1641  fITSsignal=t->GetPIDsignal();
1642  fITSLabel = t->GetLabel();
1643  // keep in fOp the parameters outside ITS for ITS stand-alone tracks
1644  if (flags==kITSout) {
1645  if (!fOp) fOp=new AliExternalTrackParam(*t);
1646  else
1647  fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1648  }
1649  }
1650  break;
1651 
1652  case kTPCin: case kTPCrefit:
1653  {
1654  fTPCLabel = t->GetLabel();
1655  if (flags==kTPCin) {
1658  fTPCchi2Iter1=t->GetChi2();
1659  }
1660  if (!fIp) fIp=new AliExternalTrackParam(*t);
1661  else
1662  fIp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1663  }
1664  // Intentionally no break statement; need to set general TPC variables as well
1665  case kTPCout:
1666  {
1667  if (flags & kTPCout){
1668  if (!fOp) fOp=new AliExternalTrackParam(*t);
1669  else
1670  fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1671  }
1673  fTPCchi2=t->GetChi2();
1674 
1675  if (fFriendTrack) { // Copy cluster indices
1676  Int_t indexTPC[AliESDfriendTrack::kMaxTPCcluster];
1677  for (Int_t i=0;i<AliESDfriendTrack::kMaxTPCcluster;i++)
1678  indexTPC[i]=t->GetClusterIndex(i);
1679  fFriendTrack->SetTPCIndices(indexTPC,AliESDfriendTrack::kMaxTPCcluster);
1680  }
1681  fTPCsignal=t->GetPIDsignal();
1682  }
1683  break;
1684 
1685  case kTRDin: case kTRDrefit:
1686  break;
1687  case kTRDout:
1688  {
1689  fTRDLabel = t->GetLabel();
1690  fTRDchi2 = t->GetChi2();
1692  if (fFriendTrack) {
1693  Int_t indexTRD[AliESDfriendTrack::kMaxTRDcluster];
1694  for (Int_t i=0;i<AliESDfriendTrack::kMaxTRDcluster;i++) indexTRD[i]=-2;
1695  for (Int_t i=0;i<6;i++) indexTRD[i]=t->GetTrackletIndex(i);
1696  fFriendTrack->SetTRDIndices(indexTRD,AliESDfriendTrack::kMaxTRDcluster);
1697  }
1698 
1699  //commented out by Xianguo
1700  //fTRDsignal=t->GetPIDsignal();
1701  }
1702  break;
1703  case kTRDbackup:
1704  if (!fOp) fOp=new AliExternalTrackParam(*t);
1705  else
1706  fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1708  break;
1709  case kTOFin:
1710  break;
1711  case kTOFout:
1712  break;
1713  case kTRDStop:
1714  break;
1715  case kHMPIDout:
1716  if (!fHMPIDp) fHMPIDp=new AliExternalTrackParam(*t);
1717  else
1718  fHMPIDp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
1719  break;
1720  default:
1721  AliError("Wrong flag !");
1722  return kFALSE;
1723  }
1724 
1725  return rc;
1726 }
1727 
1728 //_______________________________________________________________________
1729 void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
1730  //---------------------------------------------------------------------
1731  // This function returns external representation of the track parameters
1732  //---------------------------------------------------------------------
1733  x=GetX();
1734  for (Int_t i=0; i<5; i++) p[i]=GetParameter()[i];
1735 }
1736 
1737 //_______________________________________________________________________
1738 void AliESDtrack::GetExternalCovariance(Double_t cov[15]) const {
1739  //---------------------------------------------------------------------
1740  // This function returns external representation of the cov. matrix
1741  //---------------------------------------------------------------------
1742  for (Int_t i=0; i<15; i++) cov[i]=AliExternalTrackParam::GetCovariance()[i];
1743 }
1744 
1745 //_______________________________________________________________________
1747  (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1748  //---------------------------------------------------------------------
1749  // This function returns the constrained external track parameters
1750  //---------------------------------------------------------------------
1751  if (!fCp) return kFALSE;
1752  alpha=fCp->GetAlpha();
1753  x=fCp->GetX();
1754  for (Int_t i=0; i<5; i++) p[i]=fCp->GetParameter()[i];
1755  return kTRUE;
1756 }
1757 
1758 //_______________________________________________________________________
1759 Bool_t
1761  //---------------------------------------------------------------------
1762  // This function returns the constrained external cov. matrix
1763  //---------------------------------------------------------------------
1764  if (!fCp) return kFALSE;
1765  for (Int_t i=0; i<15; i++) c[i]=fCp->GetCovariance()[i];
1766  return kTRUE;
1767 }
1768 
1769 Bool_t
1771  (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1772  //---------------------------------------------------------------------
1773  // This function returns external representation of the track parameters
1774  // at the inner layer of TPC
1775  //---------------------------------------------------------------------
1776  if (!fIp) return kFALSE;
1777  alpha=fIp->GetAlpha();
1778  x=fIp->GetX();
1779  for (Int_t i=0; i<5; i++) p[i]=fIp->GetParameter()[i];
1780  return kTRUE;
1781 }
1782 
1783 Bool_t
1785  //---------------------------------------------------------------------
1786  // This function returns external representation of the cov. matrix
1787  // at the inner layer of TPC
1788  //---------------------------------------------------------------------
1789  if (!fIp) return kFALSE;
1790  for (Int_t i=0; i<15; i++) cov[i]=fIp->GetCovariance()[i];
1791  return kTRUE;
1792 }
1793 
1794 void
1796  //
1797  // This is a direct setter for the outer track parameters
1798  //
1799  SetStatus(flags);
1800  if (fOp) delete fOp;
1801  fOp=new AliExternalTrackParam(*p);
1802 }
1803 
1804 void
1806  //
1807  // This is a direct setter for the outer track parameters
1808  //
1809  SetStatus(flags);
1810  if (fHMPIDp) delete fHMPIDp;
1812 }
1813 
1814 Bool_t
1816  (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1817  //---------------------------------------------------------------------
1818  // This function returns external representation of the track parameters
1819  // at the inner layer of TRD
1820  //---------------------------------------------------------------------
1821  if (!fOp) return kFALSE;
1822  alpha=fOp->GetAlpha();
1823  x=fOp->GetX();
1824  for (Int_t i=0; i<5; i++) p[i]=fOp->GetParameter()[i];
1825  return kTRUE;
1826 }
1827 
1828 Bool_t
1830  (Double_t &alpha, Double_t &x, Double_t p[5]) const {
1831  //---------------------------------------------------------------------
1832  // This function returns external representation of the track parameters
1833  // at the inner layer of TRD
1834  //---------------------------------------------------------------------
1835  if (!fHMPIDp) return kFALSE;
1836  alpha=fHMPIDp->GetAlpha();
1837  x=fHMPIDp->GetX();
1838  for (Int_t i=0; i<5; i++) p[i]=fHMPIDp->GetParameter()[i];
1839  return kTRUE;
1840 }
1841 
1842 Bool_t
1844  //---------------------------------------------------------------------
1845  // This function returns external representation of the cov. matrix
1846  // at the inner layer of TRD
1847  //---------------------------------------------------------------------
1848  if (!fOp) return kFALSE;
1849  for (Int_t i=0; i<15; i++) cov[i]=fOp->GetCovariance()[i];
1850  return kTRUE;
1851 }
1852 
1853 Bool_t
1855  //---------------------------------------------------------------------
1856  // This function returns external representation of the cov. matrix
1857  // at the inner layer of TRD
1858  //---------------------------------------------------------------------
1859  if (!fHMPIDp) return kFALSE;
1860  for (Int_t i=0; i<15; i++) cov[i]=fHMPIDp->GetCovariance()[i];
1861  return kTRUE;
1862 }
1863 
1864 Int_t AliESDtrack::GetNcls(Int_t idet) const
1865 {
1866  // Get number of clusters by subdetector index
1867  //
1868  Int_t ncls = 0;
1869  switch(idet){
1870  case 0:
1871  ncls = fITSncls;
1872  break;
1873  case 1:
1874  ncls = fTPCncls;
1875  break;
1876  case 2:
1877  ncls = fTRDncls;
1878  break;
1879  case 3:
1880  if (fTOFindex != -1)
1881  ncls = 1;
1882  break;
1883  case 4: //PHOS
1884  break;
1885  case 5: //HMPID
1886  if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) {
1887  if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) {
1888  ncls = 1;
1889  }
1890  }
1891  break;
1892  default:
1893  break;
1894  }
1895  return ncls;
1896 }
1897 
1898 Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const
1899 {
1900  // Get cluster index array by subdetector index
1901  //
1902  Int_t ncls = 0;
1903  switch(idet){
1904  case 0:
1905  ncls = GetITSclusters(idx);
1906  break;
1907  case 1:
1908  ncls = GetTPCclusters(idx);
1909  break;
1910  case 2:
1911  ncls = GetTRDclusters(idx);
1912  break;
1913  case 3:
1914  if (fTOFindex != -1) {
1915  idx[0] = fTOFindex;
1916  ncls = 1;
1917  }
1918  break;
1919  case 4: //PHOS
1920  break;
1921  case 5:
1922  if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) {
1923  if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) {
1924  idx[0] = GetHMPIDcluIdx();
1925  ncls = 1;
1926  }
1927  }
1928  break;
1929  case 6: //EMCAL
1930  break;
1931  default:
1932  break;
1933  }
1934  return ncls;
1935 }
1936 
1937 //_______________________________________________________________________
1938 void AliESDtrack::GetIntegratedTimes(Double_t *times, Int_t nspec) const
1939 {
1940  // get integrated time for requested N species
1941  if (nspec<1) return;
1942  if(fNtofClusters>0 && GetESDEvent()){
1943  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
1944  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
1945  //
1946  for(int i=tofcl->GetNMatchableTracks();i--;){
1947  if(tofcl->GetTrackIndex(i) == GetID()) {
1948  for (int j=nspec; j--;) times[j]=tofcl->GetIntegratedTime(j,i);
1949  return;
1950  }
1951  }
1952  }
1953  else if(fNtofClusters>0)
1954  AliInfo("No AliESDEvent available here!\n");
1955 
1956  // Returns the array with integrated times for each particle hypothesis
1957  if(fTrackTime)
1958  for (int i=nspec; i--;) times[i]=fTrackTime[i];
1959  else
1960 // The line below is wrong since it does not honor the nspec value
1961 // The "times" array may have only AliPID::kSPECIES size, as called by:
1962 // AliESDpidCuts::AcceptTrack()
1963 // for (int i=AliPID::kSPECIESC; i--;) times[i]=0.0;
1964  for (int i=nspec; i--;) times[i]=0.0;
1965 }
1966 //_______________________________________________________________________
1968  Int_t index = -1;
1969  if(fNtofClusters>0 && GetESDEvent()){
1970  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
1971  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
1972 
1973  for(Int_t i=0;i < tofcl->GetNMatchableTracks();i++){
1974  if(tofcl->GetTrackIndex(i) == GetID()) index = i;
1975  }
1976 
1977  if(fNtofClusters>0 && index > -1)
1978  return tofcl->GetLength(index);
1979  }
1980  else if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
1981 
1982  return fTrackLength;
1983 }
1984 
1985 //_______________________________________________________________________
1986 void AliESDtrack::SetIntegratedTimes(const Double_t *times)
1987 {
1988  // Sets the array with integrated times for each particle hypotesis
1989  if(!fTrackTime) fTrackTime = new Double32_t[AliPID::kSPECIESC];
1990  for (int i=AliPID::kSPECIESC; i--;) fTrackTime[i]=times[i];
1991 }
1992 
1993 //_______________________________________________________________________
1994 void AliESDtrack::SetITSpid(const Double_t *p)
1995 {
1996  // Sets values for the probability of each particle type (in ITS)
1997  if (!fITSr) fITSr = new Double32_t[AliPID::kSPECIESC];
2000 }
2001 
2002 //_______________________________________________________________________
2003 void AliESDtrack::GetITSpid(Double_t *p) const {
2004  // Gets the probability of each particle type (in ITS)
2005  for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i] = fITSr ? fITSr[i] : 0;
2006 }
2007 
2008 //_______________________________________________________________________
2009 Char_t AliESDtrack::GetITSclusters(Int_t *idx) const {
2010  //---------------------------------------------------------------------
2011  // This function returns indices of the assgined ITS clusters
2012  //---------------------------------------------------------------------
2013  if (idx && fFriendTrack) {
2014  Int_t *index=fFriendTrack->GetITSindices();
2015  for (Int_t i=0; i<AliESDfriendTrack::kMaxITScluster; i++) {
2016  if ( (i>=fITSncls) && (i<6) ) idx[i]=-1;
2017  else {
2018  if (index) {
2019  idx[i]=index[i];
2020  }
2021  else idx[i]= -2;
2022  }
2023  }
2024  }
2025  return fITSncls;
2026 }
2027 
2028 //_______________________________________________________________________
2029 Bool_t AliESDtrack::GetITSModuleIndexInfo(Int_t ilayer,Int_t &idet,Int_t &status,
2030  Float_t &xloc,Float_t &zloc) const {
2031  //----------------------------------------------------------------------
2032  // This function encodes in the module number also the status of cluster association
2033  // "status" can have the following values:
2034  // 1 "found" (cluster is associated),
2035  // 2 "dead" (module is dead from OCDB),
2036  // 3 "skipped" (module or layer forced to be skipped),
2037  // 4 "outinz" (track out of z acceptance),
2038  // 5 "nocls" (no clusters in the road),
2039  // 6 "norefit" (cluster rejected during refit),
2040  // 7 "deadzspd" (holes in z in SPD)
2041  // Also given are the coordinates of the crossing point of track and module
2042  // (in the local module ref. system)
2043  // WARNING: THIS METHOD HAS TO BE SYNCHRONIZED WITH AliITStrackV2::GetModuleIndexInfo()!
2044  //----------------------------------------------------------------------
2045 
2046  if(fITSModule[ilayer]==-1) {
2047  idet = -1;
2048  status=0;
2049  xloc=-99.; zloc=-99.;
2050  return kFALSE;
2051  }
2052 
2053  Int_t module = fITSModule[ilayer];
2054 
2055  idet = Int_t(module/1000000);
2056 
2057  module -= idet*1000000;
2058 
2059  status = Int_t(module/100000);
2060 
2061  module -= status*100000;
2062 
2063  Int_t signs = Int_t(module/10000);
2064 
2065  module-=signs*10000;
2066 
2067  Int_t xInt = Int_t(module/100);
2068  module -= xInt*100;
2069 
2070  Int_t zInt = module;
2071 
2072  if(signs==1) { xInt*=1; zInt*=1; }
2073  if(signs==2) { xInt*=1; zInt*=-1; }
2074  if(signs==3) { xInt*=-1; zInt*=1; }
2075  if(signs==4) { xInt*=-1; zInt*=-1; }
2076 
2077  xloc = 0.1*(Float_t)xInt;
2078  zloc = 0.1*(Float_t)zInt;
2079 
2080  if(status==4) idet = -1;
2081 
2082  return kTRUE;
2083 }
2084 
2085 //_______________________________________________________________________
2086 UShort_t AliESDtrack::GetTPCclusters(Int_t *idx) const {
2087  //---------------------------------------------------------------------
2088  // This function returns indices of the assgined ITS clusters
2089  //---------------------------------------------------------------------
2090  if (idx && fFriendTrack) {
2091  Int_t *index=fFriendTrack->GetTPCindices();
2092 
2093  if (index){
2094  memcpy(idx,index,sizeof(int)*AliESDfriendTrack::kMaxTPCcluster);
2095  //RS for (Int_t i=0; i<AliESDfriendTrack::kMaxTPCcluster; i++) idx[i]=index[i];
2096  }
2097  else {
2098  for (Int_t i=0; i<AliESDfriendTrack::kMaxTPCcluster; i++) idx[i]=-2;
2099  }
2100  }
2101  return fTPCncls;
2102 }
2103 
2104 //_______________________________________________________________________
2106 {
2107  // This function calls GetTPCClusterInfo with some default parameters which are used in the track selection and caches the outcome
2108  // because GetTPCClusterInfo is quite time-consuming
2109 
2110  if (fCacheNCrossedRows > -1)
2111  return fCacheNCrossedRows;
2112 
2114  return fCacheNCrossedRows;
2115 }
2116 
2117 //_______________________________________________________________________
2118 Float_t AliESDtrack::GetTPCClusterInfo(Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1, Int_t bitType ) const
2119 {
2120  //
2121  // TPC cluster information
2122  // type 0: get fraction of found/findable clusters with neighbourhood definition
2123  // 1: findable clusters with neighbourhood definition
2124  // 2: found clusters
2125  // 3: get fraction of found/findable clusters with neighbourhood definition - requiring before and after row
2126  // 4: findable clusters with neighbourhood definition - before and after row
2127  // bitType:
2128  // 0 - all cluster used
2129  // 1 - clusters used for the kalman update
2130  // definition of findable clusters:
2131  // a cluster is defined as findable if there is another cluster
2132  // within +- nNeighbours pad rows. The idea is to overcome threshold
2133  // effects with a very simple algorithm.
2134  //
2135 
2136 
2137  Int_t found=0;
2138  Int_t findable=0;
2139  Int_t last=-nNeighbours;
2140  const TBits & clusterMap = (bitType%2==0) ? fTPCClusterMap : fTPCFitMap;
2141 
2142 
2143  Int_t upperBound=clusterMap.GetNbits();
2144  if (upperBound>row1) upperBound=row1;
2145  if (type>=3){ // requires cluster before and after
2146  for (Int_t i=row0; i<upperBound; ++i){
2147  Int_t beforeAfter=0;
2148  if (clusterMap[i]) {
2149  last=i;
2150  ++found;
2151  ++findable;
2152  continue;
2153  }
2154  if ((i-last)<=nNeighbours) {
2155  ++beforeAfter;
2156  }
2157  //look to nNeighbours after
2158  for (Int_t j=i+1; j<i+1+nNeighbours; ++j){
2159  if (clusterMap[j]){
2160  ++beforeAfter;
2161  break;
2162  }
2163  }
2164  if (beforeAfter>1) ++findable;
2165  }
2166  if (type==3) return Float_t(found)/Float_t(TMath::Max(findable,1));
2167  if (type==4) return findable;
2168  return 0;
2169  }
2170 
2171  for (Int_t i=row0; i<upperBound; ++i){
2172  //look to current row
2173  if (clusterMap[i]) {
2174  last=i;
2175  ++found;
2176  ++findable;
2177  continue;
2178  }
2179  //look to nNeighbours before
2180  if ((i-last)<=nNeighbours) {
2181  ++findable;
2182  continue;
2183  }
2184  //look to nNeighbours after
2185  for (Int_t j=i+1; j<i+1+nNeighbours; ++j){
2186  if (clusterMap[j]){
2187  ++findable;
2188  break;
2189  }
2190  }
2191  }
2192  if (type==2) return found;
2193  if (type==1) return findable;
2194 
2195  if (type==0){
2196  Float_t fraction=0;
2197  if (findable>0)
2198  fraction=(Float_t)found/(Float_t)findable;
2199  else
2200  fraction=0;
2201  return fraction;
2202  }
2203  return 0; // undefined type - default value
2204 }
2205 
2206 //_______________________________________________________________________
2207 Float_t AliESDtrack::GetTPCClusterDensity(Int_t nNeighbours/*=3*/, Int_t type/*=0*/, Int_t row0, Int_t row1, Int_t bitType ) const
2208 {
2209  //
2210  // TPC cluster density - only rows where signal before and after given row are used
2211  // - slower function
2212  // type 0: get fraction of found/findable clusters with neighbourhood definition
2213  // 1: findable clusters with neighbourhood definition
2214  // 2: found clusters
2215  // bitType:
2216  // 0 - all cluster used
2217  // 1 - clusters used for the kalman update
2218  // definition of findable clusters:
2219  // a cluster is defined as findable if there is another cluster
2220  // within +- nNeighbours pad rows. The idea is to overcome threshold
2221  // effects with a very simple algorithm.
2222  //
2223  Int_t found=0;
2224  Int_t findable=0;
2225  // Int_t last=-nNeighbours;
2226  const TBits & clusterMap = (bitType%2==0) ? fTPCClusterMap : fTPCFitMap;
2227  Int_t upperBound=clusterMap.GetNbits();
2228  if (upperBound>row1) upperBound=row1;
2229  for (Int_t i=row0; i<upperBound; ++i){
2230  Bool_t isUp=kFALSE;
2231  Bool_t isDown=kFALSE;
2232  for (Int_t idelta=1; idelta<=nNeighbours; idelta++){
2233  if (i-idelta>=0 && clusterMap[i-idelta]) isDown=kTRUE;
2234  if (i+idelta<upperBound && clusterMap[i+idelta]) isUp=kTRUE;
2235  }
2236  if (isUp&&isDown){
2237  ++findable;
2238  if (clusterMap[i]) ++found;
2239  }
2240  }
2241  if (type==2) return found;
2242  if (type==1) return findable;
2243 
2244  if (type==0){
2245  Float_t fraction=0;
2246  if (findable>0)
2247  fraction=(Float_t)found/(Float_t)findable;
2248  else
2249  fraction=0;
2250  return fraction;
2251  }
2252  return 0; // undefined type - default value
2253 }
2254 
2255 
2256 
2257 
2258 //_______________________________________________________________________
2259 Double_t AliESDtrack::GetTPCdensity(Int_t row0, Int_t row1) const{
2260  //
2261  // GetDensity of the clusters on given region between row0 and row1
2262  // Dead zone effect takin into acoount
2263  //
2264  if (!fFriendTrack) return 0.0;
2265  Int_t good = 0;
2266  Int_t found = 0;
2267  //
2268  Int_t *index=fFriendTrack->GetTPCindices();
2269  for (Int_t i=row0;i<=row1;i++){
2270  Int_t idx = index[i];
2271  if (idx!=-1) good++; // track outside of dead zone
2272  if (idx>0) found++;
2273  }
2274  Float_t density=0.5;
2275  if (good>TMath::Max((row1-row0)*0.5,0.0)) density = Float_t(found)/Float_t(good);
2276  return density;
2277 }
2278 
2279 //_______________________________________________________________________
2280 void AliESDtrack::SetTPCpid(const Double_t *p) {
2281  // Sets values for the probability of each particle type (in TPC)
2282  if (!fTPCr) fTPCr = new Double32_t[AliPID::kSPECIES];
2285 }
2286 
2287 //_______________________________________________________________________
2288 void AliESDtrack::GetTPCpid(Double_t *p) const {
2289  // Gets the probability of each particle type (in TPC)
2290  for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i] = fTPCr ? fTPCr[i] : 0;
2291 }
2292 
2293 //_______________________________________________________________________
2294 UChar_t AliESDtrack::GetTRDclusters(Int_t *idx) const {
2295  //---------------------------------------------------------------------
2296  // This function returns indices of the assgined TRD clusters
2297  //---------------------------------------------------------------------
2298  if (idx && fFriendTrack) {
2299  Int_t *index=fFriendTrack->GetTRDindices();
2300 
2301  if (index) {
2302  for (Int_t i=0; i<AliESDfriendTrack::kMaxTRDcluster; i++) idx[i]=index[i];
2303  }
2304  else {
2305  for (Int_t i=0; i<AliESDfriendTrack::kMaxTRDcluster; i++) idx[i]=-2;
2306  }
2307  }
2308  return fTRDncls;
2309 }
2310 
2311 //_______________________________________________________________________
2312 UChar_t AliESDtrack::GetTRDtracklets(Int_t *idx) const {
2313 //
2314 // This function returns the number of TRD tracklets used in tracking
2315 // and it fills the indices of these tracklets in the array "idx" as they
2316 // are registered in the TRD track list.
2317 //
2318 // Caution :
2319 // 1. The idx array has to be allocated with a size >= AliESDtrack::kTRDnPlanes
2320 // 2. The idx array store not only the index but also the layer of the tracklet.
2321 // Therefore tracks with TRD gaps contain default values for indices [-1]
2322 
2323  if (!fFriendTrack) return 0;
2324  if (!idx) return GetTRDntracklets();
2325  Int_t *index=fFriendTrack->GetTRDindices();
2326  Int_t n = 0;
2327  for (Int_t i=0; i<kTRDnPlanes; i++){
2328  if (index){
2329  if(index[i]>=0) n++;
2330  idx[i]=index[i];
2331  }
2332  else idx[i] = -2;
2333  }
2334  return n;
2335 }
2336 
2337 //_______________________________________________________________________
2338 void AliESDtrack::SetTRDpid(const Double_t *p) {
2339  // Sets values for the probability of each particle type (in TRD)
2340  if (!fTRDr) fTRDr = new Double32_t[AliPID::kSPECIES];
2343 }
2344 
2345 //_______________________________________________________________________
2346 void AliESDtrack::GetTRDpid(Double_t *p) const {
2347  // Gets the probability of each particle type (in TRD)
2348  for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i] = fTRDr ? fTRDr[i]:0;
2349 }
2350 
2351 //_______________________________________________________________________
2352 void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
2353 {
2354  // Sets the probability of particle type iSpecies to p (in TRD)
2355  if (!fTRDr) {
2356  fTRDr = new Double32_t[AliPID::kSPECIES];
2357  for (Int_t i=AliPID::kSPECIES; i--;) fTRDr[i] = 0;
2358  }
2359  fTRDr[iSpecies] = p;
2360 }
2361 
2362 Double_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
2363 {
2364  // Returns the probability of particle type iSpecies (in TRD)
2365  return fTRDr ? fTRDr[iSpecies] : 0;
2366 }
2367 
2368 //____________________________________________________
2370 {
2371  // built in backward compatibility
2372  Int_t idx = fTRDnSlices - (kTRDnPlanes<<1);
2373  return idx<18 ? fTRDnSlices/kTRDnPlanes : idx/kTRDnPlanes;
2374 }
2375 
2376 //____________________________________________________
2377 Double_t AliESDtrack::GetTRDmomentum(Int_t plane, Double_t *sp) const
2378 {
2379 //Returns momentum estimation and optional its error (sp)
2380 // in TRD layer "plane".
2381 
2382  if (!fTRDnSlices) {
2383  AliDebug(2, "No TRD info allocated for this track.");
2384  return -1.;
2385  }
2386  if ((plane<0) || (plane>=kTRDnPlanes)) {
2387  AliWarning(Form("Request for TRD plane[%d] outside range.", plane));
2388  return -1.;
2389  }
2390 
2391  Int_t idx = fTRDnSlices-(kTRDnPlanes<<1)+plane;
2392  // Protection for backward compatibility
2393  if(idx<(GetNumberOfTRDslices()*kTRDnPlanes)) return -1.;
2394 
2395  if(sp) (*sp) = fTRDslices[idx+kTRDnPlanes];
2396  return fTRDslices[idx];
2397 }
2398 
2399 //____________________________________________________
2400 Double_t AliESDtrack::GetTRDslice(Int_t plane, Int_t slice) const {
2401  //Gets the charge from the slice of the plane
2402 
2403  if(!fTRDslices) {
2404  //AliError("No TRD slices allocated for this track !");
2405  return -1.;
2406  }
2407  if ((plane<0) || (plane>=kTRDnPlanes)) {
2408  AliError("Info for TRD plane not available !");
2409  return -1.;
2410  }
2411  Int_t ns=GetNumberOfTRDslices();
2412  if ((slice<-1) || (slice>=ns)) {
2413  //AliError("Wrong TRD slice !");
2414  return -1.;
2415  }
2416 
2417  if(slice>=0) return fTRDslices[plane*ns + slice];
2418 
2419  // return average of the dEdx measurements
2420  Double_t q=0.; Double32_t *s = &fTRDslices[plane*ns];
2421  for (Int_t i=0; i<ns; i++, s++) if((*s)>0.) q+=(*s);
2422  return q/ns;
2423 }
2424 
2425 //____________________________________________________
2427  //Sets the number of slices used for PID
2428  if (fTRDnSlices) return;
2429 
2430  fTRDnSlices=n;
2431  fTRDslices=new Double32_t[fTRDnSlices];
2432 
2433  // set-up correctly the allocated memory
2434  memset(fTRDslices, 0, n*sizeof(Double32_t));
2435  for (Int_t i=GetNumberOfTRDslices(); i--;) fTRDslices[i]=-1.;
2436 }
2437 
2438 //____________________________________________________
2439 void AliESDtrack::SetTRDslice(Double_t q, Int_t plane, Int_t slice) {
2440  //Sets the charge q in the slice of the plane
2441  if(!fTRDslices) {
2442  AliError("No TRD slices allocated for this track !");
2443  return;
2444  }
2445  if ((plane<0) || (plane>=kTRDnPlanes)) {
2446  AliError("Info for TRD plane not allocated !");
2447  return;
2448  }
2449  Int_t ns=GetNumberOfTRDslices();
2450  if ((slice<0) || (slice>=ns)) {
2451  AliError(Form("Wrong TRD slice %d/%d, NSlices=%d",plane,slice,ns));
2452  return;
2453  }
2454  Int_t n=plane*ns + slice;
2455  fTRDslices[n]=q;
2456 }
2457 
2458 
2459 //____________________________________________________
2460 void AliESDtrack::SetTRDmomentum(Double_t p, Int_t plane, Double_t *sp)
2461 {
2462  if(!fTRDslices) {
2463  AliError("No TRD slices allocated for this track !");
2464  return;
2465  }
2466  if ((plane<0) || (plane>=kTRDnPlanes)) {
2467  AliError("Info for TRD plane not allocated !");
2468  return;
2469  }
2470 
2471  Int_t idx = fTRDnSlices-(kTRDnPlanes<<1)+plane;
2472  // Protection for backward compatibility
2473  if(idx<GetNumberOfTRDslices()*kTRDnPlanes) return;
2474 
2475  if(sp) fTRDslices[idx+kTRDnPlanes] = (*sp);
2476  fTRDslices[idx] = p;
2477 }
2478 
2479 
2480 //_______________________________________________________________________
2481 void AliESDtrack::SetTOFpid(const Double_t *p) {
2482  // Sets the probability of each particle type (in TOF)
2483  if (!fTOFr) fTOFr = new Double32_t[AliPID::kSPECIES];
2486 }
2487 
2488 //_______________________________________________________________________
2489 void AliESDtrack::SetTOFLabel(const Int_t *p) {
2490 
2491  if(fNtofClusters>0){
2492  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
2493  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
2494  AliESDTOFHit* hit = tofcl->GetTOFHit(0);
2495 
2496  if(hit) hit->SetTOFLabel(p);
2497  }
2498  else{
2499  // Sets (in TOF)
2500  if(!fTOFLabel) fTOFLabel = new Int_t[3];
2501  for (Int_t i=0; i<3; i++) fTOFLabel[i]=p[i];
2502  }
2503 }
2504 
2505 //_______________________________________________________________________
2506 void AliESDtrack::GetTOFpid(Double_t *p) const {
2507  // Gets probabilities of each particle type (in TOF)
2508  for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i] = fTOFr ? fTOFr[i]:0;
2509 }
2510 
2511 //_______________________________________________________________________
2512 void AliESDtrack::GetTOFLabel(Int_t *p) const {
2513  // Gets (in TOF)
2514  if(fNtofClusters>0){
2515  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
2516  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
2517 
2518  for (Int_t i=0; i<3; i++) p[i]=tofcl->GetLabel(i);
2519  }
2520  else{
2521  if(fTOFLabel) for (Int_t i=0; i<3; i++) p[i]=fTOFLabel[i];
2522  else for (int i=3;i--;) p[i] = -1;
2523  }
2524 }
2525 
2526 //_______________________________________________________________________
2527 void AliESDtrack::GetTOFInfo(Float_t *info) const {
2528  // Gets (in TOF)
2529  for (Int_t i=0; i<10; i++) info[i]=fTOFInfo[i];
2530 }
2531 
2532 //_______________________________________________________________________
2534  // Gets (in TOF)
2535  for (Int_t i=0; i<10; i++) fTOFInfo[i]=info[i];
2536 }
2537 
2538 
2539 
2540 //_______________________________________________________________________
2541 void AliESDtrack::SetHMPIDpid(const Double_t *p) {
2542  // Sets the probability of each particle type (in HMPID)
2543  if (!fHMPIDr) fHMPIDr = new Double32_t[AliPID::kSPECIES];
2546 }
2547 
2548 //_______________________________________________________________________
2550  if(fTPCdEdxInfo) delete fTPCdEdxInfo;
2551  fTPCdEdxInfo = dEdxInfo;
2552 }
2553 
2554 //_______________________________________________________________________
2555 void AliESDtrack::GetHMPIDpid(Double_t *p) const {
2556  // Gets probabilities of each particle type (in HMPID)
2557  for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i] = fHMPIDr ? fHMPIDr[i]:0;
2558 }
2559 
2560 
2561 
2562 //_______________________________________________________________________
2563 void AliESDtrack::SetESDpid(const Double_t *p) {
2564  // Sets the probability of each particle type for the ESD track
2565  if (!fR) fR = new Double32_t[AliPID::kSPECIES];
2568 }
2569 
2570 //_______________________________________________________________________
2571 void AliESDtrack::GetESDpid(Double_t *p) const {
2572  // Gets probability of each particle type for the ESD track
2573  for (Int_t i=0; i<AliPID::kSPECIES; i++) p[i] = fR ? fR[i]:0;
2574 }
2575 
2576 //_______________________________________________________________________
2578 Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
2579  //
2580  // Try to relate the TPC-only track parameters to the vertex "vtx",
2581  // if the (rough) transverse impact parameter is not bigger then "maxd".
2582  // Magnetic field is "b" (kG).
2583  //
2584  // a) The TPC-only paramters are extapolated to the DCA to the vertex.
2585  // b) The impact parameters and their covariance matrix are calculated.
2586  // c) An attempt to constrain the TPC-only params to the vertex is done.
2587  // The constrained params are returned via "cParam".
2588  //
2589  // In the case of success, the returned value is kTRUE
2590  // otherwise, it's kFALSE)
2591  //
2592 
2593  if (!fTPCInner) return kFALSE;
2594  if (!vtx) return kFALSE;
2595 
2596  Double_t dz[2],cov[3];
2597  if (!fTPCInner->PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
2598 
2599  fdTPC = dz[0];
2600  fzTPC = dz[1];
2601  fCddTPC = cov[0];
2602  fCdzTPC = cov[1];
2603  fCzzTPC = cov[2];
2604 
2605  Double_t covar[6]; vtx->GetCovarianceMatrix(covar);
2606  Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
2607  Double_t c[3]={covar[2],0.,covar[5]};
2608 
2609  Double_t chi2=GetPredictedChi2(p,c);
2610  if (chi2>kVeryBig) return kFALSE;
2611 
2612  fCchi2TPC=chi2;
2613 
2614  if (!cParam) return kTRUE;
2615 
2616  *cParam = *fTPCInner;
2617  if (!cParam->Update(p,c)) return kFALSE;
2618 
2619  return kTRUE;
2620 }
2621 
2622 //_______________________________________________________________________
2624 Double_t b[3], Double_t maxd, AliExternalTrackParam *cParam) {
2625  //
2626  // Try to relate the TPC-only track parameters to the vertex "vtx",
2627  // if the (rough) transverse impact parameter is not bigger then "maxd".
2628  //
2629  // All three components of the magnetic field ,"b[3]" (kG),
2630  // are taken into account.
2631  //
2632  // a) The TPC-only paramters are extapolated to the DCA to the vertex.
2633  // b) The impact parameters and their covariance matrix are calculated.
2634  // c) An attempt to constrain the TPC-only params to the vertex is done.
2635  // The constrained params are returned via "cParam".
2636  //
2637  // In the case of success, the returned value is kTRUE
2638  // otherwise, it's kFALSE)
2639  //
2640 
2641  if (!fTPCInner) return kFALSE;
2642  if (!vtx) return kFALSE;
2643 
2644  Double_t dz[2],cov[3];
2645  if (!fTPCInner->PropagateToDCABxByBz(vtx, b, maxd, dz, cov)) return kFALSE;
2646 
2647  fdTPC = dz[0];
2648  fzTPC = dz[1];
2649  fCddTPC = cov[0];
2650  fCdzTPC = cov[1];
2651  fCzzTPC = cov[2];
2652 
2653  Double_t covar[6]; vtx->GetCovarianceMatrix(covar);
2654  Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
2655  Double_t c[3]={covar[2],0.,covar[5]};
2656 
2657  Double_t chi2=GetPredictedChi2(p,c);
2658  if (chi2>kVeryBig) return kFALSE;
2659 
2660  fCchi2TPC=chi2;
2661 
2662  if (!cParam) return kTRUE;
2663 
2664  *cParam = *fTPCInner;
2665  if (!cParam->Update(p,c)) return kFALSE;
2666 
2667  return kTRUE;
2668 }
2669 
2670 //_______________________________________________________________________
2672 Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
2673  //
2674  // Try to relate this track to the vertex "vtx",
2675  // if the (rough) transverse impact parameter is not bigger then "maxd".
2676  // Magnetic field is "b" (kG).
2677  //
2678  // a) The track gets extapolated to the DCA to the vertex.
2679  // b) The impact parameters and their covariance matrix are calculated.
2680  // c) An attempt to constrain this track to the vertex is done.
2681  // The constrained params are returned via "cParam".
2682  //
2683  // In the case of success, the returned value is kTRUE
2684  // (otherwise, it's kFALSE)
2685  //
2686 
2687  if (!vtx) return kFALSE;
2688 
2689  Double_t dz[2],cov[3];
2690  if (!PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
2691 
2692  fD = dz[0];
2693  fZ = dz[1];
2694  fCdd = cov[0];
2695  fCdz = cov[1];
2696  fCzz = cov[2];
2697 
2698  Double_t covar[6]; vtx->GetCovarianceMatrix(covar);
2699  Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
2700  Double_t c[3]={covar[2],0.,covar[5]};
2701 
2702  Double_t chi2=GetPredictedChi2(p,c);
2703  if (chi2>kVeryBig) return kFALSE;
2704 
2705  fCchi2=chi2;
2706 
2707 
2708  //--- Could now these lines be removed ? ---
2709  delete fCp;
2710  fCp=new AliExternalTrackParam(*this);
2711 
2712  if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;}
2713  //----------------------------------------
2714 
2715  // fVertexID = vtx->GetID(); //No GetID() in AliVVertex
2716 
2717  if (!cParam) return kTRUE;
2718 
2719  *cParam = *this;
2720  if (!cParam->Update(p,c)) return kFALSE;
2721 
2722  return kTRUE;
2723 }
2724 
2725 //_______________________________________________________________________
2727 Double_t b[3], Double_t maxd, AliExternalTrackParam *cParam) {
2728  //
2729  // Try to relate this track to the vertex "vtx",
2730  // if the (rough) transverse impact parameter is not bigger then "maxd".
2731  // Magnetic field is "b" (kG).
2732  //
2733  // a) The track gets extapolated to the DCA to the vertex.
2734  // b) The impact parameters and their covariance matrix are calculated.
2735  // c) An attempt to constrain this track to the vertex is done.
2736  // The constrained params are returned via "cParam".
2737  //
2738  // In the case of success, the returned value is kTRUE
2739  // (otherwise, it's kFALSE)
2740  //
2741 
2742  if (!vtx) return kFALSE;
2743 
2744  Double_t dz[2],cov[3];
2745  if (!PropagateToDCABxByBz(vtx, b, maxd, dz, cov)) return kFALSE;
2746 
2747  fD = dz[0];
2748  fZ = dz[1];
2749  fCdd = cov[0];
2750  fCdz = cov[1];
2751  fCzz = cov[2];
2752 
2753  Double_t covar[6]; vtx->GetCovarianceMatrix(covar);
2754  Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
2755  Double_t c[3]={covar[2],0.,covar[5]};
2756 
2757  Double_t chi2=GetPredictedChi2(p,c);
2758  if (chi2>kVeryBig) return kFALSE;
2759 
2760  fCchi2=chi2;
2761 
2762 
2763  //--- Could now these lines be removed ? ---
2764  delete fCp;
2765  fCp=new AliExternalTrackParam(*this);
2766 
2767  if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;}
2768  //----------------------------------------
2769 
2770  // fVertexID = vtx->GetID(); // No GetID in AliVVertex
2771 
2772  if (!cParam) return kTRUE;
2773 
2774  *cParam = *this;
2775  if (!cParam->Update(p,c)) return kFALSE;
2776 
2777  return kTRUE;
2778 }
2779 
2780 
2781 
2782 
2783 
2784 
2785 
2786 
2787 
2788 
2789 //_______________________________________________________________________
2791 Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
2792  //
2793  // Try to relate the TPC-only track parameters to the vertex "vtx",
2794  // if the (rough) transverse impact parameter is not bigger then "maxd".
2795  // Magnetic field is "b" (kG).
2796  //
2797  // a) The TPC-only paramters are extapolated to the DCA to the vertex.
2798  // b) The impact parameters and their covariance matrix are calculated.
2799  // c) An attempt to constrain the TPC-only params to the vertex is done.
2800  // The constrained params are returned via "cParam".
2801  //
2802  // In the case of success, the returned value is kTRUE
2803  // otherwise, it's kFALSE)
2804  //
2805 
2806  if (!fTPCInner) return kFALSE;
2807  if (!vtx) return kFALSE;
2808 
2809  Double_t dz[2],cov[3];
2810  if (!fTPCInner->PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
2811 
2812  fdTPC = dz[0];
2813  fzTPC = dz[1];
2814  fCddTPC = cov[0];
2815  fCdzTPC = cov[1];
2816  fCzzTPC = cov[2];
2817 
2818  Double_t covar[6]; vtx->GetCovMatrix(covar);
2819  Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
2820  Double_t c[3]={covar[2],0.,covar[5]};
2821 
2822  Double_t chi2=GetPredictedChi2(p,c);
2823  if (chi2>kVeryBig) return kFALSE;
2824 
2825  fCchi2TPC=chi2;
2826 
2827  if (!cParam) return kTRUE;
2828 
2829  *cParam = *fTPCInner;
2830  if (!cParam->Update(p,c)) return kFALSE;
2831 
2832  return kTRUE;
2833 }
2834 
2835 //_______________________________________________________________________
2837 Double_t b[3], Double_t maxd, AliExternalTrackParam *cParam) {
2838  //
2839  // Try to relate the TPC-only track parameters to the vertex "vtx",
2840  // if the (rough) transverse impact parameter is not bigger then "maxd".
2841  //
2842  // All three components of the magnetic field ,"b[3]" (kG),
2843  // are taken into account.
2844  //
2845  // a) The TPC-only paramters are extapolated to the DCA to the vertex.
2846  // b) The impact parameters and their covariance matrix are calculated.
2847  // c) An attempt to constrain the TPC-only params to the vertex is done.
2848  // The constrained params are returned via "cParam".
2849  //
2850  // In the case of success, the returned value is kTRUE
2851  // otherwise, it's kFALSE)
2852  //
2853 
2854  if (!fTPCInner) return kFALSE;
2855  if (!vtx) return kFALSE;
2856 
2857  Double_t dz[2],cov[3];
2858  if (!fTPCInner->PropagateToDCABxByBz(vtx, b, maxd, dz, cov)) return kFALSE;
2859 
2860  fdTPC = dz[0];
2861  fzTPC = dz[1];
2862  fCddTPC = cov[0];
2863  fCdzTPC = cov[1];
2864  fCzzTPC = cov[2];
2865 
2866  Double_t covar[6]; vtx->GetCovMatrix(covar);
2867  Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
2868  Double_t c[3]={covar[2],0.,covar[5]};
2869 
2870  Double_t chi2=GetPredictedChi2(p,c);
2871  if (chi2>kVeryBig) return kFALSE;
2872 
2873  fCchi2TPC=chi2;
2874 
2875  if (!cParam) return kTRUE;
2876 
2877  *cParam = *fTPCInner;
2878  if (!cParam->Update(p,c)) return kFALSE;
2879 
2880  return kTRUE;
2881 }
2882 
2883 //_______________________________________________________________________
2885 Double_t b, Double_t maxd, AliExternalTrackParam *cParam) {
2886  //
2887  // Try to relate this track to the vertex "vtx",
2888  // if the (rough) transverse impact parameter is not bigger then "maxd".
2889  // Magnetic field is "b" (kG).
2890  //
2891  // a) The track gets extapolated to the DCA to the vertex.
2892  // b) The impact parameters and their covariance matrix are calculated.
2893  // c) An attempt to constrain this track to the vertex is done.
2894  // The constrained params are returned via "cParam".
2895  //
2896  // In the case of success, the returned value is kTRUE
2897  // (otherwise, it's kFALSE)
2898  //
2899 
2900  if (!vtx) return kFALSE;
2901 
2902  Double_t dz[2],cov[3];
2903  if (!PropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE;
2904 
2905  fD = dz[0];
2906  fZ = dz[1];
2907  fCdd = cov[0];
2908  fCdz = cov[1];
2909  fCzz = cov[2];
2910 
2911  Double_t covar[6]; vtx->GetCovMatrix(covar);
2912  Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
2913  Double_t c[3]={covar[2],0.,covar[5]};
2914 
2915  Double_t chi2=GetPredictedChi2(p,c);
2916  if (chi2>kVeryBig) return kFALSE;
2917 
2918  fCchi2=chi2;
2919 
2920 
2921  //--- Could now these lines be removed ? ---
2922  delete fCp;
2923  fCp=new AliExternalTrackParam(*this);
2924 
2925  if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;}
2926  //----------------------------------------
2927 
2928  fVertexID = vtx->GetID();
2929 
2930  if (!cParam) return kTRUE;
2931 
2932  *cParam = *this;
2933  if (!cParam->Update(p,c)) return kFALSE;
2934 
2935  return kTRUE;
2936 }
2937 
2938 //_______________________________________________________________________
2940 Double_t b[3], Double_t maxd, AliExternalTrackParam *cParam) {
2941  //
2942  // Try to relate this track to the vertex "vtx",
2943  // if the (rough) transverse impact parameter is not bigger then "maxd".
2944  // Magnetic field is "b" (kG).
2945  //
2946  // a) The track gets extapolated to the DCA to the vertex.
2947  // b) The impact parameters and their covariance matrix are calculated.
2948  // c) An attempt to constrain this track to the vertex is done.
2949  // The constrained params are returned via "cParam".
2950  //
2951  // In the case of success, the returned value is kTRUE
2952  // (otherwise, it's kFALSE)
2953  //
2954 
2955  if (!vtx) return kFALSE;
2956 
2957  Double_t dz[2],cov[3];
2958  if (!PropagateToDCABxByBz(vtx, b, maxd, dz, cov)) return kFALSE;
2959 
2960  fD = dz[0];
2961  fZ = dz[1];
2962  fCdd = cov[0];
2963  fCdz = cov[1];
2964  fCzz = cov[2];
2965 
2966  Double_t covar[6]; vtx->GetCovMatrix(covar);
2967  Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]};
2968  Double_t c[3]={covar[2],0.,covar[5]};
2969 
2970  Double_t chi2=GetPredictedChi2(p,c);
2971  if (chi2>kVeryBig) return kFALSE;
2972 
2973  fCchi2=chi2;
2974 
2975 
2976  //--- Could now these lines be removed ? ---
2977  delete fCp;
2978  fCp=new AliExternalTrackParam(*this);
2979 
2980  if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;}
2981  //----------------------------------------
2982 
2983  fVertexID = vtx->GetID();
2984 
2985  if (!cParam) return kTRUE;
2986 
2987  *cParam = *this;
2988  if (!cParam->Update(p,c)) return kFALSE;
2989 
2990  return kTRUE;
2991 }
2992 
2993 //_______________________________________________________________________
2994 void AliESDtrack::Print(Option_t *) const {
2995  // Prints info on the track
2997  printf("ESD track info\n") ;
2998  Double_t p[AliPID::kSPECIES] ;
2999  Int_t index = 0 ;
3000  if( IsOn(kITSpid) ){
3001  printf("From ITS: ") ;
3002  GetITSpid(p) ;
3003  for(index = 0 ; index < AliPID::kSPECIES; index++)
3004  printf("%f, ", p[index]) ;
3005  printf("\n signal = %f\n", GetITSsignal()) ;
3006  }
3007  if( IsOn(kTPCpid) ){
3008  printf("From TPC: ") ;
3009  GetTPCpid(p) ;
3010  for(index = 0 ; index < AliPID::kSPECIES; index++)
3011  printf("%f, ", p[index]) ;
3012  printf("\n signal = %f\n", GetTPCsignal()) ;
3013  }
3014  if( IsOn(kTRDpid) ){
3015  printf("From TRD: ") ;
3016  GetTRDpid(p) ;
3017  for(index = 0 ; index < AliPID::kSPECIES; index++)
3018  printf("%f, ", p[index]) ;
3019  printf("\n signal = %f\n", GetTRDsignal()) ;
3020  printf("\n NchamberdEdx = %d\n", GetTRDNchamberdEdx()) ;
3021  printf("\n NclusterdEdx = %d\n", GetTRDNclusterdEdx()) ;
3022  }
3023  if( IsOn(kTOFpid) ){
3024  printf("From TOF: ") ;
3025  GetTOFpid(p) ;
3026  for(index = 0 ; index < AliPID::kSPECIES; index++)
3027  printf("%f, ", p[index]) ;
3028  printf("\n signal = %f\n", GetTOFsignal()) ;
3029  }
3030  if( IsOn(kHMPIDpid) ){
3031  printf("From HMPID: ") ;
3032  GetHMPIDpid(p) ;
3033  for(index = 0 ; index < AliPID::kSPECIES; index++)
3034  printf("%f, ", p[index]) ;
3035  printf("\n signal = %f\n", GetHMPIDsignal()) ;
3036  }
3037 }
3038 
3039 
3040 //
3041 // Draw functionality
3042 // Origin: Marian Ivanov, Marian.Ivanov@cern.ch
3043 //
3044 void AliESDtrack::FillPolymarker(TPolyMarker3D *pol, Float_t magF, Float_t minR, Float_t maxR, Float_t stepR){
3045  //
3046  // Fill points in the polymarker
3047  //
3048  TObjArray arrayRef;
3049  arrayRef.AddLast(new AliExternalTrackParam(*this));
3050  if (fIp) arrayRef.AddLast(new AliExternalTrackParam(*fIp));
3051  if (fOp) arrayRef.AddLast(new AliExternalTrackParam(*fOp));
3052  if (fHMPIDp) arrayRef.AddLast(new AliExternalTrackParam(*fHMPIDp));
3053  //
3054  Double_t mpos[3]={0,0,0};
3055  Int_t entries=arrayRef.GetEntries();
3056  for (Int_t i=0;i<entries;i++){
3057  Double_t pos[3];
3058  ((AliExternalTrackParam*)arrayRef.At(i))->GetXYZ(pos);
3059  mpos[0]+=pos[0]/entries;
3060  mpos[1]+=pos[1]/entries;
3061  mpos[2]+=pos[2]/entries;
3062  }
3063  // Rotate to the mean position
3064  //
3065  Float_t fi= TMath::ATan2(mpos[1],mpos[0]);
3066  for (Int_t i=0;i<entries;i++){
3067  Bool_t res = ((AliExternalTrackParam*)arrayRef.At(i))->Rotate(fi);
3068  if (!res) delete arrayRef.RemoveAt(i);
3069  }
3070  Int_t counter=0;
3071  for (Double_t r=minR; r<maxR; r+=stepR){
3072  Double_t sweight=0;
3073  Double_t mlpos[3]={0,0,0};
3074  for (Int_t i=0;i<entries;i++){
3075  Double_t point[3]={0,0,0};
3076  AliExternalTrackParam *param = ((AliExternalTrackParam*)arrayRef.At(i));
3077  if (!param) continue;
3078  if (param->GetXYZAt(r,magF,point)){
3079  Double_t weight = 1./(10.+(r-param->GetX())*(r-param->GetX()));
3080  sweight+=weight;
3081  mlpos[0]+=point[0]*weight;
3082  mlpos[1]+=point[1]*weight;
3083  mlpos[2]+=point[2]*weight;
3084  }
3085  }
3086  if (sweight>0){
3087  mlpos[0]/=sweight;
3088  mlpos[1]/=sweight;
3089  mlpos[2]/=sweight;
3090  pol->SetPoint(counter,mlpos[0],mlpos[1], mlpos[2]);
3091  // printf("xyz\t%f\t%f\t%f\n",mlpos[0], mlpos[1],mlpos[2]);
3092  counter++;
3093  }
3094  }
3095 }
3096 
3097 //_______________________________________________________________________
3098 void AliESDtrack::SetITSdEdxSamples(const Double_t s[4]) {
3099  //
3100  // Store the dE/dx samples measured by the two SSD and two SDD layers.
3101  // These samples are corrected for the track segment length.
3102  //
3103  for (Int_t i=0; i<4; i++) fITSdEdxSamples[i]=s[i];
3104 }
3105 
3106 //_______________________________________________________________________
3107 void AliESDtrack::GetITSdEdxSamples(Double_t s[4]) const {
3108  //
3109  // Get the dE/dx samples measured by the two SSD and two SDD layers.
3110  // These samples are corrected for the track segment length.
3111  //
3112  for (Int_t i=0; i<4; i++) s[i]=fITSdEdxSamples[i];
3113 }
3114 
3115 
3116 UShort_t AliESDtrack::GetTPCnclsS(Int_t i0,Int_t i1) const{
3117  //
3118  // get number of shared TPC clusters
3119  //
3120  return fTPCSharedMap.CountBits(i0)-fTPCSharedMap.CountBits(i1);
3121 }
3122 
3123 UShort_t AliESDtrack::GetTPCncls(Int_t i0,Int_t i1) const{
3124  //
3125  // get number of TPC clusters
3126  //
3127  return fTPCClusterMap.CountBits(i0)-fTPCClusterMap.CountBits(i1);
3128 }
3129 
3130 //____________________________________________________________________
3132 {
3133  // Calculates the chi2 between the TPC track (TPCinner) constrained to the primary vertex and the global track
3134  //
3135  // Returns -1 in case the calculation failed
3136  //
3137  // Value is cached as a non-persistent member.
3138  //
3139  // Code adapted from original code by GSI group (Jacek, Marian, Michael)
3140 
3141  // cache, ignoring that a different vertex might be passed
3144 
3147 
3148  Double_t x[3];
3149  GetXYZ(x);
3150  Double_t b[3];
3152 
3153  if (!fTPCInner) {
3154  AliWarning("Could not get TPC Inner Param.");
3156  }
3157 
3158  // clone for constraining
3160  if (!tpcInnerC) {
3161  AliWarning("Clone of TPCInnerParam failed.");
3163  }
3164 
3165  // transform to the track reference frame
3166  Bool_t isOK = tpcInnerC->Rotate(GetAlpha());
3167  isOK &= tpcInnerC->PropagateTo(GetX(), b[2]);
3168  if (!isOK) {
3169  delete tpcInnerC;
3170  tpcInnerC = 0;
3171  AliWarning("Rotation/Propagation of track failed.") ;
3173  }
3174 
3175  // constrain TPCinner
3176  isOK = tpcInnerC->ConstrainToVertex(vtx, b);
3177 
3178  // transform to the track reference frame
3179  isOK &= tpcInnerC->Rotate(GetAlpha());
3180  isOK &= tpcInnerC->PropagateTo(GetX(), b[2]);
3181 
3182  if (!isOK) {
3183  AliWarning("ConstrainTPCInner failed.") ;
3184  delete tpcInnerC;
3185  tpcInnerC = 0;
3187  }
3188 
3189  // calculate chi2 between vi and vj vectors
3190  // with covi and covj covariance matrices
3191  // chi2ij = (vi-vj)^(T)*(covi+covj)^(-1)*(vi-vj)
3192  TMatrixD deltaT(5,1);
3193  TMatrixD delta(1,5);
3194  TMatrixD covarM(5,5);
3195 
3196  for (Int_t ipar=0; ipar<5; ipar++) {
3197  deltaT(ipar,0) = tpcInnerC->GetParameter()[ipar] - GetParameter()[ipar];
3198  delta(0,ipar) = tpcInnerC->GetParameter()[ipar] - GetParameter()[ipar];
3199 
3200  for (Int_t jpar=0; jpar<5; jpar++) {
3201  Int_t index = GetIndex(ipar,jpar);
3202  covarM(ipar,jpar) = GetCovariance()[index]+tpcInnerC->GetCovariance()[index];
3203  }
3204  }
3205  // chi2 distance TPC constrained and TPC+ITS
3206  TMatrixD covarMInv = covarM.Invert();
3207  TMatrixD mat2 = covarMInv*deltaT;
3208  TMatrixD chi2 = delta*mat2;
3209 
3210  delete tpcInnerC;
3211  tpcInnerC = 0;
3212 
3215 }
3216 
3218 {
3219  //
3220  // Set the detector PID
3221  //
3222  if (fDetectorPID) delete fDetectorPID;
3223  fDetectorPID=pid;
3224 
3225 }
3226 
3227 Double_t AliESDtrack::GetLengthInActiveZone( Int_t mode, Double_t deltaY, Double_t deltaZ, Double_t bz, Double_t exbPhi , TTreeSRedirector * pcstream) const {
3228  //
3229  // Input parameters:
3230  // mode - type of external track parameters
3231  // deltaY - user defined "dead region" in cm
3232  // deltaZ - user defined "active region" in cm (250 cm drift lenght - 14 cm L1 delay
3233  // bz - magnetic field
3234  // exbPhi - optional rotation due to the ExB effect
3235  // return value:
3236  // the length of the track in cm in "active volume" of the TPC
3237  //
3238  if (mode==0) return GetLengthInActiveZone(this, deltaY,deltaZ,bz, exbPhi,pcstream);
3239  if (mode==1) return GetLengthInActiveZone(fIp, deltaY,deltaZ,bz, exbPhi,pcstream);
3240  if (mode==2) return GetLengthInActiveZone(fOp, deltaY,deltaZ,bz, exbPhi,pcstream);
3241  return 0;
3242 }
3243 
3244 Double_t AliESDtrack::GetLengthInActiveZone(const AliExternalTrackParam *paramT, Double_t deltaY, Double_t deltaZ, Double_t bz, Double_t exbPhi , TTreeSRedirector * pcstream) {
3245  //
3246  // Numerical code to calculate the length of the track in active region of the TPC
3247  // ( can be speed up if somebody wants to invest time - analysical version shoult be possible)
3248  //
3249  // Input parameters:
3250  // paramT - external track parameters
3251  // deltaY - user defined "dead region" in cm
3252  // deltaZ - user defined "active region" in cm (250 cm drift lenght - 14 cm L1 delay
3253  // bz - magnetic field
3254  // exbPhi - optional rotation due to the ExB effect
3255  // return value:
3256  // the length of the track in cm in "active volume" of the TPC
3257  //
3258  const Double_t rIn=85;
3259  const Double_t rOut=245;
3260  Double_t xyz[3], pxyz[3];
3261  if (paramT->GetXYZAt(rIn,bz,xyz)){
3262  paramT->GetPxPyPzAt(rIn,bz,pxyz);
3263  }else{
3264  paramT->GetXYZ(xyz);
3265  paramT->GetPxPyPz(pxyz);
3266  }
3267  //
3268  Double_t dca = -paramT->GetD(0,0,bz); // get impact parameter distance to point (0,0)
3269  Double_t radius= TMath::Abs(1/paramT->GetC(bz)); //
3270  Double_t sign = paramT->GetSign()*TMath::Sign(1.,bz)*(-1.);
3271  Double_t R0 = TMath::Sqrt(xyz[0]*xyz[0]+xyz[1]*xyz[1]); // radius at current point
3272  Double_t phiR0 = TMath::ATan2(xyz[1],xyz[0]); // angle of given point
3273  Double_t dPhiR0= -TMath::ASin((dca*dca-2*dca*radius*sign+R0*R0)/(2*R0*(dca-radius*sign)));
3274  Double_t phi0 = phiR0-(dPhiR0); // global phi offset to be added
3275  //
3276  //
3277  AliExternalTrackParam paramR=(*paramT);
3278  Double_t length=0;
3279  for (Double_t R=rIn; R<=rOut; R++){
3280  Double_t sinPhi=(dca*dca-2*dca*radius*sign+R*R)/(2*R*(dca-radius*sign));
3281  if (TMath::Abs(sinPhi)>=1) continue;
3282  Double_t dphi = -TMath::ASin(sinPhi);
3283  Double_t phi = phi0+dphi; // global phi
3284  Int_t sector = TMath::Nint(9*phi/(TMath::Pi()));
3285  Double_t dPhiEdge = phi-(sector*TMath::Pi()/9)+exbPhi; // distance to sector boundary in rphi
3286  Double_t dX = R*TMath::Cos(phi)-xyz[0];
3287  Double_t dY = R*TMath::Sin(phi)-xyz[1];
3288  Double_t deltaPhi = 2*TMath::ASin(0.5*TMath::Sqrt(dX*dX+dY*dY)/radius);
3289  Double_t z = xyz[2]+deltaPhi*radius*paramT->GetTgl();
3290  if (TMath::Abs(dPhiEdge*R)>deltaY && TMath::Abs(z)<deltaZ){
3291  length++;
3292  }
3293  // Double_t deltaZ= dphi*radius;
3294  if (pcstream){
3295  //should we keep debug possibility ?
3296  AliExternalTrackParam paramTcopy=(*paramT);
3297  paramR.Rotate(phi);
3298  paramR.PropagateTo(R,bz);
3299  (*pcstream)<<"debugEdge"<<
3300  "length="<<length<< // track length
3301  "radius="<<radius<< // radius
3302  "R="<<R<< // radius
3303  "dphiEdge="<<dPhiEdge<< // distance to edge
3304  "phi0="<<phi0<< // phi0 -phi at the track initial position
3305  "phi="<<phi<< //
3306  "z="<<z<<
3307  "pT.="<<&paramTcopy<<
3308  "pR.="<<&paramR<<
3309  "\n";
3310  }
3311  }
3312  return length;
3313 }
3314 
3316 {
3317  int pid = fPIDForTracking;
3318  if (pid<AliPID::kPion && fgTrackEMuAsPi) pid = AliPID::kPion;
3319  double m = AliPID::ParticleMass(pid);
3321 }
3322 
3323 
3324 void AliESDtrack::SetTOFclusterArray(Int_t /*ncluster*/,Int_t */*TOFcluster*/){
3325  AliInfo("Method has to be implemented!");
3326 // fNtofClusters=ncluster;
3327 // if(TOFcluster == fTOFcluster) return;
3328 // if(fTOFcluster){ // reset previous content
3329 // delete[] fTOFcluster;
3330 // fTOFcluster = NULL;
3331 // fNtofClusters=0;
3332 // }
3333 
3334 // if(ncluster){ // set new content
3335 // fTOFcluster = new Int_t[fNtofClusters];
3336 // for(Int_t i=0;i < fNtofClusters;i++) fTOFcluster[i] = TOFcluster[i];
3337 // }
3338 // else
3339 // fTOFcluster = 0;
3340 }
3341 
3342 //____________________________________________
3344 {
3345  // remove reference to this track from TOF clusters
3346  if (!fNtofClusters || !GetESDEvent()) return;
3347  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3348  for (;fNtofClusters--;) {
3349  AliESDTOFCluster* clTOF = (AliESDTOFCluster*)tofclArray->At(fTOFcluster[fNtofClusters]);
3350  clTOF->SuppressMatchedTrack(GetID());
3351  if (!clTOF->GetNMatchableTracks()) { // remove this cluster
3352  int last = tofclArray->GetEntriesFast()-1;
3353  AliESDTOFCluster* clTOFL = (AliESDTOFCluster*)tofclArray->At(last);
3354  if (last != fTOFcluster[fNtofClusters]) {
3355  *clTOF = *clTOFL; // move last cluster to the place of eliminated one
3356  // fix the references on this cluster
3357  clTOF->FixSelfReferences(last,fTOFcluster[fNtofClusters]);
3358  }
3359  tofclArray->RemoveAt(last);
3360  }
3361  }
3362 }
3363 
3364 //____________________________________________
3365 void AliESDtrack::ReplaceTOFTrackID(int oldID, int newID)
3366 {
3367  // replace the ID in TOF clusters references to this track
3368  if (!fNtofClusters || !GetESDEvent()) return;
3369  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3370  for (int it=fNtofClusters;it--;) {
3371  AliESDTOFCluster* clTOF = (AliESDTOFCluster*)tofclArray->At(fTOFcluster[it]);
3372  clTOF->ReplaceMatchedTrackID(oldID,newID);
3373  }
3374 }
3375 
3376 //____________________________________________
3377 void AliESDtrack::ReplaceTOFClusterID(int oldID, int newID)
3378 {
3379  // replace the referenc on TOF cluster oldID by newID
3380  if (!fNtofClusters || !GetESDEvent()) return;
3381  for (int it=fNtofClusters;it--;) {
3382  if (fTOFcluster[it] == oldID) {
3383  fTOFcluster[it] = newID;
3384  return;
3385  }
3386  }
3387 }
3388 
3389 //____________________________________________
3390 void AliESDtrack::ReplaceTOFMatchID(int oldID, int newID)
3391 {
3392  // replace in the ESDTOFCluster associated with this track the id of the corresponding
3393  // ESDTOFMatch from oldID to newID
3394  if (!fNtofClusters || !GetESDEvent()) return;
3395  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3396  for (int it=fNtofClusters;it--;) {
3397  AliESDTOFCluster* clTOF = (AliESDTOFCluster*)tofclArray->At(fTOFcluster[it]);
3398  clTOF->ReplaceMatchID(oldID,newID);
3399  }
3400 }
3401 
3402 //____________________________________________
3404 {
3405  fNtofClusters++;
3406 
3407  Int_t *old = fTOFcluster;
3408  fTOFcluster = new Int_t[fNtofClusters];
3409 
3410  for(Int_t i=0;i < fNtofClusters-1;i++) fTOFcluster[i] = old[i];
3411  fTOFcluster[fNtofClusters-1] = icl;
3412 
3413  if(fNtofClusters-1) delete[] old; // delete previous content
3414 
3415 }
3416 
3417 //____________________________________________
3418 void AliESDtrack::SetTOFsignal(Double_t tof)
3419 {
3420  if(fNtofClusters>0 && GetESDEvent()){
3421  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3422  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3423  AliESDTOFHit* hit = tofcl->GetTOFHit(0);
3424  if(hit) hit->SetTime(tof);
3425  }
3426  else{
3427  if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3428  fTOFsignal=tof;
3429  }
3430 }
3431 //____________________________________________
3433  if(fNtofClusters>0 && GetESDEvent()){
3434  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3435  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3436  AliESDTOFHit* hit = tofcl->GetTOFHit(0);
3437  if(hit) hit->SetTOFchannel(index);
3438  }
3439  else{
3440  if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3441  fTOFCalChannel=index;
3442  }
3443 }
3444 //____________________________________________
3445 void AliESDtrack::SetTOFsignalToT(Double_t ToT){
3446  if(fNtofClusters>0 && GetESDEvent()){
3447  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3448  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3449  AliESDTOFHit* hit = tofcl->GetTOFHit(0);
3450  if(hit) hit->SetTOT(ToT);
3451  }
3452  else{
3453  if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3454  fTOFsignalToT=ToT;
3455  }
3456 }
3457 //____________________________________________
3458 void AliESDtrack::SetTOFsignalRaw(Double_t tof){
3459  if(fNtofClusters>0 && GetESDEvent()){
3460  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3461  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3462  AliESDTOFHit* hit = tofcl->GetTOFHit(0);
3463  if(hit) hit->SetTimeRaw(tof);
3464  }
3465  else{
3466  if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3467  fTOFsignalRaw=tof;
3468  }
3469 }
3470 //____________________________________________
3472  Int_t index = -1;
3473  AliESDTOFCluster *tofcl;
3474 
3475  if(fNtofClusters>0 && GetESDEvent()){
3476  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3477  tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3478 
3479  for(Int_t i=0;i < tofcl->GetNMatchableTracks();i++){
3480  if(tofcl->GetTrackIndex(i) == GetID()) index = i;
3481  }
3482 
3483  }
3484  if(index > -1){
3485  AliESDTOFMatch* match = tofcl->GetTOFMatch(index);
3486  if(match){
3487  match->SetDz(dz);
3488  }
3489  }
3490  else{
3491  if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3492  fTOFsignalDz=dz;
3493  }
3494 
3495 
3496 }
3497 //____________________________________________
3499  Int_t index = -1;
3500  AliESDTOFCluster *tofcl;
3501 
3502  if(fNtofClusters>0 && GetESDEvent()){
3503  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3504  tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3505 
3506  for(Int_t i=0;i < tofcl->GetNMatchableTracks();i++){
3507  if(tofcl->GetTrackIndex(i) == GetID()) index = i;
3508  }
3509 
3510  }
3511  if(index > -1){
3512  AliESDTOFMatch* match = tofcl->GetTOFMatch(index);
3513  if(match){
3514  match->SetDx(dx);
3515  }
3516  }
3517  else{
3518  if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3519  fTOFsignalDx=dx;
3520  }
3521 }
3522 //____________________________________________
3523 void AliESDtrack::SetTOFDeltaBC(Short_t deltaBC){
3524  if(fNtofClusters>0 && GetESDEvent()){
3525  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3526  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3527  AliESDTOFHit* hit = tofcl->GetTOFHit(0);
3528  if(hit) hit->SetDeltaBC(deltaBC);
3529  }
3530  else{
3531  if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3532  fTOFdeltaBC=deltaBC;
3533  }
3534 }
3535 //____________________________________________
3536 void AliESDtrack::SetTOFL0L1(Short_t l0l1){
3537  if(fNtofClusters>0 && GetESDEvent()){
3538  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3539  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3540  AliESDTOFHit* hit = tofcl->GetTOFHit(0);
3541  if(hit) hit->SetL0L1Latency(l0l1);
3542  }
3543  else{
3544  if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3545  fTOFl0l1=l0l1;
3546  }
3547 }
3548 //____________________________________________
3549 Double_t AliESDtrack::GetTOFsignal() const
3550 {
3551  if(fNtofClusters>0 && GetESDEvent()){
3552  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3553  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3554 
3555  return tofcl->GetTime();
3556  }
3557  else if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3558 
3559  return fTOFsignal;
3560 }
3561 
3562 //____________________________________________
3564 {
3565  if(fNtofClusters>0 && GetESDEvent()){
3566  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3567  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3568 
3569  return tofcl->GetTOT();
3570  }
3571  else if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3572 
3573  return fTOFsignalToT;
3574 }
3575 
3576 //____________________________________________
3578 {
3579  if(fNtofClusters>0 && GetESDEvent()){
3580  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3581  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3582 
3583  return tofcl->GetTimeRaw();
3584  }
3585  else if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3586 
3587  return fTOFsignalRaw;
3588 }
3589 
3590 //____________________________________________
3592 {
3593 
3594  AliESDTOFCluster *tofcl;
3595 
3596  Int_t index = -1;
3597  if(fNtofClusters>0 && GetESDEvent()){
3598  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3599  tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3600 
3601  for(Int_t i=0;i < tofcl->GetNMatchableTracks();i++){
3602  if(tofcl->GetTrackIndex(i) == GetID()) index = i;
3603  }
3604  }
3605  else if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3606 
3607  if(fNtofClusters>0 && index > -1){
3608  return tofcl->GetDz(index);
3609  }
3610  return fTOFsignalDz;
3611 }
3612 
3613 //____________________________________________
3615 {
3616  AliESDTOFCluster *tofcl;
3617 
3618  Int_t index = -1;
3619  if(fNtofClusters>0 && GetESDEvent()){
3620  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3621  tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3622  for(Int_t i=0;i < tofcl->GetNMatchableTracks();i++){
3623  if(tofcl->GetTrackIndex(i) == GetID()) index = i;
3624  }
3625  }
3626  else if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3627  if(fNtofClusters>0 && index > -1){
3628  return tofcl->GetDx(index);
3629  }
3630  return fTOFsignalDx;
3631 }
3632 
3633 //____________________________________________
3635 {
3636  if(fNtofClusters>0 && GetESDEvent()){
3637  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3638  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3639  return tofcl->GetDeltaBC();
3640  }
3641  else if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3642 
3643  return fTOFdeltaBC;
3644 }
3645 
3646 //____________________________________________
3647 Short_t AliESDtrack::GetTOFL0L1() const
3648 {
3649  if(fNtofClusters>0 && GetESDEvent()){
3650  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3651  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3652 
3653  return tofcl->GetL0L1Latency();
3654  }
3655  else if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3656 
3657  return fTOFl0l1;
3658 }
3659 
3660 //____________________________________________
3662 {
3663  if(fNtofClusters>0 && GetESDEvent()){
3664  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3665  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3666 
3667  return tofcl->GetTOFchannel();
3668  }
3669  else if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3670 
3671  return fTOFCalChannel;
3672 }
3673 
3674 //____________________________________________
3676 {
3677  if(fNtofClusters>0 && GetESDEvent()){
3678  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3679  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3680 
3681  return tofcl->GetClusterIndex();
3682  }
3683  else if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3684 
3685  return fTOFindex;
3686 }
3687 
3688 //____________________________________________
3690 {
3691  return fNtofClusters;
3692 }
3693 
3694 //____________________________________________
3696  if(fNtofClusters>0 && GetESDEvent()){
3697  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3698  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[0]);
3699 
3700  if (tofcl->GetNMatchableTracks() > 1)
3701  return kTRUE;
3702  }
3703  else if(fNtofClusters>0) AliInfo("No AliESDEvent available here!\n");
3704 
3705  return kFALSE;
3706 }
3707 
3708 //____________________________________________
3709 void AliESDtrack::ReMapTOFcluster(Int_t ncl,Int_t *mapping){
3710  for(Int_t i=0;i<fNtofClusters;i++){
3711  if(fTOFcluster[i]<ncl && fTOFcluster[i]>-1)
3712  fTOFcluster[i] = mapping[fTOFcluster[i]];
3713  else
3714  AliInfo(Form("TOF cluster re-mapping in AliESDtrack: out of range (%i > %i)\n",fTOFcluster[i],ncl));
3715  }
3716 }
3717 
3718 //____________________________________________
3720  TClonesArray *tofclArray = GetESDEvent()->GetESDTOFClusters();
3721 
3722  for(Int_t i=0;i<fNtofClusters-1;i++){
3723  for(Int_t j=i+1;j<fNtofClusters;j++){
3724  AliESDTOFCluster *tofcl = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[i]);
3725  Int_t index1 = -1;
3726  for(Int_t it=0;it < tofcl->GetNMatchableTracks();it++){
3727  if(tofcl->GetTrackIndex(it) == GetID()) index1 = it;
3728  }
3729  Double_t timedist1 = 10000;
3730  for(Int_t isp=0; isp< AliPID::kSPECIESC;isp++){
3731  Double_t timec = TMath::Abs(tofcl->GetTime() - tofcl->GetIntegratedTime(isp));
3732  if(timec < timedist1) timedist1 = timec;
3733  }
3734  timedist1 *= 0.03; // in cm
3735  Double_t radius1 = tofcl->GetDx(index1)*tofcl->GetDx(index1) + tofcl->GetDz(index1)*tofcl->GetDz(index1) + timedist1*timedist1;
3736 
3737  AliESDTOFCluster *tofcl2 = (AliESDTOFCluster *) tofclArray->At(fTOFcluster[j]);
3738  Int_t index2 = -1;
3739  for(Int_t it=0;it < tofcl2->GetNMatchableTracks();it++){
3740  if(tofcl2->GetTrackIndex(it) == GetID()) index2 = it;
3741  }
3742  if(index1 == -1 || index2 == -1){
3743  }
3744  Double_t timedist2 = 10000;
3745  for(Int_t isp=0; isp< AliPID::kSPECIESC;isp++){
3746  Double_t timec = TMath::Abs(tofcl2->GetTime() - tofcl2->GetIntegratedTime(isp));
3747  if(timec < timedist2) timedist2 = timec;
3748  }
3749  timedist2 *= 0.03; // in cm
3750  Double_t radius2 = tofcl2->GetDx(index2)*tofcl2->GetDx(index2) + tofcl2->GetDz(index2)*tofcl2->GetDz(index2) + timedist2*timedist2;
3751 
3752  if(radius2 < radius1){
3753  Int_t change = fTOFcluster[i];
3754  fTOFcluster[i] = fTOFcluster[j];
3755  fTOFcluster[j] = change;
3756  }
3757  }
3758  }
3759 }
3760 
3761 //____________________________________________
3763  return fESDEvent ? fESDEvent->GetTOFHeader() : 0x0;
3764 }
3765 
3766 //___________________________________________
3767 void AliESDtrack::SetID(Short_t id)
3768 {
3769  // set track ID taking care about dependencies
3771  fID=id;
3772 }
3773 
3774 
3775 Double_t AliESDtrack::GetdEdxInfo(Int_t regionID, Int_t calibID, Int_t qID, Int_t valueID){
3776  //
3777  // Interface to get the calibrated dEdx information
3778  // For details of arguments and return values see
3779  // AliTPCdEdxInfo::GetdEdxInfo(Int_t regionID, Int_t calibID, Int_t valueID)
3780  //
3781  if (!fTPCdEdxInfo) return 0;
3782  if (!fIp) return 0;
3783  return fTPCdEdxInfo->GetdEdxInfo(fIp, regionID, calibID, qID, valueID);
3784 }
3785 
3786 
3787 Double_t AliESDtrack::GetdEdxInfoTRD(Int_t method, Double_t p0, Double_t p1, Double_t p2){
3788  //
3789  // Methods
3790  // mean values:
3791  // 0.) linear
3792  // 1.) logarithmic
3793  // 2.) 1/sqrt
3794  // 3.) power()
3795  // time COG:
3796  // 4.) linear
3797  // 5.) logarithmic
3798  // 6.) square
3799  Int_t nSlicesPerLayer=GetNumberOfTRDslices();
3800  Int_t nSlicesAll=GetNumberOfTRDslices()*kTRDnPlanes;
3801 
3802  if (method<=3){
3803  Double_t sumAmp=0;
3804  Int_t sumW=0;
3805  for (Int_t ibin=0; ibin<nSlicesAll; ibin++){
3806  if (fTRDslices[ibin]<=0) continue;
3807  sumW++;
3808  if (method==0) sumAmp+=fTRDslices[ibin];
3809  if (method==1) sumAmp+=TMath::Log(TMath::Abs(fTRDslices[ibin])+p0);
3810  if (method==2) sumAmp+=1/TMath::Sqrt(TMath::Abs(fTRDslices[ibin])+p0);
3811  if (method==3) sumAmp+=TMath::Power(TMath::Abs(fTRDslices[ibin])+p0,p1);
3812  }
3813  if (sumW==0) return 0;
3814  Double_t dEdx=sumAmp/sumW;
3815  if (method==1) dEdx= TMath::Exp(dEdx);
3816  if (method==2) dEdx= 1/(dEdx*dEdx);
3817  if (method==3) dEdx= TMath::Power(dEdx,1/p1);
3818  return dEdx;
3819  }
3820  if (method>3){
3821  Double_t sumWT=0;
3822  Double_t sumW=0;
3823  for (Int_t ibin=0; ibin<nSlicesAll; ibin++){
3824  if (fTRDslices[ibin]<=0) continue;
3825  Double_t time=(ibin%nSlicesPerLayer);
3826  Double_t weight=fTRDslices[ibin];
3827  if (method==5) weight=TMath::Log((weight+p0)/p0);
3828  if (method==6) weight=TMath::Power(weight+p0,p1);
3829  sumWT+=time*weight;
3830  sumW+=weight;
3831  }
3832  if (sumW<=0) return 0;
3833  Double_t meanTime=sumWT/sumW;
3834  return meanTime;
3835  }
3836  return 0;
3837 }
3838 
3839 void AliESDtrack::SetImpactParameters( const Float_t p[2], const Float_t cov[3], const Float_t chi2, const AliExternalTrackParam *cParam)
3840 {
3841  // set impact parameters
3842 
3843  fD = p[0];
3844  fZ = p[1];
3845  fCdd = cov[0];
3846  fCdz = cov[1];
3847  fCzz = cov[2];
3848  fCchi2=chi2;
3849  delete fCp;
3850  if( cParam ) fCp=new AliExternalTrackParam(*cParam);
3851 }
3852 
3853 void AliESDtrack::SetImpactParametersTPC( const Float_t p[2], const Float_t cov[3], const Float_t chi2 )
3854 {
3855  // set impact parameters TPC
3856 
3857  fdTPC = p[0];
3858  fzTPC = p[1];
3859  fCddTPC = cov[0];
3860  fCdzTPC = cov[1];
3861  fCzzTPC = cov[2];
3862  fCchi2TPC = chi2;
3863 }
3864 
3866 {
3867  // when true, track mu and e with pion mass (run 2)
3868  fgTrackEMuAsPi = val;
3869  AliInfoClassF("Track e and mu with pion mass: %d",fgTrackEMuAsPi);
3870 }
Double32_t * fR
Definition: AliESDtrack.h:584
void ReplaceTOFTrackID(int oldID, int newID)
void SetTOFInfo(Float_t *info)
TBrowser b
Definition: RunAnaESD.C:12
Double32_t fZ
Definition: AliESDtrack.h:605
Int_t fLabel
Definition: AliESDtrack.h:568
TObject * GetCalibObject(Int_t index)
const AliTOFHeader * GetTOFHeader() const
Int_t GetNcls(Int_t idet) const
Bool_t GetITSModuleIndexInfo(Int_t ilayer, Int_t &idet, Int_t &status, Float_t &xloc, Float_t &zloc) const
Double32_t fGlobalChi2
Definition: AliESDtrack.h:617
virtual Int_t GetEMCALcluster() const
Definition: AliVTrack.h:141
void ReplaceTOFClusterID(int oldID, int newID)
void SetOuterHmpParam(const AliExternalTrackParam *p, ULong_t flags)
Double_t GetTRDslice(Int_t plane, Int_t slice=-1) const
Double_t GetTRDmomentum(Int_t plane, Double_t *sp=0x0) const
void SetTRDsignal(Double_t sig)
Definition: AliESDtrack.h:288
Char_t fPIDForTrackingIn
Definition: AliESDtrack.h:673
Double32_t fHMPIDtrkY
Definition: AliESDtrack.h:647
Double_t GetChi2() const
Short_t GetTOFL0L1() const
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
Int_t GetHMPIDcluIdx() const
Definition: AliESDtrack.h:390
Bool_t GetPxPyPzAt(Double_t x, Double_t b, Double_t p[3]) const
Int_t fTOFCalChannel
TOF label.
Definition: AliESDtrack.h:574
Float_t GetTimeRaw(Int_t ihit=0) const
Double32_t fHMPIDmipX
Definition: AliESDtrack.h:648
Bool_t RelateToVVertex(const AliVVertex *vtx, Double_t b, Double_t maxd, AliExternalTrackParam *cParam=0)
Char_t GetID() const
Definition: AliESDVertex.h:82
void SetTRDslice(Double_t q, Int_t plane, Int_t slice)
void SuppressMatchedTrack(Int_t id)
Double32_t fHMPIDtrkTheta
[0.,0.,8] "detector response probabilities" (for the PID)
Definition: AliESDtrack.h:591
Int_t fHMPIDqn
Definition: AliESDtrack.h:576
void SetTOFsignalDz(Double_t dz)
virtual Int_t GetTrackletIndex(Int_t) const
void Print(Option_t *option="") const
Double32_t * fTRDslices
Definition: AliESDtrack.h:668
Double32_t fCchi2
Definition: AliESDtrack.h:607
UShort_t GetTPCnclsS(Int_t i0=0, Int_t i1=159) const
AliTPCcalibPID * pid
Definition: CalibPID.C:69
virtual Int_t GetNumberOfTRDslices() const
Definition: AliVTrack.h:100
TClonesArray * GetESDTOFClusters() const
Definition: AliESDEvent.h:350
const TBits * GetTPCSharedMapPtr() const
Definition: AliESDtrack.h:279
Int_t GetDeltaBC(Int_t ihit=0) const
virtual Int_t GetClusterIndex(Int_t) const
Bool_t Rotate(Double_t alpha)
Double32_t fITSsignalTuned
Definition: AliESDtrack.h:620
Bool_t RelateToVVertexTPCBxByBz(const AliVVertex *vtx, Double_t b[3], Double_t maxd, AliExternalTrackParam *cParam=0)
Double32_t fHMPIDtrkX
Definition: AliESDtrack.h:646
UShort_t fTPCnclsFIter1
Definition: AliESDtrack.h:656
UShort_t GetTPCclusters(Int_t *idx) const
Double_t GetdEdxInfoTRD(Int_t method, Double_t p0, Double_t p1, Double_t p2)
void SetOuterParam(const AliExternalTrackParam *p, ULong_t flags)
static bool fgkOnlineMode
Definition: AliESDtrack.h:694
Int_t fITSModule[12]
Definition: AliESDtrack.h:570
Double32_t fD
Definition: AliESDtrack.h:604
AliExternalTrackParam * fHMPIDp
Definition: AliESDtrack.h:557
Double32_t fTPCchi2
Definition: AliESDtrack.h:611
virtual void GetImpactParameters(Float_t[], Float_t[]) const
Definition: AliVTrack.h:136
Bool_t Update(const Double_t p[2], const Double_t cov[3])
Double_t Y() const
Double32_t fTOFsignalTuned
detector&#39;s PID signal [ps]
Definition: AliESDtrack.h:634
ULong64_t fFlags
Definition: AliESDtrack.h:566
void Set(T x, T alpha, const T param[5], const T covar[15])
static Bool_t fgTrackEMuAsPi
indicate the online mode to skip some of the functionality
Definition: AliESDtrack.h:695
#define TObjArray
Bool_t GetOuterHmpExternalParameters(Double_t &alpha, Double_t &x, Double_t p[5]) const
Double32_t fTOFsignalDx
local z of track&#39;s impact on the TOF pad [cm]
Definition: AliESDtrack.h:638
void FixSelfReferences(int oldID, int newID)
void SetITSOut(const AliExternalTrackParam &param)
Int_t GetTOFBunchCrossing(Double_t b=0, Bool_t pidTPConly=kTRUE) const
void GetTOFpid(Double_t *p) const
static bool OnlineMode()
Definition: AliESDtrack.h:489
Bool_t GetOuterExternalCovariance(Double_t cov[15]) const
Bool_t GetXYZ(Double_t *p) const
virtual void GetITSdEdxSamples(Double_t s[4]) const
Definition: AliVTrack.h:90
Double32_t * fHMPIDr
[0.,0.,8] "detector response probabilities" (for the PID)
Definition: AliESDtrack.h:589
static Int_t GetIndex(Int_t i, Int_t j)
void SetIntegratedLength(Double_t l)
Definition: AliESDtrack.h:75
void GetIntegratedTimes(Double_t *times, Int_t nspec=AliPID::kSPECIESC) const
Double32_t fTPCsignal
Definition: AliESDtrack.h:623
void SetImpactParametersTPC(const Float_t p[2], const Float_t cov[3], const Float_t chi2)
const char * path
virtual void GetCovarianceMatrix(Double_t covmatrix[6]) const =0
void SetTPCSharedMap(const TBits &amap)
Definition: AliESDtrack.h:282
Double_t fTrackPtOnEMCal
Definition: AliESDtrack.h:685
Double32_t fTRDsignal
Definition: AliESDtrack.h:629
void GetExternalParameters(Double_t &x, Double_t p[5]) const
void GetESDpid(Double_t *p) const
Int_t GetID() const
Definition: AliESDtrack.h:69
void AddCalibObject(TObject *object)
virtual void SetTimeRaw(Double_t timeraw)
Definition: AliESDTOFHit.h:30
void SetTrackPhiEtaPtOnEMCal(Double_t phi, Double_t eta, Double_t pt)
Definition: AliESDtrack.h:416
void SetTPCFitMap(const TBits &amap)
Definition: AliESDtrack.h:280
Int_t GetL0L1Latency(Int_t ihit=0) const
Int_t GetPIDForTracking() const
Definition: AliESDtrack.h:101
Int_t GetTOFclusterN() const
virtual Double_t GetTOFsignal() const
Definition: AliVTrack.h:173
static Float_t ParticleMass(Int_t iType)
Definition: AliPID.h:56
Double_t GetIntegratedLength() const
AliESDfriendTrack * fFriendTrack
Definition: AliESDtrack.h:558
void SetTRDmomentum(Double_t p, Int_t plane, Double_t *sp=0x0)
TBits fTPCSharedMap
Definition: AliESDtrack.h:562
void SortTOFcluster()
virtual void SetTOFLabel(const Int_t label[3])
Definition: AliESDTOFHit.h:42
EParticleType
Definition: AliPID.h:27
void SetTRDpid(const Double_t *p)
void SetLabel(Int_t label)
Definition: AliESDtrack.h:84
Bool_t FillTPCOnlyTrack(AliESDtrack &track)
Float_t GetTPCClusterInfo(Int_t nNeighbours=3, Int_t type=0, Int_t row0=0, Int_t row1=159, Int_t bitType=0) const
Float_t p[]
Definition: kNNTest.C:133
Double_t fTrackPhiOnEMCal
transient object to cache PID information
Definition: AliESDtrack.h:683
virtual void GetIntegratedTimes(Double_t *, Int_t nspec=AliPID::kSPECIESC) const
Definition: AliVTrack.cxx:82
void SetID(Short_t id)
void SetStatus(ULong64_t flags)
Definition: AliESDtrack.h:72
Float_t GetDz(Int_t i=0) const
TTreeSRedirector * pcstream
Double32_t fCddTPC
Definition: AliESDtrack.h:601
virtual Int_t GetLabel() const =0
Double32_t fTOFsignal
Definition: AliESDtrack.h:633
virtual void SetTOFchannel(Int_t tofch)
Definition: AliESDTOFHit.h:34
Double32_t fTPCsignalS
[0.,0.,10] detector&#39;s PID signal tuned on data when using MC
Definition: AliESDtrack.h:625
Double_t GetAlpha() const
void SetTOFsignal(Double_t tof)
const TBits * GetTPCFitMapPtr() const
Definition: AliESDtrack.h:275
virtual Double_t GetTrackEtaOnEMCal() const
Definition: AliVTrack.h:146
Double32_t fTOFsignalDz
detector&#39;s uncorrected time signal [ps]
Definition: AliESDtrack.h:637
Double_t GetTOFsignalToT() const
Bool_t PropagateToDCABxByBz(const AliVVertex *vtx, Double_t b[3], Double_t maxd, Double_t dz[2]=0, Double_t cov[3]=0)
UShort_t fFrTrackID
Definition: AliESDtrack.h:564
Bool_t GetConstrainedExternalCovariance(Double_t cov[15]) const
void ReMapTOFcluster(Int_t ncl, Int_t *mapping)
Int_t fNtofClusters
Definition: AliESDtrack.h:689
AliTPCfastTrack * track
Bool_t HasPointOnITSLayer(Int_t i) const
Definition: AliESDtrack.h:218
AliExternalTrackParam * fCp
Definition: AliESDtrack.h:553
virtual Double_t GetTgl() const
void SetTPCpid(const Double_t *p)
Double_t GetTOFExpTDiff(Double_t b=0, Bool_t pidTPConly=kTRUE) const
Float_t GetLength(Int_t i=0) const
Double_t GetTOFsignalDz() const
virtual void SetDz(Double_t delta)
UChar_t fTRDncls0
Definition: AliESDtrack.h:662
Double32_t fTRDQuality
Definition: AliESDtrack.h:630
const AliDetectorPID * fDetectorPID
Vertex for which the cache is valid.
Definition: AliESDtrack.h:681
Double_t PropagateToDCA(AliExternalTrackParam *p, Double_t b)
const Double_t * GetParameter() const
const Float_t kAlmost0
void GetTOFInfo(Float_t *info) const
void SetTPCIndices(Int_t *indices, Int_t n)
Int_t * fTOFcluster
Definition: AliESDtrack.h:690
virtual Double_t GetPIDsignal() const
#define AliWarning(message)
Definition: AliLog.h:541
void SetTOFpid(const Double_t *p)
AliExternalTrackParam * fOp
Definition: AliESDtrack.h:556
void SetTOFclusterArray(Int_t ncluster, Int_t *TOFcluster)
Char_t GetITSclusters(Int_t *idx) const
virtual UShort_t GetTPCNcls() const
Definition: AliVTrack.h:96
Double32_t fITSchi2
Definition: AliESDtrack.h:610
Double32_t * fITSr
[0.,0.,8] combined "detector response probability"
Definition: AliESDtrack.h:585
AliExternalInfo info
Double32_t fTOFInfo[10]
local x of track&#39;s impact on the TOF pad [cm]
Definition: AliESDtrack.h:639
Double_t GetIntegratedTime(Int_t iPart=0, Int_t i=0) const
void GetITSdEdxSamples(Double_t s[4]) const
virtual Bool_t IsStartedTimeIntegral() const
Double32_t * fTRDr
[0.,0.,8] "detector response probabilities" (for the PID)
Definition: AliESDtrack.h:587
UChar_t fITSClusterMap
Definition: AliESDtrack.h:659
Bool_t RelateToVertex(const AliESDVertex *vtx, Double_t b, Double_t maxd, AliExternalTrackParam *cParam=0)
Bool_t RelateToVVertexTPC(const AliVVertex *vtx, Double_t b, Double_t maxd, AliExternalTrackParam *cParam=0)
Double_t E() const
Bool_t GetConstrainedExternalParameters(Double_t &alpha, Double_t &x, Double_t p[5]) const
Double32_t fTOFsignalToT
detector&#39;s PID signal tuned on data when using MC
Definition: AliESDtrack.h:635
Bool_t IsTOFHitAlreadyMatched() const
TBits fTPCFitMap
All the complementary information.
Definition: AliESDtrack.h:560
void sum()
Float_t fCacheNCrossedRows
Pointer back to event to which the track belongs.
Definition: AliESDtrack.h:677
void dY()
Definition: CalibAlign.C:547
AliESDTOFHit * GetTOFHit(Int_t i) const
void SetTOFsignalDx(Double_t dx)
UChar_t GetTRDntracklets() const
Definition: AliESDtrack.h:294
virtual Double_t GetITSsignal() const
Definition: AliVTrack.h:162
Double_t GetHMPIDsignal() const
Definition: AliESDtrack.h:383
Double32_t fTrackLength
TOFs estimated by the tracking.
Definition: AliESDtrack.h:597
void SetESDpid(const Double_t *p)
Double_t chi2
Definition: AnalyzeLaser.C:7
Int_t fITSLabel
Definition: AliESDtrack.h:569
Bool_t IsOn(ULong64_t mask) const
Definition: AliESDtrack.h:81
Int_t * fTOFLabel
Definition: AliESDtrack.h:573
void GetTPCpid(Double_t *p) const
UChar_t GetTRDtracklets(Int_t *idx) const
virtual void SetTOT(Double_t tot)
Definition: AliESDTOFHit.h:31
Char_t fVertexID
Definition: AliESDtrack.h:671
Bool_t GetOuterHmpExternalCovariance(Double_t cov[15]) const
UShort_t fTPCnclsIter1
Definition: AliESDtrack.h:655
Float_t fCacheChi2TPCConstrainedVsGlobal
Cache for the number of crossed rows.
Definition: AliESDtrack.h:678
Double_t GetTOFsignalRaw() const
Double_t GetTPCsignal() const
Definition: AliESDtrack.h:259
void MakeMiniESDtrack()
void SetTOFsignalRaw(Double_t tof)
void SetTPCOut(const AliExternalTrackParam &param)
UChar_t fTRDNchamberdEdx
Definition: AliESDtrack.h:664
void SetHMPIDpid(const Double_t *p)
Float_t GetTime(Int_t ihit=0) const
Float_t GetTOT(Int_t ihit=0) const
Float_t GetTPCCrossedRows() const
Double_t GetChi2TPCConstrainedVsGlobal(const AliESDVertex *vtx) const
#define AliInfo(message)
Definition: AliLog.h:484
virtual void Print(Option_t *opt) const
void SetITSIndices(Int_t *indices, Int_t n)
Double32_t fITSsignal
Definition: AliESDtrack.h:619
Double_t GetdEdxInfo(Int_t regionID, Int_t calibID, Int_t qID, Int_t valueID)
UChar_t fTRDncls
Definition: AliESDtrack.h:661
Double32_t fITSdEdxSamples[4]
[0.,0.,10] detector&#39;s PID signal
Definition: AliESDtrack.h:621
Bool_t RelateToVertexBxByBz(const AliESDVertex *vtx, Double_t b[3], Double_t maxd, AliExternalTrackParam *cParam=0)
Double32_t fHMPIDtrkPhi
Definition: AliESDtrack.h:593
void SetIntegratedTimes(const Double_t *times)
void AddTOFcluster(Int_t icl)
void SetTPCdEdxInfo(AliTPCdEdxInfo *dEdxInfo)
void SetTPCClusterMap(const TBits &amap)
Definition: AliESDtrack.h:281
Double32_t fTRDchi2
Definition: AliESDtrack.h:613
Bool_t ConstrainToVertex(const AliVVertex *vtx, Double_t b[3])
Int_t GetClusterIndex(Int_t ihit=0) const
virtual Int_t GetID() const =0
virtual void SetTime(Double_t time)
Definition: AliESDTOFHit.h:29
AliExternalTrackParam * fIp
Definition: AliESDtrack.h:554
Double32_t * fTOFr
[0.,0.,8] "detector response probabilities" (for the PID)
Definition: AliESDtrack.h:588
Double32_t fdTPC
Track length.
Definition: AliESDtrack.h:599
Double32_t * fTPCr
[0.,0.,8] "detector response probabilities" (for the PID)
Definition: AliESDtrack.h:586
virtual Double_t GetTrackPtOnEMCal() const
Definition: AliVTrack.h:147
Int_t GetLabel(Int_t i=0, Int_t ihit=0) const
Char_t fITSncls
Definition: AliESDtrack.h:658
const Double_t * GetCovariance() const
virtual UShort_t GetTPCsignalN() const
Definition: AliVTrack.h:168
Bool_t UpdateTrackParams(const AliKalmanTrack *t, ULong64_t flags)
void SetTOFLabel(const Int_t *p)
static void GetBxByBz(const Double_t r[3], Double_t b[3])
Definition: AliPID.h:19
UShort_t fTPCncls
Definition: AliESDtrack.h:652
static void SetTrackEMuAsPi(Bool_t val)
const Double_t kVeryBig
Bool_t GetPxPyPz(Double_t *p) const
void GetITSpid(Double_t *p) const
virtual Double_t GetTrackPhiOnEMCal() const
Definition: AliVTrack.h:145
UChar_t fITSSharedMap
Definition: AliESDtrack.h:660
Double32_t fCzz
Definition: AliESDtrack.h:606
void AddCalibObject(TObject *calibObject)
Double_t GetMass(Bool_t tpcOnly=kFALSE) const
Definition: AliESDtrack.h:98
virtual void SetL0L1Latency(Int_t latency)
Definition: AliESDTOFHit.h:32
Int_t fKinkIndexes[3]
Definition: AliESDtrack.h:581
Bool_t RelateToVVertexBxByBz(const AliVVertex *vtx, Double_t b[3], Double_t maxd, AliExternalTrackParam *cParam=0)
void SetTOFsignalToT(Double_t ToT)
virtual void SetDeltaBC(Int_t deltabc)
Definition: AliESDTOFHit.h:33
virtual const TBits * GetTPCClusterMapPtr() const
Definition: AliVTrack.h:91
AliESDTOFMatch * GetTOFMatch(Int_t i) const
virtual void SetDx(Double_t delta)
Int_t fHMPIDcluIdx
Definition: AliESDtrack.h:577
static Double_t GetLengthInActiveZone(const AliExternalTrackParam *paramT, Double_t deltaY, Double_t deltaZ, Double_t bz, Double_t exbPhi=0, TTreeSRedirector *pcstream=0)
Double_t GetTRDsignal() const
Definition: AliESDtrack.h:318
virtual Bool_t GetTPCdEdxInfo(AliTPCdEdxInfo &) const
Definition: AliVTrack.h:95
Double32_t fCdzTPC
Definition: AliESDtrack.h:601
void GetTRDpid(Double_t *p) const
Double32_t fCzzTPC
Definition: AliESDtrack.h:601
Double_t M() const
virtual Double_t GetITSsignalTunedOnData() const
Definition: AliVTrack.h:163
Int_t GetTOFcluster() const
Int_t GetTOFchannel(Int_t ihit=0) const
virtual Double_t GetTRDchi2() const
Definition: AliVTrack.h:105
void ReplaceTOFMatchID(int oldID, int newID)
virtual Double_t GetITSchi2() const
Definition: AliVTrack.h:107
Double_t GetTOFsignalDx() const
virtual Double_t GetTPCsignal() const
Definition: AliVTrack.h:165
UShort_t fTPCsignalN
Definition: AliESDtrack.h:654
const AliESDEvent * fESDEvent
Definition: AliESDtrack.h:675
void SuppressTOFMatches()
Double_t GetTPCdensity(Int_t row0, Int_t row1) const
virtual ~AliESDtrack()
Short_t fTOFdeltaBC
TOF informations.
Definition: AliESDtrack.h:640
#define AliInfoClassF(message,...)
Definition: AliLog.h:504
Char_t fPIDForTracking
Definition: AliESDtrack.h:672
void SetEMCALcluster(Int_t index)
Definition: AliESDtrack.h:409
void ReplaceMatchID(int oldID, int newID)
virtual Double_t GetTRDslice(Int_t, Int_t) const
Definition: AliVTrack.h:99
Int_t fCaloIndex
Definition: AliESDtrack.h:578
AliESDtrack & operator=(const AliESDtrack &)
#define AliDebug(logLevel, message)
Definition: AliLog.h:300
Int_t GetTOFCalChannel() const
Double_t GetITSsignal() const
Definition: AliESDtrack.h:183
Double_t GetIntegratedLength() const
Double32_t fHMPIDchi2
Definition: AliESDtrack.h:615
Double32_t fCdz
Definition: AliESDtrack.h:606
AliTPCdEdxInfo * fTPCdEdxInfo
Definition: AliESDtrack.h:626
void SetTRDIn(const AliExternalTrackParam &param)
Double32_t fCaloDz
Definition: AliESDtrack.h:644
void FillPolymarker(TPolyMarker3D *pol, Float_t magf, Float_t minR, Float_t maxR, Float_t stepR)
void ReplaceMatchedTrackID(int oldID, int newID)
AliExternalTrackParam & operator=(const AliExternalTrackParam &trkPar)
Double_t GetPredictedChi2(const Double_t p[2], const Double_t cov[3]) const
Double32_t fHMPIDsignal
Definition: AliESDtrack.h:594
virtual Double_t GetTPCchi2() const
Definition: AliVTrack.h:98
Double_t GetdEdxInfo(AliExternalTrackParam *param, Int_t regionID, Int_t calibID, Int_t qID, Int_t valueID)
Int_t GetNumberOfTRDslices() const
Int_t GetLabel() const
Double_t GetTOFExpTDiffSpec(AliPID::EParticleType specie=AliPID::kPion, Double_t b=0) const
void SetTOFCalChannel(Int_t index)
Double32_t fHMPIDmipY
Definition: AliESDtrack.h:649
Int_t GetNumberOfClusters() const
void SetTPCsignal(Float_t signal, Float_t sigma, UChar_t npoints)
Definition: AliESDtrack.h:243
Int_t GetTrackIndex(Int_t i=0) const
Int_t GetNMatchableTracks() const
Int_t fTOFindex
Channel Index of the TOF Signal.
Definition: AliESDtrack.h:575
TObject * GetCalibObject(Int_t index) const
Bool_t RelateToVertexTPCBxByBz(const AliESDVertex *vtx, Double_t b[3], Double_t maxd, AliExternalTrackParam *cParam=0)
Int_t fTRDnSlices
Definition: AliESDtrack.h:667
void SetTOFL0L1(Short_t l0l1)
void GetTOFLabel(Int_t *p) const
Double32_t fCdd
Definition: AliESDtrack.h:606
virtual Double_t GetC(Double_t b) const
UShort_t fTPCnclsF
Definition: AliESDtrack.h:653
virtual Double_t GetTRDsignal() const
Definition: AliVTrack.h:177
Char_t fTRDTimBin[kTRDnPlanes]
Definition: AliESDtrack.h:670
Double32_t fCaloDx
detector&#39;s L0L1 latency correction
Definition: AliESDtrack.h:643
Int_t GetPID(Bool_t tpcOnly=kFALSE) const
Short_t fTOFl0l1
detector&#39;s Delta Bunch Crossing correction
Definition: AliESDtrack.h:641
Double32_t fCchi2TPC
Definition: AliESDtrack.h:602
void SetTRDIndices(Int_t *indices, Int_t n)
UChar_t fTRDntracklets
Definition: AliESDtrack.h:663
void GetHMPIDpid(Double_t *p) const
void SetPIDValues(Double_t *dest, const Double_t *src, Int_t n)
Double_t fTrackEtaOnEMCal
Definition: AliESDtrack.h:684
Bool_t RelateToVertexTPC(const AliESDVertex *vtx, Double_t b, Double_t maxd, AliExternalTrackParam *cParam=0)
Bool_t GetOuterExternalParameters(Double_t &alpha, Double_t &x, Double_t p[5]) const
Bool_t GetInnerExternalParameters(Double_t &alpha, Double_t &x, Double_t p[5]) const
#define AliError(message)
Definition: AliLog.h:591
UChar_t GetTRDNclusterdEdx() const
Definition: AliESDtrack.h:320
void SetNumberOfTRDslices(Int_t n)
virtual UChar_t GetTRDntrackletsPID() const
Definition: AliVTrack.h:102
void GetCovMatrix(Double_t covmatrix[6]) const
virtual const Double_t * PID() const =0
Int_t fTRDLabel
Definition: AliESDtrack.h:572
void GetIntegratedTimes(Double_t *times, Int_t nspec=AliPID::kSPECIES) const
virtual void Copy(TObject &obj) const
static Int_t ParticleCode(Int_t iType)
Definition: AliPID.h:70
Int_t fV0Indexes[3]
Definition: AliESDtrack.h:582
Short_t GetTOFDeltaBC() const
Bool_t PropagateTo(Double_t p[3], Double_t covyz[3], Double_t covxyz[3], Double_t b)
Double32_t fzTPC
Definition: AliESDtrack.h:600
Bool_t GetInnerExternalCovariance(Double_t cov[15]) const
virtual UShort_t GetTPCNclsF() const
Definition: AliVTrack.h:97
const AliESDVertex * fCacheChi2TPCConstrainedVsGlobalVertex
Cache for the chi2 of constrained TPC vs global track.
Definition: AliESDtrack.h:679
void res(Char_t i)
Definition: Resolution.C:2
for(Int_t itree=0;itree< arrInputTreesDistortionCalib->GetEntriesFast();++itree)
Double32_t fTPCPoints[4]
Definition: AliESDtrack.h:627
Int_t fTPCLabel
Definition: AliESDtrack.h:571
Int_t GetClusters(Int_t idet, Int_t *idx) const
Double32_t fITSchi2Std[kNITSchi2Std]
Definition: AliESDtrack.h:609
Double32_t fTPCsignalTuned
Definition: AliESDtrack.h:624
const AliESDEvent * GetESDEvent() const
Definition: AliESDtrack.h:468
Double32_t * fTrackTime
Definition: AliESDtrack.h:596
void SetITSpid(const Double_t *p)
virtual UChar_t GetTRDncls() const
Definition: AliVTrack.h:101
Double32_t fTRDBudget
Definition: AliESDtrack.h:631
AliTOFHeader * GetTOFHeader() const
Definition: AliESDEvent.h:346
Double32_t fTOFchi2
Definition: AliESDtrack.h:614
UChar_t GetTRDclusters(Int_t *idx) const
virtual ULong64_t GetStatus() const =0
AliExternalTrackParam * fTPCInner
Definition: AliESDtrack.h:555
Double_t GetD(Double_t xv, Double_t yv, Double_t b) const
UShort_t GetTPCncls(Int_t row0=0, Int_t row1=159) const
void SetITSdEdxSamples(const Double_t s[4])
class TMatrixT< Double_t > TMatrixD
Bool_t GetXYZAt(Double_t x, Double_t b, Double_t r[3]) const
Double32_t fTOFsignalRaw
detector&#39;s ToT signal [ns]
Definition: AliESDtrack.h:636
Double_t GetMassForTracking() const
UChar_t GetTRDNchamberdEdx() const
Definition: AliESDtrack.h:319
UChar_t fTRDNclusterdEdx
Definition: AliESDtrack.h:665
virtual void SetDetectorPID(const AliDetectorPID *pid)
Double_t GetTOFsignal() const
Float_t GetDx(Int_t i=0) const
void GetExternalCovariance(Double_t cov[15]) const
void SetImpactParameters(const Float_t p[2], const Float_t cov[3], const Float_t chi2, const AliExternalTrackParam *cParam)
TBits fTPCClusterMap
Definition: AliESDtrack.h:561
virtual UChar_t GetITSClusterMap() const =0
void SetTOFDeltaBC(Short_t deltaBC)
Double32_t fTPCchi2Iter1
Definition: AliESDtrack.h:612
Float_t GetTPCClusterDensity(Int_t nNeighbours=3, Int_t type=0, Int_t row0=0, Int_t row1=159, Int_t bitType=0) const
virtual Double_t GetTRDmomentum(Int_t, Double_t *=0x0) const
Definition: AliVTrack.h:196