DUNE-DAQ
DUNE Trigger and Data Acquisition software
|
#include <TAFileHandler.hpp>
Public Member Functions | |
TAFileHandler (std::vector< std::shared_ptr< hdf5libs::HDF5RawDataFile > > _input_files, nlohmann::json _config, std::pair< uint64_t, uint64_t > _sliceid_range, bool _run_parallel, bool _quiet) | |
Constructor, takes file input path & configuration. | |
~TAFileHandler ()=default | |
std::vector< daqdataformats::SourceID > | get_valid_sourceids (daqdataformats::TimeSlice &_timeslice) |
Get the valid sourceids object from HDF5 file. | |
void | start_processing () |
User interaction for task processing. | |
void | wait_to_complete_work () |
Waits for all the tasks to complete. | |
std::map< uint64_t, std::vector< triggeralgs::TriggerActivity > > | get_tas () |
Retrieves all the TAs with std::move operator. | |
std::map< uint64_t, std::vector< std::unique_ptr< daqdataformats::Fragment > > > | get_frags () |
Retrieves all the unique pointers to the TA fragments. | |
hdf5libs::HDF5SourceIDHandler::source_id_geo_id_map_t | get_sourceid_geoid_map () |
Get the sourceid to geoid map object. | |
Private Member Functions | |
void | process_tasks () |
Function that processes the whole file. | |
void | process_task (daqdataformats::SourceID _source_id, uint64_t _rec, daqdataformats::FragmentHeader _header, std::vector< trgdataformats::TriggerPrimitive > &&_tps) |
Function that processes one slice for one plane. | |
void | worker_thread () |
Creates & runs a worker thread. | |
void | enqueue_task (std::function< void()> task) |
Enqueues task to process. | |
void | wait_to_complete_tasks () |
Waits to complete a task. | |
Private Attributes | |
std::vector< std::shared_ptr< hdf5libs::HDF5RawDataFile > > | m_input_files |
A pointer to the input file. | |
nlohmann::json | m_configuration |
configuration for the TA-makers | |
std::vector< std::string > | m_input_paths |
input vector of tpstream input paths | |
std::map< daqdataformats::SourceID, std::unique_ptr< trgtools::EmulateTAUnit > > | m_ta_emulators |
Map of SourceID : Emulator unit (TAMaker) | |
std::pair< uint64_t, uint64_t > | m_sliceid_range |
Range of TimeSlice IDs to process. | |
const bool | m_run_parallel |
Run the TA makers in parllel. | |
const bool | m_quiet |
Quiet down the cout output. | |
std::thread | m_main_thread |
The file handler thread. | |
std::atomic< bool > | m_stop {false} |
Bool to indicate to stop the emulation. | |
std::mutex | m_savetps_mutex |
Mutex for saving the TPs. | |
std::vector< std::thread > | m_thread_pool |
std::condition_variable | m_condition |
std::condition_variable | m_task_complete_condition |
std::queue< std::function< void()> > | m_task_queue |
std::mutex | m_queue_mutex |
std::atomic< size_t > | m_active_tasks |
std::map< uint64_t, std::vector< triggeralgs::TriggerActivity > > | m_tas |
Output vector of TAs. | |
std::map< uint64_t, std::vector< std::unique_ptr< daqdataformats::Fragment > > > | m_ta_fragments |
Output vector of TA fragments. | |
uint16_t | m_id |
Unique ID for this TAFileHandler. | |
Static Private Attributes | |
static uint16_t | m_id_next = 0 |
Global variable used to get the next ID. | |
static const size_t | SIZE_TP = sizeof(trgdataformats::TriggerPrimitive) |
Size of the TPS. | |
Definition at line 23 of file TAFileHandler.hpp.
dunedaq::trgtools::TAFileHandler::TAFileHandler | ( | std::vector< std::shared_ptr< hdf5libs::HDF5RawDataFile > > | _input_files, |
nlohmann::json | _config, | ||
std::pair< uint64_t, uint64_t > | _sliceid_range, | ||
bool | _run_parallel, | ||
bool | _quiet ) |
Constructor, takes file input path & configuration.
Each TAFileHandler will create its own thread, so all TAFileHandlers are run on separate threads
_input_files | a vector of input HDF5 shared pointers to process |
_config | TAMaker configuration |
_sliceid_range | range of sliceids to process |
_run_parallel | run each TAMaker (one per SourceID) in parallel |
_quiet | quiet down the cout |
Definition at line 11 of file TAFileHandler.cpp.
|
default |
|
private |
Enqueues task to process.
task | task to porcess |
Definition at line 219 of file TAFileHandler.cpp.
std::map< uint64_t, std::vector< std::unique_ptr< daqdataformats::Fragment > > > dunedaq::trgtools::TAFileHandler::get_frags | ( | ) |
Retrieves all the unique pointers to the TA fragments.
Definition at line 304 of file TAFileHandler.cpp.
hdf5libs::HDF5SourceIDHandler::source_id_geo_id_map_t dunedaq::trgtools::TAFileHandler::get_sourceid_geoid_map | ( | ) |
Get the sourceid to geoid map object.
Definition at line 94 of file TAFileHandler.cpp.
std::map< uint64_t, std::vector< triggeralgs::TriggerActivity > > dunedaq::trgtools::TAFileHandler::get_tas | ( | ) |
Retrieves all the TAs with std::move operator.
Definition at line 299 of file TAFileHandler.cpp.
std::vector< daqdataformats::SourceID > dunedaq::trgtools::TAFileHandler::get_valid_sourceids | ( | daqdataformats::TimeSlice & | _timeslice | ) |
Get the valid sourceids object from HDF5 file.
_timeslice | timeslice to load the sourceIDs from |
Definition at line 75 of file TAFileHandler.cpp.
|
private |
Function that processes one slice for one plane.
_source_id | sourceID to process |
_rec | record ID to process |
_header | fragment header |
_tps | vectors of trigger primitives to process (with move operator) |
Definition at line 258 of file TAFileHandler.cpp.
|
private |
Function that processes the whole file.
Definition at line 134 of file TAFileHandler.cpp.
void dunedaq::trgtools::TAFileHandler::start_processing | ( | ) |
User interaction for task processing.
Definition at line 213 of file TAFileHandler.cpp.
|
private |
Waits to complete a task.
Definition at line 229 of file TAFileHandler.cpp.
void dunedaq::trgtools::TAFileHandler::wait_to_complete_work | ( | ) |
Waits for all the tasks to complete.
Definition at line 235 of file TAFileHandler.cpp.
|
private |
Creates & runs a worker thread.
Get a task from the queue (with locking)
Definition at line 103 of file TAFileHandler.cpp.
|
private |
Definition at line 160 of file TAFileHandler.hpp.
|
private |
Definition at line 156 of file TAFileHandler.hpp.
|
private |
configuration for the TA-makers
Definition at line 121 of file TAFileHandler.hpp.
|
private |
Unique ID for this TAFileHandler.
Definition at line 169 of file TAFileHandler.hpp.
|
staticprivate |
Global variable used to get the next ID.
Definition at line 171 of file TAFileHandler.hpp.
|
private |
A pointer to the input file.
Definition at line 118 of file TAFileHandler.hpp.
|
private |
input vector of tpstream input paths
Definition at line 124 of file TAFileHandler.hpp.
|
private |
The file handler thread.
Definition at line 143 of file TAFileHandler.hpp.
|
private |
Definition at line 159 of file TAFileHandler.hpp.
|
private |
Quiet down the cout output.
Definition at line 136 of file TAFileHandler.hpp.
|
private |
Run the TA makers in parllel.
Definition at line 133 of file TAFileHandler.hpp.
|
private |
Mutex for saving the TPs.
Definition at line 154 of file TAFileHandler.hpp.
|
private |
Range of TimeSlice IDs to process.
Definition at line 130 of file TAFileHandler.hpp.
|
private |
Bool to indicate to stop the emulation.
Definition at line 146 of file TAFileHandler.hpp.
|
private |
Map of SourceID : Emulator unit (TAMaker)
Definition at line 127 of file TAFileHandler.hpp.
|
private |
Output vector of TA fragments.
Definition at line 166 of file TAFileHandler.hpp.
|
private |
Output vector of TAs.
Definition at line 163 of file TAFileHandler.hpp.
|
private |
Definition at line 157 of file TAFileHandler.hpp.
|
private |
Definition at line 158 of file TAFileHandler.hpp.
|
private |
Definition at line 155 of file TAFileHandler.hpp.
|
staticprivate |
Size of the TPS.
Definition at line 173 of file TAFileHandler.hpp.