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