Skip to content

Commit

Permalink
fix navigator
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand committed Dec 13, 2024
1 parent 5ab184d commit 1adb9be
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
9 changes: 7 additions & 2 deletions Core/include/Acts/Propagator/Navigator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ class Navigator {

NavigatorStatistics statistics;

void resetAfterLayerSwitch() {
navSurfaces.clear();
navSurfaceIndex.reset();
}

void resetAfterVolumeSwitch() {
navSurfaces.clear();
navSurfaceIndex.reset();
Expand Down Expand Up @@ -522,8 +527,7 @@ class Navigator {
state.navigationStage = Stage::surfaceTarget;

// partial reset
state.navSurfaces.clear();
state.navSurfaceIndex = -1;
state.resetAfterLayerSwitch();

return;
}
Expand All @@ -537,6 +541,7 @@ class Navigator {
state.currentVolume = boundary->attachedVolume(state.options.geoContext,
position, direction);

// partial reset
state.resetAfterVolumeSwitch();

if (state.currentVolume != nullptr) {
Expand Down
12 changes: 12 additions & 0 deletions Tests/UnitTests/Core/Propagator/NavigatorTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) {

// Estimate the next target
NavigationTarget target = navigator.nextTarget(state, position, direction);
BOOST_CHECK(!target.isNone());
// A layer has been found
BOOST_CHECK_EQUAL(state.navLayers.size(), 1u);
// The index should points to the begin
Expand Down Expand Up @@ -296,6 +297,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) {

// Estimate the next target
target = navigator.nextTarget(state, position, direction);
BOOST_CHECK(!target.isNone());

// Do the step towards the boundary
step(position, direction, target);
Expand All @@ -308,6 +310,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) {

// Estimate the next target
target = navigator.nextTarget(state, position, direction);
BOOST_CHECK(!target.isNone());
// Intersect the target
targetIntersection = target.surface->intersect(tgContext, position, direction)
.closestForward();
Expand All @@ -323,6 +326,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) {

// Estimate the next target
target = navigator.nextTarget(state, position, direction);
BOOST_CHECK(!target.isNone());

// Step through the surfaces on first layer
for (std::size_t isf = 0; isf < 5; ++isf) {
Expand All @@ -332,6 +336,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) {
navigator.handleSurfaceReached(state, position, direction, *target.surface);
// ACTORS - ABORTERS - PRE STEP
target = navigator.nextTarget(state, position, direction);
BOOST_CHECK(!target.isNone());

ACTS_INFO("<<< Test 1e-1i >>> step within 1st layer at "
<< toString(position));
Expand All @@ -344,6 +349,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) {
navigator.handleSurfaceReached(state, position, direction, *target.surface);
// ACTORS - ABORTERS - PRE STEP
target = navigator.nextTarget(state, position, direction);
BOOST_CHECK(!target.isNone());

ACTS_INFO("<<< Test 1j >>> step to 2nd layer at " << toString(position));

Expand All @@ -355,6 +361,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) {
navigator.handleSurfaceReached(state, position, direction, *target.surface);
// ACTORS - ABORTERS - PRE STEP
target = navigator.nextTarget(state, position, direction);
BOOST_CHECK(!target.isNone());

ACTS_INFO("<<< Test 1k-1o >>> step within 2nd layer at "
<< toString(position));
Expand All @@ -367,6 +374,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) {
navigator.handleSurfaceReached(state, position, direction, *target.surface);
// ACTORS - ABORTERS - PRE STEP
target = navigator.nextTarget(state, position, direction);
BOOST_CHECK(!target.isNone());

ACTS_INFO("<<< Test 1p >>> step to 3rd layer at " << toString(position));

Expand All @@ -378,6 +386,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) {
navigator.handleSurfaceReached(state, position, direction, *target.surface);
// ACTORS - ABORTERS - PRE STEP
target = navigator.nextTarget(state, position, direction);
BOOST_CHECK(!target.isNone());

ACTS_INFO("<<< Test 1q-1s >>> step within 3rd layer at "
<< toString(position));
Expand All @@ -390,6 +399,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) {
navigator.handleSurfaceReached(state, position, direction, *target.surface);
// ACTORS - ABORTERS - PRE STEP
target = navigator.nextTarget(state, position, direction);
BOOST_CHECK(!target.isNone());

ACTS_INFO("<<< Test 1t >>> step to 4th layer at " << toString(position));

Expand All @@ -401,6 +411,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) {
navigator.handleSurfaceReached(state, position, direction, *target.surface);
// ACTORS - ABORTERS - PRE STEP
target = navigator.nextTarget(state, position, direction);
BOOST_CHECK(!target.isNone());

ACTS_INFO("<<< Test 1t-1v >>> step within 4th layer at "
<< toString(position));
Expand All @@ -413,6 +424,7 @@ BOOST_AUTO_TEST_CASE(Navigator_target_methods) {
navigator.handleSurfaceReached(state, position, direction, *target.surface);
// ACTORS - ABORTERS - PRE STEP
target = navigator.nextTarget(state, position, direction);
BOOST_CHECK(target.isNone());

ACTS_INFO("<<< Test 1w >>> step to boundary at " << toString(position));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
#include <boost/test/unit_test.hpp>

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Definitions/Direction.hpp"
#include "Acts/Definitions/TrackParametrization.hpp"
#include "Acts/Definitions/Units.hpp"
#include "Acts/EventData/GenericCurvilinearTrackParameters.hpp"
#include "Acts/EventData/SourceLink.hpp"
#include "Acts/EventData/TrackParameters.hpp"
#include "Acts/EventData/detail/TestSourceLink.hpp"
Expand All @@ -25,7 +23,6 @@
#include "Acts/Propagator/EigenStepper.hpp"
#include "Acts/Propagator/Navigator.hpp"
#include "Acts/Propagator/Propagator.hpp"
#include "Acts/Propagator/StraightLineStepper.hpp"
#include "Acts/SpacePointFormation/SpacePointBuilder.hpp"
#include "Acts/SpacePointFormation/SpacePointBuilderConfig.hpp"
#include "Acts/SpacePointFormation/SpacePointBuilderOptions.hpp"
Expand All @@ -34,10 +31,8 @@
#include "Acts/Tests/CommonHelpers/MeasurementsCreator.hpp"
#include "Acts/Tests/CommonHelpers/TestSpacePoint.hpp"

#include <algorithm>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <optional>
#include <random>
Expand All @@ -49,11 +44,11 @@ using namespace Acts::UnitLiterals;

namespace Acts::Test {

using StraightPropagator = Propagator<StraightLineStepper, Navigator>;
using TestSourceLink = detail::Test::TestSourceLink;
using ConstantFieldStepper = EigenStepper<>;
using ConstantFieldPropagator = Propagator<ConstantFieldStepper, Navigator>;
// Construct initial track parameters.

/// Construct initial track parameters.
CurvilinearTrackParameters makeParameters(double phi, double theta, double p,
double q) {
// create covariance matrix from reasonable standard deviations
Expand Down

0 comments on commit 1adb9be

Please sign in to comment.