Small scaling factor introduced in order to match measured and calculated
[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
16#include "AliVirtualParticle.h"
17#include "AliAODVertex.h"
5d62ce04 18#include "AliAODRedCov.h"
df9db588 19
20class AliAODTrack : public AliVirtualParticle {
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,
df9db588 63 AODTrk_t ttype=kUndef);
64
dc825b15 65 AliAODTrack(Int_t id,
df9db588 66 Int_t label,
67 Float_t p[3],
68 Bool_t cartesian,
69 Float_t x[3],
70 Bool_t dca,
71 Float_t covMatrix[21],
72 Short_t q,
73 UChar_t itsClusMap,
74 Float_t pid[10],
75 AliAODVertex *prodVertex,
1912763f 76 Bool_t usedForVtxFit,
dc825b15 77 Bool_t usedForPrimVtxFit,
df9db588 78 AODTrk_t ttype=kUndef);
79
80 virtual ~AliAODTrack();
81 AliAODTrack(const AliAODTrack& trk);
82 AliAODTrack& operator=(const AliAODTrack& trk);
83
84 // kinematics
16b65f2a 85 virtual Double_t OneOverPt() const { return (fMomentum[0] != 0.) ? 1./fMomentum[0] : -999.; }
df9db588 86 virtual Double_t Phi() const { return fMomentum[1]; }
87 virtual Double_t Theta() const { return fMomentum[2]; }
88
16b65f2a 89 virtual Double_t Px() const { return fMomentum[0] * TMath::Cos(fMomentum[1]); }
90 virtual Double_t Py() const { return fMomentum[0] * TMath::Sin(fMomentum[1]); }
91 virtual Double_t Pz() const { return fMomentum[0] / TMath::Tan(fMomentum[2]); }
92 virtual Double_t Pt() const { return fMomentum[0]; }
df9db588 93 virtual Double_t P() const { return TMath::Sqrt(Pt()*Pt()+Pz()*Pz()); }
4697e4fb 94
1912763f 95 Double_t Chi2perNDF() const { return fChi2perNDF; }
4697e4fb 96
97 virtual Double_t M() const { return M(GetMostProbablePID()); }
98 Double_t M(AODTrkPID_t pid) const;
99 virtual Double_t E() const { return E(GetMostProbablePID()); }
100 Double_t E(AODTrkPID_t pid) const;
101 Double_t E(Double_t m) const { return TMath::Sqrt(P()*P() + m*m); }
102 virtual Double_t Y() const { return Y(GetMostProbablePID()); }
103 Double_t Y(AODTrkPID_t pid) const;
104 Double_t Y(Double_t m) const;
df9db588 105
106 virtual Double_t Eta() const { return -TMath::Log(TMath::Tan(0.5 * fMomentum[2])); }
df9db588 107
108 virtual Short_t Charge() const {return fCharge; }
109
110 // PID
111 virtual const Double_t *PID() const { return fPID; }
4697e4fb 112 AODTrkPID_t GetMostProbablePID() const;
113 void ConvertAliPIDtoAODPID();
df9db588 114
115 template <class T> void GetPID(T *pid) const {
116 for(Int_t i=0; i<10; ++i) pid[i]=fPID[i];}
117
118 template <class T> void SetPID(const T *pid) {
119 if(pid) for(Int_t i=0; i<10; ++i) fPID[i]=pid[i];
186bf2c9 120 else {for(Int_t i=0; i<10; fPID[i++]=0.); fPID[AliAODTrack::kUnknown]=1.;}}
df9db588 121
122 Int_t GetID() const { return fID; }
123 Int_t GetLabel() const { return fLabel; }
124 Char_t GetType() const { return fType;}
1912763f 125 Bool_t GetUsedForVtxFit() const { return TestBit(kUsedForVtxFit); }
dc825b15 126 Bool_t GetUsedForPrimVtxFit() const { return TestBit(kUsedForPrimVtxFit); }
df9db588 127
128 template <class T> void GetP(T *p) const {
129 p[0]=fMomentum[0]; p[1]=fMomentum[1]; p[2]=fMomentum[2];}
130
131 template <class T> void GetPxPyPz(T *p) const {
132 p[0] = Px(); p[1] = Py(); p[2] = Pz();}
133
134 template <class T> Bool_t GetPosition(T *x) const {
135 x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2];
136 return TestBit(kIsDCA);}
137
138 template <class T> void SetCovMatrix(const T *covMatrix) {
5d62ce04 139 if(!fCovMatrix) fCovMatrix=new AliAODRedCov<6>();
df9db588 140 fCovMatrix->SetCovMatrix(covMatrix);}
141
142 template <class T> Bool_t GetCovMatrix(T *covMatrix) const {
143 if(!fCovMatrix) return kFALSE;
144 fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;}
145
146 void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;}
147
1912763f 148 UChar_t GetITSClusterMap() const { return (UChar_t)fITSMuonClusterMap; }
149 UInt_t GetMUONClusterMap() const { return fITSMuonClusterMap/65536; }
150 UInt_t GetITSMUONClusterMap() const { return fITSMuonClusterMap; }
df9db588 151
152 AliAODVertex *GetProdVertex() const { return (AliAODVertex*)fProdVertex.GetObject(); }
153
154 // print
155 void Print(const Option_t *opt = "") const;
156
157 // setters
14b34be5 158 void SetID(Int_t id) { fID = id; }
159 void SetLabel(Int_t label) {fLabel = label; }
df9db588 160
14b34be5 161 template <class T> void SetPosition(const T *x, Bool_t isDCA = kFALSE);
df9db588 162 void SetDCA(Double_t d, Double_t z);
1912763f 163 void SetUsedForVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForVtxFit) : ResetBit(kUsedForVtxFit); }
dc825b15 164 void SetUsedForPrimVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForPrimVtxFit) : ResetBit(kUsedForPrimVtxFit); }
df9db588 165
14b34be5 166 void SetOneOverPt(Double_t oneOverPt) { fMomentum[0] = oneOverPt; }
16b65f2a 167 void SetPt(Double_t pt) { fMomentum[0] = pt; };
14b34be5 168 void SetPhi(Double_t phi) { fMomentum[1] = phi; }
169 void SetTheta(Double_t theta) { fMomentum[2] = theta; }
170 template <class T> void SetP(const T *p, Bool_t cartesian = kTRUE);
df9db588 171 void SetP() {fMomentum[0]=fMomentum[1]=fMomentum[2]=-999.;}
172
14b34be5 173 void SetCharge(Short_t q) { fCharge = q; }
1912763f 174 void SetChi2perNDF(Double_t chi2perNDF) { fChi2perNDF = chi2perNDF; }
df9db588 175
1912763f 176 void SetITSClusterMap(UChar_t itsClusMap) { fITSMuonClusterMap = (UInt_t)itsClusMap; }
177 void SetMuonClusterMap(UInt_t muonClusMap) { fITSMuonClusterMap = muonClusMap*65536; }
178 void SetITSMuonClusterMap(UInt_t itsMuonClusMap) { fITSMuonClusterMap = itsMuonClusMap; }
df9db588 179
180 void SetProdVertex(TObject *vertex) { fProdVertex = vertex; }
181
182 // name and title
183 void SetType(AODTrk_t ttype) { fType=ttype; }
184
df9db588 185 private :
186
187 // Momentum & position
1912763f 188 Double32_t fMomentum[3]; // momemtum stored in pt, phi, theta
189 Double32_t fPosition[3]; // position of first point on track or dca
df9db588 190
1912763f 191 Double32_t fPID[10]; // [0.,1.,8] pointer to PID object
192 Double32_t fChi2perNDF; // chi2/NDF of mometum fit
df9db588 193
1912763f 194 Int_t fID; // unique track ID, points back to the ESD track
195 Int_t fLabel; // track label, points back to MC track
df9db588 196
1912763f 197 AliAODRedCov<6> *fCovMatrix; // covariance matrix (x, y, z, px, py, pz)
198 TRef fProdVertex; // vertex of origin
df9db588 199
1912763f 200 Char_t fCharge; // particle charge
201 UInt_t fITSMuonClusterMap; // map of ITS and muon clusters, one bit per layer (ITS: bit 1-8, muon: bit 17-32)
202 Char_t fType; // Track Type
df9db588 203
204
1912763f 205 ClassDef(AliAODTrack,2);
df9db588 206};
207
208#endif