]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliESDMuonTrack.h
Coding convention violations: suppression
[u/mrichter/AliRoot.git] / STEER / AliESDMuonTrack.h
1 #ifndef ALIESDMUONTRACK_H
2 #define ALIESDMUONTRACK_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice                               */
6
7 /* $Id$ */
8
9 /// \class AliESDMuonTrack
10 /// \brief Class to describe the MUON tracks in the Event Summary Data class
11 //  Author: G.Martinez
12
13
14 #include <TMath.h>
15 #include <TMatrixD.h>
16 #include <TDatabasePDG.h>
17
18 #include "AliVParticle.h"
19
20 class AliESDMuonCluster;
21 class TClonesArray;
22 class TLorentzVector;
23
24 class AliESDMuonTrack : public AliVParticle {
25 public:
26   AliESDMuonTrack(); //Constructor
27   virtual ~AliESDMuonTrack(); // Destructor
28   AliESDMuonTrack(const AliESDMuonTrack& esdm);
29   AliESDMuonTrack& operator=(const AliESDMuonTrack& esdm);
30   virtual void Copy(TObject &obj) const;
31
32   virtual void Clear(Option_t* opt = "");
33   
34   void Reset();
35   
36   // Return kTRUE if the track contain tracker data
37   Bool_t ContainTrackerData() const {return (fMuonClusterMap>0) ? kTRUE : kFALSE;}
38   // Return kTRUE if the track contain trigger data
39   Bool_t ContainTriggerData() const {return (LoCircuit()>0) ? kTRUE : kFALSE;}
40   
41   // Get and Set methods for data at vertex
42   Double_t GetInverseBendingMomentum(void) const {return fInverseBendingMomentum;}
43   void     SetInverseBendingMomentum(Double_t InverseBendingMomentum) 
44                 {fInverseBendingMomentum = InverseBendingMomentum;}
45   Double_t GetThetaX(void) const {return fThetaX;}
46   void     SetThetaX(Double_t ThetaX) {fThetaX = ThetaX;}
47   Double_t GetThetaY(void) const {return fThetaY;}
48   void     SetThetaY(Double_t ThetaY) {fThetaY = ThetaY;}
49   Double_t GetZ(void) const {return fZ;}
50   void     SetZ(Double_t Z) {fZ = Z;}
51   Double_t GetBendingCoor(void) const {return fBendingCoor;}
52   void     SetBendingCoor(Double_t BendingCoor) {fBendingCoor = BendingCoor;}
53   Double_t GetNonBendingCoor(void) const {return fNonBendingCoor;}
54   void     SetNonBendingCoor(Double_t NonBendingCoor) {fNonBendingCoor = NonBendingCoor;}
55   
56   // Get and Set methods for data at Distance of Closest Approach in the vertex plane
57   Double_t GetInverseBendingMomentumAtDCA(void) const {return fInverseBendingMomentumAtDCA;}
58   void     SetInverseBendingMomentumAtDCA(Double_t InverseBendingMomentum) 
59                 {fInverseBendingMomentumAtDCA = InverseBendingMomentum;}
60   Double_t GetThetaXAtDCA(void) const {return fThetaXAtDCA;}
61   void     SetThetaXAtDCA(Double_t ThetaX) {fThetaXAtDCA = ThetaX;}
62   Double_t GetThetaYAtDCA(void) const {return fThetaYAtDCA;}
63   void     SetThetaYAtDCA(Double_t ThetaY) {fThetaYAtDCA = ThetaY;}
64   Double_t GetBendingCoorAtDCA(void) const {return fBendingCoorAtDCA;}
65   void     SetBendingCoorAtDCA(Double_t BendingCoor) {fBendingCoorAtDCA = BendingCoor;}
66   Double_t GetNonBendingCoorAtDCA(void) const {return fNonBendingCoorAtDCA;}
67   void     SetNonBendingCoorAtDCA(Double_t NonBendingCoor) {fNonBendingCoorAtDCA = NonBendingCoor;}
68   Double_t GetDCA(void) const {return TMath::Sqrt(fNonBendingCoorAtDCA*fNonBendingCoorAtDCA +
69                                                   fBendingCoorAtDCA*fBendingCoorAtDCA);}
70   
71   // Get and Set methods for data at first station
72   Double_t GetInverseBendingMomentumUncorrected(void) const {return fInverseBendingMomentumUncorrected;}
73   void     SetInverseBendingMomentumUncorrected(Double_t InverseBendingMomentum) 
74                 {fInverseBendingMomentumUncorrected = InverseBendingMomentum;}
75   Double_t GetThetaXUncorrected(void) const {return fThetaXUncorrected;}
76   void     SetThetaXUncorrected(Double_t ThetaX) {fThetaXUncorrected = ThetaX;}
77   Double_t GetThetaYUncorrected(void) const {return fThetaYUncorrected;}
78   void     SetThetaYUncorrected(Double_t ThetaY) {fThetaYUncorrected = ThetaY;}
79   Double_t GetZUncorrected(void) const {return fZUncorrected;}
80   void     SetZUncorrected(Double_t Z) {fZUncorrected = Z;}
81   Double_t GetBendingCoorUncorrected(void) const {return fBendingCoorUncorrected;}
82   void     SetBendingCoorUncorrected(Double_t BendingCoor) {fBendingCoorUncorrected = BendingCoor;}
83   Double_t GetNonBendingCoorUncorrected(void) const {return fNonBendingCoorUncorrected;}
84   void     SetNonBendingCoorUncorrected(Double_t NonBendingCoor) {fNonBendingCoorUncorrected = NonBendingCoor;}
85   
86   // Get and Set methods for covariance matrix of data at first station
87   void     GetCovariances(TMatrixD& cov) const;
88   void     SetCovariances(const TMatrixD& cov);
89   void     GetCovarianceXYZPxPyPz(Double_t cov[21]) const;
90   
91   // Get and Set methods for global tracking info
92   Double_t GetChi2(void) const {return fChi2;}
93   void     SetChi2(Double_t Chi2) {fChi2 = Chi2;}
94   UChar_t  GetNHit(void) const {return fNHit;}
95   void     SetNHit(UInt_t NHit) {fNHit = NHit;}
96   
97   // Get and Set methods for trigger matching
98   Int_t    GetMatchTrigger() const;
99   Bool_t   MatchTriggerDigits() const;
100   Double_t GetChi2MatchTrigger() const {return fChi2MatchTrigger;}
101   void     SetChi2MatchTrigger(Double_t Chi2MatchTrigger) {fChi2MatchTrigger = Chi2MatchTrigger;}
102   UShort_t GetHitsPatternInTrigCh() const {return fHitsPatternInTrigCh;}
103   void     SetHitsPatternInTrigCh(UShort_t hitsPatternInTrigCh) {fHitsPatternInTrigCh = hitsPatternInTrigCh;}
104   void     SetLocalTrigger(Int_t locTrig) { fLocalTrigger = locTrig; }
105   Int_t    LoCircuit(void) const { return fLocalTrigger & 0xFF;       }
106   Int_t    LoStripX(void) const  { return fLocalTrigger >>  8 & 0x1F; }
107   Int_t    LoStripY(void) const  { return fLocalTrigger >> 13 & 0x0F; }
108   Int_t    LoDev(void)    const  { return fLocalTrigger >> 17 & 0x1F; }
109   Int_t    LoLpt(void)    const  { return fLocalTrigger >> 22 & 0x03; }
110   Int_t    LoHpt(void)    const  { return fLocalTrigger >> 24 & 0x03; }
111   Int_t    GetTriggerWithoutChamber(void) const { return fLocalTrigger >> 26 & 0xF; }
112   Bool_t TriggerFiredWithoutChamber(Int_t ich) const { return GetTriggerWithoutChamber() >> (3 - ich) & 0x1; }
113
114   // Get and Set methods for the hit strips pattern in the trigger chambers
115   UShort_t GetTriggerX1Pattern() const { return fX1Pattern; }
116   UShort_t GetTriggerY1Pattern() const { return fY1Pattern; }
117   UShort_t GetTriggerX2Pattern() const { return fX2Pattern; }
118   UShort_t GetTriggerY2Pattern() const { return fY2Pattern; }
119   UShort_t GetTriggerX3Pattern() const { return fX3Pattern; }
120   UShort_t GetTriggerY3Pattern() const { return fY3Pattern; }
121   UShort_t GetTriggerX4Pattern() const { return fX4Pattern; }
122   UShort_t GetTriggerY4Pattern() const { return fY4Pattern; }
123   void     SetTriggerX1Pattern(UShort_t pat) { fX1Pattern = pat; }
124   void     SetTriggerY1Pattern(UShort_t pat) { fY1Pattern = pat; }
125   void     SetTriggerX2Pattern(UShort_t pat) { fX2Pattern = pat; }
126   void     SetTriggerY2Pattern(UShort_t pat) { fY2Pattern = pat; }
127   void     SetTriggerX3Pattern(UShort_t pat) { fX3Pattern = pat; }
128   void     SetTriggerY3Pattern(UShort_t pat) { fY3Pattern = pat; }
129   void     SetTriggerX4Pattern(UShort_t pat) { fX4Pattern = pat; }
130   void     SetTriggerY4Pattern(UShort_t pat) { fY4Pattern = pat; }
131
132   // Get and Set methods for muon cluster map
133   UInt_t   GetMuonClusterMap() const {return fMuonClusterMap;}
134   void     SetMuonClusterMap(UInt_t muonClusterMap) {fMuonClusterMap = muonClusterMap;}
135   void     AddInMuonClusterMap(Int_t chamber) {fMuonClusterMap |= BIT(chamber);}
136   Bool_t   IsInMuonClusterMap(Int_t chamber) const {return (Bool_t) ((fMuonClusterMap & BIT(chamber)) != 0);}
137   
138   // Identify the tracks sharing cluster(s) with another (use the last bit of fMuonClusterMap)
139   void     Connected(Bool_t flag = kTRUE) {flag ? SETBIT(fMuonClusterMap,31) : CLRBIT(fMuonClusterMap,31);}
140   Bool_t   IsConnected() const {return TESTBIT(fMuonClusterMap,31);}
141   
142   // Methods to get, fill and check the array of associated clusters
143   Int_t         GetNClusters() const;
144   TClonesArray& GetClusters() const;
145   void          AddCluster(const AliESDMuonCluster &cluster);
146   Bool_t        ClustersStored() const;
147   
148   // Methods to compute track momentum
149   Double_t Px() const;
150   Double_t Py() const;
151   Double_t Pz() const;
152   Double_t P() const;
153   Bool_t   PxPyPz(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE; }
154   void     LorentzP(TLorentzVector& vP) const;
155   Double_t PxAtDCA() const;
156   Double_t PyAtDCA() const;
157   Double_t PzAtDCA() const;
158   Double_t PAtDCA() const;
159   Bool_t   PxPyPzAtDCA(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE; }
160   void     LorentzPAtDCA(TLorentzVector& vP) const;
161   Double_t PxUncorrected() const;
162   Double_t PyUncorrected() const;
163   Double_t PzUncorrected() const;
164   Double_t PUncorrected() const;
165   Bool_t   PxPyPzUncorrected(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE; }
166   void     LorentzPUncorrected(TLorentzVector& vP) const;
167   
168   // additional methods to comply with AliVParticle
169   Double_t Xv() const {return -999.;} // put reasonable values here
170   Double_t Yv() const {return -999.;} //
171   Double_t Zv() const {return -999.;} //
172   Bool_t   XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE; }  
173   Double_t Pt() const { return TMath::Sqrt(Px()*Px() + Py()*Py()); }
174   Double_t OneOverPt() const { return (Pt() != 0.) ? 1./Pt() : FLT_MAX; }
175   Double_t Phi() const { return TMath::Pi()+TMath::ATan2(-Py(), -Px()); }
176   Double_t Theta() const { return TMath::ATan2(Pt(), Pz()); }
177   Double_t E() const { return TMath::Sqrt(M()*M() + P()*P()); }
178   Double_t M() const { return TDatabasePDG::Instance()->GetParticle("mu-")->Mass(); }
179   Double_t Eta() const { return -TMath::Log(TMath::Tan(0.5 * Theta()));}
180   Double_t Y() const { return (Pz()/E() != 1.) ? TMath::ATanH(Pz()/E()) : FLT_MAX; }
181   Short_t  Charge() const { return (Short_t)TMath::Sign(1., GetInverseBendingMomentum()); }
182   const Double_t *PID() const { return (Double_t*)0x0; }
183   
184   /// Set the corresponding MC track number
185   void  SetLabel(Int_t label) {fLabel = label;}
186   /// Return the corresponding MC track number
187   Int_t GetLabel() const {return fLabel;}
188
189   /// Additional methods to decode hit pattern
190   /// The hit pattern is a UShort_t with:
191   /// <pre>
192   ///   0    |   1 0 0 0 1  |  1 1  |   1  1  0  1  |   1  1  0  1   
193   ///        |              |       |               | 
194   /// unused |  RPC (0-17)  |  flag |  Bend plane   | Non-bend plane
195   ///        |      or      |       | Match chamber | Match chamber
196   ///        | further info |       |  11 12 13 14  |  11 12 13 14
197   ///        |    (20-24)   |       |               |
198   /// </pre>
199   enum EAliTriggerChPatternFlag {
200     kNoEff,    ///< Track is not good for chamber efficiency evaluation
201     kChEff,    ///< Track crosses different RPCs
202     kSlatEff,  ///< Track crosses the same RPC in all planes
203     kBoardEff  ///< Track crosses the same board in all planes
204   };
205   enum EAliTriggerChPatternInfo {
206     kCrossDifferentSlats  = 20, ///< The RPC cannot be univoquely determined
207     kTrackMatchesManyPads = 21, ///< Track not good for effciency calculation since it matches many pads
208     kTrackMatchesFewPads  = 22, ///< Track not good for effciency calculation since it matches pads in less than 3/4 chambers
209     kTrackOutsideGeometry = 23, ///< Problems in pattern determination since track extrapolation is outside trigger chambers
210     kTrackerTrackPattern  = 24  ///< The pattern was calculated from a tracker track not matching trigger track
211   };
212   /// Set hits pattern
213   static void SetFiredChamber(UShort_t& pattern, Int_t cathode, Int_t chamber);
214   /// Add efficiency flag and crossed RPC or info on rejected track
215   static void AddEffInfo(UShort_t& pattern, Int_t slatOrInfo, EAliTriggerChPatternFlag effType = kNoEff);
216   /// Chamber was hit
217   static Bool_t IsChamberHit(UShort_t pattern, Int_t cathode, Int_t chamber);
218   /// Get Efficiency flag
219   static Int_t GetEffFlag(UShort_t pattern);
220   /// Getting crossed slat or info
221   static Int_t GetSlatOrInfo(UShort_t pattern);
222
223   
224 protected:
225   // parameters at vertex
226   Double32_t fInverseBendingMomentum; ///< Inverse bending momentum (GeV/c ** -1) times the charge 
227   Double32_t fThetaX;                 ///< Angle of track at vertex in X direction (rad)
228   Double32_t fThetaY;                 ///< Angle of track at vertex in Y direction (rad)
229   Double32_t fZ;                      ///< Z coordinate (cm)
230   Double32_t fBendingCoor;            ///< bending coordinate (cm)
231   Double32_t fNonBendingCoor;         ///< non bending coordinate (cm)
232   
233   // parameters at Distance of Closest Approach in the vertex plane
234   Double32_t fInverseBendingMomentumAtDCA; ///< Inverse bending momentum (GeV/c ** -1) times the charge 
235   Double32_t fThetaXAtDCA;                 ///< Angle of track at vertex in X direction (rad)
236   Double32_t fThetaYAtDCA;                 ///< Angle of track at vertex in Y direction (rad)
237   Double32_t fBendingCoorAtDCA;            ///< bending coordinate (cm)
238   Double32_t fNonBendingCoorAtDCA;         ///< non bending coordinate (cm)
239   
240   // parameters at first tracking station
241   Double32_t fInverseBendingMomentumUncorrected; ///< Inverse bending momentum (GeV/c ** -1) times the charge 
242   Double32_t fThetaXUncorrected;                 ///< Angle of track at vertex in X direction (rad)
243   Double32_t fThetaYUncorrected;                 ///< Angle of track at vertex in Y direction (rad)
244   Double32_t fZUncorrected;                      ///< Z coordinate (cm)
245   Double32_t fBendingCoorUncorrected;            ///< bending coordinate (cm)
246   Double32_t fNonBendingCoorUncorrected;         ///< non bending coordinate (cm)
247   
248   /// reduced covariance matrix of UNCORRECTED track parameters, ordered as follow:      <pre>
249   /// [0] =  <X,X>
250   /// [1] =<X,ThetaX>  [2] =<ThetaX,ThetaX>
251   /// [3] =  <X,Y>     [4] =  <Y,ThetaX>     [5] =  <Y,Y>
252   /// [6] =<X,ThetaY>  [7] =<ThetaX,ThetaY>  [8] =<Y,ThetaY>  [9] =<ThetaY,ThetaY>
253   /// [10]=<X,InvP_yz> [11]=<ThetaX,InvP_yz> [12]=<Y,InvP_yz> [13]=<ThetaY,InvP_yz> [14]=<InvP_yz,InvP_yz>  </pre>
254   Double32_t fCovariances[15]; ///< \brief reduced covariance matrix of parameters AT FIRST CHAMBER
255   
256   // global tracking info
257   Double32_t fChi2;                ///< chi2 in the MUON track fit
258   Double32_t fChi2MatchTrigger;    ///< chi2 of trigger/track matching
259   Int_t      fLocalTrigger;        ///< packed local trigger information
260
261   // hit strips pattern in the trigger chambers
262   UShort_t fX1Pattern;             ///< x-strips pattern in st6/ch1
263   UShort_t fY1Pattern;             ///< y-strips pattern in st6/ch1
264   UShort_t fX2Pattern;             ///< x-strips pattern in st6/ch2
265   UShort_t fY2Pattern;             ///< y-strips pattern in st6/ch2
266   UShort_t fX3Pattern;             ///< x-strips pattern in st7/ch1
267   UShort_t fY3Pattern;             ///< y-strips pattern in st7/ch1
268   UShort_t fX4Pattern;             ///< x-strips pattern in st7/ch2
269   UShort_t fY4Pattern;             ///< y-strips pattern in st7/ch2
270   
271   UInt_t   fMuonClusterMap;        ///< Map of clusters in tracking chambers
272   UShort_t fHitsPatternInTrigCh;   ///< Word containing info on the hits left in trigger chambers
273   UChar_t  fNHit;                  ///< number of hit in the track
274   
275   mutable TClonesArray* fClusters; ///< Array of clusters attached to the track
276   
277   Int_t fLabel;                    ///< point to the corresponding MC track
278   
279   ClassDef(AliESDMuonTrack,11) // MUON ESD track class 
280 };
281
282 #endif