]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliTrackParam.cxx
Right cathode numbering (Christian)
[u/mrichter/AliRoot.git] / STEER / AliTrackParam.cxx
CommitLineData
51ad6848 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/* $Id$ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// base class for track parameters //
21// //
22// The idea of having a separate class for the track parametrisation and //
23// not including it in the track classes itself is to not duplicate code. //
24// Track classes which use the same parametrisation can include a track //
25// parameters object for their common parametrisation. The code, e.g. for //
26// the propagation, does not need to be duplicated. //
27// //
28// The AliTrackParam and its derived classes //
29// - know the current track parameters and their covariance matrix as well //
30// as the local x coordinate and azimuthal angle alpha of the current //
31// parametrisation //
32// - can rotate their local coordinate system //
33// - can create a parametrisation in external format from itself //
34// - can propagate through material or vacuum //
35// - can calculate a chi^2 for a cluster //
36// - can update the parameters using the position and covariance of a //
37// cluster //
38// //
39// In addition some methods to get quantities useful for analysis, like //
40// the momentum, are implemented. //
41// //
42///////////////////////////////////////////////////////////////////////////////
43
44
45#include "AliTrackParam.h"
46#include "AliExternalTrackParam.h"
47#include "AliRunLoader.h"
48#include "AliRun.h"
49#include "AliMagF.h"
50
51
52Double_t FastMath::fgFastAsin[20000];
53
54FastMath::FastMath()
55{
56 for (Int_t i=0;i<10000;i++){
57 fgFastAsin[2*i] = TMath::ASin(i/10000.);
58 fgFastAsin[2*i+1] = (TMath::ASin((i+1)/10000.)-fgFastAsin[2*i]);
59 }
60}
61
62Double_t FastMath::FastAsin(Double_t x)
63{
64 if (x>0){
65 Int_t index = int(x*10000);
66 return fgFastAsin[2*index]+(x*10000.-index)*fgFastAsin[2*index+1];
67 }
68 x*=-1;
69 Int_t index = int(x*10000);
70 return -(fgFastAsin[2*index]+(x*10000.-index)*fgFastAsin[2*index+1]);
71}
72
73FastMath gFastMath;
74
75
76
77ClassImp(AliTrackParam)
78
79
80
81
82//_____________________________________________________________________________
83Bool_t AliTrackParam::RotateAndPropagateTo(Double_t alpha, Double_t x,
84 Double_t* length)
85{
86// Rotate the reference axis for the parametrisation to the given angle and
87// propagate the track parameters to the given x coordinate assuming vacuum.
88// If length is not NULL, the change of track length is added to it.
89
90 if (!RotateTo(alpha)) return kFALSE;
91 if (!PropagateTo(x, length)) return kFALSE;
92 return kTRUE;
93}
94
95//_____________________________________________________________________________
96Double_t AliTrackParam::GetDsdx() const
97{
98// get the change of track length s per step in x: ds/dx
99
100 TVector3 x(TMath::Cos(Alpha()), TMath::Sin(Alpha()), 0);
101 TVector3 p = Momentum();
102 Double_t xp = x*p;
103 if (xp == 0) return 1.E6;
104 return p.Mag() / xp;
105}
106
107
108//_____________________________________________________________________________
109Double_t AliTrackParam::Phi() const
110{
111// get the azimuthal angre
112
113 return Momentum().Phi();
114}
115
116//_____________________________________________________________________________
117Double_t AliTrackParam::SigmaPhi() const
118{
119// get the error of the azimuthal angle
120
121 AliExternalTrackParam* param = CreateExternalParam();
122 Double_t result = param->SigmaPhi();
123 delete param;
124 return result;
125}
126
127//_____________________________________________________________________________
128Double_t AliTrackParam::Theta() const
129{
130// the the polar angle
131
132 return Momentum().Theta();
133}
134
135//_____________________________________________________________________________
136Double_t AliTrackParam::SigmaTheta() const
137{
138// get the error of the polar angle
139
140 AliExternalTrackParam* param = CreateExternalParam();
141 Double_t result = param->SigmaTheta();
142 delete param;
143 return result;
144}
145
146//_____________________________________________________________________________
147Double_t AliTrackParam::Eta() const
148{
149// get the pseudorapidity
150
151 return Momentum().Eta();
152}
153
154//_____________________________________________________________________________
155Double_t AliTrackParam::Px() const
156{
157// get the x component of the momentum
158
159 return Momentum().Px();
160}
161
162//_____________________________________________________________________________
163Double_t AliTrackParam::Py() const
164{
165// get the y component of the momentum
166
167 return Momentum().Py();
168}
169
170//_____________________________________________________________________________
171Double_t AliTrackParam::Pz() const
172{
173// get the z component of the momentum
174
175 return Momentum().Pz();
176}
177
178//_____________________________________________________________________________
179Double_t AliTrackParam::Pt() const
180{
181// get the transversal component of the momentum
182
183 return Momentum().Pt();
184}
185
186//_____________________________________________________________________________
187Double_t AliTrackParam::SigmaPt() const
188{
189// get the error of the transversal component of the momentum
190
191 AliExternalTrackParam* param = CreateExternalParam();
192 Double_t result = param->SigmaPt();
193 delete param;
194 return result;
195}
196
197//_____________________________________________________________________________
198Double_t AliTrackParam::P() const
199{
200// get the absolute momentum
201
202 return Momentum().Mag();
203}
204
205//_____________________________________________________________________________
206TVector3 AliTrackParam::Momentum() const
207{
208// get the momentum vector
209
210 AliExternalTrackParam* param = CreateExternalParam();
211 TVector3 result = param->Momentum();
212 delete param;
213 return result;
214}
215
216//_____________________________________________________________________________
217TVector3 AliTrackParam::Position() const
218{
219// get the current spatial position in global coordinates
220
221 Double_t sinAlpha = TMath::Sin(Alpha());
222 Double_t cosAlpha = TMath::Cos(Alpha());
223 return TVector3(X()*cosAlpha - Y()*sinAlpha,
224 X()*sinAlpha + Y()*cosAlpha,
225 Z());
226}
227
228//_____________________________________________________________________________
229TVector3 AliTrackParam::PositionAt(Double_t x) const
230{
231// get the spatial position at x in global coordinates
232
233 Double_t y;
234 Double_t z;
235 if (!GetProlongationAt(x, y, z)) return TVector3(0,0,0);
236 Double_t sinAlpha = TMath::Sin(Alpha());
237 Double_t cosAlpha = TMath::Cos(Alpha());
238 return TVector3(x*cosAlpha - y*sinAlpha, x*sinAlpha + y*cosAlpha, z);
239}
240