ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/Muon.h
Revision: 1.47
Committed: Thu Mar 29 23:41:55 2012 UTC (13 years, 1 month ago) by paus
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_026, Mit_025e
Changes since 1.46: +10 -10 lines
Log Message:
Version with working skimming and last 4.4 tag.

File Contents

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