From b945f5a7b9468ee71e24e0cdff6baa1ee5c1f89f Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Tue, 30 Jul 2019 10:14:34 -0500 Subject: [PATCH] Added consumes to EcalNextToDeadChannelESProducer Also use ESGetToken returned by consumes. --- .../plugins/EcalNextToDeadChannelESProducer.cc | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/RecoEcal/EgammaCoreTools/plugins/EcalNextToDeadChannelESProducer.cc b/RecoEcal/EgammaCoreTools/plugins/EcalNextToDeadChannelESProducer.cc index 16043869a98c2..1e8b549107f36 100644 --- a/RecoEcal/EgammaCoreTools/plugins/EcalNextToDeadChannelESProducer.cc +++ b/RecoEcal/EgammaCoreTools/plugins/EcalNextToDeadChannelESProducer.cc @@ -37,15 +37,13 @@ class EcalNextToDeadChannelESProducer : public edm::ESProducer { edm::ReusableObjectHolder holder_; + edm::ESGetToken const channelToken_; // threshold above which a channel will be considered "dead" int statusThreshold_; }; -EcalNextToDeadChannelESProducer::EcalNextToDeadChannelESProducer(const edm::ParameterSet& iConfig) { - //the following line is needed to tell the framework what - // data is being produced - setWhatProduced(this); - +EcalNextToDeadChannelESProducer::EcalNextToDeadChannelESProducer(const edm::ParameterSet& iConfig) + : channelToken_(setWhatProduced(this).consumesFrom()) { statusThreshold_ = iConfig.getParameter("channelStatusThresholdForDead"); } @@ -65,8 +63,7 @@ void EcalNextToDeadChannelESProducer::setupNextToDeadChannels(const EcalChannelS // Find channels next to dead ones and fill corresponding record - edm::ESHandle h; - chs.get(h); + EcalChannelStatus const& h = chs.get(channelToken_); for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) { if (ieta == 0) @@ -75,7 +72,7 @@ void EcalNextToDeadChannelESProducer::setupNextToDeadChannels(const EcalChannelS if (EBDetId::validDetId(ieta, iphi)) { EBDetId detid(ieta, iphi); - if (EcalTools::isNextToDeadFromNeighbours(detid, *h, statusThreshold_)) { + if (EcalTools::isNextToDeadFromNeighbours(detid, h, statusThreshold_)) { rcd->setValue(detid, 1); }; } @@ -89,7 +86,7 @@ void EcalNextToDeadChannelESProducer::setupNextToDeadChannels(const EcalChannelS if (EEDetId::validDetId(iX, iY, 1)) { EEDetId detid(iX, iY, 1); - if (EcalTools::isNextToDeadFromNeighbours(detid, *h, statusThreshold_)) { + if (EcalTools::isNextToDeadFromNeighbours(detid, h, statusThreshold_)) { rcd->setValue(detid, 1); }; } @@ -97,7 +94,7 @@ void EcalNextToDeadChannelESProducer::setupNextToDeadChannels(const EcalChannelS if (EEDetId::validDetId(iX, iY, -1)) { EEDetId detid(iX, iY, -1); - if (EcalTools::isNextToDeadFromNeighbours(detid, *h, statusThreshold_)) { + if (EcalTools::isNextToDeadFromNeighbours(detid, h, statusThreshold_)) { rcd->setValue(detid, 1); }; }