]>
Commit | Line | Data |
---|---|---|
a9e2aefa | 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 | ||
88cb7938 | 16 | /* $Id$ */ |
a9e2aefa | 17 | |
56316147 | 18 | //----------------------------------------------------------------------------- |
19 | // Class AliMUONTrackParam | |
20 | //------------------------- | |
21 | // Track parameters in ALICE dimuon spectrometer | |
22 | //----------------------------------------------------------------------------- | |
a9e2aefa | 23 | |
37827b29 | 24 | #include "AliMUONTrackParam.h" |
96ebe67e | 25 | #include "AliMUONVCluster.h" |
22ccc301 | 26 | |
211c52eb | 27 | #include "AliESDMuonTrack.h" |
37827b29 | 28 | #include "AliLog.h" |
22ccc301 | 29 | |
22ccc301 | 30 | #include <TMath.h> |
ea94c18b | 31 | |
32 | #include <Riostream.h> | |
a9e2aefa | 33 | |
7945aae7 | 34 | /// \cond CLASSIMP |
a9e2aefa | 35 | ClassImp(AliMUONTrackParam) // Class implementation in ROOT context |
7945aae7 | 36 | /// \endcond |
a9e2aefa | 37 | |
61adb9bd | 38 | //_________________________________________________________________________ |
30178c30 | 39 | AliMUONTrackParam::AliMUONTrackParam() |
54d7ba50 | 40 | : TObject(), |
208f139e | 41 | fZ(0.), |
ea94c18b | 42 | fParameters(5,1), |
208f139e | 43 | fCovariances(0x0), |
ea94c18b | 44 | fPropagator(0x0), |
45 | fExtrapParameters(0x0), | |
46 | fExtrapCovariances(0x0), | |
47 | fSmoothParameters(0x0), | |
48 | fSmoothCovariances(0x0), | |
96ebe67e | 49 | fClusterPtr(0x0), |
50 | fOwnCluster(kFALSE), | |
ea94c18b | 51 | fRemovable(kFALSE), |
52 | fTrackChi2(0.), | |
53 | fLocalChi2(0.) | |
30178c30 | 54 | { |
37827b29 | 55 | /// Constructor |
30178c30 | 56 | } |
61adb9bd | 57 | |
30178c30 | 58 | //_________________________________________________________________________ |
de2cd600 | 59 | AliMUONTrackParam::AliMUONTrackParam(const AliMUONTrackParam& theMUONTrackParam) |
60 | : TObject(theMUONTrackParam), | |
208f139e | 61 | fZ(theMUONTrackParam.fZ), |
ea94c18b | 62 | fParameters(theMUONTrackParam.fParameters), |
208f139e | 63 | fCovariances(0x0), |
ea94c18b | 64 | fPropagator(0x0), |
65 | fExtrapParameters(0x0), | |
66 | fExtrapCovariances(0x0), | |
67 | fSmoothParameters(0x0), | |
68 | fSmoothCovariances(0x0), | |
96ebe67e | 69 | fClusterPtr(0x0), |
70 | fOwnCluster(theMUONTrackParam.fOwnCluster), | |
ea94c18b | 71 | fRemovable(theMUONTrackParam.fRemovable), |
72 | fTrackChi2(theMUONTrackParam.fTrackChi2), | |
73 | fLocalChi2(theMUONTrackParam.fLocalChi2) | |
de2cd600 | 74 | { |
2457f726 | 75 | /// Copy constructor |
208f139e | 76 | if (theMUONTrackParam.fCovariances) fCovariances = new TMatrixD(*(theMUONTrackParam.fCovariances)); |
ea94c18b | 77 | if (theMUONTrackParam.fPropagator) fPropagator = new TMatrixD(*(theMUONTrackParam.fPropagator)); |
78 | if (theMUONTrackParam.fExtrapParameters) fExtrapParameters = new TMatrixD(*(theMUONTrackParam.fExtrapParameters)); | |
79 | if (theMUONTrackParam.fExtrapCovariances) fExtrapCovariances = new TMatrixD(*(theMUONTrackParam.fExtrapCovariances)); | |
80 | if (theMUONTrackParam.fSmoothParameters) fSmoothParameters = new TMatrixD(*(theMUONTrackParam.fSmoothParameters)); | |
81 | if (theMUONTrackParam.fSmoothCovariances) fSmoothCovariances = new TMatrixD(*(theMUONTrackParam.fSmoothCovariances)); | |
96ebe67e | 82 | |
1467f4ba | 83 | if(fOwnCluster) fClusterPtr = static_cast<AliMUONVCluster*>(theMUONTrackParam.fClusterPtr->Clone()); |
96ebe67e | 84 | else fClusterPtr = theMUONTrackParam.fClusterPtr; |
de2cd600 | 85 | } |
86 | ||
87 | //_________________________________________________________________________ | |
88 | AliMUONTrackParam& AliMUONTrackParam::operator=(const AliMUONTrackParam& theMUONTrackParam) | |
61adb9bd | 89 | { |
2457f726 | 90 | /// Asignment operator |
30178c30 | 91 | if (this == &theMUONTrackParam) |
61adb9bd | 92 | return *this; |
93 | ||
30178c30 | 94 | // base class assignement |
95 | TObject::operator=(theMUONTrackParam); | |
96 | ||
ea94c18b | 97 | fZ = theMUONTrackParam.fZ; |
98 | ||
99 | fParameters = theMUONTrackParam.fParameters; | |
208f139e | 100 | |
101 | if (theMUONTrackParam.fCovariances) { | |
102 | if (fCovariances) *fCovariances = *(theMUONTrackParam.fCovariances); | |
103 | else fCovariances = new TMatrixD(*(theMUONTrackParam.fCovariances)); | |
019df241 | 104 | } else { |
208f139e | 105 | delete fCovariances; |
106 | fCovariances = 0x0; | |
107 | } | |
108 | ||
ea94c18b | 109 | if (theMUONTrackParam.fPropagator) { |
110 | if (fPropagator) *fPropagator = *(theMUONTrackParam.fPropagator); | |
111 | else fPropagator = new TMatrixD(*(theMUONTrackParam.fPropagator)); | |
019df241 | 112 | } else { |
ea94c18b | 113 | delete fPropagator; |
114 | fPropagator = 0x0; | |
115 | } | |
116 | ||
117 | if (theMUONTrackParam.fExtrapParameters) { | |
118 | if (fExtrapParameters) *fExtrapParameters = *(theMUONTrackParam.fExtrapParameters); | |
119 | else fExtrapParameters = new TMatrixD(*(theMUONTrackParam.fExtrapParameters)); | |
019df241 | 120 | } else { |
ea94c18b | 121 | delete fExtrapParameters; |
122 | fExtrapParameters = 0x0; | |
123 | } | |
124 | ||
125 | if (theMUONTrackParam.fExtrapCovariances) { | |
126 | if (fExtrapCovariances) *fExtrapCovariances = *(theMUONTrackParam.fExtrapCovariances); | |
127 | else fExtrapCovariances = new TMatrixD(*(theMUONTrackParam.fExtrapCovariances)); | |
019df241 | 128 | } else { |
ea94c18b | 129 | delete fExtrapCovariances; |
130 | fExtrapCovariances = 0x0; | |
131 | } | |
132 | ||
133 | if (theMUONTrackParam.fSmoothParameters) { | |
134 | if (fSmoothParameters) *fSmoothParameters = *(theMUONTrackParam.fSmoothParameters); | |
135 | else fSmoothParameters = new TMatrixD(*(theMUONTrackParam.fSmoothParameters)); | |
019df241 | 136 | } else { |
ea94c18b | 137 | delete fSmoothParameters; |
138 | fSmoothParameters = 0x0; | |
139 | } | |
140 | ||
141 | if (theMUONTrackParam.fSmoothCovariances) { | |
142 | if (fSmoothCovariances) *fSmoothCovariances = *(theMUONTrackParam.fSmoothCovariances); | |
143 | else fSmoothCovariances = new TMatrixD(*(theMUONTrackParam.fSmoothCovariances)); | |
019df241 | 144 | } else { |
ea94c18b | 145 | delete fSmoothCovariances; |
146 | fSmoothCovariances = 0x0; | |
147 | } | |
148 | ||
7332f213 | 149 | if (fOwnCluster) delete fClusterPtr; |
96ebe67e | 150 | fOwnCluster = theMUONTrackParam.fOwnCluster; |
1467f4ba | 151 | if(fOwnCluster) fClusterPtr = static_cast<AliMUONVCluster*>(theMUONTrackParam.fClusterPtr->Clone()); |
96ebe67e | 152 | else fClusterPtr = theMUONTrackParam.fClusterPtr; |
ea94c18b | 153 | |
154 | fRemovable = theMUONTrackParam.fRemovable; | |
155 | ||
156 | fTrackChi2 = theMUONTrackParam.fTrackChi2; | |
157 | fLocalChi2 = theMUONTrackParam.fLocalChi2; | |
158 | ||
61adb9bd | 159 | return *this; |
160 | } | |
de2cd600 | 161 | |
162 | //__________________________________________________________________________ | |
163 | AliMUONTrackParam::~AliMUONTrackParam() | |
61adb9bd | 164 | { |
de2cd600 | 165 | /// Destructor |
208f139e | 166 | DeleteCovariances(); |
ea94c18b | 167 | delete fPropagator; |
168 | delete fExtrapParameters; | |
169 | delete fExtrapCovariances; | |
170 | delete fSmoothParameters; | |
171 | delete fSmoothCovariances; | |
96ebe67e | 172 | if(fOwnCluster) delete fClusterPtr; |
de2cd600 | 173 | } |
174 | ||
175 | //__________________________________________________________________________ | |
ea94c18b | 176 | void |
177 | AliMUONTrackParam::Clear(Option_t* /*opt*/) | |
178 | { | |
96ebe67e | 179 | /// clear memory |
ea94c18b | 180 | DeleteCovariances(); |
181 | delete fPropagator; fPropagator = 0x0; | |
182 | delete fExtrapParameters; fExtrapParameters = 0x0; | |
183 | delete fExtrapCovariances; fExtrapCovariances = 0x0; | |
184 | delete fSmoothParameters; fSmoothParameters = 0x0; | |
185 | delete fSmoothCovariances; fSmoothCovariances = 0x0; | |
96ebe67e | 186 | if(fOwnCluster) { |
187 | delete fClusterPtr; fClusterPtr = 0x0; | |
188 | } | |
de2cd600 | 189 | } |
190 | ||
211c52eb | 191 | //_________________________________________________________________________ |
192 | void AliMUONTrackParam::GetParamFrom(const AliESDMuonTrack& esdMuonTrack) | |
193 | { | |
60765b06 | 194 | /// Get parameters from ESD track |
ea94c18b | 195 | fZ = esdMuonTrack.GetZ(); |
196 | fParameters(0,0) = esdMuonTrack.GetNonBendingCoor(); | |
197 | fParameters(1,0) = TMath::Tan(esdMuonTrack.GetThetaX()); | |
198 | fParameters(2,0) = esdMuonTrack.GetBendingCoor(); | |
199 | fParameters(3,0) = TMath::Tan(esdMuonTrack.GetThetaY()); | |
200 | fParameters(4,0) = esdMuonTrack.GetInverseBendingMomentum(); | |
211c52eb | 201 | } |
202 | ||
203 | //_________________________________________________________________________ | |
ea94c18b | 204 | void AliMUONTrackParam::SetParamFor(AliESDMuonTrack& esdMuonTrack) const |
211c52eb | 205 | { |
60765b06 | 206 | /// Set parameters in ESD track |
ea94c18b | 207 | esdMuonTrack.SetZ(fZ); |
208 | esdMuonTrack.SetNonBendingCoor(fParameters(0,0)); | |
209 | esdMuonTrack.SetThetaX(TMath::ATan(fParameters(1,0))); | |
210 | esdMuonTrack.SetBendingCoor(fParameters(2,0)); | |
211 | esdMuonTrack.SetThetaY(TMath::ATan(fParameters(3,0))); | |
212 | esdMuonTrack.SetInverseBendingMomentum(fParameters(4,0)); | |
211c52eb | 213 | } |
214 | ||
22ccc301 | 215 | //_________________________________________________________________________ |
61fed964 | 216 | void AliMUONTrackParam::GetParamFromDCA(const AliESDMuonTrack& esdMuonTrack) |
217 | { | |
218 | /// Get parameters from ESD track | |
219 | fZ = esdMuonTrack.GetZ(); | |
220 | fParameters(0,0) = esdMuonTrack.GetNonBendingCoorAtDCA(); | |
221 | fParameters(1,0) = TMath::Tan(esdMuonTrack.GetThetaXAtDCA()); | |
222 | fParameters(2,0) = esdMuonTrack.GetBendingCoorAtDCA(); | |
223 | fParameters(3,0) = TMath::Tan(esdMuonTrack.GetThetaYAtDCA()); | |
224 | fParameters(4,0) = esdMuonTrack.GetInverseBendingMomentumAtDCA(); | |
225 | } | |
226 | ||
227 | //_________________________________________________________________________ | |
228 | void AliMUONTrackParam::SetParamForDCA(AliESDMuonTrack& esdMuonTrack) const | |
229 | { | |
230 | /// Set parameters in ESD track | |
231 | esdMuonTrack.SetNonBendingCoorAtDCA(fParameters(0,0)); | |
232 | esdMuonTrack.SetThetaXAtDCA(TMath::ATan(fParameters(1,0))); | |
233 | esdMuonTrack.SetBendingCoorAtDCA(fParameters(2,0)); | |
234 | esdMuonTrack.SetThetaYAtDCA(TMath::ATan(fParameters(3,0))); | |
235 | esdMuonTrack.SetInverseBendingMomentumAtDCA(fParameters(4,0)); | |
236 | } | |
237 | ||
238 | //_________________________________________________________________________ | |
22ccc301 | 239 | void AliMUONTrackParam::GetParamFromUncorrected(const AliESDMuonTrack& esdMuonTrack) |
240 | { | |
60765b06 | 241 | /// Get parameters from ESD track |
ea94c18b | 242 | fZ = esdMuonTrack.GetZUncorrected(); |
243 | fParameters(0,0) = esdMuonTrack.GetNonBendingCoorUncorrected(); | |
244 | fParameters(1,0) = TMath::Tan(esdMuonTrack.GetThetaXUncorrected()); | |
245 | fParameters(2,0) = esdMuonTrack.GetBendingCoorUncorrected(); | |
246 | fParameters(3,0) = TMath::Tan(esdMuonTrack.GetThetaYUncorrected()); | |
247 | fParameters(4,0) = esdMuonTrack.GetInverseBendingMomentumUncorrected(); | |
22ccc301 | 248 | } |
249 | ||
61fed964 | 250 | //_________________________________________________________________________ |
ea94c18b | 251 | void AliMUONTrackParam::SetParamForUncorrected(AliESDMuonTrack& esdMuonTrack) const |
22ccc301 | 252 | { |
60765b06 | 253 | /// Set parameters in ESD track |
ea94c18b | 254 | esdMuonTrack.SetZUncorrected(fZ); |
255 | esdMuonTrack.SetNonBendingCoorUncorrected(fParameters(0,0)); | |
256 | esdMuonTrack.SetThetaXUncorrected(TMath::ATan(fParameters(1,0))); | |
257 | esdMuonTrack.SetBendingCoorUncorrected(fParameters(2,0)); | |
258 | esdMuonTrack.SetThetaYUncorrected(TMath::ATan(fParameters(3,0))); | |
259 | esdMuonTrack.SetInverseBendingMomentumUncorrected(fParameters(4,0)); | |
60765b06 | 260 | } |
261 | ||
61fed964 | 262 | //_________________________________________________________________________ |
60765b06 | 263 | void AliMUONTrackParam::GetCovFrom(const AliESDMuonTrack& esdMuonTrack) |
264 | { | |
265 | /// Get parameters covariances from ESD track | |
266 | ||
267 | // Get ESD covariance matrix | |
268 | if (!fCovariances) fCovariances = new TMatrixD(5,5); | |
269 | esdMuonTrack.GetCovariances(*fCovariances); | |
270 | ||
271 | // compute Jacobian to change the coordinate system | |
272 | // from (X,thetaX,Y,thetaY,c/pYZ) to (X,slopeX,Y,slopeY,c/pYZ) | |
273 | Double_t cosThetaX = TMath::Cos(TMath::ATan(fParameters(1,0))); | |
274 | Double_t cosThetaY = TMath::Cos(TMath::ATan(fParameters(3,0))); | |
275 | TMatrixD jacob(5,5); | |
276 | jacob.Zero(); | |
277 | jacob(0,0) = 1.; | |
278 | jacob(1,1) = 1. / cosThetaX / cosThetaX; | |
279 | jacob(2,2) = 1.; | |
280 | jacob(3,3) = 1. / cosThetaY / cosThetaY; | |
281 | jacob(4,4) = 1.; | |
282 | ||
283 | // compute covariance matrix in ESD coordinate system | |
284 | TMatrixD tmp(*fCovariances,TMatrixD::kMultTranspose,jacob); | |
285 | *fCovariances = TMatrixD(jacob,TMatrixD::kMult,tmp); | |
286 | ||
287 | } | |
288 | ||
289 | //_________________________________________________________________________ | |
290 | void AliMUONTrackParam::SetCovFor(AliESDMuonTrack& esdMuonTrack) const | |
291 | { | |
292 | /// Set parameters covariances in ESD track | |
293 | ||
294 | // set null matrix if covariances does not exist | |
295 | if (!fCovariances) { | |
296 | TMatrixD tmp(5,5); | |
297 | tmp.Zero(); | |
298 | esdMuonTrack.SetCovariances(tmp); | |
299 | return; | |
300 | } | |
301 | ||
302 | // compute Jacobian to change the coordinate system | |
303 | // from (X,slopeX,Y,slopeY,c/pYZ) to (X,thetaX,Y,thetaY,c/pYZ) | |
304 | Double_t cosThetaX = TMath::Cos(TMath::ATan(fParameters(1,0))); | |
305 | Double_t cosThetaY = TMath::Cos(TMath::ATan(fParameters(3,0))); | |
306 | TMatrixD jacob(5,5); | |
307 | jacob.Zero(); | |
308 | jacob(0,0) = 1.; | |
309 | jacob(1,1) = cosThetaX * cosThetaX; | |
310 | jacob(2,2) = 1.; | |
311 | jacob(3,3) = cosThetaY * cosThetaY; | |
312 | jacob(4,4) = 1.; | |
313 | ||
314 | // compute covariance matrix in ESD coordinate system | |
315 | TMatrixD tmp(*fCovariances,TMatrixD::kMultTranspose,jacob); | |
316 | TMatrixD tmp2(jacob,TMatrixD::kMult,tmp); | |
317 | esdMuonTrack.SetCovariances(tmp2); | |
318 | ||
22ccc301 | 319 | } |
320 | ||
b8dc484b | 321 | //__________________________________________________________________________ |
6464217e | 322 | Double_t AliMUONTrackParam::Px() const |
b8dc484b | 323 | { |
22ccc301 | 324 | /// return p_x from track parameters |
b8dc484b | 325 | Double_t pYZ, pZ, pX; |
326 | pYZ = 0; | |
ea94c18b | 327 | if ( TMath::Abs(fParameters(4,0)) > 0 ) |
328 | pYZ = TMath::Abs(1.0 / fParameters(4,0)); | |
329 | pZ = -pYZ / (TMath::Sqrt(1.0 + fParameters(3,0) * fParameters(3,0))); // spectro. (z<0) | |
330 | pX = pZ * fParameters(1,0); | |
b8dc484b | 331 | return pX; |
332 | } | |
37827b29 | 333 | |
b8dc484b | 334 | //__________________________________________________________________________ |
6464217e | 335 | Double_t AliMUONTrackParam::Py() const |
b8dc484b | 336 | { |
22ccc301 | 337 | /// return p_y from track parameters |
b8dc484b | 338 | Double_t pYZ, pZ, pY; |
339 | pYZ = 0; | |
ea94c18b | 340 | if ( TMath::Abs(fParameters(4,0)) > 0 ) |
341 | pYZ = TMath::Abs(1.0 / fParameters(4,0)); | |
342 | pZ = -pYZ / (TMath::Sqrt(1.0 + fParameters(3,0) * fParameters(3,0))); // spectro. (z<0) | |
343 | pY = pZ * fParameters(3,0); | |
b8dc484b | 344 | return pY; |
345 | } | |
37827b29 | 346 | |
b8dc484b | 347 | //__________________________________________________________________________ |
6464217e | 348 | Double_t AliMUONTrackParam::Pz() const |
b8dc484b | 349 | { |
22ccc301 | 350 | /// return p_z from track parameters |
b8dc484b | 351 | Double_t pYZ, pZ; |
352 | pYZ = 0; | |
ea94c18b | 353 | if ( TMath::Abs(fParameters(4,0)) > 0 ) |
354 | pYZ = TMath::Abs(1.0 / fParameters(4,0)); | |
355 | pZ = -pYZ / (TMath::Sqrt(1.0 + fParameters(3,0) * fParameters(3,0))); // spectro. (z<0) | |
b8dc484b | 356 | return pZ; |
357 | } | |
37827b29 | 358 | |
b8dc484b | 359 | //__________________________________________________________________________ |
6464217e | 360 | Double_t AliMUONTrackParam::P() const |
b8dc484b | 361 | { |
22ccc301 | 362 | /// return p from track parameters |
b8dc484b | 363 | Double_t pYZ, pZ, p; |
364 | pYZ = 0; | |
ea94c18b | 365 | if ( TMath::Abs(fParameters(4,0)) > 0 ) |
366 | pYZ = TMath::Abs(1.0 / fParameters(4,0)); | |
367 | pZ = -pYZ / (TMath::Sqrt(1.0 + fParameters(3,0) * fParameters(3,0))); // spectro. (z<0) | |
b8dc484b | 368 | p = TMath::Abs(pZ) * |
ea94c18b | 369 | TMath::Sqrt(1.0 + fParameters(3,0) * fParameters(3,0) + fParameters(1,0) * fParameters(1,0)); |
b8dc484b | 370 | return p; |
371 | ||
b45fd22b | 372 | } |
4d03a78e | 373 | |
208f139e | 374 | //__________________________________________________________________________ |
ea94c18b | 375 | const TMatrixD& AliMUONTrackParam::GetCovariances() const |
208f139e | 376 | { |
377 | /// Return the covariance matrix (create it before if needed) | |
378 | if (!fCovariances) { | |
379 | fCovariances = new TMatrixD(5,5); | |
ea94c18b | 380 | fCovariances->Zero(); |
208f139e | 381 | } |
ea94c18b | 382 | return *fCovariances; |
383 | } | |
208f139e | 384 | |
385 | //__________________________________________________________________________ | |
ea94c18b | 386 | void AliMUONTrackParam::SetCovariances(const TMatrixD& covariances) |
208f139e | 387 | { |
388 | /// Set the covariance matrix | |
ea94c18b | 389 | if (fCovariances) *fCovariances = covariances; |
390 | else fCovariances = new TMatrixD(covariances); | |
208f139e | 391 | } |
392 | ||
393 | //__________________________________________________________________________ | |
ea94c18b | 394 | void AliMUONTrackParam::SetCovariances(const Double_t matrix[5][5]) |
208f139e | 395 | { |
396 | /// Set the covariance matrix | |
397 | if (fCovariances) fCovariances->SetMatrixArray(&(matrix[0][0])); | |
398 | else fCovariances = new TMatrixD(5,5,&(matrix[0][0])); | |
399 | } | |
400 | ||
401 | //__________________________________________________________________________ | |
ea94c18b | 402 | void AliMUONTrackParam::SetVariances(const Double_t matrix[5][5]) |
208f139e | 403 | { |
404 | /// Set the diagonal terms of the covariance matrix (variances) | |
405 | if (!fCovariances) fCovariances = new TMatrixD(5,5); | |
ea94c18b | 406 | fCovariances->Zero(); |
208f139e | 407 | for (Int_t i=0; i<5; i++) (*fCovariances)(i,i) = matrix[i][i]; |
408 | } | |
409 | ||
410 | //__________________________________________________________________________ | |
411 | void AliMUONTrackParam::DeleteCovariances() | |
412 | { | |
413 | /// Delete the covariance matrix | |
686772dc | 414 | delete fCovariances; |
208f139e | 415 | fCovariances = 0x0; |
416 | } | |
417 | ||
418 | //__________________________________________________________________________ | |
ea94c18b | 419 | const TMatrixD& AliMUONTrackParam::GetPropagator() const |
208f139e | 420 | { |
ea94c18b | 421 | /// Return the propagator (create it before if needed) |
422 | if (!fPropagator) { | |
423 | fPropagator = new TMatrixD(5,5); | |
019df241 | 424 | fPropagator->UnitMatrix(); |
208f139e | 425 | } |
ea94c18b | 426 | return *fPropagator; |
96ebe67e | 427 | } |
ea94c18b | 428 | |
429 | //__________________________________________________________________________ | |
430 | void AliMUONTrackParam::ResetPropagator() | |
431 | { | |
432 | /// Reset the propagator | |
019df241 | 433 | if (fPropagator) fPropagator->UnitMatrix(); |
ea94c18b | 434 | } |
435 | ||
436 | //__________________________________________________________________________ | |
437 | void AliMUONTrackParam::UpdatePropagator(const TMatrixD& propagator) | |
438 | { | |
439 | /// Update the propagator | |
ea94c18b | 440 | if (fPropagator) *fPropagator = TMatrixD(propagator,TMatrixD::kMult,*fPropagator); |
441 | else fPropagator = new TMatrixD(propagator); | |
442 | } | |
443 | ||
444 | //__________________________________________________________________________ | |
445 | const TMatrixD& AliMUONTrackParam::GetExtrapParameters() const | |
446 | { | |
447 | /// Return extrapolated parameters (create it before if needed) | |
448 | if (!fExtrapParameters) { | |
449 | fExtrapParameters = new TMatrixD(5,1); | |
450 | fExtrapParameters->Zero(); | |
451 | } | |
452 | return *fExtrapParameters; | |
453 | } | |
454 | ||
455 | //__________________________________________________________________________ | |
456 | void AliMUONTrackParam::SetExtrapParameters(const TMatrixD& extrapParameters) | |
457 | { | |
458 | /// Set extrapolated parameters | |
ea94c18b | 459 | if (fExtrapParameters) *fExtrapParameters = extrapParameters; |
460 | else fExtrapParameters = new TMatrixD(extrapParameters); | |
461 | } | |
462 | ||
463 | //__________________________________________________________________________ | |
464 | const TMatrixD& AliMUONTrackParam::GetExtrapCovariances() const | |
465 | { | |
466 | /// Return the extrapolated covariance matrix (create it before if needed) | |
467 | if (!fExtrapCovariances) { | |
468 | fExtrapCovariances = new TMatrixD(5,5); | |
469 | fExtrapCovariances->Zero(); | |
470 | } | |
471 | return *fExtrapCovariances; | |
472 | } | |
473 | ||
474 | //__________________________________________________________________________ | |
475 | void AliMUONTrackParam::SetExtrapCovariances(const TMatrixD& extrapCovariances) | |
476 | { | |
477 | /// Set the extrapolated covariance matrix | |
ea94c18b | 478 | if (fExtrapCovariances) *fExtrapCovariances = extrapCovariances; |
479 | else fExtrapCovariances = new TMatrixD(extrapCovariances); | |
480 | } | |
481 | ||
482 | //__________________________________________________________________________ | |
483 | const TMatrixD& AliMUONTrackParam::GetSmoothParameters() const | |
484 | { | |
485 | /// Return the smoothed parameters (create it before if needed) | |
486 | if (!fSmoothParameters) { | |
487 | fSmoothParameters = new TMatrixD(5,1); | |
488 | fSmoothParameters->Zero(); | |
489 | } | |
490 | return *fSmoothParameters; | |
491 | } | |
492 | ||
493 | //__________________________________________________________________________ | |
494 | void AliMUONTrackParam::SetSmoothParameters(const TMatrixD& smoothParameters) | |
495 | { | |
496 | /// Set the smoothed parameters | |
ea94c18b | 497 | if (fSmoothParameters) *fSmoothParameters = smoothParameters; |
498 | else fSmoothParameters = new TMatrixD(smoothParameters); | |
499 | } | |
500 | ||
501 | //__________________________________________________________________________ | |
502 | const TMatrixD& AliMUONTrackParam::GetSmoothCovariances() const | |
503 | { | |
504 | /// Return the smoothed covariance matrix (create it before if needed) | |
505 | if (!fSmoothCovariances) { | |
506 | fSmoothCovariances = new TMatrixD(5,5); | |
507 | fSmoothCovariances->Zero(); | |
508 | } | |
509 | return *fSmoothCovariances; | |
510 | } | |
511 | ||
512 | //__________________________________________________________________________ | |
513 | void AliMUONTrackParam::SetSmoothCovariances(const TMatrixD& smoothCovariances) | |
514 | { | |
515 | /// Set the smoothed covariance matrix | |
ea94c18b | 516 | if (fSmoothCovariances) *fSmoothCovariances = smoothCovariances; |
517 | else fSmoothCovariances = new TMatrixD(smoothCovariances); | |
208f139e | 518 | } |
519 | ||
7d98b674 | 520 | //__________________________________________________________________________ |
521 | void AliMUONTrackParam::SetClusterPtr(AliMUONVCluster* cluster, Bool_t owner) | |
522 | { | |
523 | /// set pointeur to associated cluster | |
524 | if (fOwnCluster) delete fClusterPtr; | |
525 | fClusterPtr = cluster; | |
526 | fOwnCluster = owner; | |
527 | } | |
528 | ||
208f139e | 529 | //__________________________________________________________________________ |
530 | Int_t AliMUONTrackParam::Compare(const TObject* trackParam) const | |
531 | { | |
532 | /// "Compare" function to sort with decreasing Z (spectro. muon Z <0). | |
96ebe67e | 533 | /// Returns 1 (0, -1) if the current Z |
534 | /// is smaller than (equal to, larger than) Z of trackParam | |
847cbaef | 535 | if (fZ < ((AliMUONTrackParam*)trackParam)->GetZ()) return(1); |
536 | else if (fZ == ((AliMUONTrackParam*)trackParam)->GetZ()) return(0); | |
208f139e | 537 | else return(-1); |
538 | } | |
539 | ||
61fed964 | 540 | //__________________________________________________________________________ |
541 | Bool_t AliMUONTrackParam::CompatibleTrackParam(const AliMUONTrackParam &trackParam, Double_t sigma2Cut, Double_t &chi2) const | |
542 | { | |
543 | /// Return kTRUE if the two set of track parameters are compatible within sigma2Cut | |
544 | /// Set chi2 to the compatible chi2 value | |
545 | /// Note that parameter covariances must exist for at least one set of parameters | |
546 | /// Note also that if parameters are not given at the same Z, results will be meaningless | |
547 | ||
548 | // reset chi2 value | |
549 | chi2 = 0.; | |
550 | ||
551 | // ckeck covariance matrices | |
552 | if (!fCovariances && !trackParam.fCovariances) { | |
553 | AliError("Covariance matrix must exist for at least one set of parameters"); | |
554 | return kFALSE; | |
555 | } | |
556 | ||
557 | Double_t maxChi2 = 5. * sigma2Cut * sigma2Cut; // 5 degrees of freedom | |
558 | ||
559 | // check Z parameters | |
560 | if (fZ != trackParam.fZ) | |
561 | AliWarning(Form("Parameters are given at different Z position (%le : %le): results are meaningless", fZ, trackParam.fZ)); | |
562 | ||
563 | // compute the parameter residuals | |
564 | TMatrixD deltaParam(fParameters, TMatrixD::kMinus, trackParam.fParameters); | |
565 | ||
566 | // build the error matrix | |
567 | TMatrixD weight(5,5); | |
568 | if (fCovariances) weight += *fCovariances; | |
569 | if (trackParam.fCovariances) weight += *(trackParam.fCovariances); | |
570 | ||
571 | // invert the error matrix to get the parameter weights if possible | |
572 | if (weight.Determinant() == 0) { | |
573 | AliError("Cannot compute the compatibility chi2"); | |
574 | return kFALSE; | |
575 | } | |
576 | weight.Invert(); | |
577 | ||
578 | // compute the compatibility chi2 | |
579 | TMatrixD tmp(deltaParam, TMatrixD::kTransposeMult, weight); | |
580 | TMatrixD mChi2(tmp, TMatrixD::kMult, deltaParam); | |
581 | ||
582 | // set chi2 value | |
583 | chi2 = mChi2(0,0); | |
584 | ||
585 | // check compatibility | |
586 | if (chi2 > maxChi2) return kFALSE; | |
587 | ||
588 | return kTRUE; | |
589 | } | |
590 | ||
591 | //__________________________________________________________________________ | |
6464217e | 592 | void AliMUONTrackParam::Print(Option_t* opt) const |
593 | { | |
2457f726 | 594 | /// Printing TrackParam information |
595 | /// "full" option for printing all the information about the TrackParam | |
6464217e | 596 | TString sopt(opt); |
597 | sopt.ToUpper(); | |
598 | ||
599 | if ( sopt.Contains("FULL") ) { | |
ea94c18b | 600 | cout << "<AliMUONTrackParam> Bending P=" << setw(5) << setprecision(3) << 1./fParameters(4,0) << |
601 | ", NonBendSlope=" << setw(5) << setprecision(3) << fParameters(1,0)*180./TMath::Pi() << | |
602 | ", BendSlope=" << setw(5) << setprecision(3) << fParameters(3,0)*180./TMath::Pi() << | |
603 | ", (x,y,z)_IP=(" << setw(5) << setprecision(3) << fParameters(0,0) << | |
604 | "," << setw(5) << setprecision(3) << fParameters(2,0) << | |
605 | "," << setw(5) << setprecision(3) << fZ << | |
6464217e | 606 | ") cm, (px,py,pz)=(" << setw(5) << setprecision(3) << Px() << |
607 | "," << setw(5) << setprecision(3) << Py() << | |
608 | "," << setw(5) << setprecision(3) << Pz() << ") GeV/c" << endl; | |
609 | } | |
610 | else { | |
611 | cout << "<AliMUONTrackParam>" << endl; | |
612 | } | |
613 | ||
614 | } |