Using TGeo to retrieve the mean material budget between two points (M.Ivanov)
[u/mrichter/AliRoot.git] / STEER / AliExternalTrackParam.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// track parameters in "external" format //
21// //
22// The track parameters are: //
23// - local y coordinate //
24// - local z coordinate //
25// - sin of azimutal angle //
26// - tan of dip angle //
27// - charge/pt //
28// The parametrisation is given at the local x coordinate fX and the //
29// azimuthal angle fAlpha. //
30// //
31// The external parametrisation can be used to exchange track parameters //
32// between different detectors. //
33// //
34///////////////////////////////////////////////////////////////////////////////
35
a0209ae4 36#include <TMath.h>
37#include <TVector3.h>
51ad6848 38
39#include "AliExternalTrackParam.h"
40#include "AliKalmanTrack.h"
41
42ClassImp(AliExternalTrackParam)
43
44
45//_____________________________________________________________________________
90e48c0c 46AliExternalTrackParam::AliExternalTrackParam() :
47 AliTrackParam(),
48 fX(0),
49 fAlpha(0)
51ad6848 50{
90e48c0c 51 //
52 // default constructor
53 //
51ad6848 54 for (Int_t i = 0; i < 5; i++) fParam[i] = 0;
55 for (Int_t i = 0; i < 15; i++) fCovar[i] = 0;
56}
57
58//_____________________________________________________________________________
59AliExternalTrackParam::AliExternalTrackParam(Double_t x, Double_t alpha,
60 const Double_t param[5],
90e48c0c 61 const Double_t covar[15]) :
62 AliTrackParam(),
63 fX(x),
64 fAlpha(alpha)
51ad6848 65{
90e48c0c 66 //
67 // create external track parameters from given arguments
68 //
51ad6848 69 for (Int_t i = 0; i < 5; i++) fParam[i] = param[i];
70 for (Int_t i = 0; i < 15; i++) fCovar[i] = covar[i];
71}
72
90e48c0c 73//_____________________________________________________________________________
74AliExternalTrackParam::AliExternalTrackParam(const AliKalmanTrack& track) :
75 fX(0),
76 fAlpha(track.GetAlpha())
51ad6848 77{
78 //
79 //
80 track.GetExternalParameters(fX,fParam);
81 track.GetExternalCovariance(fCovar);
51ad6848 82}
83
51ad6848 84//_____________________________________________________________________________
85const Double_t* AliExternalTrackParam::GetParameter() const
86{
87// get a pointer to the array of track parameters
88
89 return fParam;
90}
91
92//_____________________________________________________________________________
93const Double_t* AliExternalTrackParam::GetCovariance() const
94{
95// get a pointer to the array of the track parameter covariance matrix
96
97 return fCovar;
98}
99
100//_____________________________________________________________________________
101AliExternalTrackParam* AliExternalTrackParam::CreateExternalParam() const
102{
103// copy this instance
104
105 return new AliExternalTrackParam(fX, fAlpha, fParam, fCovar);
106}
107
108//_____________________________________________________________________________
109void AliExternalTrackParam::ResetCovariance(Double_t factor,
110 Bool_t clearOffDiagonal)
111{
112// reset the covariance matrix ("forget" track history)
113
114 Int_t k = 0;
115 for (Int_t i = 0; i < 5; i++) {
116 for (Int_t j = 0; j < i; j++) { // off diagonal elements
117 if (clearOffDiagonal) {
118 fCovar[k++] = 0;
119 } else {
120 fCovar[k++] *= factor;
121 }
122 }
123 fCovar[k++] *= factor; // diagonal elements
124 }
125}
126
127
128//_____________________________________________________________________________
129Bool_t AliExternalTrackParam::PropagateTo(Double_t /*x*/, Double_t* /*length*/)
130{
131// Propagate the track parameters to the given x coordinate assuming vacuum.
132// If length is not NULL, the change of track length is added to it.
133//
134// NOT IMPLEMENTED for this class
135
136 return kFALSE;
137}
138
139//_____________________________________________________________________________
140Bool_t AliExternalTrackParam::RotateTo(Double_t /*alpha*/)
141{
142// Rotate the reference axis for the parametrisation to the given angle.
143//
144// NOT IMPLEMENTED for this class
145
146 return kFALSE;
147}
148
149//_____________________________________________________________________________
150Bool_t AliExternalTrackParam::CorrectForMaterial(Double_t /*dAngle*/,
151 Double_t /*dPrel*/)
152{
153// Take into account material effects assuming:
154// dAngle2: mean multiple scattering angle in rad squared
155// dPrel : mean relative momentum gain (if > 0) or loss (if < 0)
156//
157// NOT IMPLEMENTED for this class
158
159 return kFALSE;
160}
161
162//_____________________________________________________________________________
163Bool_t AliExternalTrackParam::GetProlongationAt(Double_t /*x*/,
164 Double_t& /*y*/,
165 Double_t& /*z*/) const
166{
167// Get the local y and z coordinates at the given x value
168//
169// NOT IMPLEMENTED for this class
170
171 return kFALSE;
172}
173
174//_____________________________________________________________________________
175Double_t AliExternalTrackParam::GetXAtVertex(Double_t /*x*/,
176 Double_t /*y*/) const
177{
178// Get the x coordinate at the given vertex (x,y)
179//
180// NOT IMPLEMENTED for this class
181
182 return 0;
183}
184
185
186//_____________________________________________________________________________
187Double_t AliExternalTrackParam::GetPredictedChi2(const AliCluster* /*cluster*/)
188{
189// calculate the chi2 contribution of the given cluster
190//
191// NOT IMPLEMENTED for this class
192
193 return -1;
194}
195
196//_____________________________________________________________________________
197Bool_t AliExternalTrackParam::Update(const AliCluster* /*cluster*/)
198{
199// update the track parameters using the position and error
200// of the given cluster
201//
202// NOT IMPLEMENTED for this class
203
204 return kFALSE;
205}
206
207
208//_____________________________________________________________________________
209Double_t AliExternalTrackParam::SigmaPhi() const
210{
211// get the error of the azimuthal angle
212
213 return TMath::Sqrt(TMath::Abs(fCovar[5] / (1. - fParam[2]*fParam[2])));
214}
215
216//_____________________________________________________________________________
217Double_t AliExternalTrackParam::SigmaTheta() const
218{
219// get the error of the polar angle
220
221 return TMath::Sqrt(TMath::Abs(fCovar[9])) / (1. + fParam[3]*fParam[3]);
222}
223
224//_____________________________________________________________________________
225Double_t AliExternalTrackParam::SigmaPt() const
226{
227// get the error of the transversal component of the momentum
228
229 return TMath::Sqrt(fCovar[14]) / TMath::Abs(fParam[4]);
230}
231
232//_____________________________________________________________________________
233TVector3 AliExternalTrackParam::Momentum() const
234{
235// get the momentum vector
236
237 Double_t phi = TMath::ASin(fParam[2]) + fAlpha;
238 Double_t pt = 1. / TMath::Abs(fParam[4]);
239 return TVector3(pt * TMath::Cos(phi),
240 pt * TMath::Sin(phi),
241 pt * fParam[3]);
242}
243
244//_____________________________________________________________________________
245TVector3 AliExternalTrackParam::Position() const
246{
247// get the current spatial position in global coordinates
248
249 return TVector3(fX * TMath::Cos(fAlpha) - fParam[0] * TMath::Sin(fAlpha),
250 fX * TMath::Sin(fAlpha) + fParam[0] * TMath::Cos(fAlpha),
251 fParam[1]);
252}
253
254
255//_____________________________________________________________________________
256void AliExternalTrackParam::Print(Option_t* /*option*/) const
257{
258// print the parameters and the covariance matrix
259
260 printf("AliExternalTrackParam: x = %-12g alpha = %-12g\n", fX, fAlpha);
261 printf(" parameters: %12g %12g %12g %12g %12g\n",
262 fParam[0], fParam[1], fParam[2], fParam[3], fParam[4]);
263 printf(" covariance: %12g\n", fCovar[0]);
264 printf(" %12g %12g\n", fCovar[1], fCovar[2]);
265 printf(" %12g %12g %12g\n", fCovar[3], fCovar[4], fCovar[5]);
266 printf(" %12g %12g %12g %12g\n",
267 fCovar[6], fCovar[7], fCovar[8], fCovar[9]);
268 printf(" %12g %12g %12g %12g %12g\n",
269 fCovar[10], fCovar[11], fCovar[12], fCovar[13], fCovar[14]);
270}