1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
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
26 ///////////////////////////////////////////////////////////////////////////////
28 #include "AliESDMuonTrack.h"
30 #include <TLorentzVector.h>
33 ClassImp(AliESDMuonTrack)
35 //_____________________________________________________________________________
36 AliESDMuonTrack::AliESDMuonTrack ():
38 fInverseBendingMomentum(0),
44 fInverseBendingMomentumUncorrected(0),
45 fThetaXUncorrected(0),
46 fThetaYUncorrected(0),
48 fBendingCoorUncorrected(0),
49 fNonBendingCoorUncorrected(0),
54 fHitsPatternInTrigCh(0),
58 // Default constructor
60 for (Int_t i = 0; i < 15; i++) fCovariances[i] = 0;
64 //_____________________________________________________________________________
65 AliESDMuonTrack::AliESDMuonTrack (const AliESDMuonTrack& MUONTrack):
66 AliVParticle(MUONTrack),
67 fInverseBendingMomentum(MUONTrack.fInverseBendingMomentum),
68 fThetaX(MUONTrack.fThetaX),
69 fThetaY(MUONTrack.fThetaY),
71 fBendingCoor(MUONTrack.fBendingCoor),
72 fNonBendingCoor(MUONTrack.fNonBendingCoor),
73 fInverseBendingMomentumUncorrected(MUONTrack.fInverseBendingMomentumUncorrected),
74 fThetaXUncorrected(MUONTrack.fThetaXUncorrected),
75 fThetaYUncorrected(MUONTrack.fThetaYUncorrected),
76 fZUncorrected(MUONTrack.fZUncorrected),
77 fBendingCoorUncorrected(MUONTrack.fBendingCoorUncorrected),
78 fNonBendingCoorUncorrected(MUONTrack.fNonBendingCoorUncorrected),
79 fChi2(MUONTrack.fChi2),
80 fChi2MatchTrigger(MUONTrack.fChi2MatchTrigger),
81 fLocalTrigger(MUONTrack.fLocalTrigger),
82 fMuonClusterMap(MUONTrack.fMuonClusterMap),
83 fHitsPatternInTrigCh(MUONTrack.fHitsPatternInTrigCh),
84 fNHit(MUONTrack.fNHit)
88 // Deep copy implemented
90 for (Int_t i = 0; i < 15; i++) fCovariances[i] = MUONTrack.fCovariances[i];
93 //_____________________________________________________________________________
94 AliESDMuonTrack& AliESDMuonTrack::operator=(const AliESDMuonTrack& MUONTrack)
97 // Equal operator for a deep copy
99 if (this == &MUONTrack)
102 AliVParticle::operator=(MUONTrack); // don't forget to invoke the base class' assignment operator
104 fInverseBendingMomentum = MUONTrack.fInverseBendingMomentum;
105 fThetaX = MUONTrack.fThetaX;
106 fThetaY = MUONTrack.fThetaY;
108 fBendingCoor = MUONTrack.fBendingCoor;
109 fNonBendingCoor = MUONTrack.fNonBendingCoor;
111 fInverseBendingMomentumUncorrected = MUONTrack.fInverseBendingMomentumUncorrected;
112 fThetaXUncorrected = MUONTrack.fThetaXUncorrected;
113 fThetaYUncorrected = MUONTrack.fThetaYUncorrected;
114 fZUncorrected = MUONTrack.fZUncorrected;
115 fBendingCoorUncorrected = MUONTrack.fBendingCoorUncorrected;
116 fNonBendingCoorUncorrected = MUONTrack.fNonBendingCoorUncorrected;
118 for (Int_t i = 0; i < 15; i++) fCovariances[i] = MUONTrack.fCovariances[i];
120 fChi2 = MUONTrack.fChi2;
121 fNHit = MUONTrack.fNHit;
123 fLocalTrigger = MUONTrack.fLocalTrigger;
124 fChi2MatchTrigger = MUONTrack.fChi2MatchTrigger;
126 fHitsPatternInTrigCh = MUONTrack.fHitsPatternInTrigCh;
128 fMuonClusterMap = MUONTrack.fMuonClusterMap;
133 //_____________________________________________________________________________
134 void AliESDMuonTrack::GetCovariances(TMatrixD& cov) const
136 // return covariance matrix of uncorrected parameters
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];
143 //_____________________________________________________________________________
144 void AliESDMuonTrack::SetCovariances(const TMatrixD& cov)
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);
153 //_____________________________________________________________________________
154 void AliESDMuonTrack::GetCovarianceXYZPxPyPz(Double_t cov[21]) const
156 // return reduced covariance matrix of uncorrected parameters in (X,Y,Z,Px,Py,Pz) coordinate system
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]
165 // Get ESD covariance matrix into a TMatrixD
166 TMatrixD covESD(5,5);
167 GetCovariances(covESD);
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;
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;
191 // compute covariance matrix in AOD coordinate system
192 TMatrixD tmp(covESD,TMatrixD::kMultTranspose,jacob);
193 TMatrixD covAOD(jacob,TMatrixD::kMult,tmp);
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);
202 //_____________________________________________________________________________
203 Double_t AliESDMuonTrack::Px() const
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;
213 //_____________________________________________________________________________
214 Double_t AliESDMuonTrack::Py() const
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;
223 //_____________________________________________________________________________
224 Double_t AliESDMuonTrack::Pz() const
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)
232 //_____________________________________________________________________________
233 Double_t AliESDMuonTrack::P() const
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);
243 //_____________________________________________________________________________
244 void AliESDMuonTrack::LorentzP(TLorentzVector& vP) const
246 // return Lorentz momentum vector from track parameters
247 Double_t muonMass = M();
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);
258 //_____________________________________________________________________________
259 Double_t AliESDMuonTrack::PxUncorrected() const
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;
269 //_____________________________________________________________________________
270 Double_t AliESDMuonTrack::PyUncorrected() const
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;
279 //_____________________________________________________________________________
280 Double_t AliESDMuonTrack::PzUncorrected() const
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)
288 //_____________________________________________________________________________
289 Double_t AliESDMuonTrack::PUncorrected() const
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);
299 //_____________________________________________________________________________
300 void AliESDMuonTrack::LorentzPUncorrected(TLorentzVector& vP) const
302 // return Lorentz momentum vector from track parameters
303 Double_t muonMass = M();
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);
314 //_____________________________________________________________________________
315 Int_t AliESDMuonTrack::GetMatchTrigger() const
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
323 if (LoCircuit() == -1) {
325 } else if (LoLpt() == 0 && LoHpt() == 0) {
327 } else if (LoLpt() > 0 && LoHpt() == 0) {
335 //_____________________________________________________________________________
336 void AliESDMuonTrack::AddInMuonClusterMap(Int_t chamber)
338 // Update the muon cluster map by adding this chamber(0..)
340 static const UInt_t kMask[10] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200};
342 fMuonClusterMap |= kMask[chamber];
346 //_____________________________________________________________________________
347 Bool_t AliESDMuonTrack::IsInMuonClusterMap(Int_t chamber) const
349 // return kTRUE if this chamber(0..) is in the muon cluster map
351 static const UInt_t kMask[10] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200};
353 return ((fMuonClusterMap | kMask[chamber]) == fMuonClusterMap) ? kTRUE : kFALSE;