AliPhysics  v5-06-40-01 (42bb456)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliEsdTrackExt.cxx
Go to the documentation of this file.
1 // $Id$
2 //
3 // Modified track class to be able to store cached quantities.
4 //
5 // Author: C.Loizides
6 
7 #include "AliEsdTrackExt.h"
8 #include <TVector3.h>
9 #include "AliESDEvent.h"
10 
11 //_________________________________________________________________________________________________
13  : AliESDtrack(), fEmcEta(-10), fEmcPhi(-10), fNCrossedRows(-10), fChi2TPCConstrainedVsGlobal(-10)
14 {
15  // Default constructor.
16 }
17 
18 //_________________________________________________________________________________________________
19 AliEsdTrackExt::AliEsdTrackExt(const AliESDtrack &t)
20  : AliESDtrack(t), fEmcEta(-10), fEmcPhi(-10), fNCrossedRows(-10), fChi2TPCConstrainedVsGlobal(-10)
21 {
22  // Constructor.
23 
24  const AliExternalTrackParam *outp = GetOuterParam();
25  if (outp&&IsEMCAL()) {
26  Double_t trkPos[3] = {0.,0.,0.};
27  if (outp->GetXYZ(trkPos)) {
28  TVector3 vec(trkPos[0],trkPos[1],trkPos[2]);
29  Double_t veta = vec.Eta();
30  Double_t vphi = vec.Phi();
31  if(vphi<0)
32  vphi += 2*TMath::Pi();
33  fEmcEta = veta;
34  fEmcPhi = vphi;
35  }
36  }
37 
38  fNCrossedRows = GetTPCCrossedRows();
39 
40  const AliESDVertex* vertex = 0;
41  vertex = fESDEvent->GetPrimaryVertexTracks();
42  if (!vertex || !vertex->GetStatus())
43  vertex = fESDEvent->GetPrimaryVertexSPD();
44  if (vertex) {
45  fChi2TPCConstrainedVsGlobal = GetChi2TPCConstrainedVsGlobal(vertex);
46  fCacheChi2TPCConstrainedVsGlobalVertex = vertex;
47  }
48 }
49 
50 //_________________________________________________________________________________________________
52 {
53  // Delete the unneeded params.
54 
55  delete fIp; fIp = 0;
56  delete fTPCInner; fTPCInner = 0;
57  delete fHMPIDp; fHMPIDp = 0;
58  delete fFriendTrack; fFriendTrack = 0;
59  if (!IsEMCAL()) {
60  delete fOp; fOp = 0;
61  }
62 }
63 
64 //_________________________________________________________________________________________________
65 void AliEsdTrackExt::MakeMiniTrack(Bool_t dall, Bool_t dcon, Bool_t dtrp, Bool_t dmap,
66  Bool_t dits, Bool_t dtpc, Bool_t dtrd, Bool_t dtof,
67  Bool_t dhmp)
68 {
69  // Make mini track depending on what should be reset.
70 
71  if (fCp && !dcon)
72  fCp->ResetCovariance(1);
73 
74  if (dtrp) {
75  if (dcon) {
76  delete fCp;
77  fCp = 0;
78  }
79  delete fIp; fIp = 0;
80  delete fTPCInner; fTPCInner = 0;
81  delete fOp; fOp = 0;
82  delete fHMPIDp; fHMPIDp = 0;
83  delete fFriendTrack; fFriendTrack = 0;
84  }
85 
86  if (dmap) {
87  fTPCFitMap.Clear();
88  fTPCClusterMap.Clear();
89  fTPCSharedMap.Clear();
90  }
91 
92  // Reset ITS track related information
93  if (dits) {
94  if (dall) {
95  fITSchi2 = 0;
96  fITSncls = 0;
97  fITSClusterMap = 0;
98  fITSSharedMap = 0;
99  fITSsignal = 0;
100  }
101  fITSLabel = 0;
102  for (Int_t i=0;i<4;++i) fITSdEdxSamples[i] = 0.;
103  for (Int_t i=0;i<AliPID::kSPECIES;++i) fITSr[i] = 0;
104  for (Int_t i=0;i<12;++i) fITSModule[i] = -1;
105  }
106 
107  // Reset TPC related track information
108  if (dtpc) {
109  if (dall) {
110  fTPCchi2 = 0;
111  fTPCchi2Iter1 = 0;
112  fTPCncls = 0;
113  fTPCnclsF = 0;
114  fTPCnclsIter1 = 0;
115  fTPCnclsFIter1 = 0;
116  fTPCFitMap = 0;
117  fTPCClusterMap = 0;
118  fTPCSharedMap = 0;
119  fTPCsignal = 0;
120  fTPCsignalS = 0;
121  fTPCsignalN = 0;
122  }
123  fTPCLabel = 0;
124  fdTPC = 0;
125  fzTPC = 0;
126  fCddTPC = 0;
127  fCdzTPC = 0;
128  fCzzTPC = 0;
129  fCchi2TPC = 0;
130  for (Int_t i=0;i<AliPID::kSPECIES;++i) fTPCr[i] = 0;
131  for (Int_t i=0;i<4;++i) fTPCPoints[i] = 0;
132  for (Int_t i=0; i<3;++i) fKinkIndexes[i] = 0;
133  for (Int_t i=0; i<3;++i) fV0Indexes[i] = 0;
134  delete fTPCdEdxInfo; fTPCdEdxInfo = 0;
135  }
136 
137  // Reset TRD related track information
138  if (dtrd) {
139  fTRDchi2 = 0;
140  fTRDncls = 0;
141  fTRDncls0 = 0;
142  fTRDsignal = 0;
143  fTRDLabel = 0;
144  fTRDQuality = 0;
145  fTRDntracklets = 0;
146  fTRDslices = 0;
147  fTRDBudget = 0;
148  for (Int_t i=0;i<kTRDnPlanes;++i) fTRDTimBin[i] = 0;
149  for (Int_t i=0;i<AliPID::kSPECIES;++i) fTRDr[i] = 0;
150  fTRDnSlices = 0;
151  if(fTRDnSlices)
152  delete[] fTRDslices;
153  }
154 
155  // Reset TOF related track information
156  if (dtof) {
157  if (dall) {
158  fTOFchi2 = 0;
159  fTOFindex = -1;
160  fTOFsignal = 99999;
161  fTOFCalChannel = -1;
162  fTOFsignalToT = 99999;
163  fTOFsignalRaw = 99999;
164  fTOFsignalDz = 999;
165  fTOFsignalDx = 999;
166  fTOFdeltaBC = 999;
167  fTOFl0l1 = 999;
168  }
169  for (Int_t i=0;i<AliPID::kSPECIES;++i) fTOFr[i] = 0;
170  for (Int_t i=0;i<3;++i) fTOFLabel[i] = -1;
171  for (Int_t i=0;i<10;++i) fTOFInfo[i] = 0;
172  for (Int_t i=0;i<AliPID::kSPECIES;++i) fTrackTime[i] = 0;
173  }
174 
175  // Reset HMPID related track information
176  if (dhmp) {
177  fHMPIDchi2 = 0;
178  fHMPIDqn = 0;
179  fHMPIDcluIdx = -1;
180  fHMPIDsignal = 0;
181  fHMPIDtrkTheta = 0;
182  fHMPIDtrkPhi = 0;
183  fHMPIDtrkX = 0;
184  fHMPIDtrkY = 0;
185  fHMPIDmipX = 0;
186  fHMPIDmipY = 0;
187  for (Int_t i=0;i<AliPID::kSPECIES;++i) fHMPIDr[i] = 0;
188  }
189 }
190 
191 //_________________________________________________________________________________________________
193 {
194  // Setup cache with stored variables.
195 
196  fCacheNCrossedRows = fNCrossedRows;
197 
198  const AliESDVertex* vertex = 0;
199  vertex = fESDEvent->GetPrimaryVertexTracks();
200  if (!vertex || !vertex->GetStatus())
201  vertex = fESDEvent->GetPrimaryVertexSPD();
202  if (vertex) {
203  fCacheChi2TPCConstrainedVsGlobal = fChi2TPCConstrainedVsGlobal;
204  fCacheChi2TPCConstrainedVsGlobalVertex = vertex;
205  }
206 }
Double32_t fNCrossedRows
Double32_t fEmcPhi
Double32_t fEmcEta
void MakeMiniTrack(Bool_t dall=0, Bool_t dcon=1, Bool_t dtrp=1, Bool_t dmap=1, Bool_t dits=1, Bool_t dtpc=1, Bool_t dtrd=1, Bool_t dtof=1, Bool_t dhmp=1)
Double32_t fChi2TPCConstrainedVsGlobal