]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliESDMuonTrack.cxx
Updated vertex diamond (from v4-06-Release)
[u/mrichter/AliRoot.git] / STEER / AliESDMuonTrack.cxx
CommitLineData
af7ba10c 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// Class to describe the MUON tracks
21// in the Event Summary Data class
22// This is where the results of reconstruction
23// are stored for the muons
24// Author: G.Martinez
25//
26///////////////////////////////////////////////////////////////////////////////
27
672b5f43 28#include "AliESDMuonTrack.h"
29
39b8d0dd 30#include <TLorentzVector.h>
31#include <TMath.h>
32
af7ba10c 33ClassImp(AliESDMuonTrack)
34
90e48c0c 35//_____________________________________________________________________________
36AliESDMuonTrack::AliESDMuonTrack ():
ad85871a 37 AliVParticle(),
90e48c0c 38 fInverseBendingMomentum(0),
39 fThetaX(0),
40 fThetaY(0),
41 fZ(0),
42 fBendingCoor(0),
43 fNonBendingCoor(0),
39b8d0dd 44 fInverseBendingMomentumUncorrected(0),
45 fThetaXUncorrected(0),
46 fThetaYUncorrected(0),
47 fZUncorrected(0),
48 fBendingCoorUncorrected(0),
49 fNonBendingCoorUncorrected(0),
90e48c0c 50 fChi2(0),
fbc3395d 51 fChi2MatchTrigger(0),
4f036e6e 52 fLocalTrigger(234),
53 fMuonClusterMap(0),
60765b06 54 fHitsPatternInTrigCh(0),
4f036e6e 55 fNHit(0)
90e48c0c 56{
60765b06 57 //
90e48c0c 58 // Default constructor
60765b06 59 //
60 for (Int_t i = 0; i < 15; i++) fCovariances[i] = 0;
90e48c0c 61}
62
63
af7ba10c 64//_____________________________________________________________________________
65AliESDMuonTrack::AliESDMuonTrack (const AliESDMuonTrack& MUONTrack):
ad85871a 66 AliVParticle(MUONTrack),
90e48c0c 67 fInverseBendingMomentum(MUONTrack.fInverseBendingMomentum),
68 fThetaX(MUONTrack.fThetaX),
69 fThetaY(MUONTrack.fThetaY),
70 fZ(MUONTrack.fZ),
71 fBendingCoor(MUONTrack.fBendingCoor),
72 fNonBendingCoor(MUONTrack.fNonBendingCoor),
39b8d0dd 73 fInverseBendingMomentumUncorrected(MUONTrack.fInverseBendingMomentumUncorrected),
74 fThetaXUncorrected(MUONTrack.fThetaXUncorrected),
75 fThetaYUncorrected(MUONTrack.fThetaYUncorrected),
76 fZUncorrected(MUONTrack.fZUncorrected),
77 fBendingCoorUncorrected(MUONTrack.fBendingCoorUncorrected),
78 fNonBendingCoorUncorrected(MUONTrack.fNonBendingCoorUncorrected),
90e48c0c 79 fChi2(MUONTrack.fChi2),
fbc3395d 80 fChi2MatchTrigger(MUONTrack.fChi2MatchTrigger),
4f036e6e 81 fLocalTrigger(MUONTrack.fLocalTrigger),
82 fMuonClusterMap(MUONTrack.fMuonClusterMap),
60765b06 83 fHitsPatternInTrigCh(MUONTrack.fHitsPatternInTrigCh),
4f036e6e 84 fNHit(MUONTrack.fNHit)
5ec1b3bc 85{
af7ba10c 86 //
87 // Copy constructor
88 // Deep copy implemented
89 //
60765b06 90 for (Int_t i = 0; i < 15; i++) fCovariances[i] = MUONTrack.fCovariances[i];
5ec1b3bc 91}
92
af7ba10c 93//_____________________________________________________________________________
5ec1b3bc 94AliESDMuonTrack& AliESDMuonTrack::operator=(const AliESDMuonTrack& MUONTrack)
95{
af7ba10c 96 //
97 // Equal operator for a deep copy
98 //
5ec1b3bc 99 if (this == &MUONTrack)
100 return *this;
101
ad85871a 102 AliVParticle::operator=(MUONTrack); // don't forget to invoke the base class' assignment operator
103
5ec1b3bc 104 fInverseBendingMomentum = MUONTrack.fInverseBendingMomentum;
8252d536 105 fThetaX = MUONTrack.fThetaX;
39b8d0dd 106 fThetaY = MUONTrack.fThetaY;
8252d536 107 fZ = MUONTrack.fZ;
108 fBendingCoor = MUONTrack.fBendingCoor;
109 fNonBendingCoor = MUONTrack.fNonBendingCoor;
39b8d0dd 110
111 fInverseBendingMomentumUncorrected = MUONTrack.fInverseBendingMomentumUncorrected;
112 fThetaXUncorrected = MUONTrack.fThetaXUncorrected;
113 fThetaYUncorrected = MUONTrack.fThetaYUncorrected;
114 fZUncorrected = MUONTrack.fZUncorrected;
115 fBendingCoorUncorrected = MUONTrack.fBendingCoorUncorrected;
116 fNonBendingCoorUncorrected = MUONTrack.fNonBendingCoorUncorrected;
117
60765b06 118 for (Int_t i = 0; i < 15; i++) fCovariances[i] = MUONTrack.fCovariances[i];
119
8252d536 120 fChi2 = MUONTrack.fChi2;
39b8d0dd 121 fNHit = MUONTrack.fNHit;
8252d536 122
423b32ca 123 fLocalTrigger = MUONTrack.fLocalTrigger;
8252d536 124 fChi2MatchTrigger = MUONTrack.fChi2MatchTrigger;
fbc3395d 125
126 fHitsPatternInTrigCh = MUONTrack.fHitsPatternInTrigCh;
8252d536 127
60765b06 128 fMuonClusterMap = MUONTrack.fMuonClusterMap;
129
5ec1b3bc 130 return *this;
131}
132
60765b06 133//_____________________________________________________________________________
134void AliESDMuonTrack::GetCovariances(TMatrixD& cov) const
135{
136 // return covariance matrix of uncorrected parameters
137 cov.ResizeTo(5,5);
138 for (Int_t i = 0; i < 5; i++)
139 for (Int_t j = 0; j <= i; j++)
140 cov(i,j) = cov (j,i) = fCovariances[i*(i+1)/2 + j];
141}
142
143//_____________________________________________________________________________
144void AliESDMuonTrack::SetCovariances(const TMatrixD& cov)
145{
146 // set reduced covariance matrix of uncorrected parameters
147 for (Int_t i = 0; i < 5; i++)
148 for (Int_t j = 0; j <= i; j++)
149 fCovariances[i*(i+1)/2 + j] = cov(i,j);
150
151}
152
153//_____________________________________________________________________________
154void AliESDMuonTrack::GetCovarianceXYZPxPyPz(Double_t cov[21]) const
155{
156 // return reduced covariance matrix of uncorrected parameters in (X,Y,Z,Px,Py,Pz) coordinate system
157 //
158 // Cov(x,x) ... : cov[0]
159 // Cov(y,x) ... : cov[1] cov[2]
160 // Cov(z,x) ... : cov[3] cov[4] cov[5]
161 // Cov(px,x)... : cov[6] cov[7] cov[8] cov[9]
162 // Cov(py,x)... : cov[10] cov[11] cov[12] cov[13] cov[14]
163 // Cov(pz,x)... : cov[15] cov[16] cov[17] cov[18] cov[19] cov[20]
164 //
165 // Get ESD covariance matrix into a TMatrixD
166 TMatrixD covESD(5,5);
167 GetCovariances(covESD);
168
169 // compute Jacobian to change the coordinate system
170 // from (X,thetaX,Y,thetaY,c/pYZ) to (X,Y,Z,pX,pY,pZ)
171 Double_t tanThetaX = TMath::Tan(fThetaXUncorrected);
172 Double_t tanThetaY = TMath::Tan(fThetaYUncorrected);
173 Double_t cosThetaX2 = TMath::Cos(fThetaXUncorrected) * TMath::Cos(fThetaXUncorrected);
174 Double_t cosThetaY2 = TMath::Cos(fThetaYUncorrected) * TMath::Cos(fThetaYUncorrected);
175 Double_t pZ = PzUncorrected();
176 Double_t dpZdthetaY = - fInverseBendingMomentumUncorrected * fInverseBendingMomentumUncorrected *
177 pZ * pZ * pZ * tanThetaY / cosThetaY2;
178 Double_t dpZdinvpYZ = - pZ / fInverseBendingMomentumUncorrected;
179 TMatrixD jacob(6,5);
180 jacob.Zero();
181 jacob(0,0) = 1.;
182 jacob(1,2) = 1.;
183 jacob(3,1) = pZ / cosThetaX2;
184 jacob(3,3) = dpZdthetaY * tanThetaX;
185 jacob(3,4) = dpZdinvpYZ * tanThetaX;
186 jacob(4,3) = dpZdthetaY * tanThetaY + pZ / cosThetaY2;
187 jacob(4,4) = dpZdinvpYZ * tanThetaY;
188 jacob(5,3) = dpZdthetaY;
189 jacob(5,4) = dpZdinvpYZ;
190
191 // compute covariance matrix in AOD coordinate system
192 TMatrixD tmp(covESD,TMatrixD::kMultTranspose,jacob);
193 TMatrixD covAOD(jacob,TMatrixD::kMult,tmp);
194
195 // Get AOD covariance matrix into co[21]
196 for (Int_t i = 0; i < 6; i++)
197 for (Int_t j = 0; j <= i; j++)
198 cov[i*(i+1)/2 + j] = covAOD(i,j);
199
200}
201
39b8d0dd 202//_____________________________________________________________________________
203Double_t AliESDMuonTrack::Px() const
204{
205 // return p_x from track parameters
206 Double_t nonBendingSlope = TMath::Tan(fThetaX);
207 Double_t bendingSlope = TMath::Tan(fThetaY);
208 Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : 0.;
209 Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
210 return pZ * nonBendingSlope;
211}
212
213//_____________________________________________________________________________
214Double_t AliESDMuonTrack::Py() const
215{
216 // return p_y from track parameters
217 Double_t bendingSlope = TMath::Tan(fThetaY);
218 Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : 0.;
219 Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
220 return pZ * bendingSlope;
221}
222
223//_____________________________________________________________________________
224Double_t AliESDMuonTrack::Pz() const
225{
226 // return p_z from track parameters
227 Double_t bendingSlope = TMath::Tan(fThetaY);
228 Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : 0.;
229 return -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
230}
231
232//_____________________________________________________________________________
233Double_t AliESDMuonTrack::P() const
234{
235 // return p from track parameters
236 Double_t nonBendingSlope = TMath::Tan(fThetaX);
237 Double_t bendingSlope = TMath::Tan(fThetaY);
238 Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : 0.;
239 Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
240 return -pZ * TMath::Sqrt(1.0 + bendingSlope*bendingSlope + nonBendingSlope*nonBendingSlope);
241}
242
243//_____________________________________________________________________________
244void AliESDMuonTrack::LorentzP(TLorentzVector& vP) const
245{
246 // return Lorentz momentum vector from track parameters
60765b06 247 Double_t muonMass = M();
39b8d0dd 248 Double_t nonBendingSlope = TMath::Tan(fThetaX);
249 Double_t bendingSlope = TMath::Tan(fThetaY);
250 Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : 0.;
251 Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
252 Double_t pX = pZ * nonBendingSlope;
253 Double_t pY = pZ * bendingSlope;
254 Double_t e = TMath::Sqrt(muonMass*muonMass + pX*pX + pY*pY + pZ*pZ);
255 vP.SetPxPyPzE(pX, pY, pZ, e);
256}
257
258//_____________________________________________________________________________
259Double_t AliESDMuonTrack::PxUncorrected() const
260{
261 // return p_x from track parameters
262 Double_t nonBendingSlope = TMath::Tan(fThetaXUncorrected);
263 Double_t bendingSlope = TMath::Tan(fThetaYUncorrected);
264 Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : 0.;
265 Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
266 return pZ * nonBendingSlope;
267}
268
269//_____________________________________________________________________________
270Double_t AliESDMuonTrack::PyUncorrected() const
271{
272 // return p_y from track parameters
273 Double_t bendingSlope = TMath::Tan(fThetaYUncorrected);
274 Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : 0.;
275 Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
276 return pZ * bendingSlope;
277}
278
279//_____________________________________________________________________________
280Double_t AliESDMuonTrack::PzUncorrected() const
281{
282 // return p_z from track parameters
283 Double_t bendingSlope = TMath::Tan(fThetaYUncorrected);
284 Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : 0.;
285 return -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
286}
287
288//_____________________________________________________________________________
289Double_t AliESDMuonTrack::PUncorrected() const
290{
291 // return p from track parameters
292 Double_t nonBendingSlope = TMath::Tan(fThetaXUncorrected);
293 Double_t bendingSlope = TMath::Tan(fThetaYUncorrected);
294 Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : 0.;
295 Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
296 return -pZ * TMath::Sqrt(1.0 + bendingSlope*bendingSlope + nonBendingSlope*nonBendingSlope);
297}
298
299//_____________________________________________________________________________
300void AliESDMuonTrack::LorentzPUncorrected(TLorentzVector& vP) const
301{
302 // return Lorentz momentum vector from track parameters
60765b06 303 Double_t muonMass = M();
39b8d0dd 304 Double_t nonBendingSlope = TMath::Tan(fThetaXUncorrected);
305 Double_t bendingSlope = TMath::Tan(fThetaYUncorrected);
306 Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : 0.;
307 Double_t pZ = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope); // spectro. (z<0)
308 Double_t pX = pZ * nonBendingSlope;
309 Double_t pY = pZ * bendingSlope;
310 Double_t e = TMath::Sqrt(muonMass*muonMass + pX*pX + pY*pY + pZ*pZ);
311 vP.SetPxPyPzE(pX, pY, pZ, e);
312}
672b5f43 313
423b32ca 314//_____________________________________________________________________________
315Int_t AliESDMuonTrack::GetMatchTrigger() const
316{
317 // backward compatibility after replacing fMatchTrigger by fLocalTrigger
318 // 0 track does not match trigger
319 // 1 track match but does not pass pt cut
320 // 2 track match Low pt cut
321 // 3 track match High pt cut
322
323 if (LoCircuit() == -1) {
324 return 0;
325 } else if (LoLpt() == 0 && LoHpt() == 0) {
326 return 1;
327 } else if (LoLpt() > 0 && LoHpt() == 0) {
328 return 2;
329 } else {
330 return 3;
331 }
332
333}
334
60765b06 335//_____________________________________________________________________________
336void AliESDMuonTrack::AddInMuonClusterMap(Int_t chamber)
337{
338 // Update the muon cluster map by adding this chamber(0..)
339
340 static const UInt_t kMask[10] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200};
341
342 fMuonClusterMap |= kMask[chamber];
343
344}
345
346//_____________________________________________________________________________
347Bool_t AliESDMuonTrack::IsInMuonClusterMap(Int_t chamber) const
348{
349 // return kTRUE if this chamber(0..) is in the muon cluster map
350
351 static const UInt_t kMask[10] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200};
352
353 return ((fMuonClusterMap | kMask[chamber]) == fMuonClusterMap) ? kTRUE : kFALSE;
354
355}
356