Skip to content

Commit 6256b6b

Browse files
committed
Use path tolerance as overstep tolerance when starting the propagation or entering new volume
1 parent eb27813 commit 6256b6b

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

core/include/detray/navigation/navigation_config.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct config {
3939
/// Maximal absolute path distance for a track to be considered 'on surface'
4040
float path_tolerance{1.f * unit<float>::um};
4141
/// How far behind the track position to look for candidates
42-
float overstep_tolerance{-300.f * unit<float>::um};
42+
float overstep_tolerance{-1000.f * unit<float>::um};
4343
/// Search window size for grid based acceleration structures
4444
/// (0, 0): only look at current bin
4545
darray<dindex, 2> search_window = {0u, 0u};

core/include/detray/navigation/navigator.hpp

+21-7
Original file line numberDiff line numberDiff line change
@@ -640,9 +640,10 @@ class navigator {
640640
/// @param state the current navigation state
641641
/// @param cfg the navigation configuration
642642
template <typename track_t>
643-
DETRAY_HOST_DEVICE inline void init(const track_t &track, state &navigation,
644-
const navigation::config &cfg,
645-
const context_type &ctx) const {
643+
DETRAY_HOST_DEVICE inline void init(
644+
const track_t &track, state &navigation, const navigation::config &cfg,
645+
const context_type &ctx,
646+
const bool us_path_tolerance_as_overstep_tolerance = true) const {
646647
const auto &det = navigation.detector();
647648
const auto volume = tracking_volume{det, navigation.volume()};
648649

@@ -651,12 +652,16 @@ class navigator {
651652
navigation.m_heartbeat = true;
652653

653654
// Search for neighboring surfaces and fill candidates into cache
655+
const scalar_type overstep_tol = us_path_tolerance_as_overstep_tolerance
656+
? -cfg.path_tolerance
657+
: cfg.overstep_tolerance;
658+
654659
volume.template visit_neighborhood<candidate_search>(
655660
track, cfg, ctx, det, ctx, track, navigation,
656661
darray<scalar_type, 2u>{cfg.min_mask_tolerance,
657662
cfg.max_mask_tolerance},
658663
static_cast<scalar_type>(cfg.mask_tolerance_scalor),
659-
static_cast<scalar_type>(cfg.overstep_tolerance));
664+
static_cast<scalar_type>(overstep_tol));
660665

661666
// Determine overall state of the navigation after updating the cache
662667
update_navigation_state(navigation, cfg);
@@ -729,7 +734,11 @@ class navigator {
729734
// If no trust could be restored for the current state, (local)
730735
// navigation might be exhausted: re-initialize volume
731736
else {
732-
init(track, navigation, cfg, ctx);
737+
// Use overstep tolerance instead of path tolerance
738+
const bool us_path_tolerance_as_overstep_tolerance = false;
739+
740+
init(track, navigation, cfg, ctx,
741+
us_path_tolerance_as_overstep_tolerance);
733742
is_init = true;
734743

735744
// Sanity check: Should never be the case after complete update call
@@ -743,7 +752,8 @@ class navigator {
743752
math::min(100.f * cfg.overstep_tolerance,
744753
-10.f * cfg.max_mask_tolerance);
745754

746-
init(track, navigation, loose_cfg, ctx);
755+
init(track, navigation, loose_cfg, ctx,
756+
us_path_tolerance_as_overstep_tolerance);
747757

748758
// Unrecoverable
749759
if (navigation.trust_level() !=
@@ -849,7 +859,11 @@ class navigator {
849859
// Actor flagged cache as broken (other cases of 'no trust' are
850860
// handeled after volume switch was checked in 'update()')
851861
if (navigation.trust_level() == navigation::trust_level::e_no_trust) {
852-
init(track, navigation, cfg, ctx);
862+
// Use overstep tolerance instead of path tolerance
863+
const bool us_path_tolerance_as_overstep_tolerance = false;
864+
865+
init(track, navigation, cfg, ctx,
866+
us_path_tolerance_as_overstep_tolerance);
853867
return true;
854868
}
855869

0 commit comments

Comments
 (0)