File indexing completed on 2026-07-26 08:22:19
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "traccc/io/read_measurements.hpp"
0010
0011 #include "csv/read_measurements.hpp"
0012 #include "read_binary.hpp"
0013 #include "traccc/io/utils.hpp"
0014
0015
0016 #include <filesystem>
0017
0018 namespace traccc::io {
0019
0020 std::vector<measurement_id_type> read_measurements(
0021 edm::measurement_collection::host& measurements, std::size_t event,
0022 std::string_view directory, const traccc::host_detector* detector,
0023 const traccc::detector_design_description::host* det_desc,
0024 const traccc::detector_conditions_description::host* det_cond,
0025 const bool sort_measurements, data_format format) {
0026 switch (format) {
0027 case data_format::csv: {
0028 return read_measurements(
0029 measurements,
0030 get_absolute_path((std::filesystem::path(directory) /
0031 std::filesystem::path(get_event_filename(
0032 event, "-measurements.csv")))
0033 .native()),
0034 detector, det_desc, det_cond, sort_measurements, format);
0035 }
0036 case data_format::binary: {
0037 return read_measurements(
0038 measurements,
0039 get_absolute_path((std::filesystem::path(directory) /
0040 std::filesystem::path(get_event_filename(
0041 event, "-measurements.dat")))
0042 .native()),
0043 detector, det_desc, det_cond, sort_measurements, format);
0044 }
0045 default:
0046 throw std::invalid_argument("Unsupported data format");
0047 }
0048 }
0049
0050 std::vector<measurement_id_type> read_measurements(
0051 edm::measurement_collection::host& measurements, std::string_view filename,
0052 const traccc::host_detector* detector,
0053 const traccc::detector_design_description::host* det_desc,
0054 const traccc::detector_conditions_description::host* det_cond,
0055 const bool sort_measurements, data_format format) {
0056 switch (format) {
0057 case data_format::csv:
0058 return csv::read_measurements(measurements, filename, detector, det_desc,
0059 det_cond, sort_measurements);
0060 case data_format::binary:
0061 details::read_binary_soa(measurements, filename);
0062 return {};
0063 default:
0064 throw std::invalid_argument("Unsupported data format");
0065 }
0066 }
0067
0068 }