Skip to content

Commit

Permalink
Made traccc::io::read compatible with the ODD data.
Browse files Browse the repository at this point in the history
So that the throughput examples could use it for reading in
their input data.
  • Loading branch information
krasznaa committed May 4, 2024
1 parent 41c742b commit 9deffd8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 5 additions & 3 deletions io/include/traccc/io/read.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** TRACCC library, part of the ACTS project (R&D line)
*
* (c) 2021-2022 CERN for the benefit of the ACTS project
* (c) 2021-2024 CERN for the benefit of the ACTS project
*
* Mozilla Public License Version 2.0
*/
Expand All @@ -26,11 +26,13 @@ namespace traccc::io {
/// @param directory The directory to read the cell data from
/// @param detector_file The file describing the detector geometry
/// @param digi_config_file The file describing the detector digitization
/// @param format The format of the event file(s)
/// @param event_format The format of the event file(s)
/// @param geometry_format The format of the geometry file
///
void read(demonstrator_input& out, std::size_t events,
std::string_view directory, std::string_view detector_file,
std::string_view digi_config_file,
data_format format = data_format::csv);
data_format event_format = data_format::csv,
data_format geometry_format = data_format::csv);

} // namespace traccc::io
9 changes: 6 additions & 3 deletions io/src/read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,25 @@ namespace traccc::io {

void read(demonstrator_input& out, std::size_t events,
std::string_view directory, std::string_view detector_file,
std::string_view digi_config_file, data_format format) {
std::string_view digi_config_file, data_format event_format,
data_format geometry_format) {

// Read in the detector configuration. We can't use structured bindings for
// the return value of read_geometry(...), because the old Intel compiler
// used in the CI, when using OpenMP, crashes on such code. :-(
const auto geom_pair = io::read_geometry(detector_file);
const auto geom_pair = io::read_geometry(detector_file, geometry_format);
const auto& geom = geom_pair.first;
const digitization_config digi_cfg =
io::read_digitization_config(digi_config_file);
const auto& barcode_map = geom_pair.second;

assert(out.size() >= events);

// Read in the cell data for all events. In parallel if possible.
#pragma omp parallel for
for (std::size_t event = 0; event < events; ++event) {
io::read_cells(out[event], event, directory, format, &geom, &digi_cfg);
io::read_cells(out[event], event, directory, event_format, &geom,
&digi_cfg, barcode_map.get());
}
}

Expand Down

0 comments on commit 9deffd8

Please sign in to comment.