52 ptCut_(iConfig.getParameter<double>(
"muonPtCut")),
57 produces<edm::PtrVector<reco::Muon>>(
"bad");
58 produces<bool>(
"notBadEvent");
69 std::vector<int> goodMuon;
72 assert(!vtx->empty());
73 const auto &
PV = vtx->front().position();
79 if (!
mu.isPFMuon() ||
mu.innerTrack().isNull()) {
80 goodMuon.push_back(-1);
84 float dxypv =
std::abs(
mu.innerTrack()->dxy(PV));
85 float dzpv =
std::abs(
mu.innerTrack()->dz(PV));
87 bool ipLoose = ((dxypv < 0.5 && dzpv < 2.0) ||
mu.innerTrack()->hitPattern().pixelLayersWithMeasurement() >= 2);
90 bool ipTight = (dxypv < 0.2 && dzpv < 0.5);
91 goodMuon.push_back(ipTight);
93 goodMuon.push_back(0);
96 goodMuon.push_back(3);
101 for (
unsigned int i = 0,
n = muons.size();
i <
n; ++
i) {
102 if (muons[
i].
pt() <
ptCut_ || goodMuon[
i] != 0)
continue;
103 if (
verbose_) printf(
"potentially bad muon %d of pt %.1f eta %+.3f phi %+.3f\n",
int(
i+1), muons[
i].
pt(), muons[
i].
eta(), muons[
i].
phi());
108 for (
unsigned int j = 0; j <
n; ++j) {
109 if (j ==
i || goodMuon[j] <= 0 || !
partnerId(muons[j]))
continue;
112 if (
verbose_) printf(
" tagged as clone of muon %d of pt %.1f eta %+.3f phi %+.3f\n",
int(j+1), muons[j].
pt(), muons[j].
eta(), muons[j].
phi());
120 out->push_back(muons.ptrAt(
i));
125 iEvent.
put(std::unique_ptr<bool>(
new bool(!found)),
"notBadEvent");
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool tighterId(const reco::Muon &mu) const
bool safeId(const reco::Muon &mu) const
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
edm::EDGetTokenT< edm::View< reco::Muon > > muons_
virtual TrackRef innerTrack() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double pt() const final
transverse momentum
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
bool outInOnly(const reco::Muon &mu) const
#define DEFINE_FWK_MODULE(type)
virtual TrackRef muonBestTrack() const
bool partnerId(const reco::Muon &mu) const
bool isGlobalMuon() const override
Abs< T >::type abs(const T &t)
bool tightGlobal(const reco::Muon &mu) const
int numberOfMatchedStations(ArbitrationType type=SegmentAndTrackArbitration) const
edm::EDGetTokenT< std::vector< reco::Vertex > > vtx_
bool isAlgoInMask(TrackAlgorithm a) const
int sharedSegments(const reco::Muon &muon1, const reco::Muon &muon2, unsigned int segmentArbitrationMask=reco::MuonSegmentMatch::BestInChamberByDR)
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
bool preselection(const reco::Muon &mu) const
AlgoMask algoMask() const
~BadGlobalMuonTagger() override
BadGlobalMuonTagger(const edm::ParameterSet &iConfig)
bool filter(edm::StreamID iID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector