Skip to content

Commit

Permalink
Merge pull request #27645 from Dr15Jones/consumesEcalNextToDeadChanne…
Browse files Browse the repository at this point in the history
…lESProducer

Added consumes to EcalNextToDeadChannelESProducer
  • Loading branch information
cmsbuild authored Jul 31, 2019
2 parents 3f13df5 + b945f5a commit 3042235
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ class EcalNextToDeadChannelESProducer : public edm::ESProducer {

edm::ReusableObjectHolder<HostType> holder_;

edm::ESGetToken<EcalChannelStatus, EcalChannelStatusRcd> 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<EcalChannelStatus, EcalChannelStatusRcd>()) {
statusThreshold_ = iConfig.getParameter<int>("channelStatusThresholdForDead");
}

Expand All @@ -65,8 +63,7 @@ void EcalNextToDeadChannelESProducer::setupNextToDeadChannels(const EcalChannelS

// Find channels next to dead ones and fill corresponding record

edm::ESHandle<EcalChannelStatus> h;
chs.get(h);
EcalChannelStatus const& h = chs.get(channelToken_);

for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) {
if (ieta == 0)
Expand All @@ -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);
};
}
Expand All @@ -89,15 +86,15 @@ 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);
};
}

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);
};
}
Expand Down

0 comments on commit 3042235

Please sign in to comment.