Skip to content

Commit 9fc0765

Browse files
committed
GPU TPC: Fix decoding of empty CTFs
1 parent 2dd4ef4 commit 9fc0765

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

GPU/GPUTracking/DataCompression/GPUTPCCompressionKernels.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ GPUdii() void GPUTPCCompressionKernels::Thread<GPUTPCCompressionKernels::step0at
5757
if ((attach & gputpcgmmergertypes::attachTrackMask) != i) {
5858
continue; // Main attachment to different track
5959
}
60-
bool rejectCluster = processors.param.rec.tpc.trackFitRejectMode && (rejectTrk || GPUTPCClusterRejection::GetIsRejected(attach));
60+
bool rejectCluster = processors.param.rec.tpc.rejectionStrategy >= GPUSettings::RejectionStrategyA && (rejectTrk || GPUTPCClusterRejection::GetIsRejected(attach));
6161
if (rejectCluster) {
6262
compressor.mClusterStatus[hitId] = 1; // Cluster rejected, do not store
6363
continue;

GPU/GPUTracking/DataCompression/TPCClusterDecompressor.cxx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,15 @@ int TPCClusterDecompressor::decompress(const CompressedClusters* clustersCompres
113113
}
114114
offset += clustersCompressed->nTrackClusters[i] - j;
115115
}
116-
ClusterNative* clusterBuffer = allocator(clustersCompressed->nAttachedClusters + clustersCompressed->nUnattachedClusters);
116+
size_t nTotalClusters = clustersCompressed->nAttachedClusters + clustersCompressed->nUnattachedClusters;
117+
ClusterNative* clusterBuffer = allocator(nTotalClusters);
117118
unsigned int offsets[NSLICES][GPUCA_ROW_COUNT];
118119
offset = 0;
119120
for (unsigned int i = 0; i < NSLICES; i++) {
120121
for (unsigned int j = 0; j < GPUCA_ROW_COUNT; j++) {
121-
clustersNative.nClusters[i][j] = clusters[i][j].size() + clustersCompressed->nSliceRowClusters[i * GPUCA_ROW_COUNT + j];
122+
clustersNative.nClusters[i][j] = clusters[i][j].size() + ((i * GPUCA_ROW_COUNT + j >= clustersCompressed->nSliceRows) ? 0 : clustersCompressed->nSliceRowClusters[i * GPUCA_ROW_COUNT + j]);
122123
offsets[i][j] = offset;
123-
offset += clustersCompressed->nSliceRowClusters[i * GPUCA_ROW_COUNT + j];
124+
offset += (i * GPUCA_ROW_COUNT + j >= clustersCompressed->nSliceRows) ? 0 : clustersCompressed->nSliceRowClusters[i * GPUCA_ROW_COUNT + j];
124125
}
125126
}
126127
clustersNative.clustersLinear = clusterBuffer;
@@ -135,8 +136,11 @@ int TPCClusterDecompressor::decompress(const CompressedClusters* clustersCompres
135136
unsigned int time = 0;
136137
unsigned short pad = 0;
137138
ClusterNative* cl = buffer + clusters[i][j].size();
138-
unsigned int end = offsets[i][j] + clustersCompressed->nSliceRowClusters[i * GPUCA_ROW_COUNT + j];
139+
unsigned int end = offsets[i][j] + ((i * GPUCA_ROW_COUNT + j >= clustersCompressed->nSliceRows) ? 0 : clustersCompressed->nSliceRowClusters[i * GPUCA_ROW_COUNT + j]);
139140
for (unsigned int k = offsets[i][j]; k < end; k++) {
141+
/*if (cl >= clustersNative.clustersLinear + nTotalClusters) {
142+
throw std::runtime_error("Bad TPC CTF data, decoded more clusters than announced");
143+
}*/
140144
if (clustersCompressed->nComppressionModes & GPUSettings::CompressionDifferences) {
141145
unsigned int timeTmp = clustersCompressed->timeDiffU[k];
142146
if (timeTmp & 800000) {

0 commit comments

Comments
 (0)