Update master to aliroot
[u/mrichter/AliRoot.git] / STEER / AOD / AliAODTrack.h
CommitLineData
df9db588 1#ifndef AliAODTrack_H
2#define AliAODTrack_H
3/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
8//-------------------------------------------------------------------------
4f6e22bd 9// AOD track implementation of AliVTrack
df9db588 10// Author: Markus Oldenburg, CERN
11//-------------------------------------------------------------------------
12
13#include <TRef.h>
507ed024 14#include <TBits.h>
df9db588 15
4f6e22bd 16#include "AliVTrack.h"
df9db588 17#include "AliAODVertex.h"
5d62ce04 18#include "AliAODRedCov.h"
7be1db84 19#include "AliAODPid.h"
50ff8c36 20#include "AliExternalTrackParam.h"
c8fe2783 21
df9db588 22
6dc40b1c 23class AliVVertex;
00a38d07 24class AliDetectorPID;
af48efa8 25class AliTPCdEdxInfo;
aab77ed0 26class AliAODEvent;
42fcc729 27class AliTOFHeader;
6dc40b1c 28
4f6e22bd 29class AliAODTrack : public AliVTrack {
df9db588 30
31 public:
32
1912763f 33 enum AODTrk_t {kUndef = -1,
34 kPrimary,
a01415e2 35 kFromDecayVtx,
36 kOrphan}; // Please note that this flag does not guarantee that the particle is a Physical Primary, it simply identifies the algorithm which was used to filter the track. In general, the following associations are used (check the filter macro to be sure, as this comment may be outdated):
37 //kPrimary: TPC only tracks, global constrained tracks, primary tracks, kink mothers;
38 //kFromDecayVtx: bachelor tracks from cascades, tracks from V0, kink daughters;
39 //kUndef:TRD matched tracks
df9db588 40
41 enum AODTrkBits_t {
dc825b15 42 kIsDCA=BIT(14), // set if fPosition is the DCA and not the position of the first point
1912763f 43 kUsedForVtxFit=BIT(15), // set if this track was used to fit the vertex it is attached to
ed47dd92 44 kUsedForPrimVtxFit=BIT(16), // set if this track was used to fit the primary vertex
9e3e4265 45 kIsTPCConstrained=BIT(17), // set if this track is a SA TPC track constrained to the SPD vertex, needs to be skipped in any track loop to avoid double counting
46 kIsHybridTPCCG=BIT(18), // set if this track can be used as a hybrid track i.e. Gbobal tracks with certain slecetion plus the TPC constrained tracks that did not pass the selection
47 kIsGlobalConstrained=BIT(19), // set if this track is a global track constrained to the vertex, needs to be skipped in any track loop to avoid double counting
48 kIsHybridGCG=BIT(20)// set if this track can be used as a hybrid track i.e. tracks with certain slecetion plus the global constraint tracks that did not pass the selection
df9db588 49 };
50
0e31a30a 51
52 enum AODTrkFilterBits_t {
ba54e4d4 53 kTrkTPCOnly = BIT(0), // Standard TPC only tracks
54 kTrkITSsa = BIT(1), // ITS standalone
55 kTrkITSConstrained = BIT(2), // Pixel OR necessary for the electrons
56 kTrkElectronsPID = BIT(3), // PID for the electrons
57 kTrkGlobalNoDCA = BIT(4), // standard cuts with very loose DCA
58 kTrkGlobal = BIT(5), // standard cuts with tight DCA cut
59 kTrkGlobalSDD = BIT(6), // standard cuts with tight DCA but with requiring the first SDD cluster instead of an SPD cluster tracks selected by this cut are exclusive to those selected by the previous cut
60 kTrkTPCOnlyConstrained = BIT(7) // TPC only tracks: TPConly information constrained to SPD vertex in the filter below
0e31a30a 61 };
62
63
4697e4fb 64 enum AODTrkPID_t {
1912763f 65 kElectron = 0,
66 kMuon = 1,
67 kPion = 2,
68 kKaon = 3,
69 kProton = 4,
4697e4fb 70 kDeuteron = 5,
71 kTriton = 6,
72 kHelium3 = 7,
73 kAlpha = 8,
74 kUnknown = 9,
75 kMostProbable = -1
76 };
df9db588 77
78 AliAODTrack();
02153d58 79 AliAODTrack(Short_t id,
df9db588 80 Int_t label,
81 Double_t p[3],
82 Bool_t cartesian,
83 Double_t x[3],
84 Bool_t dca,
85 Double_t covMatrix[21],
86 Short_t q,
87 UChar_t itsClusMap,
df9db588 88 AliAODVertex *prodVertex,
1912763f 89 Bool_t usedForVtxFit,
dc825b15 90 Bool_t usedForPrimVtxFit,
ec40c484 91 AODTrk_t ttype=kUndef,
862ce351 92 UInt_t selectInfo=0,
93 Float_t chi2perNDF = -999.);
df9db588 94
76b98553 95
02153d58 96 AliAODTrack(Short_t id,
df9db588 97 Int_t label,
98 Float_t p[3],
99 Bool_t cartesian,
100 Float_t x[3],
101 Bool_t dca,
102 Float_t covMatrix[21],
103 Short_t q,
104 UChar_t itsClusMap,
df9db588 105 AliAODVertex *prodVertex,
1912763f 106 Bool_t usedForVtxFit,
dc825b15 107 Bool_t usedForPrimVtxFit,
ec40c484 108 AODTrk_t ttype=kUndef,
862ce351 109 UInt_t selectInfo=0,
110 Float_t chi2perNDF = -999.);
df9db588 111
112 virtual ~AliAODTrack();
113 AliAODTrack(const AliAODTrack& trk);
114 AliAODTrack& operator=(const AliAODTrack& trk);
115
116 // kinematics
16b65f2a 117 virtual Double_t OneOverPt() const { return (fMomentum[0] != 0.) ? 1./fMomentum[0] : -999.; }
df9db588 118 virtual Double_t Phi() const { return fMomentum[1]; }
119 virtual Double_t Theta() const { return fMomentum[2]; }
120
16b65f2a 121 virtual Double_t Px() const { return fMomentum[0] * TMath::Cos(fMomentum[1]); }
122 virtual Double_t Py() const { return fMomentum[0] * TMath::Sin(fMomentum[1]); }
123 virtual Double_t Pz() const { return fMomentum[0] / TMath::Tan(fMomentum[2]); }
124 virtual Double_t Pt() const { return fMomentum[0]; }
df9db588 125 virtual Double_t P() const { return TMath::Sqrt(Pt()*Pt()+Pz()*Pz()); }
c683ddc2 126 virtual Bool_t PxPyPz(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE; }
127
128 virtual Double_t Xv() const { return GetProdVertex() ? GetProdVertex()->GetX() : -999.; }
129 virtual Double_t Yv() const { return GetProdVertex() ? GetProdVertex()->GetY() : -999.; }
130 virtual Double_t Zv() const { return GetProdVertex() ? GetProdVertex()->GetZ() : -999.; }
131 virtual Bool_t XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE; }
132
c4460410 133 Double_t Chi2perNDF() const { return fChi2perNDF; }
a2c30af1 134
135 UShort_t GetTPCnclsS(Int_t i0=0,Int_t i1=159) const {
136 UShort_t cl = fTPCSharedMap.CountBits(i0)-fTPCSharedMap.CountBits(i1);
0914b519 137 return cl;
138 }
4697e4fb 139
a2c30af1 140 UShort_t GetTPCncls(Int_t i0=0,Int_t i1=159) const {
141 UShort_t cl = fTPCFitMap.CountBits(i0)-fTPCFitMap.CountBits(i1);
142 if(cl==0)cl = fTPCClusterMap.CountBits(i0)-fTPCClusterMap.CountBits(i1);// backward compatibility
143 return cl;
144 }
145
146 UShort_t GetTPCNcls() const { return GetTPCncls(); }
147
a01415e2 148 Int_t GetNcls(Int_t idet) const;
149
4697e4fb 150 virtual Double_t M() const { return M(GetMostProbablePID()); }
151 Double_t M(AODTrkPID_t pid) const;
152 virtual Double_t E() const { return E(GetMostProbablePID()); }
153 Double_t E(AODTrkPID_t pid) const;
154 Double_t E(Double_t m) const { return TMath::Sqrt(P()*P() + m*m); }
155 virtual Double_t Y() const { return Y(GetMostProbablePID()); }
156 Double_t Y(AODTrkPID_t pid) const;
157 Double_t Y(Double_t m) const;
df9db588 158
159 virtual Double_t Eta() const { return -TMath::Log(TMath::Tan(0.5 * fMomentum[2])); }
df9db588 160
161 virtual Short_t Charge() const {return fCharge; }
162
6dc40b1c 163 virtual Bool_t PropagateToDCA(const AliVVertex *vtx,
164 Double_t b, Double_t maxd, Double_t dz[2], Double_t covar[3]);
165
df9db588 166 // PID
167 virtual const Double_t *PID() const { return fPID; }
4697e4fb 168 AODTrkPID_t GetMostProbablePID() const;
169 void ConvertAliPIDtoAODPID();
e68fa179 170 void SetDetPID(AliAODPid *aodpid) {fDetPid = aodpid;}
df9db588 171
76b98553 172 void SetPIDForTracking(Int_t pid) {fPIDForTracking = pid;}
173 Int_t GetPIDForTracking() const {return fPIDForTracking;}
174 Double_t GetMassForTracking() const;
175
cdd730d0 176 template <typename T> void GetPID(T *pid) const {
76b98553 177 for(Int_t i=0; i<10; ++i) pid[i] = fPID ? fPID[i]:0;}
df9db588 178
cdd730d0 179 template <typename T> void SetPID(const T *pid) {
76b98553 180 if (pid) {
181 if (!fPID) fPID = new Double32_t[10];
182 for(Int_t i=0; i<10; ++i) fPID[i]=pid[i];
183 }
184 else {delete[] fPID; fPID = 0;}
185 }
186
6efb741f 187 Bool_t IsOn(Int_t mask) const {return (fFlags&mask)>0;}
188 ULong_t GetStatus() const { return GetFlags(); }
189 ULong_t GetFlags() const { return fFlags; }
190
4f6e22bd 191 Int_t GetID() const { return (Int_t)fID; }
02153d58 192 Int_t GetLabel() const { return fLabel; }
a2c30af1 193 void GetTOFLabel(Int_t *p) const;
194
195
02153d58 196 Char_t GetType() const { return fType;}
862ce351 197 Bool_t IsPrimaryCandidate() const;
02153d58 198 Bool_t GetUsedForVtxFit() const { return TestBit(kUsedForVtxFit); }
199 Bool_t GetUsedForPrimVtxFit() const { return TestBit(kUsedForPrimVtxFit); }
9e3e4265 200
201 Bool_t IsHybridGlobalConstrainedGlobal() const { return TestBit(kIsHybridGCG); }
202 Bool_t IsHybridTPCConstrainedGlobal() const { return TestBit(kIsHybridTPCCG); }
203 Bool_t IsTPCOnly() const { return IsTPCConstrained(); } // obsolete bad naming
204 Bool_t IsTPCConstrained() const { return TestBit(kIsTPCConstrained); }
205 Bool_t IsGlobalConstrained() const { return TestBit(kIsGlobalConstrained); }
76e6ee6a 206 //
1cecd6e3 207 Int_t GetTOFBunchCrossing(Double_t b=0, Bool_t tpcPIDonly=kFALSE) const;
76e6ee6a 208 //
15da855d 209 using AliVTrack::GetP;
cdd730d0 210 template <typename T> void GetP(T *p) const {
df9db588 211 p[0]=fMomentum[0]; p[1]=fMomentum[1]; p[2]=fMomentum[2];}
212
cdd730d0 213// template <typename T> void GetPxPyPz(T *p) const {
c8fe2783 214// p[0] = Px(); p[1] = Py(); p[2] = Pz();}
215 Bool_t GetPxPyPz(Double_t *p) const;
df9db588 216
cdd730d0 217 template <typename T> Bool_t GetPosition(T *x) const {
df9db588 218 x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2];
219 return TestBit(kIsDCA);}
220
cdd730d0 221 template <typename T> void SetCovMatrix(const T *covMatrix) {
5d62ce04 222 if(!fCovMatrix) fCovMatrix=new AliAODRedCov<6>();
df9db588 223 fCovMatrix->SetCovMatrix(covMatrix);}
224
cdd730d0 225 template <typename T> Bool_t GetCovMatrix(T *covMatrix) const {
df9db588 226 if(!fCovMatrix) return kFALSE;
227 fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;}
228
892be05f 229 Bool_t GetXYZ(Double_t *p) const {
6a33e0e9 230 return GetPosition(p); }
086400fc 231
232 Bool_t GetXYZAt(Double_t x, Double_t b, Double_t *r) const;
c8253dd9 233 Bool_t GetXYZatR(Double_t xr,Double_t bz, Double_t *xyz=0, Double_t* alpSect=0) const;
234
4f6e22bd 235 Bool_t GetCovarianceXYZPxPyPz(Double_t cv[21]) const {
236 return GetCovMatrix(cv);}
237
df9db588 238 void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;}
239
a01415e2 240 Double_t XAtDCA() const { return fPositionAtDCA[0]; } //makes sense only for constrained tracks, returns dummy values for all other tracks
241 Double_t YAtDCA() const { return fPositionAtDCA[1]; } //makes sense only for constrained tracks, returns dummy values for all other tracks
6c954176 242 Double_t ZAtDCA() const {
243 if (IsMuonTrack()) return fPosition[2];
244 else if (TestBit(kIsDCA)) return fPosition[1];
a01415e2 245 else return -999.; } //makes sense only for constrained tracks, returns dummy values for all other tracks
6c954176 246 Bool_t XYZAtDCA(Double_t x[3]) const { x[0] = XAtDCA(); x[1] = YAtDCA(); x[2] = ZAtDCA(); return kTRUE; }
247
248 Double_t DCA() const {
249 if (IsMuonTrack()) return TMath::Sqrt(XAtDCA()*XAtDCA() + YAtDCA()*YAtDCA());
250 else if (TestBit(kIsDCA)) return fPosition[0];
251 else return -999.; }
252
a01415e2 253 Double_t PxAtDCA() const { return fMomentumAtDCA[0]; } //makes sense only for constrained tracks, returns dummy values for all other tracks
254 Double_t PyAtDCA() const { return fMomentumAtDCA[1]; } //makes sense only for constrained tracks, returns dummy values for all other tracks
255 Double_t PzAtDCA() const { return fMomentumAtDCA[2]; } //makes sense only for constrained tracks, returns dummy values for all other tracks
6c954176 256 Double_t PAtDCA() const { return TMath::Sqrt(PxAtDCA()*PxAtDCA() + PyAtDCA()*PyAtDCA() + PzAtDCA()*PzAtDCA()); }
257 Bool_t PxPyPzAtDCA(Double_t p[3]) const { p[0] = PxAtDCA(); p[1] = PyAtDCA(); p[2] = PzAtDCA(); return kTRUE; }
258
f43586f0 259 Double_t GetRAtAbsorberEnd() const { return fRAtAbsorberEnd; }
260
6c954176 261 UChar_t GetITSClusterMap() const { return (UChar_t)(fITSMuonClusterMap&0xff); }
6dc40b1c 262 Int_t GetITSNcls() const;
263 Bool_t HasPointOnITSLayer(Int_t i) const { return TESTBIT(GetITSClusterMap(),i); }
6c954176 264 UShort_t GetHitsPatternInTrigCh() const { return (UShort_t)((fITSMuonClusterMap&0xff00)>>8); }
265 UInt_t GetMUONClusterMap() const { return (fITSMuonClusterMap&0x3ff0000)>>16; }
266 UInt_t GetITSMUONClusterMap() const { return fITSMuonClusterMap; }
267
8a1418dc 268 Bool_t TestFilterBit(UInt_t filterBit) const {return (Bool_t) ((filterBit & fFilterMap) != 0);}
6db112a4 269 Bool_t TestFilterMask(UInt_t filterMask) const {return (Bool_t) ((filterMask & fFilterMap) == filterMask);}
e4b91233 270 void SetFilterMap(UInt_t i){fFilterMap = i;}
681b1d8b 271 UInt_t GetFilterMap() const {return fFilterMap;}
df9db588 272
507ed024 273 const TBits& GetTPCClusterMap() const {return fTPCClusterMap;}
086400fc 274 const TBits* GetTPCClusterMapPtr() const {return &fTPCClusterMap;}
bcabd0e4 275 const TBits& GetTPCFitMap() const {return fTPCFitMap;}
74ca66e3 276 const TBits* GetTPCFitMapPtr() const {return &fTPCFitMap;}
25f906db 277 Float_t GetTPCClusterInfo(Int_t nNeighbours=3, Int_t type=0, Int_t row0=0, Int_t row1=159, Int_t /*type*/=0) const;
9006fe9c 278
507ed024 279 const TBits& GetTPCSharedMap() const {return fTPCSharedMap;}
74ca66e3 280 const TBits* GetTPCSharedMapPtr() const {return &fTPCSharedMap;}
507ed024 281 void SetTPCClusterMap(const TBits amap) {fTPCClusterMap = amap;}
282 void SetTPCSharedMap(const TBits amap) {fTPCSharedMap = amap;}
bcabd0e4 283 void SetTPCFitMap(const TBits amap) {fTPCFitMap = amap;}
3c01c166 284 void SetTPCPointsF(UShort_t findable){fTPCnclsF = findable;}
820214a7 285 void SetTPCNCrossedRows(UInt_t n) {fTPCNCrossedRows = n;}
50ff8c36 286
287 virtual const AliExternalTrackParam * GetInnerParam() const { return NULL; }
288 virtual const AliExternalTrackParam * GetOuterParam() const { return NULL; }
3c01c166 289
290 UShort_t GetTPCNclsF() const { return fTPCnclsF;}
820214a7 291 UShort_t GetTPCNCrossedRows() const { return fTPCNCrossedRows;}
292 Float_t GetTPCFoundFraction() const { return fTPCNCrossedRows>0 ? float(GetTPCNcls())/fTPCNCrossedRows : 0;}
3c01c166 293
a7d9ab9e 294 // Calorimeter Cluster
295 Int_t GetEMCALcluster() const {return fCaloIndex;}
296 void SetEMCALcluster(Int_t index) {fCaloIndex=index;}
297 Bool_t IsEMCAL() const {return fFlags&kEMCALmatch;}
298
ed15417e 299 Double_t GetTrackPhiOnEMCal() const {return fTrackPhiOnEMCal;}
300 Double_t GetTrackEtaOnEMCal() const {return fTrackEtaOnEMCal;}
a29b2a8a 301 Double_t GetTrackPtOnEMCal() const {return fTrackPtOnEMCal;}
37cf883a 302 Double_t GetTrackPOnEMCal() const {return TMath::Abs(fTrackEtaOnEMCal) < 1 ? fTrackPtOnEMCal*TMath::CosH(fTrackEtaOnEMCal) : -999;}
a29b2a8a 303 void SetTrackPhiEtaPtOnEMCal(Double_t phi,Double_t eta,Double_t pt) {fTrackPhiOnEMCal=phi;fTrackEtaOnEMCal=eta;fTrackPtOnEMCal=pt;}
ed15417e 304
a7d9ab9e 305 Int_t GetPHOScluster() const {return fCaloIndex;}
306 void SetPHOScluster(Int_t index) {fCaloIndex=index;}
307 Bool_t IsPHOS() const {return fFlags&kPHOSmatch;}
308
9006fe9c 309 //pid signal interface
310 Double_t GetITSsignal() const { return fDetPid?fDetPid->GetITSsignal():0.; }
74ca66e3 311 void GetITSdEdxSamples(Double_t s[4]) const;
9006fe9c 312 Double_t GetTPCsignal() const { return fDetPid?fDetPid->GetTPCsignal():0.; }
539a5a59 313 Double_t GetTPCsignalTunedOnData() const { return fTPCsignalTuned;}
314 void SetTPCsignalTunedOnData(Double_t signal) {fTPCsignalTuned = signal;}
9006fe9c 315 UShort_t GetTPCsignalN() const { return fDetPid?fDetPid->GetTPCsignalN():0; }
de26d2c7 316 virtual AliTPCdEdxInfo* GetTPCdEdxInfo() const {return fDetPid?fDetPid->GetTPCdEdxInfo():0;}
9006fe9c 317 Double_t GetTPCmomentum() const { return fDetPid?fDetPid->GetTPCmomentum():0.; }
ef7661fd 318 Double_t GetTPCTgl() const { return fDetPid?fDetPid->GetTPCTgl():0.; }
5839d3e1 319 Double_t GetTOFsignal() const { return fDetPid?fDetPid->GetTOFsignal():0.; }
9b5c8b95 320 Double_t GetIntegratedLength() const { return fTrackLength;}
321 void SetIntegratedLength(Double_t l) {fTrackLength = l;}
a2c30af1 322 Double_t GetTOFsignalTunedOnData() const { return fTOFsignalTuned;}
323 void SetTOFsignalTunedOnData(Double_t signal) {fTOFsignalTuned = signal;}
567624b5 324 Double_t GetHMPIDsignal() const;
325 Double_t GetHMPIDoccupancy() const;
326
327 Int_t GetHMPIDcluIdx() const;
328
329 void GetHMPIDtrk(Float_t &x, Float_t &y, Float_t &th, Float_t &ph) const;
330 void GetHMPIDmip(Float_t &x,Float_t &y,Int_t &q,Int_t &nph) const;
331
332 Bool_t GetOuterHmpPxPyPz(Double_t *p) const;
5839d3e1 333
3c894a02 334 void GetIntegratedTimes(Double_t *times, Int_t nspec=AliPID::kSPECIES) const {if (fDetPid) fDetPid->GetIntegratedTimes(times, nspec);}
fd21ec8d 335 Double_t GetTRDslice(Int_t plane, Int_t slice) const;
6736efd5 336 Double_t GetTRDsignal() const {return fDetPid ? fDetPid->GetTRDsignal() : 0;}
ea235c90 337 Double_t GetTRDmomentum(Int_t plane, Double_t */*sp*/=0x0) const;
643d59bf 338 Double_t GetTRDchi2() const {return fDetPid ? fDetPid->GetTRDChi2() : -1;}
74ca66e3 339 UChar_t GetTRDncls(Int_t layer) const;
340 UChar_t GetTRDncls() const {return GetTRDncls(-1);}
99e9d5ec 341 UChar_t GetTRDntrackletsPID() const;
73b4da68 342 Int_t GetNumberOfTRDslices() const { return fDetPid?fDetPid->GetTRDnSlices():0; }
c997f0f9 343 void GetHMPIDpid(Double_t */*p*/) const { return; } // TODO: To be implemented properly with the new HMPID object
fd21ec8d 344
f7cc8591 345 void SetMFTClusterPattern(ULong_t mftClusterPattern) { fMFTClusterPattern = mftClusterPattern; } // AU
346 ULong_t GetMFTClusterPattern() { return fMFTClusterPattern; } // AU
347
539a5a59 348 const AliAODEvent* GetAODEvent() const {return fAODEvent;}
d38034b8 349 virtual const AliVEvent* GetEvent() const {return (AliVEvent*)fAODEvent;}
aab77ed0 350 void SetAODEvent(const AliAODEvent* ptr){fAODEvent = ptr;}
42fcc729 351 const AliTOFHeader* GetTOFHeader() const;
aab77ed0 352
7be1db84 353 AliAODPid *GetDetPid() const { return fDetPid; }
df9db588 354 AliAODVertex *GetProdVertex() const { return (AliAODVertex*)fProdVertex.GetObject(); }
355
356 // print
357 void Print(const Option_t *opt = "") const;
358
359 // setters
6efb741f 360 void SetFlags(ULong_t flags) { fFlags = flags; }
361 void SetStatus(ULong_t flags) { fFlags|=flags; }
362 void ResetStatus(ULong_t flags) { fFlags&=~flags; }
363
02153d58 364 void SetID(Short_t id) { fID = id; }
6efb741f 365 void SetLabel(Int_t label) { fLabel = label; }
a2c30af1 366 void SetTOFLabel(const Int_t* p);
cdd730d0 367 template <typename T> void SetPosition(const T *x, Bool_t isDCA = kFALSE);
df9db588 368 void SetDCA(Double_t d, Double_t z);
1912763f 369 void SetUsedForVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForVtxFit) : ResetBit(kUsedForVtxFit); }
dc825b15 370 void SetUsedForPrimVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForPrimVtxFit) : ResetBit(kUsedForPrimVtxFit); }
9e3e4265 371
372 void SetIsTPCOnly(Bool_t b = kTRUE) { SetIsTPCConstrained(b); }// obsolete bad naming
041743e4 373
9e3e4265 374 void SetIsTPCConstrained(Bool_t b = kTRUE) { b ? SetBit(kIsTPCConstrained) : ResetBit(kIsTPCConstrained); }
041743e4 375 void SetIsHybridTPCConstrainedGlobal(Bool_t hybrid = kTRUE) { hybrid ? SetBit(kIsHybridTPCCG) : ResetBit(kIsHybridTPCCG); }
376
9e3e4265 377 void SetIsGlobalConstrained(Bool_t b = kTRUE) { b ? SetBit(kIsGlobalConstrained) : ResetBit(kIsGlobalConstrained); }
378 void SetIsHybridGlobalConstrainedGlobal(Bool_t hybrid = kTRUE) { hybrid ? SetBit(kIsHybridGCG) : ResetBit(kIsHybridGCG); }
379
380
df9db588 381
f4ad422f 382 void SetOneOverPt(Double_t oneOverPt) { fMomentum[0] = 1. / oneOverPt; }
16b65f2a 383 void SetPt(Double_t pt) { fMomentum[0] = pt; };
14b34be5 384 void SetPhi(Double_t phi) { fMomentum[1] = phi; }
385 void SetTheta(Double_t theta) { fMomentum[2] = theta; }
cdd730d0 386 template <typename T> void SetP(const T *p, Bool_t cartesian = kTRUE);
df9db588 387 void SetP() {fMomentum[0]=fMomentum[1]=fMomentum[2]=-999.;}
388
6c954176 389 void SetXYAtDCA(Double_t x, Double_t y) {fPositionAtDCA[0] = x; fPositionAtDCA[1] = y;}
390 void SetPxPyPzAtDCA(Double_t pX, Double_t pY, Double_t pZ) {fMomentumAtDCA[0] = pX; fMomentumAtDCA[1] = pY; fMomentumAtDCA[2] = pZ;}
391
f43586f0 392 void SetRAtAbsorberEnd(Double_t r) { fRAtAbsorberEnd = r; }
393
14b34be5 394 void SetCharge(Short_t q) { fCharge = q; }
1912763f 395 void SetChi2perNDF(Double_t chi2perNDF) { fChi2perNDF = chi2perNDF; }
df9db588 396
6c954176 397 void SetITSClusterMap(UChar_t itsClusMap) { fITSMuonClusterMap = (fITSMuonClusterMap&0xffffff00)|(((UInt_t)itsClusMap)&0xff); }
398 void SetHitsPatternInTrigCh(UShort_t hitsPatternInTrigCh) { fITSMuonClusterMap = (fITSMuonClusterMap&0xffff00ff)|((((UInt_t)hitsPatternInTrigCh)&0xff)<<8); }
399 void SetMuonClusterMap(UInt_t muonClusMap) { fITSMuonClusterMap = (fITSMuonClusterMap&0xfc00ffff)|((muonClusMap&0x3ff)<<16); }
400 void SetITSMuonClusterMap(UInt_t itsMuonClusMap) { fITSMuonClusterMap = itsMuonClusMap; }
0a2dcc83 401 void SetMUONtrigHitsMapTrg(UInt_t muonTrigHitsMap) { fMUONtrigHitsMapTrg = muonTrigHitsMap; }
ad30e3df 402 UInt_t GetMUONTrigHitsMapTrg() const { return fMUONtrigHitsMapTrg; }
0a2dcc83 403 void SetMUONtrigHitsMapTrk(UInt_t muonTrigHitsMap) { fMUONtrigHitsMapTrk = muonTrigHitsMap; }
ad30e3df 404 UInt_t GetMUONTrigHitsMapTrk() const { return fMUONtrigHitsMapTrk; }
405 Int_t GetMuonTrigDevSign() const;
df9db588 406
8a1418dc 407 Int_t GetMatchTrigger() const {return fITSMuonClusterMap>>30;}
e1c744ca 408 // 0 Muon track does not match trigger
409 // 1 Muon track match but does not pass pt cut
410 // 2 Muon track match Low pt cut
411 // 3 Muon track match High pt cut
412 void SetMatchTrigger(Int_t MatchTrigger);
2200238e 413 Bool_t MatchTrigger() const { return (GetMatchTrigger()>0); } // Muon track matches trigger track
414 Bool_t MatchTriggerLowPt() const { return (GetMatchTrigger()>1); } // Muon track matches trigger track and passes Low pt cut
415 Bool_t MatchTriggerHighPt() const { return (GetMatchTrigger()>2); } // Muon track matches trigger track and passes High pt cut
416 Bool_t MatchTriggerDigits() const; // Muon track matches trigger digits
8a1418dc 417 Double_t GetChi2MatchTrigger() const { return fChi2MatchTrigger;}
6c954176 418 void SetChi2MatchTrigger(Double_t Chi2MatchTrigger) {fChi2MatchTrigger = Chi2MatchTrigger; }
2200238e 419 Bool_t HitsMuonChamber(Int_t MuonChamber, Int_t cathode = -1) const; // Check if track hits Muon chambers
f7cc8591 420 Bool_t IsMuonTrack() const { return ( (GetMUONClusterMap()>0) && !fIsMuonGlobalTrack ) ? kTRUE : kFALSE; }
5c15a68b 421
f7cc8591 422 Bool_t IsMuonGlobalTrack() const { return fIsMuonGlobalTrack; } // AU
423 void SetIsMuonGlobalTrack(Bool_t isMuonGlobalTrack) { fIsMuonGlobalTrack = isMuonGlobalTrack; } // AU
424
5c15a68b 425 void Connected(Bool_t flag) {flag ? SETBIT(fITSMuonClusterMap,26) : CLRBIT(fITSMuonClusterMap,26);}
426 Bool_t IsConnected() const {return TESTBIT(fITSMuonClusterMap,26);}
e1c744ca 427
c683ddc2 428 void SetProdVertex(TObject *vertex) { fProdVertex = vertex; }
429 void SetType(AODTrk_t ttype) { fType=ttype; }
430
00a38d07 431 // Trasient PID object, is owned by the track
432 virtual void SetDetectorPID(const AliDetectorPID *pid);
433 virtual const AliDetectorPID* GetDetectorPID() const { return fDetectorPID; }
6dc40b1c 434
6a8e543a 435 // Dummy
436 Int_t PdgCode() const {return 0;}
437
df9db588 438 private :
439
440 // Momentum & position
1912763f 441 Double32_t fMomentum[3]; // momemtum stored in pt, phi, theta
442 Double32_t fPosition[3]; // position of first point on track or dca
6c954176 443
444 Double32_t fMomentumAtDCA[3]; // momentum (px,py,pz) at DCA
445 Double32_t fPositionAtDCA[2]; // trasverse position (x,y) at DCA
446
f43586f0 447 Double32_t fRAtAbsorberEnd; // transverse position r at the end of the muon absorber
448
862ce351 449 Double32_t fChi2perNDF; // chi2/NDF of momentum fit
9333290e 450 Double32_t fChi2MatchTrigger; // chi2 of trigger/track matching
76b98553 451 Double32_t* fPID; //! [0.,1.,8] pointer to PID object
df9db588 452
6efb741f 453 ULong_t fFlags; // reconstruction status flags
1912763f 454 Int_t fLabel; // track label, points back to MC track
9b5c8b95 455 Int_t fTOFLabel[3]; // TOF label
456 Double32_t fTrackLength; // Track length
6c954176 457 UInt_t fITSMuonClusterMap; // map of ITS and muon clusters, one bit per layer
458 // (ITS: bit 1-8, muon trigger: bit 9-16, muon tracker: bit 17-26, muon match trigger: bit 31-32)
0a2dcc83 459 UInt_t fMUONtrigHitsMapTrg; // Muon trigger hits map from trigger
460 UInt_t fMUONtrigHitsMapTrk; // Muon trigger hits map from tracker track extrapolation
9333290e 461 UInt_t fFilterMap; // filter information, one bit per set of cuts
df9db588 462
bcabd0e4 463 TBits fTPCFitMap; // Map of clusters, one bit per padrow; if has a cluster on given padrow which is used in the fit
507ed024 464 TBits fTPCClusterMap; // Map of clusters, one bit per padrow; 1 if has a cluster on given padrow
465 TBits fTPCSharedMap; // Map of clusters, one bit per padrow; 1 if has a shared cluster on given padrow
bcabd0e4 466
3c01c166 467 UShort_t fTPCnclsF; // findable clusters
820214a7 468 UShort_t fTPCNCrossedRows; // n crossed rows
507ed024 469
02153d58 470 Short_t fID; // unique track ID, points back to the ESD track
471
1912763f 472 Char_t fCharge; // particle charge
a01415e2 473 Char_t fType; // Track Type, explanation close to the enum AODTrk_t
a7d9ab9e 474
76b98553 475 Char_t fPIDForTracking; // pid using for tracking of ESD track
476
a7d9ab9e 477 Int_t fCaloIndex; // index of associated EMCAL/PHOS cluster (AliAODCaloCluster)
478
507ed024 479
9333290e 480 AliAODRedCov<6> *fCovMatrix; // covariance matrix (x, y, z, px, py, pz)
00a38d07 481 AliAODPid *fDetPid; // more detailed or detector specific raw pid information
482 mutable const AliDetectorPID* fDetectorPID; //! transient object to cache calibrated PID information
9333290e 483 TRef fProdVertex; // vertex of origin
df9db588 484
a29b2a8a 485 Double_t fTrackPhiOnEMCal; // phi of track after being propagated to the EMCal surface (default r = 440 cm)
486 Double_t fTrackEtaOnEMCal; // eta of track after being propagated to the EMCal surface (default r = 440 cm)
487 Double_t fTrackPtOnEMCal; // pt of track after being propagated to the EMCal surface (default r = 440 cm)
ed15417e 488
f7cc8591 489 Bool_t fIsMuonGlobalTrack; // True if the track is built from the combination of MUON and MFT clusters // AU
490
539a5a59 491 Double_t fTPCsignalTuned; //! TPC signal tuned on data when using MC
a2c30af1 492 Double_t fTOFsignalTuned; //! TOF signal tuned on data when using MC
539a5a59 493
f7cc8591 494 ULong_t fMFTClusterPattern; // Tells us which MFT clusters are contained in the track, and which one is a good one (if MC) // AU
495
d38034b8 496 const AliAODEvent* fAODEvent; //! pointer back to the event the track belongs to
aab77ed0 497
f8356e9e 498 //---------------------------------------------------------------------------
499 //--the calibration interface--
500 //--to be used in online calibration/QA
501 //--should also be implemented in ESD so it works offline as well
502 //-----------
503 virtual Int_t GetTrackParam ( AliExternalTrackParam &p ) const;
504 virtual Int_t GetTrackParamRefitted ( AliExternalTrackParam &p ) const;
505 virtual Int_t GetTrackParamIp ( AliExternalTrackParam &p ) const;
506 virtual Int_t GetTrackParamTPCInner ( AliExternalTrackParam &p ) const;
507 virtual Int_t GetTrackParamOp ( AliExternalTrackParam &p ) const;
508 virtual Int_t GetTrackParamCp ( AliExternalTrackParam &p ) const;
509 virtual Int_t GetTrackParamITSOut ( AliExternalTrackParam &p ) const;
510
f7cc8591 511 ClassDef(AliAODTrack, 24);
df9db588 512};
513
862ce351 514inline Bool_t AliAODTrack::IsPrimaryCandidate() const
515{
516 // True of track passes primary particle selection (independent of type)
517 //
518 if (fFilterMap) {
519 return kTRUE;
520 } else {
521 return kFALSE;
522 }
523}
524
6dc40b1c 525inline Int_t AliAODTrack::GetITSNcls() const
526{
527 // Number of points in ITS
528 Int_t n=0;
529 for(Int_t i=0;i<6;i++) if(HasPointOnITSLayer(i)) n++;
530 return n;
531}
532
6e78367a 533//______________________________________________________________________________
534template <typename T>
535void AliAODTrack::SetPosition(const T *x, const Bool_t dca)
536{
537 // set the position
538
539 if (x) {
540 if (!dca) {
541 ResetBit(kIsDCA);
542
543 fPosition[0] = x[0];
544 fPosition[1] = x[1];
545 fPosition[2] = x[2];
546 } else {
547 SetBit(kIsDCA);
548 // don't know any better yet
549 fPosition[0] = -999.;
550 fPosition[1] = -999.;
551 fPosition[2] = -999.;
552 }
553 } else {
554 ResetBit(kIsDCA);
555
556 fPosition[0] = -999.;
557 fPosition[1] = -999.;
558 fPosition[2] = -999.;
559 }
560}
561
562//template<> void AliAODTrack::SetPosition(const double *, Bool_t);
fe7d86eb 563
df9db588 564#endif