From a07f4dbee5a64d3ab561e81ce4173e11445d320a Mon Sep 17 00:00:00 2001 From: Andre Govinda Stahl Leiton Date: Thu, 4 Jul 2024 14:25:30 +0200 Subject: [PATCH] Update HLTPixelTrackFilter for 2024 PbPb UPC --- .../special/plugins/HLTPixelTrackFilter.cc | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/HLTrigger/special/plugins/HLTPixelTrackFilter.cc b/HLTrigger/special/plugins/HLTPixelTrackFilter.cc index 3377f829fb089..5a3748094794d 100644 --- a/HLTrigger/special/plugins/HLTPixelTrackFilter.cc +++ b/HLTrigger/special/plugins/HLTPixelTrackFilter.cc @@ -1,5 +1,5 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDFilter.h" +#include "HLTrigger/HLTcore/interface/HLTFilter.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -11,24 +11,25 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" -#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h" // // class declaration // -class HLTPixelTrackFilter : public edm::stream::EDFilter<> { +class HLTPixelTrackFilter : public HLTFilter { public: explicit HLTPixelTrackFilter(const edm::ParameterSet&); ~HLTPixelTrackFilter() override; + bool hltFilter(edm::Event&, + const edm::EventSetup&, + trigger::TriggerFilterObjectWithRefs& filterproduct) const override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - bool filter(edm::Event&, const edm::EventSetup&) override; - edm::InputTag inputTag_; // input tag identifying product containing pixel clusters unsigned int min_pixelTracks_; // minimum number of clusters unsigned int max_pixelTracks_; // maximum number of clusters - edm::EDGetTokenT inputToken_; + edm::EDGetTokenT inputToken_; }; // @@ -36,10 +37,11 @@ class HLTPixelTrackFilter : public edm::stream::EDFilter<> { // HLTPixelTrackFilter::HLTPixelTrackFilter(const edm::ParameterSet& config) - : inputTag_(config.getParameter("pixelTracks")), + : HLTFilter(config), + inputTag_(config.getParameter("pixelTracks")), min_pixelTracks_(config.getParameter("minPixelTracks")), max_pixelTracks_(config.getParameter("maxPixelTracks")) { - inputToken_ = consumes(inputTag_); + inputToken_ = consumes(inputTag_); LogDebug("") << "Using the " << inputTag_ << " input collection"; LogDebug("") << "Requesting at least " << min_pixelTracks_ << " PixelTracks"; if (max_pixelTracks_ > 0) @@ -50,6 +52,7 @@ HLTPixelTrackFilter::~HLTPixelTrackFilter() = default; void HLTPixelTrackFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; + makeHLTFilterDescription(desc); desc.add("pixelTracks", edm::InputTag("hltPixelTracks")); desc.add("minPixelTracks", 0); desc.add("maxPixelTracks", 0); @@ -60,12 +63,22 @@ void HLTPixelTrackFilter::fillDescriptions(edm::ConfigurationDescriptions& descr // member functions // // ------------ method called to produce the data ------------ -bool HLTPixelTrackFilter::filter(edm::Event& event, const edm::EventSetup& iSetup) { +bool HLTPixelTrackFilter::hltFilter(edm::Event& event, + const edm::EventSetup& iSetup, + trigger::TriggerFilterObjectWithRefs& filterproduct) const { + // All HLT filters must create and fill an HLT filter object, + // recording any reconstructed physics objects satisfying (or not) + // this HLT filter, and place it in the Event. + if (saveTags()) + filterproduct.addCollectionTag(inputTag_); + // get hold of products from Event - edm::Handle trackColl; - event.getByToken(inputToken_, trackColl); + const auto& trackColl = event.getHandle(inputToken_); unsigned int numTracks = trackColl->size(); + for (size_t i = 0; i < numTracks; i++) + filterproduct.addObject(trigger::TriggerTrack, reco::RecoChargedCandidateRef(trackColl, i)); + LogDebug("") << "Number of tracks accepted: " << numTracks; bool accept = (numTracks >= min_pixelTracks_); if (max_pixelTracks_ > 0)