Skip to content

Commit

Permalink
Merge pull request #42763 from vlimant/13_0_backport_41496
Browse files Browse the repository at this point in the history
Change from numberOfMatches() to segment number in DisplacedMuonFilterProducer
  • Loading branch information
cmsbuild authored Sep 13, 2023
2 parents 382249d + 9342710 commit c8890a9
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions PhysicsTools/PatAlgos/plugins/DisplacedMuonFilterProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ void pat::DisplacedMuonFilterProducer::produce(edm::Event& iEvent, const edm::Ev
std::vector<bool> 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));

Expand All @@ -169,9 +170,28 @@ void pat::DisplacedMuonFilterProducer::produce(edm::Event& iEvent, const edm::Ev
oMuons = oMuons - 1;
continue;
}
// Discard STA-only muons below pt threshold
} else if (muon.standAloneMuon()->pt() < minPtSTA_) {
filteredmuons[i] = false;
oMuons = oMuons - 1;
continue;
} else {
// Discard STA-only muons with less than minMatches_ segments and below pt threshold
if (!muon.isMatchesValid() || muon.numberOfMatches() < minMatches_ || muon.standAloneMuon()->pt() < minPtSTA_) {
// Compute number of DT+CSC segments and discard those that have less than the minimum required
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
if (nsegments < minMatches_) {
filteredmuons[i] = false;
oMuons = oMuons - 1;
continue;
Expand Down

0 comments on commit c8890a9

Please sign in to comment.