Skip to content

Commit

Permalink
Fix navigation assertions that failed in conjunction with navigation …
Browse files Browse the repository at this point in the history
…validation tools
  • Loading branch information
niermann999 committed Oct 16, 2024
1 parent ce76635 commit 2c2fc94
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
4 changes: 3 additions & 1 deletion io/include/detray/io/csv/track_parameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ inline void write_free_track_params(
for (const auto &[charge, track_param] : track_params) {

const auto &glob_pos = track_param.pos();
const auto &p = track_param.mom(charge);
// Momentum may not be retrievable for straight-line tracks
const auto &p{charge != 0.f ? track_param.mom(charge)
: track_param.dir()};

io::csv::free_track_parameters track_param_data{};
track_param_data.track_id = track_idx;
Expand Down
18 changes: 13 additions & 5 deletions tests/include/detray/test/validation/step_tracer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,21 @@ struct step_tracer : actor {
const auto& navigation = prop_state._navigation;
const auto& stepping = prop_state._stepping;

const bool is_on_sf{navigation.is_on_module() ||
navigation.is_on_portal()};

// Collect the data whenever requested
if (navigation.is_on_module() || navigation.is_on_portal() ||
tracer_state.m_collect_every_step) {
if (is_on_sf || tracer_state.m_collect_every_step) {

const geometry::barcode bcd{is_on_sf ? navigation.barcode()
: geometry::barcode{}};

step_data_t sd{stepping.step_size(), stepping.path_length(),
stepping.n_total_trials(), navigation.direction(),
navigation.barcode(), stepping(),
step_data_t sd{stepping.step_size(),
stepping.path_length(),
stepping.n_total_trials(),
navigation.direction(),
bcd,
stepping(),
stepping.transport_jacobian()};

tracer_state.m_steps.push_back(std::move(sd));
Expand Down

0 comments on commit 2c2fc94

Please sign in to comment.