Real-time Timepix3 data clustering, visualization and classification with a new Clusterer framework
Lukáš Meduna, Benedikt Bergmann, Petr Burian, Petr Mánek, Stanislav Pospíšil, Michal Suk
PProceedings of the CTD/WIT 2019PROC-CTD19-105October 30, 2019
Real-time Timepix3 data clustering, visualization and classificationwith a new Clusterer framework
Luk´aˇs Meduna , Benedikt Bergmann , Petr Burian
1, 2 ,Petr M´anek , Stanislav Posp´ıˇsil , Michal Suk On behalf of Institute of Experimental and Applied PhysicsCzech Technical University in Prague, Czech Republicand Faculty of Electrical EngineeringUniversity of West Bohemia.
ABSTRACTWith the next-generation Timepix3 hybrid pixel detector, new possibilities andchallenges have arisen. The Timepix3 segments active sensor area of 1 . cm into a square matrix of 256 x 256 pixels. In each pixel, the Time of Arrival (ToA,with a time binning of 1.56 ns ) and Time over Threshold (ToT, energy) aremeasured simultaneously in a data-driven, i.e. self-triggered, read-out scheme.This contribution presents a framework for data acquisition, real-time clustering,visualization, classification and data saving. All of these tasks can be performedonline, directly from multiple readouts through UDP protocol. Clusters arereconstructed on a pixel-by-pixel decision from the stream of not-necessarilychronologically sorted pixel data. To achieve quick spatial pixel-to-clustermatching, non-trivial data structures (quadtree) are utilized.Furthermore, parallelism (i.e multi-threaded architecture) is used to furtherimprove the performance of the framework. Such real-time clustering offers theadvantages of online filtering and classification of events. Versatility of thesoftware is ensured by supporting all major operating systems (macOS, Windowsand Linux) with both graphical and command-line interfaces.The performance of the real-time clustering and applied filtration methods aredemonstrated using data from the Timepix3 network installed in the ATLAS andMoEDAL experiments at CERN.PRESENTED ATConnecting the Dots and Workshop on Intelligent Trackers (CTD/WIT 2019)Instituto de F´ısica Corpuscular (IFIC), Valencia, SpainApril 2-5, 2019 a r X i v : . [ phy s i c s . i n s - d e t ] O c t onnecting the Dots and Workshop on Intelligent Trackers. IFIC (Valencia). April 2-5, 2019 Timepix3 [4] is the latest addition to the family of hybrid pixel detectors developed in the Medipix collabo-ration ∗ . Timepix3 features an active are of 1.98 cm segmented into a square matrix of 256 x 256 pixels ata pixel pitch of 55 µ m. Each pixel provides information about the energy deposition and the time of arrival(time binning 1.5625 ns). Its high temporal granularity allows measurements in high flux environments with-out risking track overlap and was successfully employed to perform 3D reconstruction of particle tracks [6, 7].Recently, Timepix3 detectors have been installed in the ATLAS [1] and MoEDAL [9] experiments at CERN,where they provide valuable information about the radiation levels and composition of the radiation fields.Whereas previous chips of Timepix technology [5] purely rely on a frame-based readout scheme, Timepix3comes with a data-driven operation, allowing a (quasi-)continuous measurement (per pixel dead-time: 475 ns).In data driven mode, the output of the detector is a stream of individual pixel which can be processed almostin real-time. The aim of the presented work is to develop algorithms for fast track building to allow onlinevisualization (for radiation level monitoring) and data filtering for pre-selection of relevant data to directlyreject unwanted events and reduce disk space requirements. We have used the Katherine readout [3] to testthe developed methodology and algorithms. However, the implemented methods are fully compatible withother Timepix3 readouts [8, 2]. The presented framework is written in the modern C ++
14 language, which is suitable for high performancecomputations. The core of the framework is independent of the GUI † that is written in the Qt5 library ‡ .Aside from the quadtree [10] structure which bolsters the performance considerably, parallelism is usedin the framework. Individual steps (i.e. reading input, parsing, clustering and visualizing) are separated intothreads. Filtering of clusters is done using plug-ins compiled as dynamic libraries.The framework was compiled, validated and tested on the major operating systems (Windows, macOSand Linux § ) thus ensuring the versatility of the software. Both CLI ¶ and GUI versions were created. Definition 1 (Cluster of pixels) . Let ∆ t be a positive real number called size of the time window, X be a set of pixels and let for each pixel p ∈ X , T oA p denotes its time of arrival. A subset C of X is called cluster, if for each pair of pixels p, p (cid:48) ∈ C the following two conditions are satisfied:1. | T oA p − T oA p (cid:48) | < ∆ t , i.e. the times of arrival of the pixels p and p (cid:48) differ less than ∆ t (cid:107)
2. There exists a path of pixels in X from p to p (cid:48) , i.e. a sequence of 8-connected pixels in X which startsin p and ends in p (cid:48) . Individual cluster events are recreated based on spatial and time configuration using the
ToA and positionin the sensor matrix ( x,y ) of pixel hits. Due to the technical implementation in the Timepix3 chip, the last200 µ s of pixels are not in chronological order. ∗ https://medipix.web.cern.ch/ † GUI - graphical user interface. ‡ https://doc.qt.io/qt-5/qt5-intro.html § Tested configurations – Windows 10 64-bit edition, macOS 10.14 (Mojave) and Linux Mint 19.0 (Debian based distribution). ¶ CLI - command line interface (cid:107)
The value depends on the expected drift times of charge carriers and responses of pixel electronics. Conservatively, a valueof 2000 ns was chosen. onnecting the Dots and Workshop on Intelligent Trackers. IFIC (Valencia). April 2-5, 2019 The goal is to transform partially unsorted hits from 2D space into the ToA sorted stream of separatedevents. The idea for processing incoming hits is given in the following.Keep a set of partial clusters (denoted as openClusters ). Try adding the new pixel to an existing cluster.If there is no existing cluster to which the new pixel can be added, create a new cluster consisting just of thecurrent pixel. If the new pixel can be added to more than one cluster, join these clusters. This is achievedby Algorithm 1. If some of the partial clusters contains only pixels with ToA less than
T oA − µ s (theunordered time window) of the new pixel, the cluster is outputted and removed from the set of openClusters .Within these 200 µ s, hundreds of clusters can be under construction. Algorithm 1
Process one pixel
Require: openClusters ← [] procedure ProcessPixel ( timepixel ) (cid:46) Pixel containing coordinates and ToA added ← False for each cluster in openClusters do if CanBeAdded ( cluster, timepixel ) then if added then lastCluster ← JoinClusters ( cluster, lastCluster ) else AddPixel ( cluster, timepixel ) added ← True lastCluster ← cluster if not added then lastCluster ← CreateNewCluster ( openClusters ) AddPixel ( lastCluster, timepixel ) CloseAndDispatchOldClusters ( openClusters )The structure timepixel is used to describe the tuple ( x , y , ToA). The method CanBeAdded uses internalquadtree structure to determine if the pixel is adjacent (i.e. ) to the cluster. Joining clustersin method
JoinClusters is done by transfer of leaf nodes from the smaller tree to the bigger one.For quick validation, if a pixel is adjacent to an open cluster, quadtree [10] was selected and implemented.
For logarithmic access time and low memory consumption per cluster, the quadtree data structure wasselected to represent the neighboring pixels during the construction of separated events. The quadtree rootnode is representing a two-dimensional area. Each of four child nodes corresponds to one of the quadrants.At the end of branches, the leaf nodes are the minimal area of given size (called leaf size ). The complexityis O (log n ), where n is number of pixels in the root area.In the framework’s implementation, an advanced approach was used. To minimize the memory alloca-tions, the tree is built from bottom up. Thus, for a single pixel the tree size is equal to the leaf size and it isincreased when pixels outside the start area are added. To determine the optimal leaf size , the performancewas measured on real data from a mixed radiation field in ATLAS. The results are shown in Figure 1. Thesize 16 ×
16 was selected as a trade-off between performance and memory impact.
With the real-time event reconstruction, multiple metrics of the radiation field can be observed in real-time.As an example, the cluster rates (radiation levels) and cluster energy spectrum as seen during a test beammeasurement are given (Figure 3). The power (data reduction) of the real time data filtering is illustratedin Figure 2(a), where all events within a 2 s integration time are shown on the left and selected tracks of2 onnecting the Dots and Workshop on Intelligent Trackers. IFIC (Valencia). April 2-5, 2019
Figure 1: Performance test of different leaf sizes in real-world data. The memory usage is compared withthe time to process the dataset. (a) (b)
Figure 2: (a) Integration window of 2 s without (left) and with (right) filtering of events of interest; (b) Singlecluster representing an inelastic interaction with the silicon nucleus of the detection medium (fragmentationreaction), which was selected and further evaluated (skeletonized). Five outgoing tracks (prongs) could beidentified. Data were acquired by Timepix3 installed in ATLAS.interest on the right. Proper filtering on track properties reduces the demand of disk space significantlywithout losing experiment relevant data. Pre-seleted Events of interest can then be further analyzed asshown in Figure 2(b), where the tracks of fragmentation products are identified by skeletonization.
In this contribution, a comprehensive framework for data processing, event building and filtering on trackfeatures in the data-driven mode of Timepix3 was presented. Methods of fast parallel and reliable clusteringof individual hits into separated events in real-time were developed. The software can be used both offline(the source is a file) and online (the source is a Timepix3 device). The clusterer offers a variety of onlinemeasurement statistics (e.g. energy spectrum, event intensity and integration live display), with support ofuser-defined filtering.The software contains support for energy calibration and time-walk correction techniques [2, 6]. It canuse the Katherine readout stream as direct data input. Modularity of the software allows interfacing differentreadouts or input sources. Online filtering on event properties was introduced as a powerful tool to reducethe amount of stored data for further analysis by regarding unwanted (background) events.
ACKNOWLEDGEMENTS
The authors would like to express their sincere gratitude to the Medipix2 and Medipix3 Collaboration fortheir permanent support. We would like to thank to RNDr. Frantiˇsek Mr´az, CSc. of the Faculty ofMathematics and Physics, Charles University, for his advices during the development of the framework.3 onnecting the Dots and Workshop on Intelligent Trackers. IFIC (Valencia). April 2-5, 2019
Figure 3: Real-time statistics of the measured radiation field. Cluster rate as a function of measurementtime (left) and energy spectrum of the clusters during the measurement (right). The data were acquiredduring a test beam campaign in a relativistic particle beam at the Super-Proton-Synchrotron at CERN. Thebottom image shows detail of the measurement while the filtering is applied. The blue line represents theraw input and the orange and green lines the filters based on class and size.This work was supported by European Regional Development Funds: ”Van de Graaf Accelerator andTunable Source of Monoenergetic Neutrons and Light Ions” (No. CZ.02.1.02 / 0.0 / 0.0 / 16 013 / 0001785) and ”Research Infrastructure for Experiments at CERN” (LM 2015058) . References [1] P. Burian et al., Timepix3 detector network at ATLAS experiment, Journal of Instrumentation vol. no. 11, C11024–C11024 (2018)[2] D. Turecek et al., USB 3.0 readout and time-walk correction method for Timepix3 detector, Journalof Instrumentation vol. no. 12, C12065–C12065 (2016)[3] P. Burian et al., Katherine: Ethernet Embedded Readout Interface for Timepix3, Journal of Instru-mentation vol. no. 11, C11001–C11001 (2017)[4] T. Poikela et al., Timepix3: a 65K channel hybrid pixel readout chip with simultaneous ToA/ToT andsparse readout, Journal of Instrumentation vol. no. 11, C11024–C11024 (2014)[5] X. Llopart et al., Timepix, a 65k programmable pixel readout chip for arrival time, energy and/or photoncounting measurements, Nuclear Instruments and Methods in Physics Research Section A: Accelerators,Spectrometers, Detectors and Associated Equipment vol. no. 1, 485 - 494 (2007)[6] B. Bergmann et al., 3D track reconstruction capability of a silicon hybrid active pixel detector, TheEuropean Physical Journal C, vol. no. 6, 421 (2017)[7] B. Bergmann et al., 3D reconstruction of particle tracks in a 2 mm thick CdTe hybrid pixel detector,The European Physical Journal C, vol. no. 2, 165 (2019)[8] J. Visser et al., SPIDR: a read-out system for Medipix3 & Timepix3, Journal of Instrumentation, vol. no. 12, C12028–C12028 (2015)[9] B. Acharya et al., The physics programme of the MoEDAL experiment at the LHC, InternationalJournal of Modern Physics A, vol. no. 23, 1430050 (2014)[10] Hanan Samet, The Quadtree and Related Hierarchical Data Structures, ACM Comput. Surv., vol.16