ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/Muon.h
(Generate patch)

Comparing UserCode/MitAna/DataTree/interface/Muon.h (file contents):
Revision 1.13 by sixie, Fri Aug 8 11:17:13 2008 UTC vs.
Revision 1.24 by bendavid, Tue Feb 17 15:09:45 2009 UTC

# Line 3 | Line 3
3   //
4   // Muon
5   //
6 < // Details to be worked out...
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 < // Authors: C.Loizides, J.Bendavid, C.Paus
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 Varaibles 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 > //   LastHit   : Returns farest (from center) station with a recorded segment
47 > //   LastStation  : Returns farest station using Segment+Track Arbitration
48 > //
49 > //  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 > //   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 > //
56 > // Authors: J.Bendavid, C.Loizides, C.Paus, P.Harris
57   //--------------------------------------------------------------------------------------------------
58  
59 < #ifndef DATATREE_MUON_H
60 < #define DATATREE_MUON_H
59 > #ifndef MITANA_DATATREE_MUON_H
60 > #define MITANA_DATATREE_MUON_H
61  
14 #include <TRef.h>
15 #include "MitAna/DataTree/interface/ChargedParticle.h"
62   #include "MitAna/DataTree/interface/Track.h"
63 + #include "MitAna/DataTree/interface/ChargedParticle.h"
64  
65 < namespace mithep
66 < {
20 <  class Muon : public ChargedParticle
21 <  {
65 > namespace mithep {
66 >  class Muon : public ChargedParticle {
67      public:
68 <      Muon() {}
68 >      Muon();
69        ~Muon() {}
70 +
71 +      enum EClassType {
72 +        kNone,              //no track assigned
73 +        kGlobal,            //"Global"
74 +        kTrackerOnly,       //"TrackerOnly"
75 +        kSta,               //"Standalone"
76 +        kAny                //any "best" of the above
77 +      };
78        
79 <      const Track   *BestTrk()            const;
80 <      const Track   *GlobalTrk()          const;
81 <      const Track   *StandaloneTrk()      const;
82 <      const Track   *TrackerTrk()         const;
83 <      const Track   *Trk()                const  { return BestTrk();          }
84 <      Double_t       IsoR03SumPt()         const { return fIsoR03SumPt;       }
85 <      Double_t       IsoR03EmEt()          const { return fIsoR03EmEt;        }
86 <      Double_t       IsoR03HadEt()         const { return fIsoR03HadEt;       }
87 <      Double_t       IsoR03HoEt()          const { return fIsoR03HoEt;        }
88 <      Int_t          IsoR03NTracks()       const { return fIsoR03NTracks;     }
89 <      Int_t          IsoR03NJets()         const { return fIsoR03NJets;       }
90 <      Double_t       IsoR05SumPt()         const { return fIsoR05SumPt;       }
91 <      Double_t       IsoR05EmEt()          const { return fIsoR05EmEt;        }
92 <      Double_t       IsoR05HadEt()         const { return fIsoR05HadEt;       }
93 <      Double_t       IsoR05HoEt()          const { return fIsoR05HoEt;        }
94 <      Int_t          IsoR05NTracks()       const { return fIsoR05NTracks;     }
95 <      Int_t          IsoR05NJets()         const { return fIsoR05NJets;       }            
96 <      Double_t       EmEnergy()            const { return fEmEnergy;          }
97 <      Double_t       HadEnergy()           const { return fHadEnergy;         }
98 <      Double_t       HoEnergy()            const { return fHoEnergy;          }
99 <      Double_t       EmS9Energy()          const { return fEmS9Energy;        }
100 <      Double_t       HadS9Energy()         const { return fHadS9Energy;       }
101 <      Double_t       HoS9Energy()          const { return fHoS9Energy;        }
102 <      Double_t       Mass()                const { return 105.658369e-3;      }  
103 <      
104 <      void           SetGlobalTrk(Track* t)                { fGlobalTrackRef = t;            }
105 <      void           SetStandaloneTrk(Track* t)            { fStandaloneTrackRef = t;        }
106 <      void           SetTrackerTrk(Track* t)               { fTrackerTrackRef = t;           }
79 >      const Track   *BestTrk()                       const;
80 >      const Track   *GlobalTrk()                     const { return fGlobalTrackRef.Obj();     }
81 >      const Track   *StandaloneTrk()                 const { return fStandaloneTrackRef.Obj(); }
82 >      const Track   *TrackerTrk()                    const { return fTrackerTrackRef.Obj();    }
83 >      const Track   *Trk()                           const { return BestTrk();                 }
84 >      Double_t       EmEnergy()                      const { return fEmEnergy;                 }
85 >      Double_t       EmS9Energy()                    const { return fEmS9Energy;               }
86 >      Double_t       GetDX(Int_t iStation)           const;
87 >      Double_t       GetDY(Int_t iStation)           const;
88 >      Double_t       GetPullX(Int_t iStation)        const;
89 >      Double_t       GetPullY(Int_t iStation)        const;
90 >      Double_t       GetTrackDist(Int_t iStation)    const;
91 >      Double_t       GetTrackDistErr(Int_t iStation) const;
92 >      Int_t          GetNSegments(Int_t iStation)    const;
93 >      Bool_t         Has(EClassType type)            const;
94 >      Bool_t         HasTrk()                        const;
95 >      Bool_t         HasGlobalTrk()                  const { return fGlobalTrackRef.IsValid();   }
96 >      Bool_t         HasStandaloneTrk()              const
97 >                       { return fStandaloneTrackRef.IsValid(); }
98 >      Bool_t         HasTrackerTrk()                 const { return fTrackerTrackRef.IsValid();  }
99 >      Double_t       HadEnergy()                     const { return fHadEnergy;                }
100 >      Double_t       HadS9Energy()                   const { return fHadS9Energy;              }
101 >      Double_t       HoEnergy()                      const { return fHoEnergy;                 }
102 >      Double_t       HoS9Energy()                    const { return fHoS9Energy;               }
103 >      EClassType     Is()                            const;
104 >      Double_t       IsoR03SumPt()                   const { return fIsoR03SumPt;              }
105 >      Double_t       IsoR03EmEt()                    const { return fIsoR03EmEt;               }
106 >      Double_t       IsoR03HadEt()                   const { return fIsoR03HadEt;              }
107 >      Double_t       IsoR03HoEt()                    const { return fIsoR03HoEt;               }
108 >      Int_t          IsoR03NTracks()                 const { return fIsoR03NTracks;            }
109 >      Int_t          IsoR03NJets()                   const { return fIsoR03NJets;              }
110 >      Double_t       IsoR05SumPt()                   const { return fIsoR05SumPt;              }
111 >      Double_t       IsoR05EmEt()                    const { return fIsoR05EmEt;               }
112 >      Double_t       IsoR05HadEt()                   const { return fIsoR05HadEt;              }
113 >      Double_t       IsoR05HoEt()                    const { return fIsoR05HoEt;               }
114 >      Int_t          IsoR05NTracks()                 const { return fIsoR05NTracks;            }
115 >      Int_t          IsoR05NJets()                   const { return fIsoR05NJets;              }
116 >      Double_t       Mass()                          const { return 105.658369e-3;             }  
117 >      Int_t          NChambers()                     const { return fNTraversedChambers;       }
118 >      Int_t          NSegments()                     const { return fStationMask.NBitsSet();   }
119 >      Int_t          LastHit()                       const;
120 >      Int_t          LastStation(Double_t iMaxD, Double_t iMaxP)               const;
121 >      Int_t          LastStation(Int_t iMax=8)                                 const;
122 >      EObjType       ObjType()                       const { return kMuon; }      
123 >      Bool_t         PromptTight(EClassType type)                              const;
124 >      Bool_t         StationBit(Int_t bit)           const { return fStationMask.TestBit(bit); }
125 >      Bool_t         TMLastStation(Double_t iDYMin = 3., Double_t iPYMin = 3.,
126 >                                   Double_t iDXMin = 3., Double_t iPXMin = 3.,Int_t iN = 2) const;
127 >      Bool_t         TMOneStation(Double_t iDYMin = 3., Double_t iPYMin = 3.,
128 >                                  Double_t iDXMin = 3., Double_t iPXMin = 3.,Int_t iN = 1)  const;
129 >      void           SetGlobalTrk(const Track *t)          { fGlobalTrackRef = t;            }
130 >      void           SetStandaloneTrk(const Track *t)      { fStandaloneTrackRef = t;        }
131 >      void           SetTrackerTrk(const Track *t)         { fTrackerTrackRef = t;           }
132 >      void           SetDX(Int_t iStation, Double_t iDX);
133 >      void           SetDY(Int_t iStation, Double_t iDY);
134 >      void           SetEmEnergy(Double_t EmEnergy)        { fEmEnergy = EmEnergy;           }
135 >      void           SetEmS9Energy(Double_t EmS9Energy)    { fEmS9Energy = EmS9Energy;       }
136 >      void           SetHadEnergy(Double_t HadEnergy)      { fHadEnergy = HadEnergy;         }
137 >      void           SetHadS9Energy(Double_t HadS9Energy)  { fHadS9Energy = HadS9Energy;     }
138 >      void           SetHoEnergy(Double_t HoEnergy)        { fHoEnergy = HoEnergy;           }
139 >      void           SetHoS9Energy(Double_t HoS9Energy)    { fHoS9Energy = HoS9Energy;       }
140        void           SetIsoR03SumPt(Double_t isoR03SumPt)  { fIsoR03SumPt = isoR03SumPt;     }
141        void           SetIsoR03EmEt(Double_t isoR03EmEt)    { fIsoR03EmEt = isoR03EmEt;       }
142        void           SetIsoR03HadEt(Double_t isoR03HadEt)  { fIsoR03HadEt = isoR03HadEt;     }
# Line 63 | Line 149 | namespace mithep
149        void           SetIsoR05HoEt(Double_t isoR05HoEt)    { fIsoR05HoEt = isoR05HoEt;       }
150        void           SetIsoR05NTracks(Int_t isoR05NTracks) { fIsoR05NTracks = isoR05NTracks; }
151        void           SetIsoR05NJets(Int_t isoR05NJets)     { fIsoR05NJets = isoR05NJets;     }      
152 <      void           SetEmEnergy(Double_t EmEnergy)        { fEmEnergy = EmEnergy;           }
153 <      void           SetHadEnergy(Double_t HadEnergy)      { fHadEnergy = HadEnergy;         }
154 <      void           SetHoEnergy(Double_t HoEnergy)        { fHoEnergy = HoEnergy;           }
155 <      void           SetEmS9Energy(Double_t EmS9Energy)    { fEmS9Energy = EmS9Energy;       }
156 <      void           SetHadS9Energy(Double_t HadS9Energy)  { fHadS9Energy = HadS9Energy;     }
157 <      void           SetHoS9Energy(Double_t HoS9Energy)    { fHoS9Energy = HoS9Energy;       }
152 >      void           SetNChambers(Int_t iNTraCh)           { fNTraversedChambers = iNTraCh;  }
153 >      void           SetNSegments(Int_t iStation, Int_t NSegments);
154 >      void           SetPullX(Int_t iStation, Double_t iPullX);
155 >      void           SetPullY(Int_t iStation, Double_t iPullY);
156 >      void           SetStationMask(UInt_t iStMask)        { fStationMask.SetBits(iStMask);  }
157 >      void           SetTrackDist(Int_t iStation, Double_t iDist);
158 >      void           SetTrackDistErr(Int_t iStation, Double_t iDistErr);
159  
160      protected:
161 <      TRef           fGlobalTrackRef;      //global combined track reference
162 <      TRef           fStandaloneTrackRef;  //standalone muon track reference
163 <      TRef           fTrackerTrackRef;     //tracker track reference
164 <      Double_t       fIsoR03SumPt;
165 <      Double_t       fIsoR03EmEt;
166 <      Double_t       fIsoR03HadEt;
167 <      Double_t       fIsoR03HoEt;
168 <      Int_t          fIsoR03NTracks;
169 <      Int_t          fIsoR03NJets;
170 <      Double_t       fIsoR05SumPt;
171 <      Double_t       fIsoR05EmEt;
172 <      Double_t       fIsoR05HadEt;
173 <      Double_t       fIsoR05HoEt;
174 <      Int_t          fIsoR05NTracks;
175 <      Int_t          fIsoR05NJets;      
176 <      Double_t       fEmEnergy;
177 <      Double_t       fHadEnergy;
178 <      Double_t       fHoEnergy;
179 <      Double_t       fEmS9Energy;
180 <      Double_t       fHadS9Energy;
181 <      Double_t       fHoS9Energy;
161 >      Ref<Track>     fGlobalTrackRef;      //global combined track reference
162 >      Ref<Track>     fStandaloneTrackRef;  //standalone muon track reference
163 >      Ref<Track>     fTrackerTrackRef;     //tracker track reference
164 >      Double32_t     fIsoR03SumPt;         //isolation size R=0.3 sum pt
165 >      Double32_t     fIsoR03EmEt;          //isolation size R=0.3 em  trans energy
166 >      Double32_t     fIsoR03HadEt;         //isolation size R=0.3 had trans energy
167 >      Double32_t     fIsoR03HoEt;          //isolation size R=0.3 ho  trans energy
168 >      Int_t          fIsoR03NTracks;       //isolation size R=0.3 number of tracks
169 >      Int_t          fIsoR03NJets;         //isolation size R=0.3 number of jets
170 >      Double32_t     fIsoR05SumPt;         //isolation size R=0.5 sum pt
171 >      Double32_t     fIsoR05EmEt;          //isolation size R=0.5 em  trans energy
172 >      Double32_t     fIsoR05HadEt;         //isolation size R=0.5 had trans energy
173 >      Double32_t     fIsoR05HoEt;          //isolation size R=0.5 ho  trans energy
174 >      Int_t          fIsoR05NTracks;       //isolation size R=0.5 number of tracks
175 >      Int_t          fIsoR05NJets;         //isolation size R=0.5 number of jets      
176 >      Double32_t     fEmEnergy;            //energy deposit in ecal
177 >      Double32_t     fHadEnergy;           //energy deposit in hcal
178 >      Double32_t     fHoEnergy;            //energy deposit in outer hcal
179 >      Double32_t     fEmS9Energy;          //energy deposit in 3x3 ecal
180 >      Double32_t     fHadS9Energy;         //energy deposit in 3x3 hcal
181 >      Double32_t     fHoS9Energy;          //energy deposit in 3x3 outer hcal
182 >      Int_t          fNTraversedChambers;  //number of tranversed chambers
183 >      BitMask8       fStationMask;         //bitmap of station with tracks, 0-3 DT, 4-7 CSCs
184 >      Double32_t     fDX[8];               //uncertainty in x in given muon chamber
185 >      Double32_t     fDY[8];               //uncertainty in y in given muon chamber
186 >      Double32_t     fPullX[8];            //pull in x in given muon chamber
187 >      Double32_t     fPullY[8];            //pull in y in given muon chamber
188 >      Double32_t     fTrackDist[8];        //dist. to track in trans. plane in given muon chamber
189 >      Double32_t     fTrackDistErr[8];     //error of dist. to track in trans. plane in chamber
190 >      Int_t          fNSegments[8];        //number of segments in given muon chamber
191  
192      ClassDef(Muon, 1) // Muon class
193    };
# Line 102 | Line 198 | inline const mithep::Track *mithep::Muon
198   {
199    // Return "best" track.
200  
201 <  if (GlobalTrk())
201 >  if (HasGlobalTrk())
202      return GlobalTrk();
203 <  else if (StandaloneTrk())
108 <    return StandaloneTrk();
109 <  else if (TrackerTrk())
203 >  else if (HasTrackerTrk())
204      return TrackerTrk();
205 +  else if (HasStandaloneTrk())
206 +    return StandaloneTrk();
207  
208 +  Error("BestTrk", "No track reference found, returning NULL pointer.");
209    return 0;
210   }
211  
212   //--------------------------------------------------------------------------------------------------
213 < inline const mithep::Track *mithep::Muon::GlobalTrk() const
214 < {
215 <  // Return global combined track.
213 > inline Double_t mithep::Muon::GetDX(Int_t iStation) const
214 > {
215 >  // Return uncertainty in x in given chamber.
216  
217 <  return static_cast<const Track*>(fGlobalTrackRef.GetObject());
217 >  assert(iStation >= 0 && iStation < 8);
218 >  return fDX[iStation];
219   }
220  
221   //--------------------------------------------------------------------------------------------------
222 < inline const mithep::Track *mithep::Muon::StandaloneTrk() const
223 < {
224 <  // Return standalone track.
222 > inline Double_t mithep::Muon::GetDY(Int_t iStation) const
223 > {
224 >  // Return uncertainty in y in given chamber.
225  
226 <  return static_cast<const Track*>(fStandaloneTrackRef.GetObject());
226 >  assert(iStation >= 0 && iStation < 8);
227 >  return fDY[iStation];
228 > }
229 >
230 > //--------------------------------------------------------------------------------------------------
231 > inline Double_t mithep::Muon::GetPullX(Int_t iStation) const
232 > {
233 >  // Return pull in x in given chamber.
234 >
235 >  assert(iStation >= 0 && iStation < 8);
236 >  return fPullX[iStation];
237 > }
238 >
239 > //--------------------------------------------------------------------------------------------------
240 > inline Double_t mithep::Muon::GetPullY(Int_t iStation) const
241 > {
242 >  // Return pull in y in given chamber.
243 >  
244 >  assert(iStation >= 0 && iStation < 8);
245 >  return fPullY[iStation];
246   }
247  
248   //--------------------------------------------------------------------------------------------------
249 < inline const mithep::Track *mithep::Muon::TrackerTrk() const
250 < {
251 <  // Return tracker track.
249 > inline Double_t mithep::Muon::GetTrackDist(Int_t iStation) const
250 > {
251 >  // Return track distance in given chamber.
252 >
253 >  assert(iStation >= 0 && iStation < 8);
254 >  return fTrackDist[iStation];
255 > }
256 >
257 > //--------------------------------------------------------------------------------------------------
258 > inline Double_t mithep::Muon::GetTrackDistErr(Int_t iStation) const
259 > {
260 >  // Return error of track distance in given chamber.
261 >
262 >  assert(iStation >= 0 && iStation < 8);
263 >  return fTrackDistErr[iStation];
264 > }
265 >
266 > //--------------------------------------------------------------------------------------------------
267 > inline Int_t mithep::Muon::GetNSegments(Int_t iStation) const
268 > {
269 >  // Return number of segments in chamber.
270 >
271 >  assert(iStation >= 0 && iStation < 8);
272 >  return fNSegments[iStation];
273 > }
274 >
275 > //--------------------------------------------------------------------------------------------------
276 > inline Bool_t mithep::Muon::Has(EClassType type) const
277 > {
278 >  // Return true if the muon has a track of given class.
279 >
280 >  switch (type) {
281 >    case kAny:
282 >      if (HasTrk())
283 >        return kTRUE;
284 >      break;
285 >    case kGlobal:
286 >      if (HasGlobalTrk())
287 >        return kTRUE;
288 >      break;
289 >    case kTrackerOnly:
290 >      if (HasTrackerTrk())
291 >        return kTRUE;
292 >      break;
293 >    case kSta:
294 >      if (HasStandaloneTrk())
295 >        return kTRUE;
296 >      break;
297 >    case kNone:
298 >      if (!HasTrk())
299 >        return kTRUE;
300 >      break;
301 >    default:
302 >      break;
303 >  }
304 >
305 >  return kFALSE;
306 > }
307 >
308 > //--------------------------------------------------------------------------------------------------
309 > inline Bool_t mithep::Muon::HasTrk() const
310 > {
311 >  // Return true if the muon has assigned any kind of track.
312 >
313 >  return (HasGlobalTrk() || HasTrackerTrk() || HasStandaloneTrk());
314 > }
315 >
316 > //--------------------------------------------------------------------------------------------------
317 > inline mithep::Muon::EClassType mithep::Muon::Is() const
318 > {
319 >  // Return the "best" classification of the muon according to the assigned tracks.
320 >
321 >  if (HasGlobalTrk())
322 >    return kGlobal;
323 >  else if (HasTrackerTrk())
324 >    return kTrackerOnly;
325 >  else if (HasStandaloneTrk())
326 >    return kSta;
327 >
328 >  return kNone;
329 > }
330 >
331 > //--------------------------------------------------------------------------------------------------
332 > inline Int_t mithep::Muon::LastHit() const
333 > {
334 >  // Return the last hit, or -1 if no one found.
335  
336 <  return static_cast<const Track*>(fTrackerTrackRef.GetObject());
336 >  Int_t lId = -1;
337 >  for (Int_t i0 = 0; i0 < 8; ++i0) {
338 >    if (GetDX(i0) < 99999 || GetDY(i0) < 99999)
339 >      lId = i0;
340 >  }
341 >  return lId;
342 > }
343 >
344 > //--------------------------------------------------------------------------------------------------
345 > inline Int_t mithep::Muon::LastStation(Int_t iMax) const
346 > {
347 >  // Return the last station, or -1 of no one found.
348 >
349 >  Int_t lId = -1;
350 >  if(TMath::Abs(iMax) > 8)
351 >    iMax = 8;
352 >  for (Int_t i0 = 0; i0 < iMax; ++i0) {
353 >    if (StationBit(i0) && ((lId % 4) < (i0 % 4)))
354 >      lId = i0;
355 >  }
356 >  return lId;
357 > }
358 >
359 > //--------------------------------------------------------------------------------------------------
360 > inline Int_t mithep::Muon::LastStation(Double_t iMaxD, Double_t iMaxP) const
361 > {
362 >  // Return the last station for given deviation and relative error, or -1 if no one found.
363 >
364 >  Int_t lId = -1;
365 >  for (Int_t i0 = 0; i0 < 8; ++i0) {
366 >    if ((lId % 4) > (i0 % 4))
367 >      continue;
368 >    if (GetTrackDist(i0) < iMaxD &&
369 >        GetTrackDist(i0)/GetTrackDistErr(i0) < iMaxP)
370 >      lId = i0;
371 >  }
372 >  return lId;
373 > }
374 >
375 > //--------------------------------------------------------------------------------------------------
376 > inline Bool_t mithep::Muon::PromptTight(EClassType type) const
377 > {
378 >  // Return whether track for given class matches tight quality criteria.
379 >
380 >  const mithep::Track *lTrack = 0;
381 >  switch (type) {
382 >    case kAny:
383 >      lTrack = BestTrk();
384 >      break;
385 >    case kGlobal:
386 >      lTrack = GlobalTrk();
387 >      break;
388 >    case kTrackerOnly:
389 >      lTrack = TrackerTrk();
390 >      break;
391 >    case kSta:
392 >      lTrack = StandaloneTrk();
393 >      break;
394 >    default:
395 >      break;
396 >  }
397 >
398 >  if (lTrack == 0)
399 >    return kFALSE;
400 >  if (lTrack->NHits() < 11)        
401 >    return kFALSE;
402 >  if (lTrack->Chi2()/lTrack->Ndof() > 10.)                        
403 >    return kFALSE;
404 >  if (lTrack->D0() > 0.2)                                          
405 >    return kFALSE;
406 >  if ((LastHit() % 4) == 0)                                  
407 >    return kFALSE;
408 >  return kTRUE;
409 > }
410 >
411 > //--------------------------------------------------------------------------------------------------
412 > inline Bool_t mithep::Muon::TMOneStation(Double_t iDYMin, Double_t iPYMin,
413 >                                         Double_t iDXMin, Double_t iPXMin, Int_t iN) const
414 > {
415 >  // Check if the muon is matched to at least one station (chamber).
416 >
417 >  if (NSegments() < iN)
418 >    return kFALSE; //second last one
419 >
420 >  Bool_t pGoodX  = kFALSE;
421 >  Bool_t pBadY   = kFALSE;
422 >  for (Int_t i0 = 0; i0 < 8; ++i0) {
423 >    if ((TMath::Abs(GetDX(i0))    < iDXMin  ||
424 >         TMath::Abs(GetPullX(i0)) < iPXMin))
425 >      pGoodX = kTRUE;
426 >    if (pGoodX &&
427 >        (TMath::Abs(GetDY(i0))    < iDYMin  ||
428 >         TMath::Abs(GetPullY(i0)) < iPYMin))  
429 >      return kTRUE;
430 >    if (TMath::Abs(GetDY(i0)) < 999999)
431 >      pBadY = kTRUE;
432 >    if (i0 == 3 && pGoodX && !pBadY)            
433 >      return kTRUE;
434 >  }
435 >  return kFALSE;
436 > }
437 >
438 > //--------------------------------------------------------------------------------------------------
439 > inline Bool_t mithep::Muon::TMLastStation(Double_t iDYMin, Double_t iPYMin,
440 >                                          Double_t iDXMin, Double_t iPXMin, Int_t iN) const
441 > {
442 >  // Check if the muon is matched to its last station (chamber).
443 >  
444 >  if (NSegments() < iN)
445 >    return kFALSE; //second last one
446 >
447 >  Int_t lLast = LastStation(-3.,-3.); // last required station
448 >  if (lLast < 0)                                  
449 >    return kFALSE;
450 >  if (GetDX(lLast) > 9999.)                
451 >    return kFALSE;
452 >  lLast = LastStation(); //no requirements
453 >  if (lLast < 0)                                  
454 >    return kFALSE;
455 >  if (!(TMath::Abs(GetDX(lLast))    < iDXMin  ||
456 >        TMath::Abs(GetPullX(lLast)) < iPXMin))  
457 >    return kFALSE;
458 >  if (lLast == 3)
459 >    lLast = LastStation(3);
460 >  if (lLast < 0)                                  
461 >    return kFALSE;
462 >  if (!(TMath::Abs(GetDY(lLast))    < iDYMin ||
463 >        TMath::Abs(GetPullY(lLast)) < iPYMin))  
464 >    return kFALSE;
465 >  return kTRUE;
466 > }
467 >
468 > //--------------------------------------------------------------------------------------------------
469 > inline void mithep::Muon::SetDX(Int_t iStation, Double_t iDX)
470 > {
471 >  // Return uncertainty in x in given chamber.
472 >
473 >  assert(iStation >= 0 && iStation < 8);
474 >  fDX[iStation] = iDX;
475 > }
476 >
477 > //--------------------------------------------------------------------------------------------------
478 > inline void mithep::Muon::SetDY(Int_t iStation, Double_t iDY)
479 > {
480 >  // Return uncertainty in y in given chamber.
481 >
482 >  assert(iStation >= 0 && iStation < 8);
483 >  fDY[iStation] = iDY;
484 > }
485 >
486 > //--------------------------------------------------------------------------------------------------
487 > inline void mithep::Muon::SetPullX(Int_t iStation, Double_t iPullX)
488 > {
489 >  // Set pull in x in given chamber.
490 >
491 >  assert(iStation >= 0 && iStation < 8);
492 >  fPullX[iStation] = iPullX;
493 > }
494 >
495 > //--------------------------------------------------------------------------------------------------
496 > inline void mithep::Muon::SetPullY(Int_t iStation, Double_t iPullY)
497 > {
498 >  // Set pull in y in given chamber.
499 >
500 >  assert(iStation >= 0 && iStation < 8);
501 >  fPullY[iStation] = iPullY;
502 > }
503 >
504 > //--------------------------------------------------------------------------------------------------
505 > inline void mithep::Muon::SetTrackDist(Int_t iStation, Double_t iDist)
506 >
507 > {
508 >  // Set track distance in given chamber.
509 >
510 >  assert(iStation >= 0 && iStation < 8);
511 >  fTrackDist[iStation] = iDist;
512 > }
513 >
514 > //--------------------------------------------------------------------------------------------------
515 > inline void mithep::Muon::SetTrackDistErr(Int_t iStation, Double_t iDistErr)
516 > {
517 >  // Set error of track distance in given chamber.
518 >
519 >  assert(iStation >= 0 && iStation < 8);
520 >  fTrackDistErr[iStation] = iDistErr;
521 > }
522 >
523 > //--------------------------------------------------------------------------------------------------
524 > inline void mithep::Muon::SetNSegments(Int_t iStation, Int_t NSegments)
525 > {
526 >  // Set number of segments in chamber.
527 >
528 >  assert(iStation >= 0 && iStation < 8);
529 >  fNSegments[iStation] = NSegments;
530   }
531   #endif
532 +
533 +
534 +
535 +
536 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines