From 41d21c467a1387e07767d08d3128422701920dfc Mon Sep 17 00:00:00 2001 From: Marino Missiroli <m.missiroli@cern.ch> Date: Sun, 18 Jun 2023 22:56:40 +0200 Subject: [PATCH] fix how HLTDeDxFilter fills TriggerFilterObjectWithRefs output product --- RecoTracker/DeDx/plugins/HLTDeDxFilter.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc b/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc index bc2e1984175d2..fa6b183f6c5bc 100644 --- a/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc +++ b/RecoTracker/DeDx/plugins/HLTDeDxFilter.cc @@ -114,7 +114,6 @@ bool HLTDeDxFilter::hltFilter(edm::Event& iEvent, iEvent.getByToken(caloTowersToken_, caloTowersHandle); bool accept = false; - int NTracks = 0; // early return if (trackCollection.empty()) @@ -131,7 +130,6 @@ bool HLTDeDxFilter::hltFilter(edm::Event& iEvent, reco::TrackRef track = reco::TrackRef(trackCollectionHandle, i); if (pt[i] > minPT_ && fabs(eta[i]) < maxETA_ && dEdxTrack[track].numberOfMeasurements() > minNOM_ && dEdxTrack[track].dEdx() > minDEDx_) { - NTracks++; if (track->numberOfValidHits() < minNumValidHits_) continue; if (track->hitPattern().trackerLayersWithoutMeasurement(reco::HitPattern::MISSING_INNER_HITS) > maxNHitMissIn_) @@ -194,10 +192,9 @@ bool HLTDeDxFilter::hltFilter(edm::Event& iEvent, // put filter object into the Event if (saveTags()) { - edm::OrphanHandle<RecoChargedCandidateCollection> chargedCandidatesHandle = - iEvent.put(std::move(chargedCandidates)); - for (int i = 0; i < NTracks; i++) { - filterproduct.addObject(TriggerMuon, RecoChargedCandidateRef(chargedCandidatesHandle, i)); + auto const chargedCandidatesHandle = iEvent.put(std::move(chargedCandidates)); + for (unsigned int i = 0; i < chargedCandidatesHandle->size(); ++i) { + filterproduct.addObject(trigger::TriggerMuon, reco::RecoChargedCandidateRef(chargedCandidatesHandle, i)); } }