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