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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines