From dac1a782317d8b3c6bfb03a15d1f2d2bc111e56a Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 30 Jun 2021 16:42:01 +0200 Subject: [PATCH] Fix crash of ECAL local reco on GPU if ECAL is not in the run. --- EventFilter/EcalRawToDigi/plugins/EcalRawToDigiGPU.cc | 7 +++++-- .../EcalRecProducers/plugins/EcalRecHitProducerGPU.cc | 4 ++++ .../plugins/EcalUncalibRecHitProducerGPU.cc | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/EventFilter/EcalRawToDigi/plugins/EcalRawToDigiGPU.cc b/EventFilter/EcalRawToDigi/plugins/EcalRawToDigiGPU.cc index 5b58bf159b9d0..4dcb1bd0e26e1 100644 --- a/EventFilter/EcalRawToDigi/plugins/EcalRawToDigiGPU.cc +++ b/EventFilter/EcalRawToDigi/plugins/EcalRawToDigiGPU.cc @@ -134,8 +134,11 @@ void EcalRawToDigiGPU::acquire(edm::Event const& event, ++counter; } - ecal::raw::entryPoint( - inputCPU, inputGPU, outputGPU_, scratchGPU, outputCPU_, conditions, ctx.stream(), counter, currentCummOffset); + // unpack if at least one FED has data + if (counter > 0) { + ecal::raw::entryPoint( + inputCPU, inputGPU, outputGPU_, scratchGPU, outputCPU_, conditions, ctx.stream(), counter, currentCummOffset); + } } void EcalRawToDigiGPU::produce(edm::Event& event, edm::EventSetup const& setup) { diff --git a/RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitProducerGPU.cc b/RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitProducerGPU.cc index 38c142f4c41f2..89048028f4279 100644 --- a/RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitProducerGPU.cc +++ b/RecoLocalCalo/EcalRecProducers/plugins/EcalRecHitProducerGPU.cc @@ -164,6 +164,10 @@ void EcalRecHitProducerGPU::acquire(edm::Event const& event, neb_ = ebUncalibRecHits.size; nee_ = eeUncalibRecHits.size; + // stop here if there are no uncalibRecHits + if (neb_ + nee_ == 0) + return; + if ((neb_ > configParameters_.maxNumberHitsEB) || (nee_ > configParameters_.maxNumberHitsEE)) { edm::LogError("EcalRecHitProducerGPU") << "max number of channels exceeded. See options 'maxNumberHitsEB and maxNumberHitsEE' "; diff --git a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitProducerGPU.cc b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitProducerGPU.cc index 3729bddde895f..c87ea1082b673 100644 --- a/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitProducerGPU.cc +++ b/RecoLocalCalo/EcalRecProducers/plugins/EcalUncalibRecHitProducerGPU.cc @@ -207,6 +207,10 @@ void EcalUncalibRecHitProducerGPU::acquire(edm::Event const& event, neb_ = ebDigis.size; nee_ = eeDigis.size; + // stop here if there are no digis + if (neb_ + nee_ == 0) + return; + if ((neb_ > configParameters_.maxNumberHitsEB) || (nee_ > configParameters_.maxNumberHitsEE)) { edm::LogError("EcalUncalibRecHitProducerGPU") << "max number of channels exceeded. See options 'maxNumberHitsEB and maxNumberHitsEE' ";