DUNE-DAQ
DUNE Trigger and Data Acquisition software
|
This is the new Trigger Primitive (TP) Replay Application (v5). For the previous version follow here. This change is after new TP format changes (v5.3).
The replay application is an 'emulation tool'. It is meant for developing the trigger, associated infrastructure, integration, and algorithm testing.
The application is replacing the readout and instead uses TPs from offline files (HDF5 TPStream). The implementation is 'emulating' the readout closely, meaning the data is replayed per-plane and per-readout unit. TP Handlers are also part of the same application, exactly as in the current readout application. This is then usually connected to the Trigger Application to more closely resemble a (small) dunedaq system.
Currently, PDS TPs are ignored. Once they are fully implemented in DAQ, replay can be easily expanded to include them (see subdetectors in code).
Process:
TPReplayModule
to assess the data and extract selected TPsThe easiest way is to use this python module. It helps to retrieve relevant OKS configuration data and modify it given user-provided selection. However, replay can also be run on any (valid) OKS configuration generated outside of this script.
Replay works via a TPReplayApplication
, a smart DAQ application that can be used inside your OKS session.
To use it, simply add this application to the appropriate segment in your session. There are example sessions available, both local and with ehn1 integration (CERN's opmon and ers). The implementation in these default sessions includes new tpreplay-segment
, that only contains the TPReplayApplication
. This is then linked with the usual (example) trigger and dataflow segments. This exact approach is also adopted by this python script. However, one can choose to include the TPReplayApplication
in already existing segments.
Remember, replay is an emulation of readout and it simply outputs TAs. Therefore, for a full stream a trigger application creating TCs and an MLT application are required (these are typically part of the trigger segment already).
Finally, configure the TPReplayModule
that is part of this application. It accepts a list of input HDF5 TPStream files. Additionally, one can choose to filter out planes. This python script will take care of creating and modifying the configuration given both the parameters from the command line and parameters extracted from data files.
One can use this script that will modify the OKS data with parameters obtained from the provided files.
Option | Type | Default Value | Description |
---|---|---|---|
--files | str | Required | Text file with full paths to HDF5 TPStream file locations. |
--filter-planes | list[int] | [] (empty) | List of planes to filter out. Accepts combinations of: 0 (U), 1 (V), 2 (X). Example: 0 1 to filter out both induction planes. |
--channel-map | str | PD2HDTPCChannelMap | Specify channel map. For example: PD2HDTPCChannelMap , PD2VDBottomTPCChannelMap , etc. For the full list, see: Channel Maps Documentation. |
--n-loops | int | -1 | Number of times to loop over the provided data. The default is -1 and this results in "infinite" replay. For multiple loops, the time of TPs is modified (shifted). |
--config | str | config/daqsystemtest/example-configs.data.xml | Path to the base OKS configuration file with tpreplay session. |
--path | str | tpreplay-run | Path for local output for configuration files. This directory will be created by this script and modified configurations stored there. |
--mem-limit | int | 25 | Because the HDF5 files are big and need to be loaded into memory to process there is a limit set (in GBs) on the memory the script can use, to preserve the server. |
--verbose | bool | False | Enable verbose logging. |
Notes:
PD2HDTPCChannelMap
. Make sure you are using the correct channel map for your data!-1
is used, the replay will continue indefinitely (until the user stops the run).tpreplay
session. Can be left to use the default.tpreplay-run
.The script makes use of tqdm
package, which needs to be (pip) installed if not available on the system.
The only required argument is the text file containing the names of TPStream files:
<== this will use default values (no filtering).
To only use the collection plane:
To use the induction planes and files with data from PD2 VD:
To change the name of local directory that gets created, and verbose logging:
To only replay once, and set a memory limit to 15 GBs:
and so on.
After a modified configuration is created, one can 'run' with this configuration using drunc
:
<== the tpreplay-run
name needs to be modified if path
argument was changed from the default value.
Additionally, the python script modified the TPReplayApplication
but not the 2 example TPReplay sessions. One can therefore pick local-tpreplay-config
for a local run or ehn1-tpreplay-config
for a run with grafana monitoring.
The last argument is the name of a session which can be anything, but should be easy to identify (use $USER
as part of the name if possible).
For more details on drunc
please see operating-a-daq-with-drunc and setting up development area.
After using the script, one can still modify the local configuration if needed.
Few notes on what happens in this script:
TPReplay
application configurationTPReplayModule
configurationchannel map
change-rate --trigger-rate X
command.TPReplayApplication
schema:
SmartDaqApplication
TPReplayModule
(below)generate_modules
function (modules & connections build instructions) TPReplayModule
schema:
Option | Description loops |
---|---|
number_of_loops | Allows replaying the TPs multiple times with shifted timestamps. |
maximum_wait_time_us | Max buffer time between sending consecutive TP vectors. |
channel_map | Specifies the detector channel map, used to extract Readout Unit (ROU), planes. |
total_planes | Represents the total number of unique planes. Required by multiple applications when building modules / linking the system. |
filter_out_plane | Option to filter out (ignore) data from a specific plane (Induction 1 / Induction 2 / Collection). |
tp_streams | List of TPStream HDF5 files to be used as input (multiple files supported). |
TPStream configuration:
Simple full path to your HDF5 TPStream files. Many can be used at once:
The design of the source code is to be modular. This means the user can provide a vector of files without restrictions on ROUs / planes. The internal linking is dependent on the total_planes variable. If one uses this python script, this is set automatically given the provided files.
The total_planes counter represents the number of active (non-filtered), unique planes for which data was 'observed' in the provided files.
Therefore, in an example scenario where 4 files are provided, covering 4 unique ROUs (for example 4 different APAs), and no planes are configured to be filtered out, the total_planes number would be 4 (ROUs) x 3 (planes) = 12. This means there would be 12 TPHandlers
, 12 queues from TPReplayModule
, 12 data request network connections, 12 outcoming TA publishing network connections. Importantly, there is always just 1 TPReplayModule
, however, it will make use of 12 threads, each feeding its own TPHandler
(pretending to be a plane from readout).
It should be mentioned that the application is fully integrated with the rest of the system, such as registering the SourceIDs in MLT and in DFO.
One can see the module generation being driven by the unique ROU and active planes. Some additional notes:
TPReplayModule
module. It has an internal logic that spawns threads.TPHandlers
make use of the common TriggerDataHandlerModules
, meaning they also contain latency buffers, have unique SourceIDs, and respond to data requests.TPHandlers
create TAs and stream these to output network connections. tpreplay-segment
(the only application there)DFApplication
: readout requestsTriggerApplication
; this creates TCs and passes onwards to MLT
The TPReplayModule
module is the base of replay. Functionality:
TriggerDataHandlerModule
, was previously using TPSets
but there is no implementation for this data type)TPHandlers
as appropriate. There is an additional wait time applied so as to not overwhelm the system.Additionally, multiple new issues have been declared to handle errors, for example:
ReplayConfigurationProblem
: Missing or incorrect configurationReplayNoValidFiles
: No provided file passes checksReplayNoValidTPs
: No valid TPs have been extracted For full list please see: Issues.hppVerbose logging is available in the TPReplayModule
:
TPHandlerModule
for sanity checking.Two example replay sessions are available as part of example-configs in daqsystemtest
repository. These are identical in terms of setup, with the only difference being opmon and error reporting.
– the session makes use of 'custom' tpreplay-root-segment
.
– the root segment contains the tpreplay-segment
itself (which containst the TPReplayApplication
), and additionally trg-segment
(which contains trigger and MLT applications) and df-segment
(which is needed for data-flow: readout requests).
– this segment contains the TPReplayApplication
. It should be noted that this is the suggested example set-up, but in theory one only needs to include the TPReplayApplication
(properly configured) in their session (no need for special segments).
TPReplayModule
configuration:For plane filtering, the filter_out_plane
variable accepts multiple values (but can also be empty).
Otherwise, the sessions are kept minimal. Most applications that are not needed are disabled (but can be used of course). You can see an overview here.
A graph showing opmon data from TPReplayModule
is available on Grafana:
Grafana -> Trigger Flow -> Plugins -> TP Maker
This shows TP data being read in, and TP vector data being created and sent. Additionally, the handler modules used are typical in the sense that they already provide the expected opmon data (TP receiving rates, TA making rates...). All other objects also have corresponding monitoring (queues, network connections, buffers...).
TPHandler
configuration, which is then used for all the instances of queues and handler objects (with unique names of course). This means that for a file with 3 active planes, the handler for each plane would be using the same algorithm (same for readout).TPReplayModule
at the conf stage: parsing configuration, multiple checks on HDF5 files, extracting ROUs, actually extracting TP data, plane filtering... Depending on the number of files this can take a lot of time. If needed, the conf step timeout may need to be extended.TPRequestHandler
is expected to link to FragmentAggregatorModule
, but this module is not required outside readout).tp.time_peak
) looping logic needs adjustingFor more details please see this report.