ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/Muon.h
Revision: 1.32
Committed: Mon Mar 22 18:40:16 2010 UTC (15 years, 1 month ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.31: +48 -2 lines
Log Message:
Explicitly store muon charge and momentum

File Contents

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