From 0676bcf75ab190f974ef1e6feb97dbd16b07eddb Mon Sep 17 00:00:00 2001 From: mmusich Date: Wed, 31 Jul 2024 10:59:10 +0200 Subject: [PATCH 1/2] skip bad channels in PFRecHitProducerKernelConstruct::applyCuts - as implemented in HcalRecHitSoAToLegacy - also check denseId validity before retrieving PF threshold --- .../plugins/alpaka/PFRecHitProducerKernel.dev.cc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/RecoParticleFlow/PFRecHitProducer/plugins/alpaka/PFRecHitProducerKernel.dev.cc b/RecoParticleFlow/PFRecHitProducer/plugins/alpaka/PFRecHitProducerKernel.dev.cc index 40d7b2315c818..1d775595bb279 100644 --- a/RecoParticleFlow/PFRecHitProducer/plugins/alpaka/PFRecHitProducerKernel.dev.cc +++ b/RecoParticleFlow/PFRecHitProducer/plugins/alpaka/PFRecHitProducerKernel.dev.cc @@ -59,8 +59,19 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { const uint32_t detId = rh.detId(); const uint32_t depth = HCAL::getDepth(detId); const uint32_t subdet = getSubdet(detId); + + // skip bad channels + if (rh.chi2() < 0) + return false; + if (topology.cutsFromDB()) { - threshold = topology.noiseThreshold()[HCAL::detId2denseId(detId)]; + const auto& denseId = HCAL::detId2denseId(detId); + if (denseId != HCAL::kInvalidDenseId) { + threshold = topology.noiseThreshold()[denseId]; + } else { + printf("Encountered invalid denseId for detId %u (subdetector %u)!", detId, subdet); + return false; + } } else { if (subdet == HcalBarrel) { threshold = params.energyThresholds()[depth - 1]; From bc2c4d96933b9ee3c0aa71189fcb76f7003bedbd Mon Sep 17 00:00:00 2001 From: mmusich Date: Wed, 31 Jul 2024 11:00:31 +0200 Subject: [PATCH 2/2] improve invalid detid printouts in CalorimeterDefinition --- .../PFRecHitProducer/plugins/alpaka/CalorimeterDefinitions.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoParticleFlow/PFRecHitProducer/plugins/alpaka/CalorimeterDefinitions.h b/RecoParticleFlow/PFRecHitProducer/plugins/alpaka/CalorimeterDefinitions.h index 39f8559abb811..4f1d50a249288 100644 --- a/RecoParticleFlow/PFRecHitProducer/plugins/alpaka/CalorimeterDefinitions.h +++ b/RecoParticleFlow/PFRecHitProducer/plugins/alpaka/CalorimeterDefinitions.h @@ -111,7 +111,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer { if (subdet == HcalEndcap) return detId2denseIdHE(detId); - printf("invalid detId: %u\n", detId); + printf("invalid Hcal detId: %u\n", detId); return kInvalidDenseId; } }; @@ -197,7 +197,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::particleFlowRecHitProducer { if (subdet == EcalEndcap) return Barrel::kSize + Endcap::denseIndex(detId); - printf("invalid detId: %u\n", detId); + printf("invalid Ecal detId: %u\n", detId); return kInvalidDenseId; }