]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliESDtrack.cxx
Change needed on Alpha
[u/mrichter/AliRoot.git] / STEER / AliESDtrack.cxx
CommitLineData
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
28ClassImp(AliESDtrack)
29
30//_______________________________________________________________________
31AliESDtrack::AliESDtrack() :
32fFlags(0),
33fITSncls(0),
34fTPCncls(0)
35{
36 //
37 // The default ESD constructor
38 //
39 for (Int_t i=0; i<kSPECIES; i++) fR[i]=0.;
40}
41
42//_______________________________________________________________________
43Float_t AliESDtrack::GetMass() const {
44 Float_t max=0.;
45 Int_t k=-1;
46 for (Int_t i=0; i<kSPECIES; i++) {
47 if (fR[i]>max) {k=i; max=fR[i];}
48 }
49 if (k==0) return 0.00051;
50 if (k==1) return 0.10566;
51 if (k==2||k==-1) return 0.13957;
52 if (k==3) return 0.49368;
53 if (k==4) return 0.93827;
54 Warning("GetMass()","Undefined mass !");
55 return 0.13957;
56}
57
58//_______________________________________________________________________
59Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags) {
60 //
61 // This function updates track's running parameters
62 //
63 switch (flags) {
64 case kITSin: case kITSout: case kITSrefit:
65 fITSncls=t->GetNumberOfClusters();
66 fITSchi2=t->GetChi2();
67 for (Int_t i=0;i<fITSncls;i++) fITSindex[i]=t->GetClusterIndex(i);
68 fITSsignal=t->GetPIDsignal();
69 break;
70 case kTPCin: case kTPCout: case kTPCrefit:
71 fTPCncls=t->GetNumberOfClusters();
72 fTPCchi2=t->GetChi2();
73 for (Int_t i=0;i<fTPCncls;i++) fTPCindex[i]=t->GetClusterIndex(i);
74 fTPCsignal=t->GetPIDsignal();
75 {Double_t mass=t->GetMass(); // preliminary mass setting
76 if (mass>0.5) fR[4]=1.; // used by
77 else if (mass<0.4) fR[2]=1.; // the ITS reconstruction
78 else fR[3]=1.;} //
79 break;
79e94bf8 80 case kTRDin: case kTRDout: case kTRDrefit:
81 fTRDncls=t->GetNumberOfClusters();
82 fTRDchi2=t->GetChi2();
83 fTRDsignal=t->GetPIDsignal();
84 break;
ae982df3 85 default:
86 Error("UpdateTrackParams()","Wrong flag !\n");
87 return kFALSE;
88 }
89
90 SetStatus(flags);
91 fLabel=t->GetLabel();
92
93 if (t->IsStartedTimeIntegral()) {
94 SetStatus(kTIME);
95 Double_t times[10];t->GetIntegratedTimes(times); SetIntegratedTimes(times);
96 SetIntegratedLength(t->GetIntegratedLength());
97 }
98
99 fRalpha=t->GetAlpha();
100 t->GetExternalParameters(fRx,fRp);
101 t->GetExternalCovariance(fRc);
102 return kTRUE;
103}
104
e23730c7 105//_______________________________________________________________________
106void AliESDtrack::GetExternalParametersAt(Double_t x, Double_t p[5]) const {
107 //---------------------------------------------------------------------
108 // This function returns external representation of the track parameters
109 // at the plane x
110 //---------------------------------------------------------------------
111 Double_t dx=x-fRx;
112 Double_t c=fRp[4]/AliKalmanTrack::GetConvConst();
113 Double_t f1=fRp[2], f2=f1 + c*dx;
114 Double_t r1=sqrt(1.- f1*f1), r2=sqrt(1.- f2*f2);
115
116 p[0]=fRp[0]+dx*(f1+f2)/(r1+r2);
117 p[1]=fRp[1]+dx*(f1+f2)/(f1*r2 + f2*r1)*fRp[3];
118 p[2]=fRp[2]+dx*c;
119 p[3]=fRp[3];
120 p[4]=fRp[4];
121}
122
ae982df3 123//_______________________________________________________________________
124void AliESDtrack::GetExternalParameters(Double_t &x, Double_t p[5]) const {
125 //---------------------------------------------------------------------
126 // This function returns external representation of the track parameters
127 //---------------------------------------------------------------------
128 x=fRx;
129 for (Int_t i=0; i<5; i++) p[i]=fRp[i];
130}
131
132Double_t AliESDtrack::GetP() const {
133 //---------------------------------------------------------------------
134 // This function returns the track momentum
135 //---------------------------------------------------------------------
136 Double_t lam=TMath::ATan(fRp[3]);
137 Double_t pt=1./TMath::Abs(fRp[4]);
138 return pt/TMath::Cos(lam);
139}
140
141void AliESDtrack::GetPxPyPz(Double_t *p) const {
142 //---------------------------------------------------------------------
143 // This function returns the global track momentum components
144 //---------------------------------------------------------------------
145 Double_t phi=TMath::ASin(fRp[2]) + fRalpha;
146 Double_t pt=1./TMath::Abs(fRp[4]);
147 p[0]=pt*TMath::Cos(phi); p[1]=pt*TMath::Sin(phi); p[2]=pt*fRp[3];
148}
149
150void AliESDtrack::GetXYZ(Double_t *xyz) const {
151 //---------------------------------------------------------------------
152 // This function returns the global track position
153 //---------------------------------------------------------------------
154 Double_t phi=TMath::ASin(fRp[2]) + fRalpha;
155 Double_t r=TMath::Sqrt(fRx*fRx + fRp[0]*fRp[0]);
156 xyz[0]=r*TMath::Cos(phi); xyz[1]=r*TMath::Sin(phi); xyz[2]=fRp[1];
157}
158
159//_______________________________________________________________________
160void AliESDtrack::GetExternalCovariance(Double_t c[15]) const {
161 //---------------------------------------------------------------------
162 // This function returns external representation of the cov. matrix
163 //---------------------------------------------------------------------
164 for (Int_t i=0; i<15; i++) c[i]=fRc[i];
165}
166
167//_______________________________________________________________________
168void AliESDtrack::GetIntegratedTimes(Double_t *times) const {
169 for (Int_t i=0; i<kSPECIES; i++) times[i]=fTrackTime[i];
170}
171
172//_______________________________________________________________________
173void AliESDtrack::SetIntegratedTimes(const Double_t *times) {
174 for (Int_t i=0; i<kSPECIES; i++) fTrackTime[i]=times[i];
175}
176
c630aafd 177//_______________________________________________________________________
178void AliESDtrack::SetITSpid(const Double_t *p) {
179 for (Int_t i=0; i<kSPECIES; i++) fITSr[i]=p[i];
180 SetStatus(AliESDtrack::kITSpid);
181}
182
183//_______________________________________________________________________
184void AliESDtrack::GetITSpid(Double_t *p) const {
185 for (Int_t i=0; i<kSPECIES; i++) p[i]=fITSr[i];
186}
187
ae982df3 188//_______________________________________________________________________
189Int_t AliESDtrack::GetITSclusters(UInt_t *idx) const {
190 //---------------------------------------------------------------------
191 // This function returns indices of the assgined ITS clusters
192 //---------------------------------------------------------------------
193 for (Int_t i=0; i<fITSncls; i++) idx[i]=fITSindex[i];
194 return fITSncls;
195}
196
197//_______________________________________________________________________
198Int_t AliESDtrack::GetTPCclusters(UInt_t *idx) const {
199 //---------------------------------------------------------------------
200 // This function returns indices of the assgined ITS clusters
201 //---------------------------------------------------------------------
202 for (Int_t i=0; i<fTPCncls; i++) idx[i]=fTPCindex[i];
203 return fTPCncls;
204}
8c6a71ab 205
206//_______________________________________________________________________
207void AliESDtrack::SetTPCpid(const Double_t *p) {
208 for (Int_t i=0; i<kSPECIES; i++) fTPCr[i]=p[i];
209 SetStatus(AliESDtrack::kTPCpid);
210}
211
212//_______________________________________________________________________
213void AliESDtrack::GetTPCpid(Double_t *p) const {
214 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTPCr[i];
215}
216
c630aafd 217//_______________________________________________________________________
218void AliESDtrack::SetTRDpid(const Double_t *p) {
219 for (Int_t i=0; i<kSPECIES; i++) fTRDr[i]=p[i];
220 SetStatus(AliESDtrack::kTRDpid);
221}
222
223//_______________________________________________________________________
224void AliESDtrack::GetTRDpid(Double_t *p) const {
225 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTRDr[i];
226}
227
79e94bf8 228//_______________________________________________________________________
229void AliESDtrack::SetTRDpid(Int_t iSpecies, Float_t p)
230{
231 fTRDr[iSpecies] = p;
232}
233
234Float_t AliESDtrack::GetTRDpid(Int_t iSpecies) const
235{
236 return fTRDr[iSpecies];
237}
238
c630aafd 239//_______________________________________________________________________
240void AliESDtrack::SetTOFpid(const Double_t *p) {
241 for (Int_t i=0; i<kSPECIES; i++) fTOFr[i]=p[i];
242 SetStatus(AliESDtrack::kTOFpid);
243}
244
245//_______________________________________________________________________
246void AliESDtrack::GetTOFpid(Double_t *p) const {
247 for (Int_t i=0; i<kSPECIES; i++) p[i]=fTOFr[i];
248}
249
8c6a71ab 250//_______________________________________________________________________
251void AliESDtrack::SetESDpid(const Double_t *p) {
252 for (Int_t i=0; i<kSPECIES; i++) fR[i]=p[i];
253 SetStatus(AliESDtrack::kESDpid);
254}
255
256//_______________________________________________________________________
257void AliESDtrack::GetESDpid(Double_t *p) const {
258 for (Int_t i=0; i<kSPECIES; i++) p[i]=fR[i];
259}
260