ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/Muon.h
Revision: 1.36
Committed: Fri May 21 18:50:07 2010 UTC (14 years, 11 months ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_014pre3
Changes since 1.35: +8 -2 lines
Log Message:
add pv compatibility variables

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 bendavid 1.36 // $Id: Muon.h,v 1.35 2010/05/06 17:30:39 bendavid 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     // LastHit : Returns farest (from center) station with a recorded segment
47     // LastStation : Returns farest station using Segment+Track Arbitration
48     //
49 pharris 1.22 // Muon Id Methods: Please see Muon Id Note(as of now unpublished):
50     // https://www.cmsaf.mit.edu/twiki/pub/CmsHep/HepWAnalysis/MuonID-ingo.pdf
51 loizides 1.23 // TMOneStation : Returns bool whether muon passes "Tracker Muon One StationId"
52     // -Matching criteria for one of all segments matched to muon
53     // TMLastStation : Returns bool whether muon passes "LastStation Id" criteria
54     // -Matching criteria for last most segment
55 loizides 1.1 //
56 loizides 1.16 // Authors: J.Bendavid, C.Loizides, C.Paus, P.Harris
57 loizides 1.1 //--------------------------------------------------------------------------------------------------
58 loizides 1.6
59 loizides 1.16 #ifndef MITANA_DATATREE_MUON_H
60     #define MITANA_DATATREE_MUON_H
61 loizides 1.8
62 loizides 1.16 #include "MitAna/DataTree/interface/Track.h"
63 bendavid 1.11 #include "MitAna/DataTree/interface/ChargedParticle.h"
64 sixie 1.34 #include "MitAna/DataTree/interface/MuonQuality.h"
65 pharris 1.15
66     namespace mithep {
67     class Muon : public ChargedParticle {
68 loizides 1.1 public:
69 loizides 1.20 Muon();
70 loizides 1.18
71     enum EClassType {
72     kNone, //no track assigned
73     kGlobal, //"Global"
74 loizides 1.31 kTracker, //"Tracker"
75 loizides 1.18 kSta, //"Standalone"
76     kAny //any "best" of the above
77     };
78 bendavid 1.2
79 loizides 1.23 const Track *BestTrk() const;
80 loizides 1.30 const Track *GlobalTrk() const { return fGlobalTrkRef.Obj(); }
81     const Track *StandaloneTrk() const { return fStaTrkRef.Obj(); }
82     const Track *TrackerTrk() const { return fTrkTrkRef.Obj(); }
83     const Track *Trk() const { return BestTrk(); }
84 bendavid 1.35 Double_t D0PV() const { return fD0PV; }
85     Double_t D0PVErr() const { return fD0PVErr; }
86     Double_t D0PVSignificance() const { return fD0PV/fD0PVErr; }
87     Double_t Ip3dPV() const { return fIp3dPV; }
88     Double_t Ip3dPVErr() const { return fIp3dPVErr; }
89     Double_t Ip3dPVSignificance() const { return fIp3dPV/fIp3dPVErr; }
90     Double_t D0PVBS() const { return fD0PVBS; }
91     Double_t D0PVBSErr() const { return fD0PVBSErr; }
92     Double_t D0PVBSSignificance() const { return fD0PVBS/fD0PVBSErr; }
93     Double_t Ip3dPVBS() const { return fIp3dPVBS; }
94     Double_t Ip3dPVBSErr() const { return fIp3dPVBSErr; }
95     Double_t Ip3dPVBSSignificance() const { return fIp3dPVBS/fIp3dPVBSErr; }
96 bendavid 1.36 Double_t PVCompatibility() const { return fPVCompatibility; }
97     Double_t PVBSCompatibility() const { return fPVBSCompatibility; }
98 loizides 1.30 Double_t EmEnergy() const { return fEmEnergy; }
99     Double_t EmS9Energy() const { return fEmS9Energy; }
100 loizides 1.20 Double_t GetDX(Int_t iStation) const;
101     Double_t GetDY(Int_t iStation) const;
102     Double_t GetPullX(Int_t iStation) const;
103     Double_t GetPullY(Int_t iStation) const;
104     Double_t GetTrackDist(Int_t iStation) const;
105     Double_t GetTrackDistErr(Int_t iStation) const;
106     Int_t GetNSegments(Int_t iStation) const;
107     Bool_t Has(EClassType type) const;
108 loizides 1.23 Bool_t HasTrk() const;
109 loizides 1.25 Bool_t HasGlobalTrk() const { return fGlobalTrkRef.IsValid(); }
110     Bool_t HasStandaloneTrk() const { return fStaTrkRef.IsValid(); }
111     Bool_t HasTrackerTrk() const { return fTrkTrkRef.IsValid(); }
112 loizides 1.23 Double_t HadEnergy() const { return fHadEnergy; }
113     Double_t HadS9Energy() const { return fHadS9Energy; }
114     Double_t HoEnergy() const { return fHoEnergy; }
115     Double_t HoS9Energy() const { return fHoS9Energy; }
116 loizides 1.20 EClassType Is() const;
117 bendavid 1.27 Bool_t IsGlobalMuon() const { return fIsGlobalMuon; }
118     Bool_t IsTrackerMuon() const { return fIsTrackerMuon; }
119     Bool_t IsStandaloneMuon() const { return fIsStandaloneMuon; }
120     Bool_t IsCaloMuon() const { return fIsCaloMuon; }
121 loizides 1.23 Double_t IsoR03SumPt() const { return fIsoR03SumPt; }
122     Double_t IsoR03EmEt() const { return fIsoR03EmEt; }
123     Double_t IsoR03HadEt() const { return fIsoR03HadEt; }
124     Double_t IsoR03HoEt() const { return fIsoR03HoEt; }
125 loizides 1.28 UShort_t IsoR03NTracks() const { return fIsoR03NTracks; }
126     UShort_t IsoR03NJets() const { return fIsoR03NJets; }
127 loizides 1.23 Double_t IsoR05SumPt() const { return fIsoR05SumPt; }
128     Double_t IsoR05EmEt() const { return fIsoR05EmEt; }
129     Double_t IsoR05HadEt() const { return fIsoR05HadEt; }
130     Double_t IsoR05HoEt() const { return fIsoR05HoEt; }
131 loizides 1.28 UShort_t IsoR05NTracks() const { return fIsoR05NTracks; }
132     UShort_t IsoR05NJets() const { return fIsoR05NJets; }
133     UInt_t NChambers() const { return fNTraversedChambers; }
134     UInt_t NSegments() const { return fStationMask.NBitsSet(); }
135 loizides 1.20 Int_t LastHit() const;
136 loizides 1.18 Int_t LastStation(Double_t iMaxD, Double_t iMaxP) const;
137 sixie 1.34 Int_t LastStation(Int_t iMax=8) const;
138 loizides 1.30 Int_t ObjId() const { return ObjType()*1000+Is(); }
139 loizides 1.25 EObjType ObjType() const { return kMuon; }
140 loizides 1.29 void Print(Option_t *opt="") const;
141 sixie 1.34 Bool_t PromptTight(EClassType type) const;
142     const MuonQuality &Quality() const { return fQuality; }
143     MuonQuality &Quality() { return fQuality; }
144 loizides 1.23 Bool_t StationBit(Int_t bit) const { return fStationMask.TestBit(bit); }
145 loizides 1.28 Bool_t TMLastStation(Double_t iDYMin = 3, Double_t iPYMin = 3,
146     Double_t iDXMin = 3, Double_t iPXMin = 3,UInt_t iN = 2) const;
147     Bool_t TMOneStation(Double_t iDYMin = 3, Double_t iPYMin = 3,
148     Double_t iDXMin = 3, Double_t iPXMin = 3,UInt_t iN = 1) const;
149 bendavid 1.33 void SetCharge(Char_t x) { fCharge = x; ClearCharge(); }
150 loizides 1.28 void SetGlobalTrk(const Track *t)
151     { fGlobalTrkRef = t; ClearMom(); ClearCharge(); }
152     void SetStandaloneTrk(const Track *t)
153     { fStaTrkRef = t; ClearMom(); ClearCharge(); }
154     void SetTrackerTrk(const Track *t)
155     { fTrkTrkRef = t; ClearMom(); ClearCharge(); }
156 loizides 1.23 void SetDX(Int_t iStation, Double_t iDX);
157     void SetDY(Int_t iStation, Double_t iDY);
158 bendavid 1.35 void SetD0PV(Double_t x) { fD0PV = x; }
159     void SetD0PVErr(Double_t x) { fD0PVErr = x; }
160     void SetIp3dPV(Double_t x) { fIp3dPV = x; }
161     void SetIp3dPVErr(Double_t x) { fIp3dPVErr = x; }
162     void SetD0PVBS(Double_t x) { fD0PVBS = x; }
163     void SetD0PVBSErr(Double_t x) { fD0PVBSErr = x; }
164     void SetIp3dPVBS(Double_t x) { fIp3dPVBS = x; }
165     void SetIp3dPVBSErr(Double_t x) { fIp3dPVBSErr = x; }
166 bendavid 1.36 void SetPVCompatibility(Double_t x) { fPVCompatibility = x; }
167     void SetPVBSCompatibility(Double_t x) { fPVBSCompatibility = x; }
168 loizides 1.25 void SetEmEnergy(Double_t EmEnergy) { fEmEnergy = EmEnergy; }
169     void SetEmS9Energy(Double_t EmS9Energy) { fEmS9Energy = EmS9Energy; }
170     void SetHadEnergy(Double_t HadEnergy) { fHadEnergy = HadEnergy; }
171     void SetHadS9Energy(Double_t HadS9Energy) { fHadS9Energy = HadS9Energy; }
172     void SetHoEnergy(Double_t HoEnergy) { fHoEnergy = HoEnergy; }
173     void SetHoS9Energy(Double_t HoS9Energy) { fHoS9Energy = HoS9Energy; }
174 bendavid 1.27 void SetIsGlobalMuon(Bool_t b) { fIsGlobalMuon = b; }
175     void SetIsTrackerMuon(Bool_t b) { fIsTrackerMuon = b; }
176     void SetIsStandaloneMuon(Bool_t b) { fIsStandaloneMuon = b; }
177     void SetIsCaloMuon(Bool_t b) { fIsCaloMuon = b; }
178 loizides 1.25 void SetIsoR03SumPt(Double_t isoR03SumPt) { fIsoR03SumPt = isoR03SumPt; }
179     void SetIsoR03EmEt(Double_t isoR03EmEt) { fIsoR03EmEt = isoR03EmEt; }
180     void SetIsoR03HadEt(Double_t isoR03HadEt) { fIsoR03HadEt = isoR03HadEt; }
181     void SetIsoR03HoEt(Double_t isoR03HoEt) { fIsoR03HoEt = isoR03HoEt; }
182 loizides 1.28 void SetIsoR03NTracks(UShort_t isoR03NTrk) { fIsoR03NTracks = isoR03NTrk; }
183     void SetIsoR03NJets(UShort_t isoR03NJets) { fIsoR03NJets = isoR03NJets; }
184 loizides 1.25 void SetIsoR05SumPt(Double_t isoR05SumPt) { fIsoR05SumPt = isoR05SumPt; }
185     void SetIsoR05EmEt(Double_t isoR05EmEt) { fIsoR05EmEt = isoR05EmEt; }
186     void SetIsoR05HadEt(Double_t isoR05HadEt) { fIsoR05HadEt = isoR05HadEt; }
187     void SetIsoR05HoEt(Double_t isoR05HoEt) { fIsoR05HoEt = isoR05HoEt; }
188 loizides 1.28 void SetIsoR05NTracks(UShort_t isoR05NTrk) { fIsoR05NTracks = isoR05NTrk; }
189     void SetIsoR05NJets(UShort_t isoR05NJets) { fIsoR05NJets = isoR05NJets; }
190     void SetNChambers(UShort_t iNTraCh) { fNTraversedChambers = iNTraCh; }
191 loizides 1.23 void SetNSegments(Int_t iStation, Int_t NSegments);
192 bendavid 1.32 void SetPtEtaPhi(Double_t pt, Double_t eta, Double_t phi);
193 loizides 1.16 void SetPullX(Int_t iStation, Double_t iPullX);
194     void SetPullY(Int_t iStation, Double_t iPullY);
195 loizides 1.25 void SetStationMask(UInt_t iStMask) { fStationMask.SetBits(iStMask); }
196 loizides 1.16 void SetTrackDist(Int_t iStation, Double_t iDist);
197     void SetTrackDistErr(Int_t iStation, Double_t iDistErr);
198 pharris 1.15
199 loizides 1.8 protected:
200 bendavid 1.32 Double_t GetCharge() const;
201 loizides 1.25 Double_t GetMass() const { return 105.658369e-3; }
202 bendavid 1.32 void GetMom() const;
203 loizides 1.25
204 bendavid 1.32 Vect3C fMom; //stored three-momentum
205     Char_t fCharge; //stored charge - filled with -99 when reading old files
206 loizides 1.25 Ref<Track> fGlobalTrkRef; //global combined track reference
207     Ref<Track> fStaTrkRef; //standalone muon track reference
208     Ref<Track> fTrkTrkRef; //tracker track reference
209 loizides 1.28 Double32_t fIsoR03SumPt; //[0,0,14]isolation size R=0.3 sum pt
210     Double32_t fIsoR03EmEt; //[0,0,14]isolation size R=0.3 em trans energy
211     Double32_t fIsoR03HadEt; //[0,0,14]isolation size R=0.3 had trans energy
212     Double32_t fIsoR03HoEt; //[0,0,14]isolation size R=0.3 ho trans energy
213     UShort_t fIsoR03NTracks; //isolation size R=0.3 number of tracks
214     UShort_t fIsoR03NJets; //isolation size R=0.3 number of jets
215     Double32_t fIsoR05SumPt; //[0,0,14]isolation size R=0.5 sum pt
216     Double32_t fIsoR05EmEt; //[0,0,14]isolation size R=0.5 em trans energy
217     Double32_t fIsoR05HadEt; //[0,0,14]isolation size R=0.5 had trans energy
218     Double32_t fIsoR05HoEt; //[0,0,14]isolation size R=0.5 ho trans energy
219     UShort_t fIsoR05NTracks; //isolation size R=0.5 number of tracks
220     UShort_t fIsoR05NJets; //isolation size R=0.5 number of jets
221     Double32_t fEmEnergy; //[0,0,14]energy deposit in ecal
222     Double32_t fHadEnergy; //[0,0,14]energy deposit in hcal
223     Double32_t fHoEnergy; //[0,0,14]energy deposit in outer hcal
224     Double32_t fEmS9Energy; //[0,0,14]energy deposit in 3x3 ecal
225     Double32_t fHadS9Energy; //[0,0,14]energy deposit in 3x3 hcal
226     Double32_t fHoS9Energy; //[0,0,14]energy deposit in 3x3 outer hcal
227 bendavid 1.35 Double32_t fD0PV; //[0,0,14]transverse impact parameter to signal PV
228     Double32_t fD0PVErr; //[0,0,14]transverse impact parameter uncertainty to signal PV
229     Double32_t fIp3dPV; //[0,0,14]3d impact parameter to signal PV
230     Double32_t fIp3dPVErr; //[0,0,14]3d impact parameter uncertainty to signal PV
231     Double32_t fD0PVBS; //[0,0,14]transverse impact parameter to signal PV w/ bs constraint
232     Double32_t fD0PVBSErr; //[0,0,14]transverse impact parameter uncertainty to signal PV w/ bs constraint
233     Double32_t fIp3dPVBS; //[0,0,14]3d impact parameter to signal PV w/ bs constraint
234     Double32_t fIp3dPVBSErr; //[0,0,14]3d impact parameter uncertainty to signal PV w/ bs constraint
235 bendavid 1.36 Double32_t fPVCompatibility; //[0,0,14]chi^2 compatibility with signal PV (ndof=2)
236     Double32_t fPVBSCompatibility; //[0,0,14]chi^2 compatibility with signal PV w/ bs constraint (ndof=2)
237 loizides 1.28 UShort_t fNTraversedChambers; //number of traversed chambers
238 sixie 1.34 MuonQuality fQuality; //muon quality
239 loizides 1.18 BitMask8 fStationMask; //bitmap of station with tracks, 0-3 DT, 4-7 CSCs
240 loizides 1.28 Double32_t fDX[8]; //[0,0,14]uncertainty in x in given muon chamber
241     Double32_t fDY[8]; //[0,0,14]uncertainty in y in given muon chamber
242     Double32_t fPullX[8]; //[0,0,14]pull in x in given muon chamber
243     Double32_t fPullY[8]; //[0,0,14]pull in y in given muon chamber
244     Double32_t fTrackDist[8]; //[0,0,14]dist. to track in trans. plane in muon chamber
245     Double32_t fTrackDistErr[8]; //[0,0,14]error of dist. to track in trans. plane
246 loizides 1.18 Int_t fNSegments[8]; //number of segments in given muon chamber
247 loizides 1.28 Bool_t fIsGlobalMuon; //GlobalMuon algo flag
248     Bool_t fIsTrackerMuon; //TrackerMuon algo flag
249     Bool_t fIsStandaloneMuon; //StandaloneMuon algo flag
250     Bool_t fIsCaloMuon; //CaloMuon algo flag
251 loizides 1.16
252 bendavid 1.36 ClassDef(Muon, 5) // Muon class
253 loizides 1.1 };
254 loizides 1.4 }
255 loizides 1.8
256 loizides 1.9 //--------------------------------------------------------------------------------------------------
257 loizides 1.10 inline const mithep::Track *mithep::Muon::BestTrk() const
258     {
259     // Return "best" track.
260    
261 loizides 1.23 if (HasGlobalTrk())
262 loizides 1.10 return GlobalTrk();
263 loizides 1.23 else if (HasTrackerTrk())
264 bendavid 1.17 return TrackerTrk();
265 loizides 1.23 else if (HasStandaloneTrk())
266 loizides 1.10 return StandaloneTrk();
267    
268 loizides 1.20 Error("BestTrk", "No track reference found, returning NULL pointer.");
269 loizides 1.10 return 0;
270     }
271    
272     //--------------------------------------------------------------------------------------------------
273 bendavid 1.32 inline Double_t mithep::Muon::GetCharge() const
274     {
275     // Return stored charge, unless it is set to invalid (-99),
276     // in that case get charge from track as before
277    
278     if (fCharge==-99)
279     return mithep::ChargedParticle::GetCharge();
280     else
281     return fCharge;
282    
283     }
284    
285     //--------------------------------------------------------------------------------------------------
286     inline void mithep::Muon::GetMom() const
287     {
288     // Get momentum of the muon. We use an explicitly stored three vector, with the pdg mass,
289     // since the momentum vector may be computed non-trivially in cmssw (since the tracker
290     // information has better resolution apparently in some cases than the global fit.)
291     // If momentum is unfilled, fall back to old method of getting momentum from best track
292     // (for backwards compatibility.)
293    
294     if (fMom.Rho()>0.0) {
295     fCachedMom.SetCoordinates(fMom.Rho(),fMom.Eta(),fMom.Phi(),GetMass());
296     }
297     else {
298     mithep::ChargedParticle::GetMom();
299     }
300    
301     }
302    
303     //--------------------------------------------------------------------------------------------------
304 loizides 1.16 inline Double_t mithep::Muon::GetDX(Int_t iStation) const
305     {
306     // Return uncertainty in x in given chamber.
307    
308     assert(iStation >= 0 && iStation < 8);
309     return fDX[iStation];
310     }
311    
312     //--------------------------------------------------------------------------------------------------
313     inline Double_t mithep::Muon::GetDY(Int_t iStation) const
314     {
315     // Return uncertainty in y in given chamber.
316    
317     assert(iStation >= 0 && iStation < 8);
318     return fDY[iStation];
319     }
320    
321     //--------------------------------------------------------------------------------------------------
322     inline Double_t mithep::Muon::GetPullX(Int_t iStation) const
323     {
324     // Return pull in x in given chamber.
325    
326     assert(iStation >= 0 && iStation < 8);
327     return fPullX[iStation];
328     }
329    
330     //--------------------------------------------------------------------------------------------------
331     inline Double_t mithep::Muon::GetPullY(Int_t iStation) const
332     {
333     // Return pull in y in given chamber.
334    
335     assert(iStation >= 0 && iStation < 8);
336     return fPullY[iStation];
337     }
338    
339     //--------------------------------------------------------------------------------------------------
340     inline Double_t mithep::Muon::GetTrackDist(Int_t iStation) const
341     {
342     // Return track distance in given chamber.
343    
344     assert(iStation >= 0 && iStation < 8);
345     return fTrackDist[iStation];
346     }
347    
348     //--------------------------------------------------------------------------------------------------
349     inline Double_t mithep::Muon::GetTrackDistErr(Int_t iStation) const
350     {
351     // Return error of track distance in given chamber.
352    
353     assert(iStation >= 0 && iStation < 8);
354     return fTrackDistErr[iStation];
355     }
356    
357     //--------------------------------------------------------------------------------------------------
358     inline Int_t mithep::Muon::GetNSegments(Int_t iStation) const
359     {
360     // Return number of segments in chamber.
361    
362     assert(iStation >= 0 && iStation < 8);
363     return fNSegments[iStation];
364     }
365    
366     //--------------------------------------------------------------------------------------------------
367 loizides 1.18 inline Bool_t mithep::Muon::Has(EClassType type) const
368     {
369     // Return true if the muon has a track of given class.
370    
371     switch (type) {
372     case kAny:
373 loizides 1.23 if (HasTrk())
374 loizides 1.18 return kTRUE;
375     break;
376     case kGlobal:
377 loizides 1.23 if (HasGlobalTrk())
378 loizides 1.18 return kTRUE;
379     break;
380 loizides 1.31 case kTracker:
381 loizides 1.23 if (HasTrackerTrk())
382 loizides 1.18 return kTRUE;
383     break;
384     case kSta:
385 loizides 1.23 if (HasStandaloneTrk())
386 loizides 1.18 return kTRUE;
387     break;
388     case kNone:
389 loizides 1.23 if (!HasTrk())
390 loizides 1.18 return kTRUE;
391     break;
392     default:
393     break;
394     }
395    
396     return kFALSE;
397     }
398    
399     //--------------------------------------------------------------------------------------------------
400 loizides 1.23 inline Bool_t mithep::Muon::HasTrk() const
401     {
402     // Return true if the muon has assigned any kind of track.
403    
404     return (HasGlobalTrk() || HasTrackerTrk() || HasStandaloneTrk());
405     }
406    
407     //--------------------------------------------------------------------------------------------------
408 loizides 1.18 inline mithep::Muon::EClassType mithep::Muon::Is() const
409     {
410     // Return the "best" classification of the muon according to the assigned tracks.
411    
412 loizides 1.23 if (HasGlobalTrk())
413 loizides 1.18 return kGlobal;
414 loizides 1.23 else if (HasTrackerTrk())
415 loizides 1.31 return kTracker;
416 loizides 1.23 else if (HasStandaloneTrk())
417 loizides 1.18 return kSta;
418    
419     return kNone;
420     }
421    
422     //--------------------------------------------------------------------------------------------------
423     inline Int_t mithep::Muon::LastHit() const
424     {
425     // Return the last hit, or -1 if no one found.
426    
427     Int_t lId = -1;
428     for (Int_t i0 = 0; i0 < 8; ++i0) {
429     if (GetDX(i0) < 99999 || GetDY(i0) < 99999)
430     lId = i0;
431     }
432     return lId;
433     }
434    
435     //--------------------------------------------------------------------------------------------------
436     inline Int_t mithep::Muon::LastStation(Int_t iMax) const
437     {
438     // Return the last station, or -1 of no one found.
439    
440     Int_t lId = -1;
441     if(TMath::Abs(iMax) > 8)
442     iMax = 8;
443     for (Int_t i0 = 0; i0 < iMax; ++i0) {
444     if (StationBit(i0) && ((lId % 4) < (i0 % 4)))
445     lId = i0;
446     }
447     return lId;
448     }
449    
450     //--------------------------------------------------------------------------------------------------
451     inline Int_t mithep::Muon::LastStation(Double_t iMaxD, Double_t iMaxP) const
452     {
453     // Return the last station for given deviation and relative error, or -1 if no one found.
454    
455     Int_t lId = -1;
456     for (Int_t i0 = 0; i0 < 8; ++i0) {
457     if ((lId % 4) > (i0 % 4))
458     continue;
459     if (GetTrackDist(i0) < iMaxD &&
460     GetTrackDist(i0)/GetTrackDistErr(i0) < iMaxP)
461     lId = i0;
462     }
463     return lId;
464     }
465    
466     //--------------------------------------------------------------------------------------------------
467     inline Bool_t mithep::Muon::PromptTight(EClassType type) const
468     {
469     // Return whether track for given class matches tight quality criteria.
470    
471     const mithep::Track *lTrack = 0;
472     switch (type) {
473     case kAny:
474     lTrack = BestTrk();
475     break;
476     case kGlobal:
477     lTrack = GlobalTrk();
478     break;
479 loizides 1.31 case kTracker:
480 loizides 1.18 lTrack = TrackerTrk();
481     break;
482     case kSta:
483     lTrack = StandaloneTrk();
484     break;
485     default:
486     break;
487     }
488    
489     if (lTrack == 0)
490     return kFALSE;
491     if (lTrack->NHits() < 11)
492     return kFALSE;
493     if (lTrack->Chi2()/lTrack->Ndof() > 10.)
494     return kFALSE;
495     if (lTrack->D0() > 0.2)
496     return kFALSE;
497     if ((LastHit() % 4) == 0)
498     return kFALSE;
499     return kTRUE;
500     }
501    
502     //--------------------------------------------------------------------------------------------------
503     inline Bool_t mithep::Muon::TMOneStation(Double_t iDYMin, Double_t iPYMin,
504 loizides 1.28 Double_t iDXMin, Double_t iPXMin, UInt_t iN) const
505 loizides 1.18 {
506     // Check if the muon is matched to at least one station (chamber).
507    
508     if (NSegments() < iN)
509     return kFALSE; //second last one
510    
511     Bool_t pGoodX = kFALSE;
512 ceballos 1.19 Bool_t pBadY = kFALSE;
513 loizides 1.18 for (Int_t i0 = 0; i0 < 8; ++i0) {
514     if ((TMath::Abs(GetDX(i0)) < iDXMin ||
515     TMath::Abs(GetPullX(i0)) < iPXMin))
516     pGoodX = kTRUE;
517     if (pGoodX &&
518     (TMath::Abs(GetDY(i0)) < iDYMin ||
519     TMath::Abs(GetPullY(i0)) < iPYMin))
520     return kTRUE;
521     if (TMath::Abs(GetDY(i0)) < 999999)
522     pBadY = kTRUE;
523     if (i0 == 3 && pGoodX && !pBadY)
524     return kTRUE;
525     }
526     return kFALSE;
527     }
528    
529     //--------------------------------------------------------------------------------------------------
530     inline Bool_t mithep::Muon::TMLastStation(Double_t iDYMin, Double_t iPYMin,
531 loizides 1.28 Double_t iDXMin, Double_t iPXMin, UInt_t iN) const
532 loizides 1.18 {
533     // Check if the muon is matched to its last station (chamber).
534    
535     if (NSegments() < iN)
536     return kFALSE; //second last one
537    
538     Int_t lLast = LastStation(-3.,-3.); // last required station
539     if (lLast < 0)
540     return kFALSE;
541     if (GetDX(lLast) > 9999.)
542     return kFALSE;
543     lLast = LastStation(); //no requirements
544     if (lLast < 0)
545     return kFALSE;
546     if (!(TMath::Abs(GetDX(lLast)) < iDXMin ||
547     TMath::Abs(GetPullX(lLast)) < iPXMin))
548     return kFALSE;
549     if (lLast == 3)
550     lLast = LastStation(3);
551     if (lLast < 0)
552     return kFALSE;
553     if (!(TMath::Abs(GetDY(lLast)) < iDYMin ||
554     TMath::Abs(GetPullY(lLast)) < iPYMin))
555     return kFALSE;
556     return kTRUE;
557     }
558    
559     //--------------------------------------------------------------------------------------------------
560 loizides 1.16 inline void mithep::Muon::SetDX(Int_t iStation, Double_t iDX)
561     {
562     // Return uncertainty in x in given chamber.
563    
564     assert(iStation >= 0 && iStation < 8);
565     fDX[iStation] = iDX;
566     }
567    
568     //--------------------------------------------------------------------------------------------------
569     inline void mithep::Muon::SetDY(Int_t iStation, Double_t iDY)
570     {
571     // Return uncertainty in y in given chamber.
572    
573     assert(iStation >= 0 && iStation < 8);
574     fDY[iStation] = iDY;
575     }
576    
577     //--------------------------------------------------------------------------------------------------
578     inline void mithep::Muon::SetPullX(Int_t iStation, Double_t iPullX)
579     {
580     // Set pull in x in given chamber.
581    
582     assert(iStation >= 0 && iStation < 8);
583     fPullX[iStation] = iPullX;
584     }
585    
586     //--------------------------------------------------------------------------------------------------
587     inline void mithep::Muon::SetPullY(Int_t iStation, Double_t iPullY)
588     {
589     // Set pull in y in given chamber.
590    
591     assert(iStation >= 0 && iStation < 8);
592     fPullY[iStation] = iPullY;
593     }
594    
595     //--------------------------------------------------------------------------------------------------
596     inline void mithep::Muon::SetTrackDist(Int_t iStation, Double_t iDist)
597 loizides 1.23
598 loizides 1.16 {
599     // Set track distance in given chamber.
600    
601     assert(iStation >= 0 && iStation < 8);
602     fTrackDist[iStation] = iDist;
603     }
604    
605     //--------------------------------------------------------------------------------------------------
606     inline void mithep::Muon::SetTrackDistErr(Int_t iStation, Double_t iDistErr)
607     {
608     // Set error of track distance in given chamber.
609 pharris 1.15
610 loizides 1.16 assert(iStation >= 0 && iStation < 8);
611     fTrackDistErr[iStation] = iDistErr;
612     }
613 pharris 1.15
614 loizides 1.16 //--------------------------------------------------------------------------------------------------
615     inline void mithep::Muon::SetNSegments(Int_t iStation, Int_t NSegments)
616     {
617     // Set number of segments in chamber.
618 pharris 1.15
619 loizides 1.16 assert(iStation >= 0 && iStation < 8);
620     fNSegments[iStation] = NSegments;
621     }
622 bendavid 1.32
623     //-------------------------------------------------------------------------------------------------
624     inline void mithep::Muon::SetPtEtaPhi(Double_t pt, Double_t eta, Double_t phi)
625     {
626     // Set three-vector
627    
628     fMom.Set(pt,eta,phi);
629     ClearMom();
630     }
631 loizides 1.16 #endif
632 loizides 1.18
633    
634    
635    
636