diff --git a/RecoLocalTracker/SiPixelClusterizer/plugins/gpuClusterChargeCut.h b/RecoLocalTracker/SiPixelClusterizer/plugins/gpuClusterChargeCut.h index 093ef05717a0a..bac8a7bc53c7e 100644 --- a/RecoLocalTracker/SiPixelClusterizer/plugins/gpuClusterChargeCut.h +++ b/RecoLocalTracker/SiPixelClusterizer/plugins/gpuClusterChargeCut.h @@ -39,11 +39,16 @@ namespace gpuClustering { auto endModule = moduleStart[0]; for (auto module = firstModule; module < endModule; module += gridDim.x) { auto firstPixel = moduleStart[1 + module]; - while (id[firstPixel] == invalidModuleId) - ++firstPixel; // could be duplicates! + while (id[firstPixel] == invalidModuleId) { + // could be duplicates! + ++firstPixel; + } auto thisModuleId = id[firstPixel]; + if (thisModuleId != moduleId[module]) { + // all pixels are either invalid or duplicates, skip this module + continue; + } assert(thisModuleId < nMaxModules); - assert(thisModuleId == moduleId[module]); auto nclus = nClustersInModule[thisModuleId]; if (nclus == 0)