From f62a42fe9f2d1b4e2605049799e634c39697c72d Mon Sep 17 00:00:00 2001 From: Matej Roguljic Date: Thu, 9 Jan 2025 22:53:26 +0100 Subject: [PATCH] check for repeat detIDs when converting clusters from SoA --- .../plugins/SiPixelDigisClustersFromSoAAlpaka.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelDigisClustersFromSoAAlpaka.cc b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelDigisClustersFromSoAAlpaka.cc index 982239924463f..26f258b92a0f9 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelDigisClustersFromSoAAlpaka.cc +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/SiPixelDigisClustersFromSoAAlpaka.cc @@ -1,4 +1,5 @@ #include +#include #include "DataFormats/Common/interface/DetSetVector.h" #include "DataFormats/DetId/interface/DetId.h" @@ -159,6 +160,7 @@ void SiPixelDigisClustersFromSoAAlpaka::produce(edm::StreamID, #ifdef GPU_DEBUG std::cout << "Dumping all digis. nDigis = " << nDigis << std::endl; #endif + std::unordered_set processedDetIds; for (uint32_t i = 0; i < nDigis; i++) { // check for uninitialized digis if (digisView[i].rawIdArr() == 0) @@ -183,12 +185,17 @@ void SiPixelDigisClustersFromSoAAlpaka::produce(edm::StreamID, #ifdef EDM_ML_DEBUG assert(digisView[i].rawIdArr() > 109999); #endif + // Check if detId has already been processed + if (processedDetIds.find(detId) != processedDetIds.end()) { + continue; // Skip processing this detId if it has already been handled + } if (detId != digisView[i].rawIdArr()) { #ifdef GPU_DEBUG std::cout << ">> Closed module --" << detId << "; nclus = " << nclus << std::endl; #endif // new module fillClusters(detId); + processedDetIds.insert(detId); #ifdef EDM_ML_DEBUG assert(nclus == -1); #endif @@ -223,8 +230,8 @@ void SiPixelDigisClustersFromSoAAlpaka::produce(edm::StreamID, aclusters[digisView[i].clus()].add(pix, digisView[i].adc()); } - // fill final clusters - if (detId > 0) + // fill final clusters (if not already filled for that ID) + if (detId > 0 && processedDetIds.find(detId) == processedDetIds.end()) fillClusters(detId); #ifdef EDM_ML_DEBUG