Skip to content

Commit

Permalink
fix: Fixing navigation failures on volume boundaries edges (#1722)
Browse files Browse the repository at this point in the history
Implements a way to hit boundaries when this is the only possible
option. Closes #1720
  • Loading branch information
noemina committed Dec 13, 2022
1 parent bbf2bf4 commit 4e60261
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Core/include/Acts/Propagator/Navigator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ struct NavigationOptions {
/// @todo could be dynamic in the future (pT dependent)
double overstepLimit = -1 * UnitConstants::um;

/// Force intersection with boundaries
bool forceIntersectBoundaries = false;

/// Constructor
///
/// @param ndir Navigation direction prescription
Expand Down Expand Up @@ -216,6 +219,8 @@ class Navigator {
bool navigationBreak = false;
// The navigation stage (@todo: integrate break, target)
Stage navigationStage = Stage::undefined;
/// Force intersection with boundaries
bool forceIntersectBoundaries = false;

/// Reset state
///
Expand Down Expand Up @@ -932,6 +937,8 @@ class Navigator {
navOpts.pathLimit =
stepper.getStepSize(state.stepping, ConstrainedStep::aborter);
navOpts.overstepLimit = stepper.overstepLimit(state.stepping);
navOpts.forceIntersectBoundaries =
state.navigation.forceIntersectBoundaries;

// Exclude the current surface in case it's a boundary
navOpts.startObject = state.navigation.currentSurface;
Expand Down Expand Up @@ -1002,7 +1009,10 @@ class Navigator {
// We have to leave the volume somehow, so try again
state.navigation.navBoundaries.clear();
ACTS_VERBOSE(volInfo(state) << "Boundary navigation lost, re-targetting.");
state.navigation.forceIntersectBoundaries = true;
if (findBoundaries()) {
// Resetting intersection check for boundary surfaces
state.navigation.forceIntersectBoundaries = false;
return true;
}

Expand Down
21 changes: 21 additions & 0 deletions Core/src/Geometry/TrackingVolume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,27 @@ Acts::TrackingVolume::compatibleBoundaries(
return BoundaryIntersection();
}

if (options.forceIntersectBoundaries and
sIntersection.intersection.pathLength * options.navDir > 0) {
const bool coCriterion =
std::abs(sIntersection.intersection.pathLength) < std::abs(oLimit);
ACTS_VERBOSE("Forcing intersection with surface "
<< bSurface->surfaceRepresentation().geometryId());
if (coCriterion) {
ACTS_VERBOSE("Intersection forced successfully ");
ACTS_VERBOSE("- intersection path length "
<< std::abs(sIntersection.intersection.pathLength)
<< " < overstep limit " << std::abs(oLimit));
sIntersection.intersection.pathLength *= options.navDir;
return BoundaryIntersection(sIntersection.intersection, bSurface,
sIntersection.object);
}
ACTS_VERBOSE("Can't force intersection: ");
ACTS_VERBOSE("- intersection path length "
<< std::abs(sIntersection.intersection.pathLength)
<< " > overstep limit " << std::abs(oLimit));
}

ACTS_VERBOSE("Check intersection with surface "
<< bSurface->surfaceRepresentation().geometryId());
if (detail::checkIntersection(sIntersection.intersection, pLimit, oLimit,
Expand Down

0 comments on commit 4e60261

Please sign in to comment.