File indexing completed on 2024-04-06 12:04:47
0001 #ifndef MuonReco_MuonSelectors_h
0002 #define MuonReco_MuonSelectors_h
0003
0004
0005
0006
0007
0008
0009 #include "DataFormats/MuonReco/interface/Muon.h"
0010 #include <string>
0011
0012 namespace reco {
0013 class Vertex;
0014 }
0015
0016 namespace muon {
0017
0018 enum SelectionType {
0019 All = 0,
0020 AllGlobalMuons = 1,
0021 AllStandAloneMuons = 2,
0022 AllTrackerMuons = 3,
0023 TrackerMuonArbitrated = 4,
0024 AllArbitrated = 5,
0025 GlobalMuonPromptTight = 6,
0026 TMLastStationLoose = 7,
0027 TMLastStationTight = 8,
0028 TM2DCompatibilityLoose = 9,
0029 TM2DCompatibilityTight = 10,
0030 TMOneStationLoose = 11,
0031 TMOneStationTight = 12,
0032 TMLastStationOptimizedLowPtLoose = 13,
0033 TMLastStationOptimizedLowPtTight = 14,
0034 GMTkChiCompatibility = 15,
0035 GMStaChiCompatibility = 16,
0036 GMTkKinkTight = 17,
0037 TMLastStationAngLoose = 18,
0038 TMLastStationAngTight = 19,
0039 TMOneStationAngLoose = 20,
0040 TMOneStationAngTight = 21,
0041
0042
0043
0044
0045
0046
0047
0048
0049 TMLastStationOptimizedBarrelLowPtLoose = 22,
0050
0051 TMLastStationOptimizedBarrelLowPtTight = 23,
0052 RPCMuLoose = 24,
0053 AllME0Muons = 25,
0054 ME0MuonArbitrated = 26,
0055 AllGEMMuons = 27,
0056 GEMMuonArbitrated = 28,
0057 TriggerIdLoose = 29
0058 };
0059
0060
0061 struct SelectionTypeStringToEnum {
0062 const char* label;
0063 SelectionType value;
0064 };
0065
0066 static const SelectionTypeStringToEnum selectionTypeStringToEnumMap[] = {
0067 {"All", All},
0068 {"AllGlobalMuons", AllGlobalMuons},
0069 {"AllStandAloneMuons", AllStandAloneMuons},
0070 {"AllTrackerMuons", AllTrackerMuons},
0071 {"TrackerMuonArbitrated", TrackerMuonArbitrated},
0072 {"AllArbitrated", AllArbitrated},
0073 {"GlobalMuonPromptTight", GlobalMuonPromptTight},
0074 {"TMLastStationLoose", TMLastStationLoose},
0075 {"TMLastStationTight", TMLastStationTight},
0076 {"TM2DCompatibilityLoose", TM2DCompatibilityLoose},
0077 {"TM2DCompatibilityTight", TM2DCompatibilityTight},
0078 {"TMOneStationLoose", TMOneStationLoose},
0079 {"TMOneStationTight", TMOneStationTight},
0080 {"TMLastStationOptimizedLowPtLoose", TMLastStationOptimizedLowPtLoose},
0081 {"TMLastStationOptimizedLowPtTight", TMLastStationOptimizedLowPtTight},
0082 {"GMTkChiCompatibility", GMTkChiCompatibility},
0083 {"GMStaChiCompatibility", GMStaChiCompatibility},
0084 {"GMTkKinkTight", GMTkKinkTight},
0085 {"TMLastStationAngLoose", TMLastStationAngLoose},
0086 {"TMLastStationAngTight", TMLastStationAngTight},
0087 {"TMOneStationAngLoose", TMOneStationAngLoose},
0088 {"TMOneStationAngTight", TMOneStationAngTight},
0089 {"TMLastStationOptimizedBarrelLowPtLoose", TMLastStationOptimizedBarrelLowPtLoose},
0090 {"TMLastStationOptimizedBarrelLowPtTight", TMLastStationOptimizedBarrelLowPtTight},
0091 {"RPCMuLoose", RPCMuLoose},
0092 {"AllME0Muons", AllME0Muons},
0093 {"ME0MuonArbitrated", ME0MuonArbitrated},
0094 {"AllGEMMuons", AllGEMMuons},
0095 {"GEMMuonArbitrated", GEMMuonArbitrated},
0096 {"TriggerIdLoose", TriggerIdLoose},
0097 {nullptr, (SelectionType)-1}};
0098
0099 SelectionType selectionTypeFromString(const std::string& label);
0100
0101
0102 struct SelectorStringToEnum {
0103 const char* label;
0104 reco::Muon::Selector value;
0105 };
0106
0107 static const SelectorStringToEnum selectorStringToEnumMap[] = {
0108 {"CutBasedIdLoose", reco::Muon::CutBasedIdLoose},
0109 {"CutBasedIdMedium", reco::Muon::CutBasedIdMedium},
0110 {"CutBasedIdMediumPrompt", reco::Muon::CutBasedIdMediumPrompt},
0111 {"CutBasedIdTight", reco::Muon::CutBasedIdTight},
0112 {"CutBasedIdGlobalHighPt", reco::Muon::CutBasedIdGlobalHighPt},
0113 {"CutBasedIdTrkHighPt", reco::Muon::CutBasedIdTrkHighPt},
0114 {"PFIsoVeryLoose", reco::Muon::PFIsoVeryLoose},
0115 {"PFIsoLoose", reco::Muon::PFIsoLoose},
0116 {"PFIsoMedium", reco::Muon::PFIsoMedium},
0117 {"PFIsoTight", reco::Muon::PFIsoTight},
0118 {"PFIsoVeryTight", reco::Muon::PFIsoVeryTight},
0119 {"TkIsoLoose", reco::Muon::TkIsoLoose},
0120 {"TkIsoTight", reco::Muon::TkIsoTight},
0121 {"SoftCutBasedId", reco::Muon::SoftCutBasedId},
0122 {"SoftMvaId", reco::Muon::SoftMvaId},
0123 {"MvaLoose", reco::Muon::MvaLoose},
0124 {"MvaMedium", reco::Muon::MvaMedium},
0125 {"MvaTight", reco::Muon::MvaTight},
0126 {"MiniIsoLoose", reco::Muon::MiniIsoLoose},
0127 {"MiniIsoMedium", reco::Muon::MiniIsoMedium},
0128 {"MiniIsoTight", reco::Muon::MiniIsoTight},
0129 {"MiniIsoVeryTight", reco::Muon::MiniIsoVeryTight},
0130 {"TriggerIdLoose", reco::Muon::TriggerIdLoose},
0131 {"InTimeMuon", reco::Muon::InTimeMuon},
0132 {"PFIsoVeryVeryTight", reco::Muon::PFIsoVeryVeryTight},
0133 {"MultiIsoLoose", reco::Muon::MultiIsoLoose},
0134 {"MultiIsoMedium", reco::Muon::MultiIsoMedium},
0135 {"PuppiIsoLoose", reco::Muon::PuppiIsoLoose},
0136 {"PuppiIsoMedium", reco::Muon::PuppiIsoMedium},
0137 {"PuppiIsoTight", reco::Muon::PuppiIsoTight},
0138 {"MvaVTight", reco::Muon::MvaVTight},
0139 {"MvaVVTight", reco::Muon::MvaVVTight},
0140 {"LowPtMvaLoose", reco::Muon::LowPtMvaLoose},
0141 {"LowPtMvaMedium", reco::Muon::LowPtMvaMedium},
0142 {"MvaIDwpMedium", reco::Muon::MvaIDwpMedium},
0143 {"MvaIDwpTight", reco::Muon::MvaIDwpTight},
0144 {nullptr, (reco::Muon::Selector)-1}};
0145
0146 reco::Muon::Selector selectorFromString(const std::string& label);
0147
0148
0149 bool isGoodMuon(const reco::Muon& muon,
0150 SelectionType type,
0151 reco::Muon::ArbitrationType arbitrationType = reco::Muon::SegmentAndTrackArbitration);
0152
0153
0154
0155
0156 enum AlgorithmType { TMLastStation, TM2DCompatibility, TMOneStation, RPCMu, ME0Mu, GEMMu };
0157
0158
0159 bool isGoodMuon(const reco::Muon& muon,
0160 AlgorithmType type,
0161 double minCompatibility,
0162 reco::Muon::ArbitrationType arbitrationType);
0163
0164 bool isGoodMuon(const reco::Muon& muon,
0165 AlgorithmType type,
0166 int minNumberOfMatches,
0167 double maxAbsDx,
0168 double maxAbsPullX,
0169 double maxAbsDy,
0170 double maxAbsPullY,
0171 double maxChamberDist,
0172 double maxChamberDistPull,
0173 reco::Muon::ArbitrationType arbitrationType,
0174 bool syncMinNMatchesNRequiredStationsInBarrelOnly = true,
0175 bool applyAlsoAngularCuts = false);
0176
0177 bool isTightMuon(const reco::Muon&, const reco::Vertex&);
0178 bool isLooseMuon(const reco::Muon&);
0179 bool isMediumMuon(const reco::Muon&, bool run2016_hip_mitigation = false);
0180 bool isSoftMuon(const reco::Muon&, const reco::Vertex&, bool run2016_hip_mitigation = false);
0181 bool isHighPtMuon(const reco::Muon&, const reco::Vertex&);
0182 bool isTrackerHighPtMuon(const reco::Muon&, const reco::Vertex&);
0183 bool isLooseTriggerMuon(const reco::Muon&);
0184
0185
0186 unsigned int RequiredStationMask(const reco::Muon& muon,
0187 double maxChamberDist,
0188 double maxChamberDistPull,
0189 reco::Muon::ArbitrationType arbitrationType);
0190
0191
0192 float caloCompatibility(const reco::Muon& muon);
0193
0194
0195 float segmentCompatibility(const reco::Muon& muon,
0196 reco::Muon::ArbitrationType arbitrationType = reco::Muon::SegmentAndTrackArbitration);
0197
0198
0199
0200
0201
0202
0203 bool overlap(const reco::Muon& muon1,
0204 const reco::Muon& muon2,
0205 double pullX = 1.0,
0206 double pullY = 1.0,
0207 bool checkAdjacentChambers = false);
0208
0209
0210
0211 int sharedSegments(const reco::Muon& muon1,
0212 const reco::Muon& muon2,
0213 unsigned int segmentArbitrationMask = reco::MuonSegmentMatch::BestInChamberByDR);
0214
0215 reco::Muon::Selector makeSelectorBitset(reco::Muon const& muon,
0216 reco::Vertex const* vertex = nullptr,
0217 bool run2016_hip_mitigation = false);
0218 }
0219 #endif