Skip to content

Commit

Permalink
Merge pull request #40629 from jeongeun/remove-consumesMany
Browse files Browse the repository at this point in the history
Migrate consumesMany() to edm::GetterOfProducts() in EgammaHLTExtraProducer
  • Loading branch information
cmsbuild authored Feb 3, 2023
2 parents d86e31d + 74ba461 commit e8ef640
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions RecoEgamma/EgammaHLTProducers/plugins/EgammaHLTExtraProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Framework/interface/GetterOfProducts.h"
#include "FWCore/Framework/interface/ProcessMatch.h"

#include "DataFormats/HLTReco/interface/EgammaObject.h"
#include "DataFormats/HLTReco/interface/EgammaObjectFwd.h"
Expand Down Expand Up @@ -183,6 +185,7 @@ class EgammaHLTExtraProducer : public edm::global::EDProducer<> {
bool saveHitsPlusPi_;
bool saveHitsPlusHalfPi_;
std::vector<double> recHitCountThresholds_;
edm::GetterOfProducts<reco::RecoEcalCandidateIsolationMap> getterOfProducts_;
};

EgammaHLTExtraProducer::Tokens::Tokens(const edm::ParameterSet& pset, edm::ConsumesCollector&& cc) {
Expand All @@ -200,8 +203,8 @@ EgammaHLTExtraProducer::EgammaHLTExtraProducer(const edm::ParameterSet& pset)
saveHitsPlusPi_(pset.getParameter<bool>("saveHitsPlusPi")),
saveHitsPlusHalfPi_(pset.getParameter<bool>("saveHitsPlusHalfPi")),
recHitCountThresholds_(pset.getParameter<std::vector<double>>("recHitCountThresholds")) {
consumesMany<reco::RecoEcalCandidateIsolationMap>();

getterOfProducts_ = edm::GetterOfProducts<reco::RecoEcalCandidateIsolationMap>(edm::ProcessMatch("*"), this);
callWhenNewProductsRegistered(getterOfProducts_);
for (auto& tokenLabel : tokens_.egCands) {
produces<trigger::EgammaObjectCollection>(tokenLabel.second);
}
Expand Down Expand Up @@ -278,8 +281,7 @@ void EgammaHLTExtraProducer::produce(edm::StreamID streamID,
edm::Event& event,
const edm::EventSetup& eventSetup) const {
std::vector<edm::Handle<reco::RecoEcalCandidateIsolationMap>> valueMapHandles;
event.getManyByType(valueMapHandles);

getterOfProducts_.fillHandles(event, valueMapHandles);
std::vector<std::unique_ptr<trigger::EgammaObjectCollection>> egTrigObjColls;
for (const auto& egCandsToken : tokens_.egCands) {
auto ecalCandsHandle = event.getHandle(egCandsToken.first.ecalCands);
Expand Down

0 comments on commit e8ef640

Please sign in to comment.