CMS 3D CMS Logo

MuonSelectors.h
Go to the documentation of this file.
1 #ifndef MuonReco_MuonSelectors_h
2 #define MuonReco_MuonSelectors_h
3 //
4 // Package: MuonReco
5 //
6 //
7 // Original Author: Jake Ribnik, Dmytro Kovalskyi
8 
10 #include <string>
11 
12 namespace reco {
13  class Vertex;
14 }
15 
16 namespace muon {
19  All = 0, // dummy options - always true
20  AllGlobalMuons = 1, // checks isGlobalMuon flag
21  AllStandAloneMuons = 2, // checks isStandAloneMuon flag
22  AllTrackerMuons = 3, // checks isTrackerMuon flag
23  TrackerMuonArbitrated = 4, // resolve ambiguity of sharing segments
24  AllArbitrated = 5, // all muons with the tracker muon arbitrated
25  GlobalMuonPromptTight = 6, // global muons with tighter fit requirements
26  TMLastStationLoose = 7, // penetration depth loose selector
27  TMLastStationTight = 8, // penetration depth tight selector
28  TM2DCompatibilityLoose = 9, // likelihood based loose selector
29  TM2DCompatibilityTight = 10, // likelihood based tight selector
30  TMOneStationLoose = 11, // require one well matched segment
31  TMOneStationTight = 12, // require one well matched segment
32  TMLastStationOptimizedLowPtLoose = 13, // combination of TMLastStation and TMOneStation
33  TMLastStationOptimizedLowPtTight = 14, // combination of TMLastStation and TMOneStation
34  GMTkChiCompatibility = 15, // require tk stub have good chi2 relative to glb track
35  GMStaChiCompatibility = 16, // require sta stub have good chi2 compatibility relative to glb track
36  GMTkKinkTight = 17, // require a small kink value in the tracker stub
37  TMLastStationAngLoose = 18, // TMLastStationLoose with additional angular cuts
38  TMLastStationAngTight = 19, // TMLastStationTight with additional angular cuts
39  TMOneStationAngLoose = 20, // TMOneStationLoose with additional angular cuts
40  TMOneStationAngTight = 21, // TMOneStationTight with additional angular cuts
41  // The two algorithms that follow are identical to what were known as
42  // TMLastStationOptimizedLowPt* (sans the Barrel) as late as revision
43  // 1.7 of this file. The names were changed because indeed the low pt
44  // optimization applies only to the barrel region, whereas the sel-
45  // ectors above are more efficient at low pt in the endcaps, which is
46  // what we feel is more suggestive of the algorithm name. This will be
47  // less confusing for future generations of CMS members, I hope...
48  // combination of TMLastStation and TMOneStation but with low pT optimization in barrel only
50  // combination of TMLastStation and TMOneStation but with low pT optimization in barrel only
52  RPCMuLoose = 24, // checks isRPCMuon flag (require two well matched hits in different RPC layers)
58  };
59 
62  const char* label;
64  };
65 
67  {"All", All},
68  {"AllGlobalMuons", AllGlobalMuons},
69  {"AllStandAloneMuons", AllStandAloneMuons},
70  {"AllTrackerMuons", AllTrackerMuons},
71  {"TrackerMuonArbitrated", TrackerMuonArbitrated},
72  {"AllArbitrated", AllArbitrated},
73  {"GlobalMuonPromptTight", GlobalMuonPromptTight},
74  {"TMLastStationLoose", TMLastStationLoose},
75  {"TMLastStationTight", TMLastStationTight},
76  {"TM2DCompatibilityLoose", TM2DCompatibilityLoose},
77  {"TM2DCompatibilityTight", TM2DCompatibilityTight},
78  {"TMOneStationLoose", TMOneStationLoose},
79  {"TMOneStationTight", TMOneStationTight},
80  {"TMLastStationOptimizedLowPtLoose", TMLastStationOptimizedLowPtLoose},
81  {"TMLastStationOptimizedLowPtTight", TMLastStationOptimizedLowPtTight},
82  {"GMTkChiCompatibility", GMTkChiCompatibility},
83  {"GMStaChiCompatibility", GMStaChiCompatibility},
84  {"GMTkKinkTight", GMTkKinkTight},
85  {"TMLastStationAngLoose", TMLastStationAngLoose},
86  {"TMLastStationAngTight", TMLastStationAngTight},
87  {"TMOneStationAngLoose", TMOneStationAngLoose},
88  {"TMOneStationAngTight", TMOneStationAngTight},
89  {"TMLastStationOptimizedBarrelLowPtLoose", TMLastStationOptimizedBarrelLowPtLoose},
90  {"TMLastStationOptimizedBarrelLowPtTight", TMLastStationOptimizedBarrelLowPtTight},
91  {"RPCMuLoose", RPCMuLoose},
92  {"AllME0Muons", AllME0Muons},
93  {"ME0MuonArbitrated", ME0MuonArbitrated},
94  {"AllGEMMuons", AllGEMMuons},
95  {"GEMMuonArbitrated", GEMMuonArbitrated},
96  {"TriggerIdLoose", TriggerIdLoose},
97  {nullptr, (SelectionType)-1}};
98 
100 
101  // a map for string label to reco::Muon::Selector enum
103  const char* label;
105  };
106 
108  {"CutBasedIdLoose", reco::Muon::CutBasedIdLoose},
109  {"CutBasedIdMedium", reco::Muon::CutBasedIdMedium},
110  {"CutBasedIdMediumPrompt", reco::Muon::CutBasedIdMediumPrompt},
111  {"CutBasedIdTight", reco::Muon::CutBasedIdTight},
112  {"CutBasedIdGlobalHighPt", reco::Muon::CutBasedIdGlobalHighPt},
113  {"CutBasedIdTrkHighPt", reco::Muon::CutBasedIdTrkHighPt},
114  {"PFIsoVeryLoose", reco::Muon::PFIsoVeryLoose},
115  {"PFIsoLoose", reco::Muon::PFIsoLoose},
116  {"PFIsoMedium", reco::Muon::PFIsoMedium},
117  {"PFIsoTight", reco::Muon::PFIsoTight},
118  {"PFIsoVeryTight", reco::Muon::PFIsoVeryTight},
119  {"TkIsoLoose", reco::Muon::TkIsoLoose},
120  {"TkIsoTight", reco::Muon::TkIsoTight},
121  {"SoftCutBasedId", reco::Muon::SoftCutBasedId},
122  {"SoftMvaId", reco::Muon::SoftMvaId},
123  {"MvaLoose", reco::Muon::MvaLoose},
124  {"MvaMedium", reco::Muon::MvaMedium},
125  {"MvaTight", reco::Muon::MvaTight},
126  {"MiniIsoLoose", reco::Muon::MiniIsoLoose},
127  {"MiniIsoMedium", reco::Muon::MiniIsoMedium},
128  {"MiniIsoTight", reco::Muon::MiniIsoTight},
129  {"MiniIsoVeryTight", reco::Muon::MiniIsoVeryTight},
130  {"TriggerIdLoose", reco::Muon::TriggerIdLoose},
131  {"InTimeMuon", reco::Muon::InTimeMuon},
132  {"PFIsoVeryVeryTight", reco::Muon::PFIsoVeryVeryTight},
133  {"MultiIsoLoose", reco::Muon::MultiIsoLoose},
134  {"MultiIsoMedium", reco::Muon::MultiIsoMedium},
135  {"PuppiIsoLoose", reco::Muon::PuppiIsoLoose},
136  {"PuppiIsoMedium", reco::Muon::PuppiIsoMedium},
137  {"PuppiIsoTight", reco::Muon::PuppiIsoTight},
138  {"MvaVTight", reco::Muon::MvaVTight},
139  {"MvaVVTight", reco::Muon::MvaVVTight},
140  {"LowPtMvaLoose", reco::Muon::LowPtMvaLoose},
141  {"LowPtMvaMedium", reco::Muon::LowPtMvaMedium},
142  {"MvaIDwpMedium", reco::Muon::MvaIDwpMedium},
143  {"MvaIDwpTight", reco::Muon::MvaIDwpTight},
144  {nullptr, (reco::Muon::Selector)-1}};
145 
147 
149  bool isGoodMuon(const reco::Muon& muon,
152 
153  // ===========================================================================
154  // Support functions
155  //
157 
158  // specialized GoodMuon functions called from main wrapper
159  bool isGoodMuon(const reco::Muon& muon,
161  double minCompatibility,
163 
164  bool isGoodMuon(const reco::Muon& muon,
166  int minNumberOfMatches,
167  double maxAbsDx,
168  double maxAbsPullX,
169  double maxAbsDy,
170  double maxAbsPullY,
171  double maxChamberDist,
172  double maxChamberDistPull,
174  bool syncMinNMatchesNRequiredStationsInBarrelOnly = true, //this is what we had originally
175  bool applyAlsoAngularCuts = false);
176 
177  bool isTightMuon(const reco::Muon&, const reco::Vertex&);
178  bool isLooseMuon(const reco::Muon&);
179  bool isMediumMuon(const reco::Muon&, bool run2016_hip_mitigation = false);
180  bool isSoftMuon(const reco::Muon&, const reco::Vertex&, bool run2016_hip_mitigation = false);
181  bool isHighPtMuon(const reco::Muon&, const reco::Vertex&);
182  bool isTrackerHighPtMuon(const reco::Muon&, const reco::Vertex&);
183  bool isLooseTriggerMuon(const reco::Muon&);
184 
185  // determine if station was crossed well withing active volume
186  unsigned int RequiredStationMask(const reco::Muon& muon,
187  double maxChamberDist,
188  double maxChamberDistPull,
190 
191  // ------------ method to return the calo compatibility for a track with matched muon info ------------
192  float caloCompatibility(const reco::Muon& muon);
193 
194  // ------------ method to calculate the segment compatibility for a track with matched muon info ------------
195  float segmentCompatibility(const reco::Muon& muon,
197 
198  // Check if two muon trajectory overlap
199  // The overlap is performed by comparing distance between two muon
200  // trajectories if they cross the same muon chamber. Trajectories
201  // overlap if distance/uncertainty is smaller than allowed pullX
202  // and pullY
203  bool overlap(const reco::Muon& muon1,
204  const reco::Muon& muon2,
205  double pullX = 1.0,
206  double pullY = 1.0,
207  bool checkAdjacentChambers = false);
208 
211  int sharedSegments(const reco::Muon& muon1,
212  const reco::Muon& muon2,
213  unsigned int segmentArbitrationMask = reco::MuonSegmentMatch::BestInChamberByDR);
214 
216  reco::Vertex const* vertex = nullptr,
217  bool run2016_hip_mitigation = false);
218 } // namespace muon
219 #endif
reco::Muon::Selector value
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
reco::Muon::Selector makeSelectorBitset(reco::Muon const &muon, reco::Vertex const *vertex=nullptr, bool run2016_hip_mitigation=false)
float caloCompatibility(const reco::Muon &muon)
bool isLooseMuon(const reco::Muon &)
SelectionType
Selector type.
Definition: MuonSelectors.h:18
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
char const * label
ArbitrationType
define arbitration schemes
Definition: Muon.h:187
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
static const unsigned int BestInChamberByDR
bool isSoftMuon(const reco::Muon &, const reco::Vertex &, bool run2016_hip_mitigation=false)
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
int sharedSegments(const reco::Muon &muon1, const reco::Muon &muon2, unsigned int segmentArbitrationMask=reco::MuonSegmentMatch::BestInChamberByDR)
bool isHighPtMuon(const reco::Muon &, const reco::Vertex &)
SelectionType selectionTypeFromString(const std::string &label)
Definition: MuonSelectors.cc:9
const reco::Muon::ArbitrationType arbitrationType
a lightweight "map" for selection type string label and enum value
Definition: MuonSelectors.h:61
unsigned int RequiredStationMask(const reco::Muon &muon, double maxChamberDist, double maxChamberDistPull, reco::Muon::ArbitrationType arbitrationType)
static const SelectorStringToEnum selectorStringToEnumMap[]
fixed size matrix
reco::Muon::Selector selectorFromString(const std::string &label)
bool isTrackerHighPtMuon(const reco::Muon &, const reco::Vertex &)
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
bool isLooseTriggerMuon(const reco::Muon &)
Selector
Definition: Muon.h:201
static const SelectionTypeStringToEnum selectionTypeStringToEnumMap[]
Definition: MuonSelectors.h:66