]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDMuonTrack.cxx
Virual base classes for AOD and ESD, organized in libSTEERBase (Markus)
[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
30 #include <TLorentzVector.h>
31 #include <TMath.h>
32
33 ClassImp(AliESDMuonTrack)
34
35 //_____________________________________________________________________________
36 AliESDMuonTrack::AliESDMuonTrack ():
37   TObject(),
38   fInverseBendingMomentum(0),
39   fThetaX(0),
40   fThetaY(0),
41   fZ(0),
42   fBendingCoor(0),
43   fNonBendingCoor(0),
44   fInverseBendingMomentumUncorrected(0),
45   fThetaXUncorrected(0),
46   fThetaYUncorrected(0),
47   fZUncorrected(0),
48   fBendingCoorUncorrected(0),
49   fNonBendingCoorUncorrected(0),
50   fChi2(0),
51   fNHit(0),
52   fLocalTrigger(234),
53   fChi2MatchTrigger(0),
54   fHitsPatternInTrigCh(0)
55 {
56   // Default constructor
57 }
58
59
60 //_____________________________________________________________________________
61 AliESDMuonTrack::AliESDMuonTrack (const AliESDMuonTrack& MUONTrack):
62   TObject(MUONTrack),
63   fInverseBendingMomentum(MUONTrack.fInverseBendingMomentum),
64   fThetaX(MUONTrack.fThetaX),
65   fThetaY(MUONTrack.fThetaY),
66   fZ(MUONTrack.fZ),
67   fBendingCoor(MUONTrack.fBendingCoor),
68   fNonBendingCoor(MUONTrack.fNonBendingCoor),
69   fInverseBendingMomentumUncorrected(MUONTrack.fInverseBendingMomentumUncorrected),
70   fThetaXUncorrected(MUONTrack.fThetaXUncorrected),
71   fThetaYUncorrected(MUONTrack.fThetaYUncorrected),
72   fZUncorrected(MUONTrack.fZUncorrected),
73   fBendingCoorUncorrected(MUONTrack.fBendingCoorUncorrected),
74   fNonBendingCoorUncorrected(MUONTrack.fNonBendingCoorUncorrected),
75   fChi2(MUONTrack.fChi2),
76   fNHit(MUONTrack.fNHit),
77   fLocalTrigger(MUONTrack.fLocalTrigger),
78   fChi2MatchTrigger(MUONTrack.fChi2MatchTrigger),
79   fHitsPatternInTrigCh(MUONTrack.fHitsPatternInTrigCh)
80 {
81   //
82   // Copy constructor
83   // Deep copy implemented
84   //
85 }
86
87 //_____________________________________________________________________________
88 AliESDMuonTrack& AliESDMuonTrack::operator=(const AliESDMuonTrack& MUONTrack)
89 {
90   // 
91   // Equal operator for a deep copy
92   //
93   if (this == &MUONTrack)
94     return *this;
95
96   fInverseBendingMomentum = MUONTrack.fInverseBendingMomentum; 
97   fThetaX                 = MUONTrack.fThetaX;           
98   fThetaY                 = MUONTrack.fThetaY;           
99   fZ                      = MUONTrack.fZ;                
100   fBendingCoor            = MUONTrack.fBendingCoor;      
101   fNonBendingCoor         = MUONTrack.fNonBendingCoor;   
102   
103   fInverseBendingMomentumUncorrected = MUONTrack.fInverseBendingMomentumUncorrected; 
104   fThetaXUncorrected                 = MUONTrack.fThetaXUncorrected;           
105   fThetaYUncorrected                 = MUONTrack.fThetaYUncorrected;           
106   fZUncorrected                      = MUONTrack.fZUncorrected;                
107   fBendingCoorUncorrected            = MUONTrack.fBendingCoorUncorrected;      
108   fNonBendingCoorUncorrected         = MUONTrack.fNonBendingCoorUncorrected;   
109   
110   fChi2                   = MUONTrack.fChi2;             
111   fNHit                   = MUONTrack.fNHit; 
112
113   fLocalTrigger           = MUONTrack.fLocalTrigger;  
114   fChi2MatchTrigger       = MUONTrack.fChi2MatchTrigger; 
115
116   fHitsPatternInTrigCh    = MUONTrack.fHitsPatternInTrigCh;
117  
118   return *this;
119 }
120
121 //_____________________________________________________________________________
122 Double_t AliESDMuonTrack::Px() const
123 {
124   // return p_x from track parameters
125   Double_t nonBendingSlope = TMath::Tan(fThetaX);
126   Double_t bendingSlope    = TMath::Tan(fThetaY);
127   Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : 0.;
128   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
129   return pZ * nonBendingSlope;
130 }
131
132 //_____________________________________________________________________________
133 Double_t AliESDMuonTrack::Py() const
134 {
135   // return p_y from track parameters
136   Double_t bendingSlope = TMath::Tan(fThetaY);
137   Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : 0.;
138   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
139   return pZ * bendingSlope;
140 }
141
142 //_____________________________________________________________________________
143 Double_t AliESDMuonTrack::Pz() const
144 {
145   // return p_z from track parameters
146   Double_t bendingSlope = TMath::Tan(fThetaY);
147   Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : 0.;
148   return -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
149 }
150
151 //_____________________________________________________________________________
152 Double_t AliESDMuonTrack::P() const
153 {
154   // return p from track parameters
155   Double_t nonBendingSlope = TMath::Tan(fThetaX);
156   Double_t bendingSlope    = TMath::Tan(fThetaY);
157   Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : 0.;
158   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
159   return -pZ * TMath::Sqrt(1.0 + bendingSlope*bendingSlope + nonBendingSlope*nonBendingSlope);
160 }
161
162 //_____________________________________________________________________________
163 void AliESDMuonTrack::LorentzP(TLorentzVector& vP) const
164 {
165   // return Lorentz momentum vector from track parameters
166   Double_t muonMass = 0.105658369;
167   Double_t nonBendingSlope = TMath::Tan(fThetaX);
168   Double_t bendingSlope    = TMath::Tan(fThetaY);
169   Double_t pYZ = (fInverseBendingMomentum != 0.) ? TMath::Abs(1. / fInverseBendingMomentum) : 0.;
170   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
171   Double_t pX  = pZ * nonBendingSlope;
172   Double_t pY  = pZ * bendingSlope;
173   Double_t e   = TMath::Sqrt(muonMass*muonMass + pX*pX + pY*pY + pZ*pZ);
174   vP.SetPxPyPzE(pX, pY, pZ, e);
175 }
176
177 //_____________________________________________________________________________
178 Double_t AliESDMuonTrack::PxUncorrected() const
179 {
180   // return p_x from track parameters
181   Double_t nonBendingSlope = TMath::Tan(fThetaXUncorrected);
182   Double_t bendingSlope    = TMath::Tan(fThetaYUncorrected);
183   Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : 0.;
184   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
185   return pZ * nonBendingSlope;
186 }
187
188 //_____________________________________________________________________________
189 Double_t AliESDMuonTrack::PyUncorrected() const
190 {
191   // return p_y from track parameters
192   Double_t bendingSlope = TMath::Tan(fThetaYUncorrected);
193   Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : 0.;
194   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
195   return pZ * bendingSlope;
196 }
197
198 //_____________________________________________________________________________
199 Double_t AliESDMuonTrack::PzUncorrected() const
200 {
201   // return p_z from track parameters
202   Double_t bendingSlope = TMath::Tan(fThetaYUncorrected);
203   Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : 0.;
204   return -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
205 }
206
207 //_____________________________________________________________________________
208 Double_t AliESDMuonTrack::PUncorrected() const
209 {
210   // return p from track parameters
211   Double_t nonBendingSlope = TMath::Tan(fThetaXUncorrected);
212   Double_t bendingSlope    = TMath::Tan(fThetaYUncorrected);
213   Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : 0.;
214   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
215   return -pZ * TMath::Sqrt(1.0 + bendingSlope*bendingSlope + nonBendingSlope*nonBendingSlope);
216 }
217
218 //_____________________________________________________________________________
219 void AliESDMuonTrack::LorentzPUncorrected(TLorentzVector& vP) const
220 {
221   // return Lorentz momentum vector from track parameters
222   Double_t muonMass = 0.105658369;
223   Double_t nonBendingSlope = TMath::Tan(fThetaXUncorrected);
224   Double_t bendingSlope    = TMath::Tan(fThetaYUncorrected);
225   Double_t pYZ = (fInverseBendingMomentumUncorrected != 0.) ? TMath::Abs(1. / fInverseBendingMomentumUncorrected) : 0.;
226   Double_t pZ  = -pYZ / TMath::Sqrt(1.0 + bendingSlope*bendingSlope);  // spectro. (z<0)
227   Double_t pX  = pZ * nonBendingSlope;
228   Double_t pY  = pZ * bendingSlope;
229   Double_t e   = TMath::Sqrt(muonMass*muonMass + pX*pX + pY*pY + pZ*pZ);
230   vP.SetPxPyPzE(pX, pY, pZ, e);
231 }
232
233 //_____________________________________________________________________________
234 Int_t AliESDMuonTrack::GetMatchTrigger() const
235 {
236   //  backward compatibility after replacing fMatchTrigger by fLocalTrigger
237   //  0 track does not match trigger
238   //  1 track match but does not pass pt cut
239   //  2 track match Low pt cut
240   //  3 track match High pt cut
241
242   if (LoCircuit() == -1) {
243     return 0;
244   } else if (LoLpt() == 0 && LoHpt() == 0) {
245     return 1;
246   } else if (LoLpt() >  0 && LoHpt() == 0) {
247     return 2;
248   } else {
249     return 3;
250   }
251
252 }
253