From ceec45f2e60f8d1934ea7c5205f9d720ffbddef9 Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Fri, 14 Oct 2022 19:59:58 +0200 Subject: [PATCH] Skip bad channels in the conversion to legacy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During the conversion from SoA to legacy format, skip bad channels, identified by a negative chiĀ². --- .../HcalRecProducers/src/HcalCPURecHitsProducer.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/RecoLocalCalo/HcalRecProducers/src/HcalCPURecHitsProducer.cc b/RecoLocalCalo/HcalRecProducers/src/HcalCPURecHitsProducer.cc index 108bdc76d8f28..ceb8f4b08f849 100644 --- a/RecoLocalCalo/HcalRecProducers/src/HcalCPURecHitsProducer.cc +++ b/RecoLocalCalo/HcalRecProducers/src/HcalCPURecHitsProducer.cc @@ -103,14 +103,18 @@ void HcalCPURecHitsProducer::produce(edm::Event& event, edm::EventSetup const& s // did not set size with ctor as there is no setter for did recHitsLegacy->reserve(tmpRecHits_.did.size()); for (uint32_t i = 0; i < tmpRecHits_.did.size(); i++) { + // skip bad channels + if (tmpRecHits_.chi2[i] < 0) + continue; + + // build a legacy rechit with the computed detid and MAHI energy recHitsLegacy->emplace_back(HcalDetId{tmpRecHits_.did[i]}, tmpRecHits_.energy[i], 0 // timeRising ); - - // update newly pushed guy - (*recHitsLegacy)[i].setChiSquared(tmpRecHits_.chi2[i]); - (*recHitsLegacy)[i].setRawEnergy(tmpRecHits_.energyM0[i]); + // update the legacy rechit with the Chi2 and M0 values + recHitsLegacy->back().setChiSquared(tmpRecHits_.chi2[i]); + recHitsLegacy->back().setRawEnergy(tmpRecHits_.energyM0[i]); } // put the legacy collection