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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines