]>
Commit | Line | Data |
---|---|---|
df9db588 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | //------------------------------------------------------------------------- | |
19 | // AOD track base class | |
20 | // Author: Markus Oldenburg, CERN | |
21 | //------------------------------------------------------------------------- | |
22 | ||
23 | #include "AliAODTrack.h" | |
24 | ||
25 | ClassImp(AliAODTrack) | |
26 | ||
27 | //______________________________________________________________________________ | |
28 | AliAODTrack::AliAODTrack() : | |
29 | AliVirtualParticle(), | |
30 | fChi2(-999.), | |
31 | fID(-999), | |
32 | fLabel(-999), | |
33 | fCovMatrix(NULL), | |
34 | fProdVertex(0x0), | |
14b34be5 | 35 | fCharge(-99), |
df9db588 | 36 | fITSClusterMap(0), |
37 | fType(kUndef) | |
38 | { | |
39 | // default constructor | |
40 | ||
41 | SetP(); | |
42 | SetPosition((Float_t*)NULL); | |
43 | SetPID((Float_t*)NULL); | |
44 | } | |
45 | ||
46 | //______________________________________________________________________________ | |
47 | AliAODTrack::AliAODTrack(Int_t id, | |
48 | Int_t label, | |
49 | Double_t p[3], | |
50 | Bool_t cartesian, | |
51 | Double_t x[3], | |
52 | Bool_t isDCA, | |
53 | Double_t covMatrix[21], | |
54 | Short_t charge, | |
55 | UChar_t itsClusMap, | |
56 | Double_t pid[10], | |
57 | AliAODVertex *prodVertex, | |
dc825b15 | 58 | Bool_t usedForPrimVtxFit, |
df9db588 | 59 | AODTrk_t ttype) : |
60 | AliVirtualParticle(), | |
61 | fChi2(-999.), | |
62 | fID(id), | |
63 | fLabel(label), | |
64 | fCovMatrix(NULL), | |
65 | fProdVertex(prodVertex), | |
66 | fCharge(charge), | |
67 | fITSClusterMap(itsClusMap), | |
68 | fType(ttype) | |
69 | { | |
70 | // constructor | |
71 | ||
72 | SetP(p, cartesian); | |
73 | SetPosition(x, isDCA); | |
dc825b15 | 74 | SetUsedForPrimVtxFit(usedForPrimVtxFit); |
df9db588 | 75 | if(covMatrix) SetCovMatrix(covMatrix); |
76 | SetPID(pid); | |
77 | ||
78 | } | |
79 | ||
80 | //______________________________________________________________________________ | |
81 | AliAODTrack::AliAODTrack(Int_t id, | |
82 | Int_t label, | |
83 | Float_t p[3], | |
84 | Bool_t cartesian, | |
85 | Float_t x[3], | |
86 | Bool_t isDCA, | |
87 | Float_t covMatrix[21], | |
88 | Short_t charge, | |
89 | UChar_t itsClusMap, | |
90 | Float_t pid[10], | |
91 | AliAODVertex *prodVertex, | |
dc825b15 | 92 | Bool_t usedForPrimVtxFit, |
df9db588 | 93 | AODTrk_t ttype) : |
94 | AliVirtualParticle(), | |
95 | fChi2(-999.), | |
96 | fID(id), | |
97 | fLabel(label), | |
98 | fCovMatrix(NULL), | |
99 | fProdVertex(prodVertex), | |
100 | fCharge(charge), | |
101 | fITSClusterMap(itsClusMap), | |
102 | fType(ttype) | |
103 | { | |
104 | // constructor | |
105 | ||
106 | SetP(p, cartesian); | |
107 | SetPosition(x, isDCA); | |
dc825b15 | 108 | SetUsedForPrimVtxFit(usedForPrimVtxFit); |
df9db588 | 109 | if(covMatrix) SetCovMatrix(covMatrix); |
110 | SetPID(pid); | |
df9db588 | 111 | } |
112 | ||
df9db588 | 113 | //______________________________________________________________________________ |
114 | AliAODTrack::~AliAODTrack() | |
115 | { | |
116 | // destructor | |
117 | delete fCovMatrix; | |
118 | } | |
119 | ||
120 | ||
121 | //______________________________________________________________________________ | |
122 | AliAODTrack::AliAODTrack(const AliAODTrack& trk) : | |
123 | AliVirtualParticle(trk), | |
124 | fChi2(trk.fChi2), | |
125 | fID(trk.fID), | |
126 | fLabel(trk.fLabel), | |
127 | fCovMatrix(NULL), | |
128 | fProdVertex(trk.fProdVertex), | |
129 | fCharge(trk.fCharge), | |
130 | fITSClusterMap(trk.fITSClusterMap), | |
131 | fType(trk.fType) | |
132 | { | |
133 | // Copy constructor | |
134 | ||
135 | trk.GetP(fMomentum); | |
136 | trk.GetPosition(fPosition); | |
dc825b15 | 137 | SetUsedForPrimVtxFit(trk.GetUsedForPrimVtxFit()); |
5d62ce04 | 138 | if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<6>(*trk.fCovMatrix); |
df9db588 | 139 | SetPID(trk.fPID); |
140 | ||
141 | } | |
142 | ||
143 | //______________________________________________________________________________ | |
144 | AliAODTrack& AliAODTrack::operator=(const AliAODTrack& trk) | |
145 | { | |
146 | // Assignment operator | |
147 | if(this!=&trk) { | |
148 | ||
149 | AliVirtualParticle::operator=(trk); | |
150 | ||
151 | trk.GetP(fMomentum); | |
152 | trk.GetPosition(fPosition); | |
153 | trk.GetPID(fPID); | |
154 | ||
155 | fChi2 = trk.fChi2; | |
156 | ||
157 | fID = trk.fID; | |
158 | fLabel = trk.fLabel; | |
159 | ||
160 | delete fCovMatrix; | |
5d62ce04 | 161 | if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<6>(*trk.fCovMatrix); |
df9db588 | 162 | else fCovMatrix=NULL; |
163 | fProdVertex = trk.fProdVertex; | |
164 | ||
165 | fCharge = trk.fCharge; | |
166 | fITSClusterMap = trk.fITSClusterMap; | |
dc825b15 | 167 | SetUsedForPrimVtxFit(trk.GetUsedForPrimVtxFit()); |
df9db588 | 168 | fType = trk.fType; |
169 | } | |
170 | ||
171 | return *this; | |
172 | } | |
173 | ||
174 | //______________________________________________________________________________ | |
175 | template <class T> void AliAODTrack::SetP(const T *p, const Bool_t cartesian) | |
176 | { | |
177 | // set the momentum | |
178 | ||
179 | if (p) { | |
180 | if (cartesian) { | |
16b65f2a | 181 | Double_t pt2 = p[0]*p[0] + p[1]*p[1]; |
182 | Double_t P = TMath::Sqrt(pt2 + p[2]*p[2]); | |
df9db588 | 183 | |
16b65f2a | 184 | fMomentum[0] = TMath::Sqrt(pt2); // pt |
185 | fMomentum[1] = (pt2 != 0.) ? TMath::ATan2(p[1], p[0]) : -999; // phi | |
186 | fMomentum[2] = (P != 0.) ? TMath::ACos(p[2]/P) : -999.; // theta | |
df9db588 | 187 | } else { |
16b65f2a | 188 | fMomentum[0] = p[0]; // pt |
df9db588 | 189 | fMomentum[1] = p[1]; // phi |
190 | fMomentum[2] = p[2]; // theta | |
191 | } | |
192 | } else { | |
193 | fMomentum[0] = -999.; | |
194 | fMomentum[1] = -999.; | |
195 | fMomentum[2] = -999.; | |
196 | } | |
197 | } | |
198 | ||
199 | //______________________________________________________________________________ | |
200 | template <class T> void AliAODTrack::SetPosition(const T *x, const Bool_t dca) | |
201 | { | |
202 | // set the position | |
203 | ||
204 | if (x) { | |
205 | if (!dca) { | |
206 | ResetBit(kIsDCA); | |
207 | ||
208 | fPosition[0] = x[0]; | |
209 | fPosition[1] = x[1]; | |
210 | fPosition[2] = x[2]; | |
211 | } else { | |
212 | SetBit(kIsDCA); | |
213 | // don't know any better yet | |
214 | fPosition[0] = -999.; | |
215 | fPosition[1] = -999.; | |
216 | fPosition[2] = -999.; | |
217 | } | |
218 | } else { | |
219 | ResetBit(kIsDCA); | |
220 | ||
221 | fPosition[0] = -999.; | |
222 | fPosition[1] = -999.; | |
223 | fPosition[2] = -999.; | |
224 | } | |
225 | } | |
226 | ||
227 | //______________________________________________________________________________ | |
228 | void AliAODTrack::SetDCA(Double_t d, Double_t z) | |
229 | { | |
230 | // set the dca | |
231 | fPosition[0] = d; | |
232 | fPosition[1] = z; | |
233 | fPosition[2] = 0.; | |
234 | SetBit(kIsDCA); | |
235 | } | |
236 | ||
237 | //______________________________________________________________________________ | |
238 | void AliAODTrack::Print(Option_t* /* option */) const | |
239 | { | |
240 | // prints information about AliAODTrack | |
241 | ||
242 | printf("Object name: %s Track type: %s\n", GetName(), GetTitle()); | |
243 | printf(" px = %f\n", Px()); | |
244 | printf(" py = %f\n", Py()); | |
245 | printf(" pz = %f\n", Pz()); | |
246 | printf(" pt = %f\n", Pt()); | |
247 | printf(" 1/pt = %f\n", OneOverPt()); | |
248 | printf(" theta = %f\n", Theta()); | |
249 | printf(" phi = %f\n", Phi()); | |
250 | printf(" chi2 = %f\n", Chi2()); | |
251 | printf(" charge = %d\n", Charge()); | |
252 | printf(" PID object: %p\n", PID()); | |
253 | } | |
254 |