From db1ce806b10092b7b2d35ae3435025a43a8bfa40 Mon Sep 17 00:00:00 2001 From: Ruben Lopez Ruiz <24.lopezr@gmail.com> Date: Wed, 15 Mar 2023 12:25:09 +0100 Subject: [PATCH] Preliminar fix to DisplacedMuonFilterProducer --- .../plugins/DisplacedMuonFilterProducer.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/PhysicsTools/PatAlgos/plugins/DisplacedMuonFilterProducer.cc b/PhysicsTools/PatAlgos/plugins/DisplacedMuonFilterProducer.cc index 28c227dd6f963..8539b1067d069 100644 --- a/PhysicsTools/PatAlgos/plugins/DisplacedMuonFilterProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/DisplacedMuonFilterProducer.cc @@ -158,6 +158,7 @@ void pat::DisplacedMuonFilterProducer::produce(edm::Event& iEvent, const edm::Ev std::vector filteredmuons(nMuons, true); int oMuons = nMuons; + unsigned int nsegments = 0; for (unsigned int i = 0; i < srcMuons->size(); i++) { const reco::Muon& muon(srcMuons->at(i)); @@ -170,8 +171,22 @@ void pat::DisplacedMuonFilterProducer::produce(edm::Event& iEvent, const edm::Ev continue; } } else { + // Compute number of DT+CSC segments + nsegments = 0; + for (trackingRecHit_iterator hit = muon.standAloneMuon()->recHitsBegin(); + hit != muon.standAloneMuon()->recHitsEnd(); + ++hit) { + if (!(*hit)->isValid()) + continue; + DetId id = (*hit)->geographicalId(); + if (id.det() != DetId::Muon) + continue; + if (id.subdetId() == MuonSubdetId::DT || id.subdetId() == MuonSubdetId::CSC) { + nsegments++; + } + } // Discard STA-only muons with less than minMatches_ segments and below pt threshold - if (!muon.isMatchesValid() || muon.numberOfMatches() < minMatches_ || muon.standAloneMuon()->pt() < minPtSTA_) { + if (nsegments < minMatches_ || muon.standAloneMuon()->pt() < minPtSTA_) { filteredmuons[i] = false; oMuons = oMuons - 1; continue;