ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/Muon.h
Revision: 1.45.2.1
Committed: Tue May 15 23:25:18 2012 UTC (12 years, 11 months ago) by paus
Content type: text/plain
Branch: Mit_025c_branch
CVS Tags: Mit_025c_branch2, Mit_025c_branch1, Mit_025c_branch0
Changes since 1.45: +90 -78 lines
Log Message:
Backporting from 5x.

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 paus 1.45.2.1 // $Id: Muon.h,v 1.45 2011/10/23 01:53:16 paus Exp $
3 loizides 1.1 //
4     // Muon
5 loizides 1.23 //
6 pharris 1.22 // Classified into 3 Types
7 loizides 1.23 // Standalone : Muon fit from hits in the muon chambers
8     // Tracker : Tracker matched track to muon chambers with segments
9     // Global : Combined track and muon chambers fit
10 loizides 1.1 //
11 loizides 1.23 // In the muon class all three muon classes exist and can be determined by checking
12     // whether a fit track exists for such a Muon (eg HasTrackerTrk() == kTRUE). When
13     // BestTrk function is called the global fit is returned, if that does not
14     // exist the tracker fit is returned upon that failure the standalone muon
15     // is subsequently returned. To consult more see:
16 pharris 1.22 // http://cmsdoc.cern.ch/cms/Physics/muon/MPOG/Notes/MuonReco.pdf
17     //
18     // Quality Varaibles for Selection
19     // Isolation : decomposed to IsoRNNXXXXX
20     // NN = 03,05 to denote R =0.3,0.5 in Isolation Cone
21 loizides 1.23 // XXXXX = SumPt - Sum of Pt of Tracks in Cone (using all Pt Tracks)
22     // XXXXX = EmEt - Sum of Et of Em component of Calo Towers (Veto=0.08)
23     // XXXXX = HadEt - Sum of Et of Had component of Calo Towers (Veto=0.1)
24     // XXXXX = HoEt - Sum of Pt of Ho component of Calo Towers (Veto=0.1)
25     // XXXXX = NTrk - Number of Tracks within Cone (using all Pt Tracks)
26     // XXXXX = NJet - Sum of Jets inside Cone
27     //
28 pharris 1.22 // Muon Quality Variables
29     // Extracted from the Muon Tracking Associator
30 loizides 1.23 // For more se https://twiki.cern.ch/twiki/bin/view/CMS/TrackAssociator
31 pharris 1.22 // Energy Variables : Energy within (5x5 Ecal Crystal/Hcal/Ho) along Track
32 loizides 1.23 // using calo towers
33     // S9 Energy Variables : Energy using reconstructed hits calo towers default
34 pharris 1.22 // Segment Variables :
35     // Segment variables are stored in array of 8:
36 loizides 1.23 // 0-3: Correspond to segments in 4 DT chambers in->outward(3 has no Y res)
37     // 4-7: Correspond to segments in 4 CSC chambers in->out
38 pharris 1.22 // If value undetermined 999999 is returned.
39     // Variables:
40 loizides 1.23 // DX,DY,PullX,PullY: Uncertainties/Pulls of propagated track
41     // with respect to local muon segment
42     // TrackDist,TrackDistErr: Summed Dist/Err (in X,Y) of segment with respect
43     // to propagated track
44     // NSegments : Number of segments in muon using Segment+Track Arbitration
45     // NChambers : Number of muon chambers traversed in propagated track
46 ceballos 1.40 // NMatches : Number of muon chambers with matches
47 loizides 1.23 // LastHit : Returns farest (from center) station with a recorded segment
48     // LastStation : Returns farest station using Segment+Track Arbitration
49     //
50 pharris 1.22 // Muon Id Methods: Please see Muon Id Note(as of now unpublished):
51     // https://www.cmsaf.mit.edu/twiki/pub/CmsHep/HepWAnalysis/MuonID-ingo.pdf
52 loizides 1.23 // TMOneStation : Returns bool whether muon passes "Tracker Muon One StationId"
53     // -Matching criteria for one of all segments matched to muon
54     // TMLastStation : Returns bool whether muon passes "LastStation Id" criteria
55     // -Matching criteria for last most segment
56 loizides 1.1 //
57 loizides 1.16 // Authors: J.Bendavid, C.Loizides, C.Paus, P.Harris
58 loizides 1.1 //--------------------------------------------------------------------------------------------------
59 loizides 1.6
60 loizides 1.16 #ifndef MITANA_DATATREE_MUON_H
61     #define MITANA_DATATREE_MUON_H
62 loizides 1.8
63 loizides 1.16 #include "MitAna/DataTree/interface/Track.h"
64 bendavid 1.11 #include "MitAna/DataTree/interface/ChargedParticle.h"
65 sixie 1.34 #include "MitAna/DataTree/interface/MuonQuality.h"
66 pharris 1.15
67     namespace mithep {
68     class Muon : public ChargedParticle {
69 loizides 1.1 public:
70 loizides 1.20 Muon();
71 loizides 1.18
72     enum EClassType {
73     kNone, //no track assigned
74     kGlobal, //"Global"
75 loizides 1.31 kTracker, //"Tracker"
76 loizides 1.18 kSta, //"Standalone"
77     kAny //any "best" of the above
78     };
79 bendavid 1.2
80 loizides 1.23 const Track *BestTrk() const;
81 loizides 1.30 const Track *GlobalTrk() const { return fGlobalTrkRef.Obj(); }
82     const Track *StandaloneTrk() const { return fStaTrkRef.Obj(); }
83     const Track *TrackerTrk() const { return fTrkTrkRef.Obj(); }
84     const Track *Trk() const { return BestTrk(); }
85 bendavid 1.35 Double_t D0PV() const { return fD0PV; }
86     Double_t D0PVErr() const { return fD0PVErr; }
87     Double_t D0PVSignificance() const { return fD0PV/fD0PVErr; }
88     Double_t Ip3dPV() const { return fIp3dPV; }
89     Double_t Ip3dPVErr() const { return fIp3dPVErr; }
90     Double_t Ip3dPVSignificance() const { return fIp3dPV/fIp3dPVErr; }
91     Double_t D0PVBS() const { return fD0PVBS; }
92     Double_t D0PVBSErr() const { return fD0PVBSErr; }
93     Double_t D0PVBSSignificance() const { return fD0PVBS/fD0PVBSErr; }
94     Double_t Ip3dPVBS() const { return fIp3dPVBS; }
95     Double_t Ip3dPVBSErr() const { return fIp3dPVBSErr; }
96     Double_t Ip3dPVBSSignificance() const { return fIp3dPVBS/fIp3dPVBSErr; }
97 paus 1.45 Double_t D0PVUB() const { return fD0PVUB; }
98     Double_t D0PVUBErr() const { return fD0PVUBErr; }
99     Double_t D0PVUBSignificance() const { return fD0PVUB/fD0PVUBErr; }
100     Double_t Ip3dPVUB() const { return fIp3dPVUB; }
101     Double_t Ip3dPVUBErr() const { return fIp3dPVUBErr; }
102     Double_t Ip3dPVUBSignificance() const { return fIp3dPVUB/fIp3dPVUBErr; }
103     Double_t D0PVUBBS() const { return fD0PVUBBS; }
104     Double_t D0PVUBBSErr() const { return fD0PVUBBSErr; }
105     Double_t D0PVUBBSSignificance() const { return fD0PVUBBS/fD0PVUBBSErr; }
106     Double_t Ip3dPVUBBS() const { return fIp3dPVUBBS; }
107     Double_t Ip3dPVUBBSErr() const { return fIp3dPVUBBSErr; }
108     Double_t Ip3dPVUBBSSignificance() const { return fIp3dPVUBBS/fIp3dPVUBBSErr;}
109 bendavid 1.36 Double_t PVCompatibility() const { return fPVCompatibility; }
110     Double_t PVBSCompatibility() const { return fPVBSCompatibility; }
111 bendavid 1.42 Double_t TrkKink() const { return fTrkKink; }
112     Double_t GlbKink() const { return fGlbKink; }
113 loizides 1.30 Double_t EmEnergy() const { return fEmEnergy; }
114     Double_t EmS9Energy() const { return fEmS9Energy; }
115 loizides 1.20 Double_t GetDX(Int_t iStation) const;
116     Double_t GetDY(Int_t iStation) const;
117     Double_t GetPullX(Int_t iStation) const;
118     Double_t GetPullY(Int_t iStation) const;
119     Double_t GetTrackDist(Int_t iStation) const;
120     Double_t GetTrackDistErr(Int_t iStation) const;
121     Int_t GetNSegments(Int_t iStation) const;
122     Bool_t Has(EClassType type) const;
123 loizides 1.23 Bool_t HasTrk() const;
124 loizides 1.25 Bool_t HasGlobalTrk() const { return fGlobalTrkRef.IsValid(); }
125     Bool_t HasStandaloneTrk() const { return fStaTrkRef.IsValid(); }
126     Bool_t HasTrackerTrk() const { return fTrkTrkRef.IsValid(); }
127 loizides 1.23 Double_t HadEnergy() const { return fHadEnergy; }
128     Double_t HadS9Energy() const { return fHadS9Energy; }
129     Double_t HoEnergy() const { return fHoEnergy; }
130     Double_t HoS9Energy() const { return fHoS9Energy; }
131 loizides 1.20 EClassType Is() const;
132 bendavid 1.27 Bool_t IsGlobalMuon() const { return fIsGlobalMuon; }
133     Bool_t IsTrackerMuon() const { return fIsTrackerMuon; }
134     Bool_t IsStandaloneMuon() const { return fIsStandaloneMuon; }
135 paus 1.45.2.1 Bool_t IsPFMuon() const { return fIsPFMuon; }
136 bendavid 1.27 Bool_t IsCaloMuon() const { return fIsCaloMuon; }
137 loizides 1.23 Double_t IsoR03SumPt() const { return fIsoR03SumPt; }
138     Double_t IsoR03EmEt() const { return fIsoR03EmEt; }
139     Double_t IsoR03HadEt() const { return fIsoR03HadEt; }
140     Double_t IsoR03HoEt() const { return fIsoR03HoEt; }
141 loizides 1.28 UShort_t IsoR03NTracks() const { return fIsoR03NTracks; }
142     UShort_t IsoR03NJets() const { return fIsoR03NJets; }
143 loizides 1.23 Double_t IsoR05SumPt() const { return fIsoR05SumPt; }
144     Double_t IsoR05EmEt() const { return fIsoR05EmEt; }
145     Double_t IsoR05HadEt() const { return fIsoR05HadEt; }
146     Double_t IsoR05HoEt() const { return fIsoR05HoEt; }
147 loizides 1.28 UShort_t IsoR05NTracks() const { return fIsoR05NTracks; }
148     UShort_t IsoR05NJets() const { return fIsoR05NJets; }
149 pharris 1.37 UInt_t NValidHits() const { return fNValidHits; }
150 loizides 1.28 UInt_t NChambers() const { return fNTraversedChambers; }
151     UInt_t NSegments() const { return fStationMask.NBitsSet(); }
152 ceballos 1.40 UInt_t NMatches() const { return fNMatches; }
153 paus 1.45.2.1 Int_t NTrkLayersHit() const { return fNTrkLayersHit; }
154     Int_t NTrkLayersNoHit() const { return fNTrkLayersNoHit; }
155     Int_t NPxlLayersHit() const { return fNPxlLayersHit; }
156     Int_t NTrkLostHitsIn() const { return fNTrkLostHitsIn; }
157     Int_t NTrkLostHitsOut() const { return fNTrkLostHitsOut; }
158 loizides 1.20 Int_t LastHit() const;
159 paus 1.45.2.1 Int_t LastStation(Double_t iMaxD,
160     Double_t iMaxP) const;
161 sixie 1.34 Int_t LastStation(Int_t iMax=8) const;
162 loizides 1.30 Int_t ObjId() const { return ObjType()*1000+Is(); }
163 loizides 1.25 EObjType ObjType() const { return kMuon; }
164 loizides 1.29 void Print(Option_t *opt="") const;
165 sixie 1.34 Bool_t PromptTight(EClassType type) const;
166     const MuonQuality &Quality() const { return fQuality; }
167     MuonQuality &Quality() { return fQuality; }
168 loizides 1.23 Bool_t StationBit(Int_t bit) const { return fStationMask.TestBit(bit); }
169 loizides 1.28 Bool_t TMLastStation(Double_t iDYMin = 3, Double_t iPYMin = 3,
170     Double_t iDXMin = 3, Double_t iPXMin = 3,UInt_t iN = 2) const;
171     Bool_t TMOneStation(Double_t iDYMin = 3, Double_t iPYMin = 3,
172     Double_t iDXMin = 3, Double_t iPXMin = 3,UInt_t iN = 1) const;
173 bendavid 1.33 void SetCharge(Char_t x) { fCharge = x; ClearCharge(); }
174 paus 1.45.2.1 void SetGlobalTrk(const Track *t)
175 loizides 1.28 { fGlobalTrkRef = t; ClearMom(); ClearCharge(); }
176 paus 1.45.2.1 void SetStandaloneTrk(const Track *t)
177 loizides 1.28 { fStaTrkRef = t; ClearMom(); ClearCharge(); }
178 paus 1.45.2.1 void SetTrackerTrk(const Track *t)
179 loizides 1.28 { fTrkTrkRef = t; ClearMom(); ClearCharge(); }
180 loizides 1.23 void SetDX(Int_t iStation, Double_t iDX);
181     void SetDY(Int_t iStation, Double_t iDY);
182 bendavid 1.35 void SetD0PV(Double_t x) { fD0PV = x; }
183     void SetD0PVErr(Double_t x) { fD0PVErr = x; }
184     void SetIp3dPV(Double_t x) { fIp3dPV = x; }
185     void SetIp3dPVErr(Double_t x) { fIp3dPVErr = x; }
186     void SetD0PVBS(Double_t x) { fD0PVBS = x; }
187     void SetD0PVBSErr(Double_t x) { fD0PVBSErr = x; }
188     void SetIp3dPVBS(Double_t x) { fIp3dPVBS = x; }
189     void SetIp3dPVBSErr(Double_t x) { fIp3dPVBSErr = x; }
190 paus 1.45 void SetD0PVUB(Double_t x) { fD0PVUB = x; }
191     void SetD0PVUBErr(Double_t x) { fD0PVUBErr = x; }
192     void SetIp3dPVUB(Double_t x) { fIp3dPVUB = x; }
193     void SetIp3dPVUBErr(Double_t x) { fIp3dPVUBErr = x; }
194     void SetD0PVUBBS(Double_t x) { fD0PVUBBS = x; }
195     void SetD0PVUBBSErr(Double_t x) { fD0PVUBBSErr = x; }
196     void SetIp3dPVUBBS(Double_t x) { fIp3dPVUBBS = x; }
197     void SetIp3dPVUBBSErr(Double_t x) { fIp3dPVUBBSErr = x; }
198 bendavid 1.36 void SetPVCompatibility(Double_t x) { fPVCompatibility = x; }
199     void SetPVBSCompatibility(Double_t x) { fPVBSCompatibility = x; }
200 bendavid 1.42 void SetTrkKink(Double_t x) { fTrkKink = x; }
201     void SetGlbKink(Double_t x) { fGlbKink = x; }
202 paus 1.45.2.1 void SetValidFraction(Double_t x) { fValidFraction = x; }
203 paus 1.45 void SetEmEnergy(Double_t emEnergy) { fEmEnergy = emEnergy; }
204     void SetEmS9Energy(Double_t emS9Energy) { fEmS9Energy = emS9Energy; }
205     void SetHadEnergy(Double_t hadEnergy) { fHadEnergy = hadEnergy; }
206     void SetHadS9Energy(Double_t hadS9Energy) { fHadS9Energy = hadS9Energy; }
207     void SetHoEnergy(Double_t hoEnergy) { fHoEnergy = hoEnergy; }
208     void SetHoS9Energy(Double_t hoS9Energy) { fHoS9Energy = hoS9Energy; }
209 bendavid 1.27 void SetIsGlobalMuon(Bool_t b) { fIsGlobalMuon = b; }
210     void SetIsTrackerMuon(Bool_t b) { fIsTrackerMuon = b; }
211     void SetIsStandaloneMuon(Bool_t b) { fIsStandaloneMuon = b; }
212 paus 1.45.2.1 void SetIsPFMuon(Bool_t b) { fIsPFMuon = b; }
213 bendavid 1.27 void SetIsCaloMuon(Bool_t b) { fIsCaloMuon = b; }
214 loizides 1.25 void SetIsoR03SumPt(Double_t isoR03SumPt) { fIsoR03SumPt = isoR03SumPt; }
215     void SetIsoR03EmEt(Double_t isoR03EmEt) { fIsoR03EmEt = isoR03EmEt; }
216     void SetIsoR03HadEt(Double_t isoR03HadEt) { fIsoR03HadEt = isoR03HadEt; }
217     void SetIsoR03HoEt(Double_t isoR03HoEt) { fIsoR03HoEt = isoR03HoEt; }
218 loizides 1.28 void SetIsoR03NTracks(UShort_t isoR03NTrk) { fIsoR03NTracks = isoR03NTrk; }
219     void SetIsoR03NJets(UShort_t isoR03NJets) { fIsoR03NJets = isoR03NJets; }
220 loizides 1.25 void SetIsoR05SumPt(Double_t isoR05SumPt) { fIsoR05SumPt = isoR05SumPt; }
221     void SetIsoR05EmEt(Double_t isoR05EmEt) { fIsoR05EmEt = isoR05EmEt; }
222     void SetIsoR05HadEt(Double_t isoR05HadEt) { fIsoR05HadEt = isoR05HadEt; }
223     void SetIsoR05HoEt(Double_t isoR05HoEt) { fIsoR05HoEt = isoR05HoEt; }
224 loizides 1.28 void SetIsoR05NTracks(UShort_t isoR05NTrk) { fIsoR05NTracks = isoR05NTrk; }
225     void SetIsoR05NJets(UShort_t isoR05NJets) { fIsoR05NJets = isoR05NJets; }
226 pharris 1.37 void SetNValidHits(UShort_t iNValidHits) { fNValidHits = iNValidHits; }
227 loizides 1.28 void SetNChambers(UShort_t iNTraCh) { fNTraversedChambers = iNTraCh; }
228 paus 1.45 void SetNSegments(Int_t iStation, Int_t nSegments);
229 paus 1.45.2.1 void SetNMatches(UShort_t i) { fNMatches = i; }
230     void SetNTrkLayersHit(Int_t i) { fNTrkLayersHit = i; }
231     void SetNTrkLayersNoHit(Int_t i) { fNTrkLayersNoHit = i; }
232     void SetNPxlLayersHit(Int_t i) { fNPxlLayersHit = i; }
233     void SetNTrkLostHitsIn(Int_t i) { fNTrkLostHitsIn = i; }
234     void SetNTrkLostHitsOut(Int_t i) { fNTrkLostHitsOut = i; }
235 bendavid 1.32 void SetPtEtaPhi(Double_t pt, Double_t eta, Double_t phi);
236 loizides 1.16 void SetPullX(Int_t iStation, Double_t iPullX);
237     void SetPullY(Int_t iStation, Double_t iPullY);
238 loizides 1.25 void SetStationMask(UInt_t iStMask) { fStationMask.SetBits(iStMask); }
239 loizides 1.16 void SetTrackDist(Int_t iStation, Double_t iDist);
240     void SetTrackDistErr(Int_t iStation, Double_t iDistErr);
241 pharris 1.15
242 loizides 1.8 protected:
243 bendavid 1.32 Double_t GetCharge() const;
244 paus 1.45.2.1 Double_t GetMass() const { return 105.658369e-3; }
245 bendavid 1.32 void GetMom() const;
246 loizides 1.25
247 bendavid 1.32 Vect3C fMom; //stored three-momentum
248     Char_t fCharge; //stored charge - filled with -99 when reading old files
249 loizides 1.25 Ref<Track> fGlobalTrkRef; //global combined track reference
250     Ref<Track> fStaTrkRef; //standalone muon track reference
251     Ref<Track> fTrkTrkRef; //tracker track reference
252 loizides 1.28 Double32_t fIsoR03SumPt; //[0,0,14]isolation size R=0.3 sum pt
253 paus 1.45.2.1 Double32_t fIsoR03EmEt; //[0,0,14]isolation size R=0.3 em trans energy
254 loizides 1.28 Double32_t fIsoR03HadEt; //[0,0,14]isolation size R=0.3 had trans energy
255     Double32_t fIsoR03HoEt; //[0,0,14]isolation size R=0.3 ho trans energy
256     UShort_t fIsoR03NTracks; //isolation size R=0.3 number of tracks
257     UShort_t fIsoR03NJets; //isolation size R=0.3 number of jets
258     Double32_t fIsoR05SumPt; //[0,0,14]isolation size R=0.5 sum pt
259 paus 1.45.2.1 Double32_t fIsoR05EmEt; //[0,0,14]isolation size R=0.5 em trans energy
260 loizides 1.28 Double32_t fIsoR05HadEt; //[0,0,14]isolation size R=0.5 had trans energy
261     Double32_t fIsoR05HoEt; //[0,0,14]isolation size R=0.5 ho trans energy
262     UShort_t fIsoR05NTracks; //isolation size R=0.5 number of tracks
263 paus 1.45.2.1 UShort_t fIsoR05NJets; //isolation size R=0.5 number of jets
264 loizides 1.28 Double32_t fEmEnergy; //[0,0,14]energy deposit in ecal
265     Double32_t fHadEnergy; //[0,0,14]energy deposit in hcal
266     Double32_t fHoEnergy; //[0,0,14]energy deposit in outer hcal
267 paus 1.45.2.1 Double32_t fEmS9Energy; //[0,0,14]energy deposit in 3x3 ecal
268 loizides 1.28 Double32_t fHadS9Energy; //[0,0,14]energy deposit in 3x3 hcal
269     Double32_t fHoS9Energy; //[0,0,14]energy deposit in 3x3 outer hcal
270 bendavid 1.35 Double32_t fD0PV; //[0,0,14]transverse impact parameter to signal PV
271     Double32_t fD0PVErr; //[0,0,14]transverse impact parameter uncertainty to signal PV
272     Double32_t fIp3dPV; //[0,0,14]3d impact parameter to signal PV
273     Double32_t fIp3dPVErr; //[0,0,14]3d impact parameter uncertainty to signal PV
274     Double32_t fD0PVBS; //[0,0,14]transverse impact parameter to signal PV w/ bs constraint
275     Double32_t fD0PVBSErr; //[0,0,14]transverse impact parameter uncertainty to signal PV w/ bs constraint
276     Double32_t fIp3dPVBS; //[0,0,14]3d impact parameter to signal PV w/ bs constraint
277     Double32_t fIp3dPVBSErr; //[0,0,14]3d impact parameter uncertainty to signal PV w/ bs constraint
278 bendavid 1.44 Double32_t fPVCompatibility; //[0,0,14]chi^2 compatibility with signal PV (ndof=2)
279 paus 1.45.2.1 Double32_t fPVBSCompatibility; //[0,0,14]chi^2 compatibility with signal PV w/ bs constraint (ndof=2)
280 paus 1.45 Double32_t fD0PVUB; //[0,0,14]transverse impact parameter to signal PVUB (unbiased primary vertex - refit removing lepton track)
281     Double32_t fD0PVUBErr; //[0,0,14]transverse impact parameter uncertainty to signal PVUB
282     Double32_t fIp3dPVUB; //[0,0,14]3d impact parameter to signal PVUB
283     Double32_t fIp3dPVUBErr; //[0,0,14]3d impact parameter uncertainty to signal PVUB
284     Double32_t fD0PVUBBS; //[0,0,14]transverse impact parameter to signal PVUB w/ bs constraint
285     Double32_t fD0PVUBBSErr; //[0,0,14]transverse impact parameter uncertainty to signal PVUB w/ bs constraint
286     Double32_t fIp3dPVUBBS; //[0,0,14]3d impact parameter to signal PVUB w/ bs constraint
287     Double32_t fIp3dPVUBBSErr; //[0,0,14]3d impact parameter uncertainty to signal PVUB w/ bs constraint
288 bendavid 1.42 Double32_t fTrkKink; //[0,0,14]kink algorithm output (tracker track)
289     Double32_t fGlbKink; //[0,0,14]kink algorithm output (global track)
290 paus 1.45.2.1 Double32_t fValidFraction; //valid tracker hits divided by expected tracker hits
291 pharris 1.37 UShort_t fNValidHits; //number of Valid hits in global fit
292 loizides 1.28 UShort_t fNTraversedChambers; //number of traversed chambers
293 ceballos 1.40 UShort_t fNMatches; //number of muon chambers with matches
294 paus 1.45.2.1 Int_t fNTrkLayersHit; //number of tracker layers of track
295     Int_t fNTrkLayersNoHit; //number of missing tracker layers of track
296     Int_t fNPxlLayersHit; //number of pixel layers of track
297     Int_t fNTrkLostHitsIn; //number of expected hits before the first hit in the trajectory
298     Int_t fNTrkLostHitsOut; //number of expected hits after the last hit in the trajectory
299 sixie 1.34 MuonQuality fQuality; //muon quality
300 loizides 1.18 BitMask8 fStationMask; //bitmap of station with tracks, 0-3 DT, 4-7 CSCs
301 loizides 1.28 Double32_t fDX[8]; //[0,0,14]uncertainty in x in given muon chamber
302     Double32_t fDY[8]; //[0,0,14]uncertainty in y in given muon chamber
303     Double32_t fPullX[8]; //[0,0,14]pull in x in given muon chamber
304     Double32_t fPullY[8]; //[0,0,14]pull in y in given muon chamber
305     Double32_t fTrackDist[8]; //[0,0,14]dist. to track in trans. plane in muon chamber
306     Double32_t fTrackDistErr[8]; //[0,0,14]error of dist. to track in trans. plane
307 loizides 1.18 Int_t fNSegments[8]; //number of segments in given muon chamber
308 loizides 1.28 Bool_t fIsGlobalMuon; //GlobalMuon algo flag
309     Bool_t fIsTrackerMuon; //TrackerMuon algo flag
310     Bool_t fIsStandaloneMuon; //StandaloneMuon algo flag
311 paus 1.45.2.1 Bool_t fIsPFMuon; //particle flow muon flag
312 loizides 1.28 Bool_t fIsCaloMuon; //CaloMuon algo flag
313 loizides 1.16
314 paus 1.45.2.1 ClassDef(Muon, 9) // Muon class
315 loizides 1.1 };
316 loizides 1.4 }
317 loizides 1.8
318 loizides 1.9 //--------------------------------------------------------------------------------------------------
319 loizides 1.10 inline const mithep::Track *mithep::Muon::BestTrk() const
320     {
321     // Return "best" track.
322    
323 ceballos 1.39 if (HasTrackerTrk())
324     return TrackerTrk();
325     else if (HasGlobalTrk())
326 loizides 1.10 return GlobalTrk();
327 loizides 1.23 else if (HasStandaloneTrk())
328 loizides 1.10 return StandaloneTrk();
329    
330 loizides 1.20 Error("BestTrk", "No track reference found, returning NULL pointer.");
331 loizides 1.10 return 0;
332     }
333    
334     //--------------------------------------------------------------------------------------------------
335 bendavid 1.32 inline Double_t mithep::Muon::GetCharge() const
336     {
337     // Return stored charge, unless it is set to invalid (-99),
338     // in that case get charge from track as before
339    
340     if (fCharge==-99)
341     return mithep::ChargedParticle::GetCharge();
342     else
343     return fCharge;
344     }
345    
346     //--------------------------------------------------------------------------------------------------
347     inline void mithep::Muon::GetMom() const
348     {
349     // Get momentum of the muon. We use an explicitly stored three vector, with the pdg mass,
350     // since the momentum vector may be computed non-trivially in cmssw (since the tracker
351     // information has better resolution apparently in some cases than the global fit.)
352     // If momentum is unfilled, fall back to old method of getting momentum from best track
353     // (for backwards compatibility.)
354 paus 1.45.2.1
355     if (fMom.Rho()>0.0)
356 bendavid 1.32 fCachedMom.SetCoordinates(fMom.Rho(),fMom.Eta(),fMom.Phi(),GetMass());
357 paus 1.45.2.1 else
358 bendavid 1.32 mithep::ChargedParticle::GetMom();
359     }
360    
361     //--------------------------------------------------------------------------------------------------
362 paus 1.45.2.1 inline Double_t mithep::Muon::GetDX(Int_t iStation) const
363 loizides 1.16 {
364     // Return uncertainty in x in given chamber.
365    
366     assert(iStation >= 0 && iStation < 8);
367 paus 1.45.2.1 return fDX[iStation];
368 loizides 1.16 }
369    
370     //--------------------------------------------------------------------------------------------------
371 paus 1.45.2.1 inline Double_t mithep::Muon::GetDY(Int_t iStation) const
372 loizides 1.16 {
373     // Return uncertainty in y in given chamber.
374    
375     assert(iStation >= 0 && iStation < 8);
376 paus 1.45.2.1 return fDY[iStation];
377 loizides 1.16 }
378    
379     //--------------------------------------------------------------------------------------------------
380 paus 1.45.2.1 inline Double_t mithep::Muon::GetPullX(Int_t iStation) const
381 loizides 1.16 {
382     // Return pull in x in given chamber.
383    
384     assert(iStation >= 0 && iStation < 8);
385 paus 1.45.2.1 return fPullX[iStation];
386 loizides 1.16 }
387    
388     //--------------------------------------------------------------------------------------------------
389 paus 1.45.2.1 inline Double_t mithep::Muon::GetPullY(Int_t iStation) const
390 loizides 1.16 {
391     // Return pull in y in given chamber.
392 paus 1.45.2.1
393 loizides 1.16 assert(iStation >= 0 && iStation < 8);
394 paus 1.45.2.1 return fPullY[iStation];
395 loizides 1.16 }
396    
397     //--------------------------------------------------------------------------------------------------
398 paus 1.45.2.1 inline Double_t mithep::Muon::GetTrackDist(Int_t iStation) const
399 loizides 1.16 {
400     // Return track distance in given chamber.
401    
402     assert(iStation >= 0 && iStation < 8);
403 paus 1.45.2.1 return fTrackDist[iStation];
404 loizides 1.16 }
405    
406     //--------------------------------------------------------------------------------------------------
407 paus 1.45.2.1 inline Double_t mithep::Muon::GetTrackDistErr(Int_t iStation) const
408 loizides 1.16 {
409     // Return error of track distance in given chamber.
410    
411     assert(iStation >= 0 && iStation < 8);
412 paus 1.45.2.1 return fTrackDistErr[iStation];
413 loizides 1.16 }
414    
415     //--------------------------------------------------------------------------------------------------
416 paus 1.45.2.1 inline Int_t mithep::Muon::GetNSegments(Int_t iStation) const
417 loizides 1.16 {
418     // Return number of segments in chamber.
419    
420     assert(iStation >= 0 && iStation < 8);
421 paus 1.45.2.1 return fNSegments[iStation];
422 loizides 1.16 }
423    
424     //--------------------------------------------------------------------------------------------------
425 loizides 1.18 inline Bool_t mithep::Muon::Has(EClassType type) const
426     {
427     // Return true if the muon has a track of given class.
428    
429     switch (type) {
430     case kAny:
431 paus 1.45.2.1 if (HasTrk())
432 loizides 1.18 return kTRUE;
433     break;
434     case kGlobal:
435 paus 1.45.2.1 if (HasGlobalTrk())
436 loizides 1.18 return kTRUE;
437     break;
438 loizides 1.31 case kTracker:
439 paus 1.45.2.1 if (HasTrackerTrk())
440 loizides 1.18 return kTRUE;
441     break;
442     case kSta:
443 paus 1.45.2.1 if (HasStandaloneTrk())
444 loizides 1.18 return kTRUE;
445     break;
446     case kNone:
447 paus 1.45.2.1 if (!HasTrk())
448 loizides 1.18 return kTRUE;
449     break;
450     default:
451     break;
452     }
453    
454     return kFALSE;
455     }
456    
457     //--------------------------------------------------------------------------------------------------
458 loizides 1.23 inline Bool_t mithep::Muon::HasTrk() const
459     {
460     // Return true if the muon has assigned any kind of track.
461    
462     return (HasGlobalTrk() || HasTrackerTrk() || HasStandaloneTrk());
463     }
464    
465     //--------------------------------------------------------------------------------------------------
466 loizides 1.18 inline mithep::Muon::EClassType mithep::Muon::Is() const
467     {
468     // Return the "best" classification of the muon according to the assigned tracks.
469    
470 loizides 1.23 if (HasGlobalTrk())
471 loizides 1.18 return kGlobal;
472 loizides 1.23 else if (HasTrackerTrk())
473 loizides 1.31 return kTracker;
474 loizides 1.23 else if (HasStandaloneTrk())
475 loizides 1.18 return kSta;
476    
477     return kNone;
478     }
479    
480     //--------------------------------------------------------------------------------------------------
481     inline Int_t mithep::Muon::LastHit() const
482     {
483     // Return the last hit, or -1 if no one found.
484    
485     Int_t lId = -1;
486     for (Int_t i0 = 0; i0 < 8; ++i0) {
487 paus 1.45.2.1 if (GetDX(i0) < 99999 || GetDY(i0) < 99999)
488 loizides 1.18 lId = i0;
489     }
490     return lId;
491     }
492    
493     //--------------------------------------------------------------------------------------------------
494     inline Int_t mithep::Muon::LastStation(Int_t iMax) const
495     {
496     // Return the last station, or -1 of no one found.
497    
498 paus 1.45.2.1 Int_t lId = -1;
499     if(TMath::Abs(iMax) > 8)
500 loizides 1.18 iMax = 8;
501     for (Int_t i0 = 0; i0 < iMax; ++i0) {
502     if (StationBit(i0) && ((lId % 4) < (i0 % 4)))
503     lId = i0;
504     }
505     return lId;
506     }
507    
508     //--------------------------------------------------------------------------------------------------
509     inline Int_t mithep::Muon::LastStation(Double_t iMaxD, Double_t iMaxP) const
510     {
511     // Return the last station for given deviation and relative error, or -1 if no one found.
512    
513     Int_t lId = -1;
514     for (Int_t i0 = 0; i0 < 8; ++i0) {
515 paus 1.45.2.1 if ((lId % 4) > (i0 % 4))
516 loizides 1.18 continue;
517     if (GetTrackDist(i0) < iMaxD &&
518 paus 1.45.2.1 GetTrackDist(i0)/GetTrackDistErr(i0) < iMaxP)
519 loizides 1.18 lId = i0;
520     }
521     return lId;
522     }
523    
524     //--------------------------------------------------------------------------------------------------
525     inline Bool_t mithep::Muon::PromptTight(EClassType type) const
526     {
527     // Return whether track for given class matches tight quality criteria.
528    
529     const mithep::Track *lTrack = 0;
530     switch (type) {
531     case kAny:
532     lTrack = BestTrk();
533     break;
534     case kGlobal:
535     lTrack = GlobalTrk();
536     break;
537 loizides 1.31 case kTracker:
538 loizides 1.18 lTrack = TrackerTrk();
539     break;
540     case kSta:
541     lTrack = StandaloneTrk();
542     break;
543     default:
544     break;
545     }
546    
547 paus 1.45.2.1 if (lTrack == 0)
548 loizides 1.18 return kFALSE;
549 paus 1.45.2.1 if (lTrack->NHits() < 11)
550 loizides 1.18 return kFALSE;
551 paus 1.45.2.1 if (lTrack->Chi2()/lTrack->Ndof() > 10.)
552 loizides 1.18 return kFALSE;
553 paus 1.45.2.1 if (lTrack->D0() > 0.2)
554 loizides 1.18 return kFALSE;
555 paus 1.45.2.1 if ((LastHit() % 4) == 0)
556 loizides 1.18 return kFALSE;
557     return kTRUE;
558     }
559    
560     //--------------------------------------------------------------------------------------------------
561     inline Bool_t mithep::Muon::TMOneStation(Double_t iDYMin, Double_t iPYMin,
562 loizides 1.28 Double_t iDXMin, Double_t iPXMin, UInt_t iN) const
563 loizides 1.18 {
564 paus 1.45.2.1 // Check if the muon is matched to at least one station (chamber).
565 loizides 1.18
566     if (NSegments() < iN)
567     return kFALSE; //second last one
568    
569 paus 1.45.2.1 Bool_t pGoodX = kFALSE;
570 ceballos 1.19 Bool_t pBadY = kFALSE;
571 loizides 1.18 for (Int_t i0 = 0; i0 < 8; ++i0) {
572     if ((TMath::Abs(GetDX(i0)) < iDXMin ||
573 paus 1.45.2.1 TMath::Abs(GetPullX(i0)) < iPXMin))
574     pGoodX = kTRUE;
575 loizides 1.18 if (pGoodX &&
576 paus 1.45.2.1 (TMath::Abs(GetDY(i0)) < iDYMin ||
577     TMath::Abs(GetPullY(i0)) < iPYMin))
578 loizides 1.18 return kTRUE;
579 paus 1.45.2.1 if (TMath::Abs(GetDY(i0)) < 999999)
580 loizides 1.18 pBadY = kTRUE;
581 paus 1.45.2.1 if (i0 == 3 && pGoodX && !pBadY)
582 loizides 1.18 return kTRUE;
583     }
584     return kFALSE;
585     }
586    
587     //--------------------------------------------------------------------------------------------------
588     inline Bool_t mithep::Muon::TMLastStation(Double_t iDYMin, Double_t iPYMin,
589 loizides 1.28 Double_t iDXMin, Double_t iPXMin, UInt_t iN) const
590 loizides 1.18 {
591 paus 1.45.2.1 // Check if the muon is matched to its last station (chamber).
592    
593     if (NSegments() < iN)
594 loizides 1.18 return kFALSE; //second last one
595    
596     Int_t lLast = LastStation(-3.,-3.); // last required station
597 paus 1.45.2.1 if (lLast < 0)
598 loizides 1.18 return kFALSE;
599 paus 1.45.2.1 if (GetDX(lLast) > 9999.)
600 loizides 1.18 return kFALSE;
601     lLast = LastStation(); //no requirements
602 paus 1.45.2.1 if (lLast < 0)
603 loizides 1.18 return kFALSE;
604     if (!(TMath::Abs(GetDX(lLast)) < iDXMin ||
605 paus 1.45.2.1 TMath::Abs(GetPullX(lLast)) < iPXMin))
606 loizides 1.18 return kFALSE;
607 paus 1.45.2.1 if (lLast == 3)
608 loizides 1.18 lLast = LastStation(3);
609 paus 1.45.2.1 if (lLast < 0)
610 loizides 1.18 return kFALSE;
611     if (!(TMath::Abs(GetDY(lLast)) < iDYMin ||
612 paus 1.45.2.1 TMath::Abs(GetPullY(lLast)) < iPYMin))
613 loizides 1.18 return kFALSE;
614     return kTRUE;
615     }
616    
617     //--------------------------------------------------------------------------------------------------
618 paus 1.45.2.1 inline void mithep::Muon::SetDX(Int_t iStation, Double_t iDX)
619 loizides 1.16 {
620     // Return uncertainty in x in given chamber.
621    
622     assert(iStation >= 0 && iStation < 8);
623     fDX[iStation] = iDX;
624     }
625    
626     //--------------------------------------------------------------------------------------------------
627     inline void mithep::Muon::SetDY(Int_t iStation, Double_t iDY)
628     {
629     // Return uncertainty in y in given chamber.
630    
631     assert(iStation >= 0 && iStation < 8);
632     fDY[iStation] = iDY;
633     }
634    
635     //--------------------------------------------------------------------------------------------------
636     inline void mithep::Muon::SetPullX(Int_t iStation, Double_t iPullX)
637     {
638     // Set pull in x in given chamber.
639    
640     assert(iStation >= 0 && iStation < 8);
641     fPullX[iStation] = iPullX;
642     }
643    
644     //--------------------------------------------------------------------------------------------------
645 paus 1.45.2.1 inline void mithep::Muon::SetPullY(Int_t iStation, Double_t iPullY)
646 loizides 1.16 {
647     // Set pull in y in given chamber.
648    
649     assert(iStation >= 0 && iStation < 8);
650     fPullY[iStation] = iPullY;
651     }
652    
653     //--------------------------------------------------------------------------------------------------
654 paus 1.45.2.1 inline void mithep::Muon::SetTrackDist(Int_t iStation, Double_t iDist)
655 loizides 1.23
656 loizides 1.16 {
657     // Set track distance in given chamber.
658    
659     assert(iStation >= 0 && iStation < 8);
660     fTrackDist[iStation] = iDist;
661     }
662    
663     //--------------------------------------------------------------------------------------------------
664     inline void mithep::Muon::SetTrackDistErr(Int_t iStation, Double_t iDistErr)
665     {
666     // Set error of track distance in given chamber.
667 pharris 1.15
668 loizides 1.16 assert(iStation >= 0 && iStation < 8);
669     fTrackDistErr[iStation] = iDistErr;
670     }
671 pharris 1.15
672 loizides 1.16 //--------------------------------------------------------------------------------------------------
673 paus 1.45.2.1 inline void mithep::Muon::SetNSegments(Int_t iStation, Int_t nSegments)
674 loizides 1.16 {
675     // Set number of segments in chamber.
676 pharris 1.15
677 loizides 1.16 assert(iStation >= 0 && iStation < 8);
678 paus 1.45 fNSegments[iStation] = nSegments;
679 loizides 1.16 }
680 bendavid 1.32
681     //-------------------------------------------------------------------------------------------------
682     inline void mithep::Muon::SetPtEtaPhi(Double_t pt, Double_t eta, Double_t phi)
683     {
684     // Set three-vector
685 paus 1.45.2.1
686 bendavid 1.32 fMom.Set(pt,eta,phi);
687     ClearMom();
688     }
689 loizides 1.16 #endif