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