Abstract
Modern hybrid pixel detectors, such as the Timepix4, generate massive data volumes that require real-time "event building" to group individual pixel hits into particle tracks. This paper presents a high-performance parallel clustering framework utilizing both CPU and GPU architectures. By implementing a zero-suppression-aware GPU algorithm based on a union-find structure, we achieved a throughput of 300 million hits per second, representing a 100x speedup over traditional CPU methods while maintaining >99.99% accuracy.
Introduction
Hybrid pixel detectors are the primary instruments for recording subatomic interactions in particle physics, providing precise spatial and temporal data. The latest generation of these detectors produces tens of millions of hits per second, creating a significant data processing challenge. Traditionally, "event building"—the process of clustering individual hits into tracks representing single particles—is performed offline. However, the sheer volume of data makes storing every raw hit inefficient. To enable real-time data reduction and faster analysis, efficient online clustering algorithms are required to handle the high-flux environments of modern experiments.
Methods
We explored two primary parallelization strategies for real-time event building: CPU-based multi-threading and GPU-accelerated clustering.
CPU-based Parallelization
A multi-threaded pipeline was developed to distribute the workload across multiple cores. We evaluated splitting data by hit count, spatial region, and time windows. Temporal splitting emerged as the most effective method for load balancing. As shown in Figure 1, this approach necessitates a "merging" step to reconnect clusters that may have been split across the boundaries of adjacent time windows.
GPU-based Clustering
The primary innovation of this work is a zero-suppression-aware algorithm designed for GPUs. Unlike standard image-processing Connected Component Labeling (CCL) which processes dense grids, this algorithm focuses exclusively on active hits, reducing complexity to be proportional to particle interactions. It utilizes a union-find data structure with path compression and a "time-invariant property," ensuring that the parent of any hit in a cluster is always an earlier hit ($toa(h) \ge toa(parent(h))$). This keeps clusters naturally sorted by time, which is critical for physics analysis. Performance is further optimized using CUDA streams to overlap data transfer with computation and low-latency shared memory to cache hit labels.
Datasets and Benchmarking
The algorithms were benchmarked against several real-world datasets acquired at the SPS CERN beam lines, including Am-241 gamma radiation, pion beams at various angles, and high-complexity lead ion beams. Artificial subsets were also used to test performance on extremely large clusters (thousands of hits).
Results
The GPU implementation demonstrated exceptional performance, reaching a throughput of 300 million hits per second. This constitutes a two-order-of-magnitude (100x) speedup compared to the CPU-based methods. Accuracy remained high, with an Intersection over Union (IoU) exceeding 99.99% relative to state-of-the-art offline tools. While the CPU version showed near-linear scaling with the number of cores, it eventually hit a performance ceiling due to merging overhead and I/O contention.
Discussion and Conclusion
Our results indicate that offloading clustering to the GPU significantly alleviates the computational bottleneck, allowing the CPU to focus on I/O management. While the GPU approach is highly effective, future work will focus on optimizing overhead for very small clusters and further offloading feature extraction—such as energy or shape calculation—directly to the GPU to further reduce data transfer requirements. This framework provides a scalable solution for the data-intensive requirements of next-generation particle detectors.
Summary updated