Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:22:19

0001 /** TRACCC library, part of the ACTS project (R&D line)
0002  *
0003  * (c) 2022-2024 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 // Local include(s).
0009 #include "traccc/io/read_cells.hpp"
0010 
0011 #include "csv/read_cells.hpp"
0012 #include "read_binary.hpp"
0013 #include "traccc/io/utils.hpp"
0014 
0015 // System include(s).
0016 #include <filesystem>
0017 
0018 namespace traccc::io {
0019 
0020 void read_cells(edm::silicon_cell_collection::host& cells, std::size_t event,
0021                 std::string_view directory,
0022                 std::unique_ptr<const Logger> ilogger,
0023                 const detector_conditions_description::host* det_cond,
0024                 data_format format, bool deduplicate,
0025                 bool use_acts_geometry_id) {
0026   switch (format) {
0027     case data_format::csv:
0028       read_cells(cells,
0029                  get_absolute_path((std::filesystem::path(directory) /
0030                                     std::filesystem::path(get_event_filename(
0031                                         event, "-cells.csv")))
0032                                        .native()),
0033                  ilogger->clone(), det_cond, format, deduplicate,
0034                  use_acts_geometry_id);
0035       break;
0036 
0037     case data_format::binary:
0038       read_cells(cells,
0039                  get_absolute_path((std::filesystem::path(directory) /
0040                                     std::filesystem::path(get_event_filename(
0041                                         event, "-cells.dat")))
0042                                        .native()),
0043                  ilogger->clone(), det_cond, format, deduplicate);
0044       break;
0045 
0046     default:
0047       throw std::invalid_argument("Unsupported data format");
0048   }
0049 }
0050 
0051 void read_cells(edm::silicon_cell_collection::host& cells,
0052                 std::string_view filename,
0053                 std::unique_ptr<const Logger> ilogger,
0054                 const detector_conditions_description::host* det_cond,
0055                 data_format format, bool deduplicate,
0056                 bool use_acts_geometry_id) {
0057   switch (format) {
0058     case data_format::csv:
0059       csv::read_cells(cells, filename, ilogger->clone(), det_cond, deduplicate,
0060                       use_acts_geometry_id);
0061       break;
0062 
0063     case data_format::binary:
0064       details::read_binary_soa(cells, filename);
0065       break;
0066 
0067     default:
0068       throw std::invalid_argument("Unsupported data format");
0069   }
0070 }
0071 
0072 }  // namespace traccc::io