]>
Commit | Line | Data |
---|---|---|
ae982df3 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | //----------------------------------------------------------------- | |
17 | // Implementation of the ESD track class | |
18 | // This is the class to deal with during the phisical analysis of data | |
19 | // | |
20 | // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch | |
21 | //----------------------------------------------------------------- | |
22 | ||
23 | #include "TMath.h" | |
24 | ||
25 | #include "AliESDtrack.h" | |
26 | #include "AliKalmanTrack.h" | |
27 | ||
28 | ClassImp(AliESDtrack) | |
29 | ||
30 | //_______________________________________________________________________ | |
31 | AliESDtrack::AliESDtrack() : | |
32 | fFlags(0), | |
33 | fITSncls(0), | |
2ee21e83 | 34 | fVertex(kFALSE), |
35 | fTPCncls(0) | |
ae982df3 | 36 | { |
37 | // | |
38 | // The default ESD constructor | |
39 | // | |
40 | for (Int_t i=0; i<kSPECIES; i++) fR[i]=0.; | |
41 | } | |
42 | ||
43 | //_______________________________________________________________________ | |
44 | Float_t AliESDtrack::GetMass() const { | |
45 | Float_t max=0.; | |
46 | Int_t k=-1; | |
47 | for (Int_t i=0; i<kSPECIES; i++) { | |
48 | if (fR[i]>max) {k=i; max=fR[i];} | |
49 | } | |
50 | if (k==0) return 0.00051; | |
51 | if (k==1) return 0.10566; | |
52 | if (k==2||k==-1) return 0.13957; | |
53 | if (k==3) return 0.49368; | |
54 | if (k==4) return 0.93827; | |
55 | Warning("GetMass()","Undefined mass !"); | |
56 | return 0.13957; | |
57 | } | |
58 | ||
59 | //_______________________________________________________________________ | |
ad2f1f2b | 60 | Bool_t AliESDtrack::UpdateTrackParams(AliKalmanTrack *t, ULong_t flags) { |
ae982df3 | 61 | // |
62 | // This function updates track's running parameters | |
63 | // | |
64 | switch (flags) { | |
ad2f1f2b | 65 | |
66 | case kITSin: | |
67 | case kITSout: | |
68 | case kITSrefit: | |
ae982df3 | 69 | fITSncls=t->GetNumberOfClusters(); |
70 | fITSchi2=t->GetChi2(); | |
71 | for (Int_t i=0;i<fITSncls;i++) fITSindex[i]=t->GetClusterIndex(i); | |
72 | fITSsignal=t->GetPIDsignal(); | |
73 | break; | |
ad2f1f2b | 74 | |
ae982df3 | 75 | case kTPCin: case kTPCout: case kTPCrefit: |
76 | fTPCncls=t->GetNumberOfClusters(); | |
77 | fTPCchi2=t->GetChi2(); | |
78 | for (Int_t i=0;i<fTPCncls;i++) fTPCindex[i]=t->GetClusterIndex(i); | |
79 | fTPCsignal=t->GetPIDsignal(); | |
80 | {Double_t mass=t->GetMass(); // preliminary mass setting | |
81 | if (mass>0.5) fR[4]=1.; // used by | |
82 | else if (mass<0.4) fR[2]=1.; // the ITS reconstruction | |
83 | else fR[3]=1.;} // | |
84 | break; | |
79e94bf8 | 85 | case kTRDin: case kTRDout: case kTRDrefit: |
86 | fTRDncls=t->GetNumberOfClusters(); | |
87 | fTRDchi2=t->GetChi2(); | |
88 | fTRDsignal=t->GetPIDsignal(); | |
89 | break; | |
ae982df3 | 90 | default: |
91 | Error("UpdateTrackParams()","Wrong flag !\n"); | |
92 | return kFALSE; | |
93 | } | |
94 | ||
95 | SetStatus(flags); | |
96 | fLabel=t->GetLabel(); | |
97 | ||
98 | if (t->IsStartedTimeIntegral()) { | |
99 | SetStatus(kTIME); | |
100 | Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times); | |
101 | SetIntegratedLength(t->GetIntegratedLength()); | |
102 | } | |
103 | ||
104 | fRalpha=t->GetAlpha(); | |
105 | t->GetExternalParameters(fRx,fRp); | |
106 | t->GetExternalCovariance(fRc); | |
ad2f1f2b | 107 | |
108 | if (flags == kITSin) | |
109 | { | |
2ee21e83 | 110 | t->PropagateTo(3.,0.0028,65.19); |
111 | t->PropagateToPrimVertex(0.,0.); | |
112 | ||
113 | Double_t ralpha=t->GetAlpha(); | |
114 | Double_t rx; // X-coordinate of the track reference plane | |
115 | Double_t rp[5]; // external track parameters | |
116 | t->GetExternalParameters(rx,rp); | |
117 | ||
118 | Double_t phi=TMath::ASin(rp[2]) + ralpha; | |
119 | Double_t pt=1./TMath::Abs(rp[4]); | |
120 | Double_t r=TMath::Sqrt(rx*rx + rp[0]*rp[0]); | |
121 | ||
122 | fVertexX=r*TMath::Cos(phi); | |
123 | fVertexY=r*TMath::Sin(phi); | |
124 | fVertexZ=rp[1]; | |
125 | ||
126 | fVertexPx = pt*TMath::Cos(phi); | |
127 | fVertexPy = pt*TMath::Sin(phi); | |
128 | fVertexPz = pt*rp[3]; | |
129 | fVertex = kTRUE; | |
ad2f1f2b | 130 | } |
131 | ||
ae982df3 | 132 | return kTRUE; |
133 | } | |
134 | ||
e23730c7 | 135 | //_______________________________________________________________________ |
136 | void AliESDtrack::GetExternalParametersAt(Double_t x, Double_t p[5]) const { | |
137 | //--------------------------------------------------------------------- | |
138 | // This function returns external representation of the track parameters | |
139 | // at the plane x | |
140 | //--------------------------------------------------------------------- | |
141 | Double_t dx=x-fRx; | |
142 | Double_t c=fRp[4]/AliKalmanTrack::GetConvConst(); | |
143 | Double_t f1=fRp[2], f2=f1 + c*dx; | |
144 | Double_t r1=sqrt(1.- f1*f1), r2=sqrt(1.- f2*f2); | |
145 | ||
146 | p[0]=fRp[0]+dx*(f1+f2)/(r1+r2); | |
147 | p[1]=fRp[1]+dx*(f1+f2)/(f1*r2 + f2*r1)*fRp[3]; | |
148 | p[2]=fRp[2]+dx*c; | |
149 | p[3]=fRp[3]; | |
150 | p[4]=fRp[4]; | |
151 | } | |
152 | ||
ae982df3 | 153 | //_______________________________________________________________________ |
154 | void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const { | |
155 | //--------------------------------------------------------------------- | |
156 | // This function returns external representation of the track parameters | |
157 | //--------------------------------------------------------------------- | |
158 | x=fRx; | |
159 | for (Int_t i=0; i<5; i++) p[i]=fRp[i]; | |
160 | } | |
161 | ||
162 | Double_t AliESDtrack::GetP() const { | |
163 | //--------------------------------------------------------------------- | |
164 | // This function returns the track momentum | |
165 | //--------------------------------------------------------------------- | |
166 | Double_t lam=TMath::ATan(fRp[3]); | |
167 | Double_t pt=1./TMath::Abs(fRp[4]); | |
168 | return pt/TMath::Cos(lam); | |
169 | } | |
170 | ||
171 | void AliESDtrack::GetPxPyPz(Double_t *p) const { | |
172 | //--------------------------------------------------------------------- | |
173 | // This function returns the global track momentum components | |
174 | //--------------------------------------------------------------------- | |
175 | Double_t phi=TMath::ASin(fRp[2]) + fRalpha; | |
176 | Double_t pt=1./TMath::Abs(fRp[4]); | |
177 | p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fRp[3]; | |
178 | } | |
179 | ||
180 | void AliESDtrack::GetXYZ(Double_t *xyz) const { | |
181 | //--------------------------------------------------------------------- | |
182 | // This function returns the global track position | |
183 | //--------------------------------------------------------------------- | |
184 | Double_t phi=TMath::ASin(fRp[2]) + fRalpha; | |
185 | Double_t r=TMath::Sqrt(fRx*fRx + fRp[0]*fRp[0]); | |
186 | xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fRp[1]; | |
187 | } | |
188 | ||
189 | //_______________________________________________________________________ | |
190 | void AliESDtrack::GetExternalCovariance(Double_t c[15]) const { | |
191 | //--------------------------------------------------------------------- | |
192 | // This function returns external representation of the cov. matrix | |
193 | //--------------------------------------------------------------------- | |
194 | for (Int_t i=0; i<15; i++) c[i]=fRc[i]; | |
195 | } | |
196 | ||
197 | //_______________________________________________________________________ | |
198 | void AliESDtrack::GetIntegratedTimes(Double_t *times) const { | |
199 | for (Int_t i=0; i<kSPECIES; i++) times[i]=fTrackTime[i]; | |
200 | } | |
201 | ||
202 | //_______________________________________________________________________ | |
203 | void AliESDtrack::SetIntegratedTimes(const Double_t *times) { | |
204 | for (Int_t i=0; i<kSPECIES; i++) fTrackTime[i]=times[i]; | |
205 | } | |
206 | ||
c630aafd | 207 | //_______________________________________________________________________ |
208 | void AliESDtrack::SetITSpid(const Double_t *p) { | |
209 | for (Int_t i=0; i<kSPECIES; i++) fITSr[i]=p[i]; | |
210 | SetStatus(AliESDtrack::kITSpid); | |
211 | } | |
212 | ||
213 | //_______________________________________________________________________ | |
214 | void AliESDtrack::GetITSpid(Double_t *p) const { | |
215 | for (Int_t i=0; i<kSPECIES; i++) p[i]=fITSr[i]; | |
216 | } | |
217 | ||
ae982df3 | 218 | //_______________________________________________________________________ |
219 | Int_t AliESDtrack::GetITSclusters(UInt_t *idx) const { | |
220 | //--------------------------------------------------------------------- | |
221 | // This function returns indices of the assgined ITS clusters | |
222 | //--------------------------------------------------------------------- | |
223 | for (Int_t i=0; i<fITSncls; i++) idx[i]=fITSindex[i]; | |
224 | return fITSncls; | |
225 | } | |
226 | ||
227 | //_______________________________________________________________________ | |
228 | Int_t AliESDtrack::GetTPCclusters(UInt_t *idx) const { | |
229 | //--------------------------------------------------------------------- | |
230 | // This function returns indices of the assgined ITS clusters | |
231 | //--------------------------------------------------------------------- | |
232 | for (Int_t i=0; i<fTPCncls; i++) idx[i]=fTPCindex[i]; | |
233 | return fTPCncls; | |
234 | } | |
8c6a71ab | 235 | |
236 | //_______________________________________________________________________ | |
237 | void AliESDtrack::SetTPCpid(const Double_t *p) { | |
238 | for (Int_t i=0; i<kSPECIES; i++) fTPCr[i]=p[i]; | |
239 | SetStatus(AliESDtrack::kTPCpid); | |
240 | } | |
241 | ||
242 | //_______________________________________________________________________ | |
243 | void AliESDtrack::GetTPCpid(Double_t *p) const { | |
244 | for (Int_t i=0; i<kSPECIES; i++) p[i]=fTPCr[i]; | |
245 | } | |
246 | ||
c630aafd | 247 | //_______________________________________________________________________ |
248 | void AliESDtrack::SetTRDpid(const Double_t *p) { | |
249 | for (Int_t i=0; i<kSPECIES; i++) fTRDr[i]=p[i]; | |
250 | SetStatus(AliESDtrack::kTRDpid); | |
251 | } | |
252 | ||
253 | //_______________________________________________________________________ | |
254 | void AliESDtrack::GetTRDpid(Double_t *p) const { | |
255 | for (Int_t i=0; i<kSPECIES; i++) p[i]=fTRDr[i]; | |
256 | } | |
257 | ||
79e94bf8 | 258 | //_______________________________________________________________________ |
259 | void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p) | |
260 | { | |
261 | fTRDr[iSpecies] = p; | |
262 | } | |
263 | ||
264 | Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const | |
265 | { | |
266 | return fTRDr[iSpecies]; | |
267 | } | |
268 | ||
c630aafd | 269 | //_______________________________________________________________________ |
270 | void AliESDtrack::SetTOFpid(const Double_t *p) { | |
271 | for (Int_t i=0; i<kSPECIES; i++) fTOFr[i]=p[i]; | |
272 | SetStatus(AliESDtrack::kTOFpid); | |
273 | } | |
274 | ||
275 | //_______________________________________________________________________ | |
276 | void AliESDtrack::GetTOFpid(Double_t *p) const { | |
277 | for (Int_t i=0; i<kSPECIES; i++) p[i]=fTOFr[i]; | |
278 | } | |
279 | ||
8c6a71ab | 280 | //_______________________________________________________________________ |
281 | void AliESDtrack::SetESDpid(const Double_t *p) { | |
282 | for (Int_t i=0; i<kSPECIES; i++) fR[i]=p[i]; | |
283 | SetStatus(AliESDtrack::kESDpid); | |
284 | } | |
285 | ||
286 | //_______________________________________________________________________ | |
287 | void AliESDtrack::GetESDpid(Double_t *p) const { | |
288 | for (Int_t i=0; i<kSPECIES; i++) p[i]=fR[i]; | |
289 | } | |
290 | ||
ad2f1f2b | 291 | void AliESDtrack::GetVertexXYZ(Double_t& x,Double_t& y, Double_t&z) const |
292 | { | |
293 | //returns track position in DCA to vertex | |
294 | x = fVertexX; | |
295 | y = fVertexY; | |
296 | z = fVertexZ; | |
297 | } | |
298 | void AliESDtrack::GetVertexPxPyPz(Double_t& px,Double_t& py, Double_t& pz) const | |
299 | { | |
300 | //returns track momentum in DCA to vertex | |
301 | px = fVertexPx; | |
302 | py = fVertexPy; | |
303 | pz = fVertexPz; | |
304 | } |