]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDMuonTrack.cxx
Updates in GRP Preprocessor (Ernesto)
[u/mrichter/AliRoot.git] / STEER / AliESDMuonTrack.cxx
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
28 #include "AliESDMuonTrack.h"
29 #include "AliESDMuonCluster.h"
30
31 #include <TClonesArray.h>
32 #include <TLorentzVector.h>
33 #include <TMath.h>
34
35 ClassImp(AliESDMuonTrack)
36
37 //_____________________________________________________________________________
38 AliESDMuonTrack::AliESDMuonTrack ():
39   AliVParticle(),
40   fInverseBendingMomentum(0),
41   fThetaX(0),
42   fThetaY(0),
43   fZ(0),
44   fBendingCoor(0),
45   fNonBendingCoor(0),
46   fInverseBendingMomentumAtDCA(0),
47   fThetaXAtDCA(0),
48   fThetaYAtDCA(0),
49   fBendingCoorAtDCA(0),
50   fNonBendingCoorAtDCA(0),
51   fInverseBendingMomentumUncorrected(0),
52   fThetaXUncorrected(0),
53   fThetaYUncorrected(0),
54   fZUncorrected(0),
55   fBendingCoorUncorrected(0),
56   fNonBendingCoorUncorrected(0),
57   fChi2(0),
58   fChi2MatchTrigger(0),
59   fLocalTrigger(0),
60   fX1Pattern(0),
61   fY1Pattern(0),
62   fX2Pattern(0),
63   fY2Pattern(0),
64   fX3Pattern(0),
65   fY3Pattern(0),
66   fX4Pattern(0),
67   fY4Pattern(0),
68   fMuonClusterMap(0),
69   fHitsPatternInTrigCh(0),
70   fNHit(0),
71   fClusters(0x0)
72 {
73   //
74   // Default constructor
75   //
76   for (Int_t i = 0; i < 15; i++) fCovariances[i] = 0;
77 }
78
79
80 //_____________________________________________________________________________
81 AliESDMuonTrack::AliESDMuonTrack (const AliESDMuonTrack& muonTrack):
82   AliVParticle(muonTrack),
83   fInverseBendingMomentum(muonTrack.fInverseBendingMomentum),
84   fThetaX(muonTrack.fThetaX),
85   fThetaY(muonTrack.fThetaY),
86   fZ(muonTrack.fZ),
87   fBendingCoor(muonTrack.fBendingCoor),
88   fNonBendingCoor(muonTrack.fNonBendingCoor),
89   fInverseBendingMomentumAtDCA(muonTrack.fInverseBendingMomentumAtDCA),
90   fThetaXAtDCA(muonTrack.fThetaXAtDCA),
91   fThetaYAtDCA(muonTrack.fThetaYAtDCA),
92   fBendingCoorAtDCA(muonTrack.fBendingCoorAtDCA),
93   fNonBendingCoorAtDCA(muonTrack.fNonBendingCoorAtDCA),
94   fInverseBendingMomentumUncorrected(muonTrack.fInverseBendingMomentumUncorrected),
95   fThetaXUncorrected(muonTrack.fThetaXUncorrected),
96   fThetaYUncorrected(muonTrack.fThetaYUncorrected),
97   fZUncorrected(muonTrack.fZUncorrected),
98   fBendingCoorUncorrected(muonTrack.fBendingCoorUncorrected),
99   fNonBendingCoorUncorrected(muonTrack.fNonBendingCoorUncorrected),
100   fChi2(muonTrack.fChi2),
101   fChi2MatchTrigger(muonTrack.fChi2MatchTrigger),
102   fLocalTrigger(muonTrack.fLocalTrigger),
103   fX1Pattern(muonTrack.fX1Pattern),
104   fY1Pattern(muonTrack.fY1Pattern),
105   fX2Pattern(muonTrack.fX2Pattern),
106   fY2Pattern(muonTrack.fY2Pattern),
107   fX3Pattern(muonTrack.fX3Pattern),
108   fY3Pattern(muonTrack.fY3Pattern),
109   fX4Pattern(muonTrack.fX4Pattern),
110   fY4Pattern(muonTrack.fY4Pattern),
111   fMuonClusterMap(muonTrack.fMuonClusterMap),
112   fHitsPatternInTrigCh(muonTrack.fHitsPatternInTrigCh),
113   fNHit(muonTrack.fNHit),
114   fClusters(0x0)
115 {
116   //
117   // Copy constructor
118   // Deep copy implemented
119   //
120   for (Int_t i = 0; i < 15; i++) fCovariances[i] = muonTrack.fCovariances[i];
121   
122   // necessary to make a copy of the objects and not only the pointers in TClonesArray
123   if (muonTrack.fClusters) {
124     fClusters = new TClonesArray("AliESDMuonCluster",muonTrack.fClusters->GetEntriesFast());
125     AliESDMuonCluster *cluster = (AliESDMuonCluster*) muonTrack.fClusters->First();
126     while (cluster) {
127       new ((*fClusters)[fClusters->GetEntriesFast()]) AliESDMuonCluster(*cluster);
128       cluster = (AliESDMuonCluster*) muonTrack.fClusters->After(cluster);
129     }
130   }
131 }
132
133 //_____________________________________________________________________________
134 AliESDMuonTrack& AliESDMuonTrack::operator=(const AliESDMuonTrack& muonTrack)
135 {
136   // 
137   // Equal operator for a deep copy
138   //
139   if (this == &muonTrack)
140     return *this;
141
142   AliVParticle::operator=(muonTrack); // don't forget to invoke the base class' assignment operator
143   
144   fInverseBendingMomentum = muonTrack.fInverseBendingMomentum; 
145   fThetaX                 = muonTrack.fThetaX;           
146   fThetaY                 = muonTrack.fThetaY;           
147   fZ                      = muonTrack.fZ;                
148   fBendingCoor            = muonTrack.fBendingCoor;      
149   fNonBendingCoor         = muonTrack.fNonBendingCoor;   
150   
151   fInverseBendingMomentumAtDCA = muonTrack.fInverseBendingMomentumAtDCA; 
152   fThetaXAtDCA                 = muonTrack.fThetaXAtDCA;           
153   fThetaYAtDCA                 = muonTrack.fThetaYAtDCA;           
154   fBendingCoorAtDCA            = muonTrack.fBendingCoorAtDCA;      
155   fNonBendingCoorAtDCA         = muonTrack.fNonBendingCoorAtDCA;   
156   
157   fInverseBendingMomentumUncorrected = muonTrack.fInverseBendingMomentumUncorrected; 
158   fThetaXUncorrected                 = muonTrack.fThetaXUncorrected;           
159   fThetaYUncorrected                 = muonTrack.fThetaYUncorrected;           
160   fZUncorrected                      = muonTrack.fZUncorrected;                
161   fBendingCoorUncorrected            = muonTrack.fBendingCoorUncorrected;      
162   fNonBendingCoorUncorrected         = muonTrack.fNonBendingCoorUncorrected;   
163   
164   for (Int_t i = 0; i < 15; i++) fCovariances[i] = muonTrack.fCovariances[i];
165   
166   fChi2                   = muonTrack.fChi2;             
167   fNHit                   = muonTrack.fNHit; 
168
169   fLocalTrigger           = muonTrack.fLocalTrigger;  
170   fX1Pattern              = muonTrack.fX1Pattern;  
171   fY1Pattern              = muonTrack.fY1Pattern;  
172   fX2Pattern              = muonTrack.fX2Pattern;  
173   fY2Pattern              = muonTrack.fY2Pattern;  
174   fX3Pattern              = muonTrack.fX3Pattern;  
175   fY3Pattern              = muonTrack.fY3Pattern;  
176   fX4Pattern              = muonTrack.fX4Pattern;  
177   fY4Pattern              = muonTrack.fY4Pattern;  
178   fChi2MatchTrigger       = muonTrack.fChi2MatchTrigger; 
179
180   fHitsPatternInTrigCh    = muonTrack.fHitsPatternInTrigCh;
181  
182   fMuonClusterMap         = muonTrack.fMuonClusterMap;
183   
184   // necessary to make a copy of the objects and not only the pointers in TClonesArray
185   delete fClusters;
186   if (muonTrack.fClusters) {
187     fClusters = new TClonesArray("AliESDMuonCluster",muonTrack.fClusters->GetEntriesFast());
188     AliESDMuonCluster *cluster = (AliESDMuonCluster*) muonTrack.fClusters->First();
189     while (cluster) {
190       new ((*fClusters)[fClusters->GetEntriesFast()]) AliESDMuonCluster(*cluster);
191       cluster = (AliESDMuonCluster*) muonTrack.fClusters->After(cluster);
192     }
193   } else fClusters = 0x0;
194   
195   return *this;
196 }
197
198 //__________________________________________________________________________
199 AliESDMuonTrack::~AliESDMuonTrack()
200 {
201   /// Destructor
202   delete fClusters;
203 }
204
205 //__________________________________________________________________________
206 void AliESDMuonTrack::Clear(Option_t* opt)
207 {
208   /// Clear arrays
209   if (fClusters) fClusters->Clear(opt);
210 }
211
212 //_____________________________________________________________________________
213 void AliESDMuonTrack::GetCovariances(TMatrixD& cov) const
214 {
215   // return covariance matrix of uncorrected parameters
216   cov.ResizeTo(5,5);
217   for (Int_t i = 0; i < 5; i++)
218     for (Int_t j = 0; j <= i; j++)
219       cov(i,j) = cov (j,i) = fCovariances[i*(i+1)/2 + j];
220 }
221
222 //_____________________________________________________________________________
223 void AliESDMuonTrack::SetCovariances(const TMatrixD& cov)
224 {
225   // set reduced covariance matrix of uncorrected parameters
226   for (Int_t i = 0; i < 5; i++)
227     for (Int_t j = 0; j <= i; j++)
228       fCovariances[i*(i+1)/2 + j] = cov(i,j);
229
230 }
231
232 //_____________________________________________________________________________
233 void AliESDMuonTrack::GetCovarianceXYZPxPyPz(Double_t cov[21]) const
234 {
235   // return reduced covariance matrix of uncorrected parameters in (X,Y,Z,Px,Py,Pz) coordinate system
236   // 
237   // Cov(x,x) ... :   cov[0]
238   // Cov(y,x) ... :   cov[1]  cov[2]
239   // Cov(z,x) ... :   cov[3]  cov[4]  cov[5]
240   // Cov(px,x)... :   cov[6]  cov[7]  cov[8]  cov[9]
241   // Cov(py,x)... :   cov[10] cov[11] cov[12] cov[13] cov[14]
242   // Cov(pz,x)... :   cov[15] cov[16] cov[17] cov[18] cov[19] cov[20]
243   //
244   // Get ESD covariance matrix into a TMatrixD
245   TMatrixD covESD(5,5);
246   GetCovariances(covESD);
247
248   // compute Jacobian to change the coordinate system
249   // from (X,thetaX,Y,thetaY,c/pYZ) to (X,Y,Z,pX,pY,pZ)
250   Double_t tanThetaX = TMath::Tan(fThetaXUncorrected);
251   Double_t tanThetaY = TMath::Tan(fThetaYUncorrected);
252   Double_t cosThetaX2 = TMath::Cos(fThetaXUncorrected) * TMath::Cos(fThetaXUncorrected);
253   Double_t cosThetaY2 = TMath::Cos(fThetaYUncorrected) * TMath::Cos(fThetaYUncorrected);
254   Double_t pZ = PzUncorrected();
255   Double_t dpZdthetaY = - fInverseBendingMomentumUncorrected * fInverseBendingMomentumUncorrected *
256                           pZ * pZ * pZ * tanThetaY / cosThetaY2;
257   Double_t dpZdinvpYZ = (fInverseBendingMomentumUncorrected != 0.) ? - pZ / fInverseBendingMomentumUncorrected : - FLT_MAX;
258   TMatrixD jacob(6,5);
259   jacob.Zero();
260   jacob(0,0) = 1.;
261   jacob(1,2) = 1.;
262   jacob(3,1) = pZ / cosThetaX2;
263   jacob(3,3) = dpZdthetaY * tanThetaX;
264   jacob(3,4) = dpZdinvpYZ * tanThetaX;
265   jacob(4,3) = dpZdthetaY * tanThetaY + pZ / cosThetaY2;
266   jacob(4,4) = dpZdinvpYZ * tanThetaY;
267   jacob(5,3) = dpZdthetaY;
268   jacob(5,4) = dpZdinvpYZ;
269   
270   // compute covariance matrix in AOD coordinate system
271   TMatrixD tmp(covESD,TMatrixD::kMultTranspose,jacob);
272   TMatrixD covAOD(jacob,TMatrixD::kMult,tmp);
273   
274   // Get AOD covariance matrix into co[21]
275   for (Int_t i = 0; i < 6; i++)
276     for (Int_t j = 0; j <= i; j++)
277       cov[i*(i+1)/2 + j] = covAOD(i,j);
278   
279 }
280
281 //_____________________________________________________________________________
282 Double_t AliESDMuonTrack::Px() const
283 {
284   // return p_x from track parameters
285   Double_t nonBendingSlope = TMath::Tan(fThetaX);
286   Double_t bendingSlope    = TMath::Tan(fThetaY);
287   Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : - FLT_MAX;
288   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
289   return pZ * nonBendingSlope;
290 }
291
292 //_____________________________________________________________________________
293 Double_t AliESDMuonTrack::Py() const
294 {
295   // return p_y from track parameters
296   Double_t bendingSlope = TMath::Tan(fThetaY);
297   Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : - FLT_MAX;
298   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
299   return pZ * bendingSlope;
300 }
301
302 //_____________________________________________________________________________
303 Double_t AliESDMuonTrack::Pz() const
304 {
305   // return p_z from track parameters
306   Double_t bendingSlope = TMath::Tan(fThetaY);
307   Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : - FLT_MAX;
308   return -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
309 }
310
311 //_____________________________________________________________________________
312 Double_t AliESDMuonTrack::P() const
313 {
314   // return p from track parameters
315   Double_t nonBendingSlope = TMath::Tan(fThetaX);
316   Double_t bendingSlope    = TMath::Tan(fThetaY);
317   Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : - FLT_MAX;
318   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
319   return -pZ * TMath::Sqrt(1.0 + bendingSlope*bendingSlope + nonBendingSlope*nonBendingSlope);
320 }
321
322 //_____________________________________________________________________________
323 void AliESDMuonTrack::LorentzP(TLorentzVector& vP) const
324 {
325   // return Lorentz momentum vector from track parameters
326   Double_t muonMass = M();
327   Double_t nonBendingSlope = TMath::Tan(fThetaX);
328   Double_t bendingSlope    = TMath::Tan(fThetaY);
329   Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : - FLT_MAX;
330   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
331   Double_t pX  = pZ * nonBendingSlope;
332   Double_t pY  = pZ * bendingSlope;
333   Double_t e   = TMath::Sqrt(muonMass*muonMass + pX*pX + pY*pY + pZ*pZ);
334   vP.SetPxPyPzE(pX, pY, pZ, e);
335 }
336
337 //_____________________________________________________________________________
338 Double_t AliESDMuonTrack::PxAtDCA() const
339 {
340   // return p_x from track parameters
341   Double_t nonBendingSlope = TMath::Tan(fThetaXAtDCA);
342   Double_t bendingSlope    = TMath::Tan(fThetaYAtDCA);
343   Double_t pYZ = (fInverseBendingMomentumAtDCA != 0.) ? TMath::Abs(1. / fInverseBendingMomentumAtDCA) : - FLT_MAX;
344   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
345   return pZ * nonBendingSlope;
346 }
347
348 //_____________________________________________________________________________
349 Double_t AliESDMuonTrack::PyAtDCA() const
350 {
351   // return p_y from track parameters
352   Double_t bendingSlope = TMath::Tan(fThetaYAtDCA);
353   Double_t pYZ = (fInverseBendingMomentumAtDCA != 0.) ? TMath::Abs(1. / fInverseBendingMomentumAtDCA) : - FLT_MAX;
354   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
355   return pZ * bendingSlope;
356 }
357
358 //_____________________________________________________________________________
359 Double_t AliESDMuonTrack::PzAtDCA() const
360 {
361   // return p_z from track parameters
362   Double_t bendingSlope = TMath::Tan(fThetaYAtDCA);
363   Double_t pYZ = (fInverseBendingMomentumAtDCA != 0.) ? TMath::Abs(1. / fInverseBendingMomentumAtDCA) : - FLT_MAX;
364   return -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
365 }
366
367 //_____________________________________________________________________________
368 Double_t AliESDMuonTrack::PAtDCA() const
369 {
370   // return p from track parameters
371   Double_t nonBendingSlope = TMath::Tan(fThetaXAtDCA);
372   Double_t bendingSlope    = TMath::Tan(fThetaYAtDCA);
373   Double_t pYZ = (fInverseBendingMomentumAtDCA != 0.) ? TMath::Abs(1. / fInverseBendingMomentumAtDCA) : - FLT_MAX;
374   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
375   return -pZ * TMath::Sqrt(1.0 + bendingSlope*bendingSlope + nonBendingSlope*nonBendingSlope);
376 }
377
378 //_____________________________________________________________________________
379 void AliESDMuonTrack::LorentzPAtDCA(TLorentzVector& vP) const
380 {
381   // return Lorentz momentum vector from track parameters
382   Double_t muonMass = M();
383   Double_t nonBendingSlope = TMath::Tan(fThetaXAtDCA);
384   Double_t bendingSlope    = TMath::Tan(fThetaYAtDCA);
385   Double_t pYZ = (fInverseBendingMomentumAtDCA != 0.) ? TMath::Abs(1. / fInverseBendingMomentumAtDCA) : - FLT_MAX;
386   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
387   Double_t pX  = pZ * nonBendingSlope;
388   Double_t pY  = pZ * bendingSlope;
389   Double_t e   = TMath::Sqrt(muonMass*muonMass + pX*pX + pY*pY + pZ*pZ);
390   vP.SetPxPyPzE(pX, pY, pZ, e);
391 }
392
393 //_____________________________________________________________________________
394 Double_t AliESDMuonTrack::PxUncorrected() const
395 {
396   // return p_x from track parameters
397   Double_t nonBendingSlope = TMath::Tan(fThetaXUncorrected);
398   Double_t bendingSlope    = TMath::Tan(fThetaYUncorrected);
399   Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : - FLT_MAX;
400   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
401   return pZ * nonBendingSlope;
402 }
403
404 //_____________________________________________________________________________
405 Double_t AliESDMuonTrack::PyUncorrected() const
406 {
407   // return p_y from track parameters
408   Double_t bendingSlope = TMath::Tan(fThetaYUncorrected);
409   Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : - FLT_MAX;
410   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
411   return pZ * bendingSlope;
412 }
413
414 //_____________________________________________________________________________
415 Double_t AliESDMuonTrack::PzUncorrected() const
416 {
417   // return p_z from track parameters
418   Double_t bendingSlope = TMath::Tan(fThetaYUncorrected);
419   Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : - FLT_MAX;
420   return -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
421 }
422
423 //_____________________________________________________________________________
424 Double_t AliESDMuonTrack::PUncorrected() const
425 {
426   // return p from track parameters
427   Double_t nonBendingSlope = TMath::Tan(fThetaXUncorrected);
428   Double_t bendingSlope    = TMath::Tan(fThetaYUncorrected);
429   Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : - FLT_MAX;
430   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
431   return -pZ * TMath::Sqrt(1.0 + bendingSlope*bendingSlope + nonBendingSlope*nonBendingSlope);
432 }
433
434 //_____________________________________________________________________________
435 void AliESDMuonTrack::LorentzPUncorrected(TLorentzVector& vP) const
436 {
437   // return Lorentz momentum vector from track parameters
438   Double_t muonMass = M();
439   Double_t nonBendingSlope = TMath::Tan(fThetaXUncorrected);
440   Double_t bendingSlope    = TMath::Tan(fThetaYUncorrected);
441   Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : - FLT_MAX;
442   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
443   Double_t pX  = pZ * nonBendingSlope;
444   Double_t pY  = pZ * bendingSlope;
445   Double_t e   = TMath::Sqrt(muonMass*muonMass + pX*pX + pY*pY + pZ*pZ);
446   vP.SetPxPyPzE(pX, pY, pZ, e);
447 }
448
449 //_____________________________________________________________________________
450 Int_t AliESDMuonTrack::GetMatchTrigger() const
451 {
452   //  backward compatibility after replacing fMatchTrigger by fLocalTrigger
453   //  0 track does not match trigger
454   //  1 track match but does not pass pt cut
455   //  2 track match Low pt cut
456   //  3 track match High pt cut
457
458   if (!LoCircuit()) {
459     return 0;
460   } else if (LoLpt() == 0 && LoHpt() == 0) {
461     return 1;
462   } else if (LoLpt() >  0 && LoHpt() == 0) {
463     return 2;
464   } else {
465     return 3;
466   }
467
468 }
469
470 //_____________________________________________________________________________
471 void AliESDMuonTrack::AddInMuonClusterMap(Int_t chamber)
472 {
473   // Update the muon cluster map by adding this chamber(0..)
474   
475   static const UInt_t kMask[10] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200};
476   
477   fMuonClusterMap |= kMask[chamber];
478   
479 }
480
481 //_____________________________________________________________________________
482 Bool_t AliESDMuonTrack::IsInMuonClusterMap(Int_t chamber) const
483 {
484   // return kTRUE if this chamber(0..) is in the muon cluster map
485   
486   static const UInt_t kMask[10] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200};
487   
488   return ((fMuonClusterMap | kMask[chamber]) == fMuonClusterMap) ? kTRUE : kFALSE;
489   
490 }
491
492 //_____________________________________________________________________________
493 Int_t AliESDMuonTrack::GetNClusters() const
494 {
495   // return the number of clusters associated to the track
496   if (!fClusters) return 0;
497   
498   return fClusters->GetEntriesFast();
499 }
500
501 //_____________________________________________________________________________
502 TClonesArray& AliESDMuonTrack::GetClusters() const
503 {
504   // return the array of clusters associated to the track
505   if (!fClusters) fClusters = new TClonesArray("AliESDMuonCluster",10);
506   
507   return *fClusters;
508 }
509
510 //_____________________________________________________________________________
511 void AliESDMuonTrack::AddCluster(const AliESDMuonCluster &cluster)
512 {
513   // add a cluster to the TClonesArray of clusters associated to the track
514   if (!fClusters) fClusters = new TClonesArray("AliESDMuonCluster",10);
515   
516   new ((*fClusters)[fClusters->GetEntriesFast()]) AliESDMuonCluster(cluster);
517 }
518
519 //_____________________________________________________________________________
520 Bool_t AliESDMuonTrack::ClustersStored() const
521 {
522   // return kTRUE if the clusters associated to the track are registered
523   if (GetNClusters() == 0) return kFALSE;
524   
525   return kTRUE;
526 }
527