Efficient Analysis of Test-beam Data with the Corryvreckan Framework

Stringent requirements are posed on the the next generations of vertex and tracking detectors for high-energy physics experiments to reach the foreseen physics goals. A large variety of silicon pixel sensors targeting the specific needs of each use case are developed and tested both in laboratory and test-beam measurement campaigns. Corryvreckan is a flexible, fast and lightweight test-beam data reconstruction and analysis framework based on a modular concept of the reconstruction chain. It is designed to fulfil the requirements for offline event building in complex data-taking environments combining detectors with different readout schemes. Its modular architecture separates the framework core from the implementation of reconstruction, analysis and detector specific algorithms. In this paper, a brief overview of the software framework and the reconstruction and analysis chain is provided. This is complemented by an example analysis of a data set using the offline event building capabilities of the framework and an improved event building scheme allowing for a more efficient usage of test-beam data exploiting the pivot pixel information of the Mimosa26 sensors.


Introduction
The physics objectives of future high-energy particle physics experiments pose stringent requirements on the tracking detector systems. With the advances of the semiconductor industry, silicon pixel sensors are an increasingly competitive technology capable to meet these requirements. Not only the planned upgrades of the experiments at the Large Hadron Collider like ATLAS [1] or CMS [2], but also other possible future high-energy physics experiments, for example at the Compact Linear Collider (CLIC) [3], foresee the use of silicon pixel sensors in their vertex and tracking detector systems. As a consequence, R&D on a vast range of both hybrid and monolithic pixel detector technologies is carried out.
New detector prototypes are often pushing the limits of technology well beyond what has proven to work in the past. Hence, it is crucial that simulations and laboratory measurements are complemented by test-beam campaigns, in which pixel detectors are tested and characterised with a beam of minimum ionising particles. Beam telescopes provide a precise reference measurement of particle tracks, which can be used to determine performance parameters of the pixel detectors under investigation such as the hit detection efficiency as well as the spatial and timing resolution.
Due to the large variety of applications, different readout architectures are implemented depend-ing on the particular requirements of each use case. This creates new challenges regarding the integration of new sensors into test-beam data acquisition systems, as well as for the reconstruction and analysis software, which needs to be capable of combining data from detectors with different readout schemes and data structures in order to avoid repeated implementations of similar algorithms. The Corryvreckan framework [4,5] addresses these challenges and provides a flexible and highly configurable tool for the efficient analysis of test-beam (and laboratory) data. It was initially developed within the CLIC Detector & Physics (CLICdp) collaboration [6,7] and is now employed and extended by a number of users and developers from different experiments supporting an increasing variety of sensor prototypes [8][9][10][11][12][13][14][15]. Through its modularity, it aims to maximize synergies between different research groups by providing a reusable and extendable code basis and thus suppressing the need for numerous similar frameworks. Its offline event building scheme allows for a combination of data from detectors with different readout schemes in multiple ways depending on the analysis objectives [16]. It is developed with the goal to be easy to use and understand, and provides comprehensive documentation [17].
This paper gives an overview of the framework architecture and briefly describes the reconstruction and analysis flow (Sect. 2). In Sect. 3, an example analysis is presented showing the capabilities of the offline event building and illustrating a recent improvement for a more efficient data analysis. Finally, Sect. 4 provides a conclusion and an outlook to future developments.

The Corryvreckan Framework
Corryvreckan is designed following a modular architecture comprising a framework core and user modules. The core handles all centrally provided functionality. This includes the user interaction via the command line interface as well as the parsing of configuration files, data input and output, and internal coordinate transformations. It is separated from modules dedicated to specific reconstruction tasks, such as reading of raw data, clustering, or track reconstruction. Owing to this modularity, users can add their own functionality to the reconstruction chain by developing new modules targeting their particular needs.
The software is configured with the help of two text-based files. The main configuration file defines the reconstruction and analysis chain by listing the required modules and providing the relevant parameters. In addition, a geometry configuration file is needed, in which the position and rotation of all detectors in the setup and their properties are defined.
As mentioned above, the flexible reconstruction and analysis chain in Corryvreckan can be adjusted according to the objectives of the analysis as will be shown in Sect. 3. The steps performed during the reconstruction are defined by the modules listed in the main configuration file. Figure 1 shows a full reconstruction and analysis chain as it can be used to investigate the performance of a device-under-test (DUT). The individuals steps are briefly outlined below. Event Building When decoding raw data from different detectors and converting them into pixel hits, these need to be arranged in coherent data chunks containing the relevant data from all detectors in order to facilitate a consistent analysis. This is referred to as event building in Corryvreckan. An event is defined by a time interval with a start and an end time. In addition, it may contain unique trigger identifies (trigger IDs) and trigger timestamps. The first module of the reconstruction chain needs to define the extent of an event. Depending on the type of detector, an event definition can be derived from data, e.g. for a shutter-based device. Otherwise, a module called Metronome can be used to create events of user-defined length. Each subsequent detector can only add matching data to this event, either based on timestamps or by comparing trigger IDs. This task is performed by modules called EventLoaders. A more detailed description of different event building schemes can be found in [16]. One example is discussed in Sect. 3 of this paper.
Clustering Depending on the incident point and angle of a traversing ionising particle, electronhole pairs can be created in two or more adjacent pixels. In addition, charge can be detected in neighbouring pixels e.g. due to lateral diffusion. This effect is called charge sharing.
Hence, pixel hits originating from the same traversing ionising particle need to be grouped into so-called clusters. Depending on the available information, a clustering algorithm based on spatial information (ClusteringSpatial) or spatial and time information (Clustering4D) can be applied.
Correlations Spatial and time correlations can be calculated between clusters on each detector plane and a user-defined reference plane. These are particularly helpful to check data quality and ensure synchronisation and alignment between devices. In addition, they can be used for a coarse prealignment prior to a precise track-based alignment (see below). They are provided by the Correlations module.
Track finding and track fitting Clusters on the telescope planes need to be combined to form reference tracks. For the track finding, candidate clusters are identified on each telescope plane. In a second step, a track model such as a straight-line track or a General Broken Lines (GBL) [18] model is fitted through these clusters. This task can be performed by different Tracking modules in Corryvreckan.
Association of DUT clusters with reference tracks For an unbiased analysis, the device-undertest should be excluded from the tracking procedure. Consequently, clusters on the DUT need to be associated with the reference tracks based on spatial and time cuts in a separate step of the reconstruction done by the DUTAssociation module.
Track-based alignment In addition to a coarse pre-alignment of the setup based on the correlations as described above, Corryvreckan supports a track-based alignment of the reference telescope by minimising the global track χ 2 using Minuit2 [19] or the Millepede-II [20] algorithm. For the device-under-test, which should be excluded from the tracking, an alignment is possible via the minimisation of its unbiased track-hit residuals.
Analysis of performance parameters In a final step, different analysis modules can be used to investigate particular performance parameters of the reference telescope and the DUT, such as the hit detection efficiency or the spatial and time resolution.

Combining Data from Different Devices by Offline Event Building
Data from different detectors can be combined using the offline event building capabilities of Corryvreckan. In this section, this is illustated by an example based on data recorded at the DESY II Test Beam Facility [21].

Experimental Setup
A schematic drawing of the experimental setup is shown in Fig. 2. The data acquisition (DAQ) was controlled via the EUDAQ2 software framework [22] using the following devices: • The AIDA Trigger Logic Unit (TLU) [23] (shown in yellow) distributes a global clock and a global time reset, and receives input signals from two scintillators. When a coincidence is detected, it generates a trigger ID, records trigger timestamp and ID, and sends out the trigger ID to all connected devices. • The EUDET-type reference telescope [24] consists of six monolithic Mimosa26 sensors (shown in red). They are read out by the NI DAQ system in a continuous rolling shutter mode with a periodicity of 115.2 µs. Only when a trigger signal is received, the data of the corresponding shutter period are stored. The trigger is provided by the TLU and the associated trigger ID is recorded together with the data to allow for an offline synchronization with the other detectors. Individual pixel timestamps are not available. Hits from Mimosa26 planes and the Timepix3 (see below) are combined into reference tracks. • As an additional timing reference plane a Timepix3 hybrid silicon pixel detector assembly [25] (shown in blue) is operated. Its precise pixel timestamps are used to assign unambiguous track timestamps. As a data-driven detector it is always active and sends its pixel hits off to the SPIDR DAQ system [26] directly after detection without the need of an external trigger signal. • The device-under-test (DUT) of the presented setup is an ATLASpix [27] high-voltage monolithic active pixel sensor (shown in green). Like the Timepix3 it is a data-driven detector, which is always active and sends its hit data including pixel timestamps off to the Caribou DAQ system [28] immediately after detection. Since the telescope, the timing reference plane, and the DUT are read out using three independent DAQ systems, the data streams do not have an inherent global event definition. This fact will be important in the following analysis example. The capability of combining these data streams in the offline analysis is one of the core strengths of the Corryvreckan event building logic.

Conventional event building with the AIDA-TLU and the Mimosa26 sensors
As the experimental setup consists of six triggered devices and two always-active data-driven detectors, a reasonable event definition should be based on the active time of the triggered devices. Outside of these active time windows, no hits are recorded on the Mimosa26 planes so that no reference tracks can be reconstructed. Since the Mimosa26 data do not contain timestamps but only trigger IDs, their active time must be reconstructed using the TLU relating the trigger IDs to timestamps. Hence, the event building needs to start with the TLU defining an event with a trigger timestamp and a trigger ID, so that the Mimosa26 data can be matched by comparing the trigger ID. The event can now be refined by spanning a time interval around the trigger timestamp covering the time in which the Mimosa26 hits may have been recorded. According to the design of the rolling shutter readout scheme with a periodicity of 115.2 µs, this time span can cover a maximum of one cycle (115.2 µs) before and two cycles (230.4 µs) after the trigger time. The exact interval depends on the position of the rolling shutter at the moment when a trigger signal is received. In the conventional approach, which has been widely used, e.g. in [11], a fixed time window corresponding to the largest possible time interval is used as illustrated at the top left of Fig. 3. Thereafter, hits from the data-driven detectors Timepix3 and ATLASpix are added to the event based on individual pixel timestamps, i.e. hits with timestamps earlier than the currently defined event are discarded, those with a later timestamp are kept for the next event, ensuring that a coherent chunk of data is used for the analysis.
Occasionally, the over-estimation of the active time of the device can lead to an additional trigger being added to the current event. If this additional trigger actually happened after the readout of the current event and the Mimosa26 sensors are active again, then this data block is also added to the current event by matching the trigger ID as illustrated on the top right of Fig. 3. Since the Timepix3 data are added based on its pixel timestamps and a hit on this detector is required during the tracking, no tracks can be found for the additional hits on the Mimosa26 planes from the additional readout block. In the next event, the Mimosa26 data block has been used, such that potential tracks from these hits cannot be reconstructed. This effect causes a slight reduction in the number of tracks that are reconstructed during analysis for a given data set. However, because the track reconstruction is restricted to the well-defined time span of the event by requiring a Timepix3 hit as part of the track, the analysis of the DUT performance is not compromised.

Improved event building exploiting the Mimosa26 pivot pixel information
In order to improve the usage of the data, a new module EventDefinitionM26 [29] has been developed. It makes use of the fact that the Mimosa26 data contains the information which pixel row the rolling shutter was passing when a trigger signal was received, the so-called pivot pixel. Using this information, the precise time interval with a duration of two readout cycles (230.4 µs) can be calculated relative to the trigger timestamp as indicated at the bottom left of Fig. 3. Consequently, the event length is reduced from 345.6 µs to 230.4 µs. As can be seen in Fig. 4, this increases the number of reconstructed events in the investigated run by ≈34 % as expected from the ratio of event lengths, whereas the number of triggers per event is reduced. If the number of triggers per event is now larger than one, it means that the TLU has recorded an additional coincidence and this trigger is stored. But because the Mimosa26 readout is still busy at this point in time, no corresponding block of data can be found for these trigger IDs and thus no second block of Mimosa26 data is added to the event. Figure 5 shows the distribution of the track fit χ 2 /ndo f (number of degrees of freedom), which is a measure for the quality of the fit. Typically, tracks with a χ 2 /ndo f < 3 are used for the final analysis. In the analysed data set with a data taking time of 600 s, the number of tracks with a χ 2 /ndo f < 3 is increased by ≈7 % compared to the conventional approach meaning that the number of tracks usable for the analysis is enhanced. Simultaneously, the number of tracks with a large χ 2 /ndo f > 50 (shown in the overflow bin) is reduced significantly by ≈20 % due to the fact that no additional Mimosa26 data blocks are added to an event and thus the combinatorics of track candidates is reduced significantly. These tracks do not play a role for the further analysis because they are rejected based on their large  χ 2 /ndo f . However, they slow down the computation time needed for the analysis because of the larger combinatorics while calculating correlations and performing the track finding and fitting. By applying this improvement in the event building logic, existing test-beam data can be exploited more efficiently because fewer data are discarded and more usable tracks are reconstructed for a given data set. The improvement becomes more significant when taking data at a beamline with a high particle rate, where multiple triggers per event occur more often. It is particularly valuable for small devices-under-test, on which the number of particle tracks is limited due to their geometrical dimensions such that a full exploitation of the recorded data is essential to get the highest possible statistics in the analysis.

Conclusion & Outlook
To pursue the foreseen physics goals of future experiments in high-energy physics, a broad spectrum of silicon pixel detectors is being developed. The large variety of technologies requires a new level of flexibility of the reconstruction and analysis software tools for test-beam data allowing to combine data from devices with different readout schemes.
The Corryvreckan framework addressed these needs by providing a flexible and highly configurable test-beam data reconstruction and analysis toolkit. It has a modular architecture separating the framework core from modules for specific reconstruction tasks. An example has been presented showing how a data set can be analysed using the flexible event building feature of the framework. In addition, a recent improvement in the event building logic exploiting the pivot pixel information for the Mimosa26 sensors has been shown. This allows for a more efficient usage of test-beam data because more usable reference tracks can be reconstructed from a given data set.
Due to its modularity and the high level of documentation, Corryvreckan enables collaborative development and long-term maintenance of its code basis shared between different research groups. Driven by the specific needs in various test-beam analysis projects, the software is extended by its users and new modules integrating further detectors, tracking in magnetic fields, and an extension allowing multi-threading are currently under development.