Skip to content

Commit

Permalink
Merge pull request acts-project#472 from beomki-yeo/fix-a-bug
Browse files Browse the repository at this point in the history
Fix: Do not sort measurments in spacepoint reading
  • Loading branch information
beomki-yeo authored Oct 23, 2023
2 parents 929479e + ae9567a commit 2a4c358
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions io/src/csv/read_measurements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
namespace traccc::io::csv {

void read_measurements(measurement_reader_output& out,
std::string_view filename) {
std::string_view filename, const bool do_sort) {

// Construct the measurement reader object.
auto reader = make_measurement_reader(filename);
Expand Down Expand Up @@ -82,8 +82,10 @@ void read_measurements(measurement_reader_output& out,
result_measurements.push_back(meas);
}

std::sort(result_measurements.begin(), result_measurements.end(),
measurement_sort_comp());
if (do_sort) {
std::sort(result_measurements.begin(), result_measurements.end(),
measurement_sort_comp());
}
}

measurement_container_types::host read_measurements_container(
Expand Down
3 changes: 2 additions & 1 deletion io/src/csv/read_measurements.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ namespace traccc::io::csv {
///
/// @param out A measurement & a cell_module (host) collections
/// @param filename The file to read the measurement data from
/// @param do_sort Whether to sort the measurements or not
///
void read_measurements(measurement_reader_output& out,
std::string_view filename);
std::string_view filename, const bool do_sort = true);

} // namespace traccc::io::csv
2 changes: 1 addition & 1 deletion io/src/csv/read_spacepoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void read_spacepoints(spacepoint_reader_output& out, std::string_view filename,
const geometry& geom) {
// Read measurements
measurement_reader_output meas_reader_out;
read_measurements(meas_reader_out, meas_filename);
read_measurements(meas_reader_out, meas_filename, false);

// Measurement hit id reader
auto mhid_reader =
Expand Down

0 comments on commit 2a4c358

Please sign in to comment.