Emulate from TP Stream¶
emulate_from_tpstream.cxx (and the application trgtools_emulate_from_tpstream)
processes timeslice HDF5 files that contain TriggerPrimitives, and creates a
new HDF5 that includes TriggerActivities and TriggerCandidates.
The primary use of this is to test TA algorithms, TC algorithms, and their
configurations, with output diagnostics available from ta_dump.py and
tc_dump.py. The full TC displays that include all TAs & TPs within those TAs
can be made with the plot_emulated_triggers.py script.
The application understands that there might be multiple sources of trigger primitives, that different files might contain TPs from different sources (e.g. two APAs), or that different files might contain TPs from the same sources but across different time-periods (e.g. two consecutive files from the same APAs).
The application will first check if we have TPs from all the available sources, find the overlapping timeslice range across input files, and process that range.
WARNING: This script is different from process_tpstream, and does not
contain all the functionality yet. Look at TODOs below for more info.
Example¶
trgtools_emulate_from_tpstream -i input_file.hdf5 -o output_file -j algo_config.json --quiet
trgtools_emulate_from_tpstream -i input_file_APA*.hdf5 -o output_file -j algo_config.json
Algorithm Configuration¶
An example algo_config.json file with an explanation are provided HERE.
Parallelisation¶
You can run the emulator with --parallel, which will not only process each TPWriter separately, but each TAMaker too. This is currently only worth trying if using slow algo, like DBSCAN, otherwise it can be marginally slower.
TODOs¶
-
Latency measurements: At the moment the script does not calculate latencies for each TP->TA->TC in a way that
convert-tplatenciesdoes -- and that needs to be corrected. -
PDS TP Emulation: Should be easy to add, but at the moment only works for TPC.
-
SliceID -> Time error checks: At the moment the code looks for matching
SliceIDs across different files, and cnverges on aSliceID"window" to get the TPs from. Although rare, it should be possible to have matchingSliceIDs with mismatching times -- we need to go off actual TP times, rather thanSliceIDs. -
Choose time-slice: The user currently cannot choose time-slice to plot: the script will match the largest timeslice available across TPWriters provided. That has to be done with combination of the above, so e.g. allow for "time offset" and "time range" to plot for (in ticks, seconds, or whatever)
-
Parallelisation: could be optimised further.
Last git commit to the markdown source of this page:
Author: Alessandro Thea
Date: Thu Mar 5 15:19:30 2026 +0100
If you see a problem with the documentation on this page, please file an Issue at https://github.com/DUNE-DAQ/trgtools/issues