]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliAODTrack.h
put STEERBase into the include path
[u/mrichter/AliRoot.git] / STEER / 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//-------------------------------------------------------------------------
9// AOD track base class
10// Author: Markus Oldenburg, CERN
11//-------------------------------------------------------------------------
12
13#include <TRef.h>
4697e4fb 14#include <TParticle.h>
df9db588 15
9861edc0 16#include "AliVParticle.h"
df9db588 17#include "AliAODVertex.h"
5d62ce04 18#include "AliAODRedCov.h"
df9db588 19
9861edc0 20class AliAODTrack : public AliVParticle {
df9db588 21
22 public:
23
1912763f 24 enum AODTrk_t {kUndef = -1,
25 kPrimary,
26 kSecondary,
27 kOrphan};
df9db588 28
29 enum AODTrkBits_t {
dc825b15 30 kIsDCA=BIT(14), // set if fPosition is the DCA and not the position of the first point
1912763f 31 kUsedForVtxFit=BIT(15), // set if this track was used to fit the vertex it is attached to
32 kUsedForPrimVtxFit=BIT(16) // set if this track was used to fit the primary vertex
df9db588 33 };
34
4697e4fb 35 enum AODTrkPID_t {
1912763f 36 kElectron = 0,
37 kMuon = 1,
38 kPion = 2,
39 kKaon = 3,
40 kProton = 4,
4697e4fb 41 kDeuteron = 5,
42 kTriton = 6,
43 kHelium3 = 7,
44 kAlpha = 8,
45 kUnknown = 9,
46 kMostProbable = -1
47 };
df9db588 48
49 AliAODTrack();
50 AliAODTrack(Int_t id,
51 Int_t label,
52 Double_t p[3],
53 Bool_t cartesian,
54 Double_t x[3],
55 Bool_t dca,
56 Double_t covMatrix[21],
57 Short_t q,
58 UChar_t itsClusMap,
59 Double_t pid[10],
60 AliAODVertex *prodVertex,
1912763f 61 Bool_t usedForVtxFit,
dc825b15 62 Bool_t usedForPrimVtxFit,
ec40c484 63 AODTrk_t ttype=kUndef,
64 UInt_t selectInfo=0);
df9db588 65
dc825b15 66 AliAODTrack(Int_t id,
df9db588 67 Int_t label,
68 Float_t p[3],
69 Bool_t cartesian,
70 Float_t x[3],
71 Bool_t dca,
72 Float_t covMatrix[21],
73 Short_t q,
74 UChar_t itsClusMap,
75 Float_t pid[10],
76 AliAODVertex *prodVertex,
1912763f 77 Bool_t usedForVtxFit,
dc825b15 78 Bool_t usedForPrimVtxFit,
ec40c484 79 AODTrk_t ttype=kUndef,
80 UInt_t selectInfo=0);
df9db588 81
82 virtual ~AliAODTrack();
83 AliAODTrack(const AliAODTrack& trk);
84 AliAODTrack& operator=(const AliAODTrack& trk);
85
86 // kinematics
16b65f2a 87 virtual Double_t OneOverPt() const { return (fMomentum[0] != 0.) ? 1./fMomentum[0] : -999.; }
df9db588 88 virtual Double_t Phi() const { return fMomentum[1]; }
89 virtual Double_t Theta() const { return fMomentum[2]; }
90
16b65f2a 91 virtual Double_t Px() const { return fMomentum[0] * TMath::Cos(fMomentum[1]); }
92 virtual Double_t Py() const { return fMomentum[0] * TMath::Sin(fMomentum[1]); }
93 virtual Double_t Pz() const { return fMomentum[0] / TMath::Tan(fMomentum[2]); }
94 virtual Double_t Pt() const { return fMomentum[0]; }
df9db588 95 virtual Double_t P() const { return TMath::Sqrt(Pt()*Pt()+Pz()*Pz()); }
4697e4fb 96
1912763f 97 Double_t Chi2perNDF() const { return fChi2perNDF; }
4697e4fb 98
99 virtual Double_t M() const { return M(GetMostProbablePID()); }
100 Double_t M(AODTrkPID_t pid) const;
101 virtual Double_t E() const { return E(GetMostProbablePID()); }
102 Double_t E(AODTrkPID_t pid) const;
103 Double_t E(Double_t m) const { return TMath::Sqrt(P()*P() + m*m); }
104 virtual Double_t Y() const { return Y(GetMostProbablePID()); }
105 Double_t Y(AODTrkPID_t pid) const;
106 Double_t Y(Double_t m) const;
df9db588 107
108 virtual Double_t Eta() const { return -TMath::Log(TMath::Tan(0.5 * fMomentum[2])); }
df9db588 109
110 virtual Short_t Charge() const {return fCharge; }
111
112 // PID
113 virtual const Double_t *PID() const { return fPID; }
4697e4fb 114 AODTrkPID_t GetMostProbablePID() const;
115 void ConvertAliPIDtoAODPID();
df9db588 116
117 template <class T> void GetPID(T *pid) const {
118 for(Int_t i=0; i<10; ++i) pid[i]=fPID[i];}
119
120 template <class T> void SetPID(const T *pid) {
121 if(pid) for(Int_t i=0; i<10; ++i) fPID[i]=pid[i];
186bf2c9 122 else {for(Int_t i=0; i<10; fPID[i++]=0.); fPID[AliAODTrack::kUnknown]=1.;}}
df9db588 123
124 Int_t GetID() const { return fID; }
125 Int_t GetLabel() const { return fLabel; }
126 Char_t GetType() const { return fType;}
1912763f 127 Bool_t GetUsedForVtxFit() const { return TestBit(kUsedForVtxFit); }
dc825b15 128 Bool_t GetUsedForPrimVtxFit() const { return TestBit(kUsedForPrimVtxFit); }
df9db588 129
130 template <class T> void GetP(T *p) const {
131 p[0]=fMomentum[0]; p[1]=fMomentum[1]; p[2]=fMomentum[2];}
132
133 template <class T> void GetPxPyPz(T *p) const {
134 p[0] = Px(); p[1] = Py(); p[2] = Pz();}
135
136 template <class T> Bool_t GetPosition(T *x) const {
137 x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2];
138 return TestBit(kIsDCA);}
139
140 template <class T> void SetCovMatrix(const T *covMatrix) {
5d62ce04 141 if(!fCovMatrix) fCovMatrix=new AliAODRedCov<6>();
df9db588 142 fCovMatrix->SetCovMatrix(covMatrix);}
143
144 template <class T> Bool_t GetCovMatrix(T *covMatrix) const {
145 if(!fCovMatrix) return kFALSE;
146 fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;}
147
148 void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;}
149
1912763f 150 UChar_t GetITSClusterMap() const { return (UChar_t)fITSMuonClusterMap; }
151 UInt_t GetMUONClusterMap() const { return fITSMuonClusterMap/65536; }
152 UInt_t GetITSMUONClusterMap() const { return fITSMuonClusterMap; }
8a1418dc 153 Bool_t TestFilterBit(UInt_t filterBit) const {return (Bool_t) ((filterBit & fFilterMap) != 0);}
df9db588 154
155 AliAODVertex *GetProdVertex() const { return (AliAODVertex*)fProdVertex.GetObject(); }
156
157 // print
158 void Print(const Option_t *opt = "") const;
159
160 // setters
14b34be5 161 void SetID(Int_t id) { fID = id; }
162 void SetLabel(Int_t label) {fLabel = label; }
df9db588 163
14b34be5 164 template <class T> void SetPosition(const T *x, Bool_t isDCA = kFALSE);
df9db588 165 void SetDCA(Double_t d, Double_t z);
1912763f 166 void SetUsedForVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForVtxFit) : ResetBit(kUsedForVtxFit); }
dc825b15 167 void SetUsedForPrimVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForPrimVtxFit) : ResetBit(kUsedForPrimVtxFit); }
df9db588 168
14b34be5 169 void SetOneOverPt(Double_t oneOverPt) { fMomentum[0] = oneOverPt; }
16b65f2a 170 void SetPt(Double_t pt) { fMomentum[0] = pt; };
14b34be5 171 void SetPhi(Double_t phi) { fMomentum[1] = phi; }
172 void SetTheta(Double_t theta) { fMomentum[2] = theta; }
173 template <class T> void SetP(const T *p, Bool_t cartesian = kTRUE);
df9db588 174 void SetP() {fMomentum[0]=fMomentum[1]=fMomentum[2]=-999.;}
175
14b34be5 176 void SetCharge(Short_t q) { fCharge = q; }
1912763f 177 void SetChi2perNDF(Double_t chi2perNDF) { fChi2perNDF = chi2perNDF; }
df9db588 178
1912763f 179 void SetITSClusterMap(UChar_t itsClusMap) { fITSMuonClusterMap = (UInt_t)itsClusMap; }
180 void SetMuonClusterMap(UInt_t muonClusMap) { fITSMuonClusterMap = muonClusMap*65536; }
181 void SetITSMuonClusterMap(UInt_t itsMuonClusMap) { fITSMuonClusterMap = itsMuonClusMap; }
df9db588 182
8a1418dc 183 Int_t GetMatchTrigger() const {return fITSMuonClusterMap>>30;}
e1c744ca 184 // 0 Muon track does not match trigger
185 // 1 Muon track match but does not pass pt cut
186 // 2 Muon track match Low pt cut
187 // 3 Muon track match High pt cut
188 void SetMatchTrigger(Int_t MatchTrigger);
8a1418dc 189 Int_t MatchTrigger() const { return (GetMatchTrigger()>0)?1:0; } // Muon track matches trigger track
190 Int_t MatchTriggerAnyPt() const { return (GetMatchTrigger()>0)?1:0; } // Muon track matches trigger track
191 Int_t MatchTriggerLowPt() const { return (GetMatchTrigger()>1)?1:0; } // Muon track matches trigger track and passes Low pt cut
192 Int_t MatchTriggerHighPt() const { return (GetMatchTrigger()>2)?1:0; } // Muon track matches trigger track and passes High pt cut
193 Double_t GetChi2MatchTrigger() const { return fChi2MatchTrigger;}
e1c744ca 194 void SetChi2MatchTrigger(Double_t Chi2MatchTrigger) {fChi2MatchTrigger = Chi2MatchTrigger;}
195 UShort_t GetHitsPatternInTrigCh() const { return (fITSMuonClusterMap&0xff00)>>8; }
196 void SetHitsPatternInTrigCh(UShort_t hitsPatternInTrigCh);
9861edc0 197 Int_t HitsMT(Int_t istation, Int_t iplane, Char_t *cathode=0); // Check if track hits Muon chambers
198 Int_t HitsMuonChamber(Int_t MuonChamber); // Check if track hits Muon chambers
199 Bool_t IsMuonTrack() const { return fITSMuonClusterMap>>16;} // This scheme has to be checked, still!
e1c744ca 200
df9db588 201 void SetProdVertex(TObject *vertex) { fProdVertex = vertex; }
202
203 // name and title
204 void SetType(AODTrk_t ttype) { fType=ttype; }
205
df9db588 206 private :
207
208 // Momentum & position
1912763f 209 Double32_t fMomentum[3]; // momemtum stored in pt, phi, theta
210 Double32_t fPosition[3]; // position of first point on track or dca
df9db588 211
1912763f 212 Double32_t fPID[10]; // [0.,1.,8] pointer to PID object
213 Double32_t fChi2perNDF; // chi2/NDF of mometum fit
df9db588 214
1912763f 215 Int_t fID; // unique track ID, points back to the ESD track
216 Int_t fLabel; // track label, points back to MC track
df9db588 217
1912763f 218 AliAODRedCov<6> *fCovMatrix; // covariance matrix (x, y, z, px, py, pz)
219 TRef fProdVertex; // vertex of origin
df9db588 220
1912763f 221 Char_t fCharge; // particle charge
222 UInt_t fITSMuonClusterMap; // map of ITS and muon clusters, one bit per layer (ITS: bit 1-8, muon: bit 17-32)
223 Char_t fType; // Track Type
df9db588 224
ec40c484 225 Double_t fChi2MatchTrigger; // chi2 of trigger/track matching
226 UInt_t fFilterMap; // filter information, one bit per set of cuts
df9db588 227
9861edc0 228 ClassDef(AliAODTrack,4);
df9db588 229};
230
231#endif