Period number added.
[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
24 enum AODTrk_t {kUndef=-1, kPrimary, kSecondary, kOrphan};
25
26 enum AODTrkBits_t {
dc825b15 27 kIsDCA=BIT(14), // set if fPosition is the DCA and not the position of the first point
28 kUsedForPrimVtxFit=BIT(15) // set if this track was used to fit the primary vertex
df9db588 29 };
30
4697e4fb 31 enum AODTrkPID_t {
32 kElectron = 0,
33 kMuon = 1,
34 kPion = 2,
35 kKaon = 3,
36 kProton = 4,
37 kDeuteron = 5,
38 kTriton = 6,
39 kHelium3 = 7,
40 kAlpha = 8,
41 kUnknown = 9,
42 kMostProbable = -1
43 };
df9db588 44
45 AliAODTrack();
46 AliAODTrack(Int_t id,
47 Int_t label,
48 Double_t p[3],
49 Bool_t cartesian,
50 Double_t x[3],
51 Bool_t dca,
52 Double_t covMatrix[21],
53 Short_t q,
54 UChar_t itsClusMap,
55 Double_t pid[10],
56 AliAODVertex *prodVertex,
dc825b15 57 Bool_t usedForPrimVtxFit,
df9db588 58 AODTrk_t ttype=kUndef);
59
dc825b15 60 AliAODTrack(Int_t id,
df9db588 61 Int_t label,
62 Float_t p[3],
63 Bool_t cartesian,
64 Float_t x[3],
65 Bool_t dca,
66 Float_t covMatrix[21],
67 Short_t q,
68 UChar_t itsClusMap,
69 Float_t pid[10],
70 AliAODVertex *prodVertex,
dc825b15 71 Bool_t usedForPrimVtxFit,
df9db588 72 AODTrk_t ttype=kUndef);
73
74 virtual ~AliAODTrack();
75 AliAODTrack(const AliAODTrack& trk);
76 AliAODTrack& operator=(const AliAODTrack& trk);
77
78 // kinematics
16b65f2a 79 virtual Double_t OneOverPt() const { return (fMomentum[0] != 0.) ? 1./fMomentum[0] : -999.; }
df9db588 80 virtual Double_t Phi() const { return fMomentum[1]; }
81 virtual Double_t Theta() const { return fMomentum[2]; }
82
16b65f2a 83 virtual Double_t Px() const { return fMomentum[0] * TMath::Cos(fMomentum[1]); }
84 virtual Double_t Py() const { return fMomentum[0] * TMath::Sin(fMomentum[1]); }
85 virtual Double_t Pz() const { return fMomentum[0] / TMath::Tan(fMomentum[2]); }
86 virtual Double_t Pt() const { return fMomentum[0]; }
df9db588 87 virtual Double_t P() const { return TMath::Sqrt(Pt()*Pt()+Pz()*Pz()); }
4697e4fb 88
89 Double_t Chi2() const { return fChi2; }
90
91 virtual Double_t M() const { return M(GetMostProbablePID()); }
92 Double_t M(AODTrkPID_t pid) const;
93 virtual Double_t E() const { return E(GetMostProbablePID()); }
94 Double_t E(AODTrkPID_t pid) const;
95 Double_t E(Double_t m) const { return TMath::Sqrt(P()*P() + m*m); }
96 virtual Double_t Y() const { return Y(GetMostProbablePID()); }
97 Double_t Y(AODTrkPID_t pid) const;
98 Double_t Y(Double_t m) const;
df9db588 99
100 virtual Double_t Eta() const { return -TMath::Log(TMath::Tan(0.5 * fMomentum[2])); }
df9db588 101
102 virtual Short_t Charge() const {return fCharge; }
103
104 // PID
105 virtual const Double_t *PID() const { return fPID; }
4697e4fb 106 AODTrkPID_t GetMostProbablePID() const;
107 void ConvertAliPIDtoAODPID();
df9db588 108
109 template <class T> void GetPID(T *pid) const {
110 for(Int_t i=0; i<10; ++i) pid[i]=fPID[i];}
111
112 template <class T> void SetPID(const T *pid) {
113 if(pid) for(Int_t i=0; i<10; ++i) fPID[i]=pid[i];
4697e4fb 114 else {for(Int_t i=0; i<10; fPID[i++]=0.);}}
df9db588 115
116 Int_t GetID() const { return fID; }
117 Int_t GetLabel() const { return fLabel; }
118 Char_t GetType() const { return fType;}
dc825b15 119 Bool_t GetUsedForPrimVtxFit() const { return TestBit(kUsedForPrimVtxFit); }
df9db588 120
121 template <class T> void GetP(T *p) const {
122 p[0]=fMomentum[0]; p[1]=fMomentum[1]; p[2]=fMomentum[2];}
123
124 template <class T> void GetPxPyPz(T *p) const {
125 p[0] = Px(); p[1] = Py(); p[2] = Pz();}
126
127 template <class T> Bool_t GetPosition(T *x) const {
128 x[0]=fPosition[0]; x[1]=fPosition[1]; x[2]=fPosition[2];
129 return TestBit(kIsDCA);}
130
131 template <class T> void SetCovMatrix(const T *covMatrix) {
5d62ce04 132 if(!fCovMatrix) fCovMatrix=new AliAODRedCov<6>();
df9db588 133 fCovMatrix->SetCovMatrix(covMatrix);}
134
135 template <class T> Bool_t GetCovMatrix(T *covMatrix) const {
136 if(!fCovMatrix) return kFALSE;
137 fCovMatrix->GetCovMatrix(covMatrix); return kTRUE;}
138
139 void RemoveCovMatrix() {delete fCovMatrix; fCovMatrix=NULL;}
140
141 UChar_t GetITSClusterMap() const { return fITSClusterMap; }
142
143 AliAODVertex *GetProdVertex() const { return (AliAODVertex*)fProdVertex.GetObject(); }
144
145 // print
146 void Print(const Option_t *opt = "") const;
147
148 // setters
14b34be5 149 void SetID(Int_t id) { fID = id; }
150 void SetLabel(Int_t label) {fLabel = label; }
df9db588 151
14b34be5 152 template <class T> void SetPosition(const T *x, Bool_t isDCA = kFALSE);
df9db588 153 void SetDCA(Double_t d, Double_t z);
dc825b15 154 void SetUsedForPrimVtxFit(Bool_t used = kTRUE) { used ? SetBit(kUsedForPrimVtxFit) : ResetBit(kUsedForPrimVtxFit); }
df9db588 155
14b34be5 156 void SetOneOverPt(Double_t oneOverPt) { fMomentum[0] = oneOverPt; }
16b65f2a 157 void SetPt(Double_t pt) { fMomentum[0] = pt; };
14b34be5 158 void SetPhi(Double_t phi) { fMomentum[1] = phi; }
159 void SetTheta(Double_t theta) { fMomentum[2] = theta; }
160 template <class T> void SetP(const T *p, Bool_t cartesian = kTRUE);
df9db588 161 void SetP() {fMomentum[0]=fMomentum[1]=fMomentum[2]=-999.;}
162
14b34be5 163 void SetCharge(Short_t q) { fCharge = q; }
164 void SetChi2(Double_t chi2) { fChi2 = chi2; }
df9db588 165
14b34be5 166 void SetITSClusterMap(UChar_t itsClusMap) { fITSClusterMap = itsClusMap; }
df9db588 167
168 void SetProdVertex(TObject *vertex) { fProdVertex = vertex; }
169
170 // name and title
171 void SetType(AODTrk_t ttype) { fType=ttype; }
172
df9db588 173 private :
174
175 // Momentum & position
16b65f2a 176 Double32_t fMomentum[3]; // momemtum stored in pt, phi, theta
df9db588 177 Double32_t fPosition[3]; // position of first point on track or dca
178
179 Double32_t fPID[10]; // [0.,1.,8] pointer to PID object
180 Double32_t fChi2; // chi2 of mometum fit
181
182 Int_t fID; // unique track ID, points back to the ESD track
183 Int_t fLabel; // track label, points back to MC track
184
4697e4fb 185 AliAODRedCov<6> *fCovMatrix; // covariance matrix (x, y, z, px, py, pz)
df9db588 186 TRef fProdVertex; // vertex of origin
187
188 Char_t fCharge; // particle charge
189 UChar_t fITSClusterMap; // map of ITS cluster, one bit per layer
d20542b6 190 Char_t fType; // Track Type
df9db588 191
192
193 ClassDef(AliAODTrack,1);
194};
195
196#endif