Skip to content

Commit

Permalink
refactor: Resolve surfaces on initialization in Navigator (acts-pro…
Browse files Browse the repository at this point in the history
…ject#3283)

Going a bit further than acts-project#3280 by removing the status flag for the start layer resolution and resolving the surfaces already in the initialization step.

blocked by
- acts-project#3280
  • Loading branch information
andiwand authored Jul 25, 2024
1 parent 3d85e3c commit b58a4b4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 30 deletions.
41 changes: 19 additions & 22 deletions Core/include/Acts/Propagator/Navigator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ class Navigator {
/// Navigation state: the target surface
const Surface* targetSurface = nullptr;

/// Indicator for start layer treatment
bool startLayerResolved = false;
/// Indicator if the target is reached
bool targetReached = false;
/// Navigation state : a break has been detected
Expand Down Expand Up @@ -266,7 +264,7 @@ class Navigator {
ACTS_VERBOSE(volInfo(state) << "Initialization.");

// Set the world volume if it is not set
if (!state.navigation.worldVolume) {
if (state.navigation.worldVolume == nullptr) {
state.navigation.worldVolume =
m_cfg.trackingGeometry->highestTrackingVolume();
}
Expand All @@ -286,7 +284,7 @@ class Navigator {
// - short-cut through object association, saves navigation in the
// - geometry and volume tree search for the lowest volume
if (state.navigation.startSurface != nullptr &&
state.navigation.startSurface->associatedLayer()) {
state.navigation.startSurface->associatedLayer() != nullptr) {
ACTS_VERBOSE(
volInfo(state)
<< "Fast start initialization through association from Surface.");
Expand Down Expand Up @@ -323,10 +321,26 @@ class Navigator {
ACTS_VERBOSE(volInfo(state) << "Start volume resolved.");
}
}

// Set the start volume as current volume
state.navigation.currentVolume = state.navigation.startVolume;
// Set the start layer as current layer
state.navigation.currentLayer = state.navigation.startLayer;

if (state.navigation.startLayer != nullptr) {
ACTS_VERBOSE(volInfo(state) << "Start layer to be resolved.");
// We provide the layer to the resolve surface method in this case
bool startResolved = resolveSurfaces(state, stepper);
if (!startResolved &&
state.navigation.startLayer == state.navigation.targetLayer) {
ACTS_VERBOSE(volInfo(state)
<< "Start is target layer and we have no surface "
"candidates. Nothing left to do.");
// set the navigation break
state.navigation.navigationBreak = true;
stepper.releaseStepSize(state.stepping, ConstrainedStep::actor);
}
}
}

/// @brief Navigator pre step call
Expand Down Expand Up @@ -593,23 +607,6 @@ class Navigator {
if (state.navigation.navigationBreak) {
return false;
}
// Make sure resolve Surfaces is called on the start layer
if (state.navigation.startLayer != nullptr &&
!state.navigation.startLayerResolved) {
ACTS_VERBOSE(volInfo(state) << "Start layer to be resolved.");
// We provide the layer to the resolve surface method in this case
state.navigation.startLayerResolved = true;
bool startResolved = resolveSurfaces(state, stepper);
if (!startResolved &&
state.navigation.startLayer == state.navigation.targetLayer) {
ACTS_VERBOSE(volInfo(state)
<< "Start is target layer, nothing left to do.");
// set the navigation break
state.navigation.navigationBreak = true;
stepper.releaseStepSize(state.stepping, ConstrainedStep::actor);
}
return startResolved;
}

// The call that we are on a layer and have not yet resolved the surfaces
// No surfaces, do not return to stepper
Expand Down Expand Up @@ -1178,7 +1175,7 @@ class Navigator {
template <typename propagator_state_t, typename stepper_t>
bool inactive(propagator_state_t& state, const stepper_t& stepper) const {
// Void behavior in case no tracking geometry is present
if (!m_cfg.trackingGeometry) {
if (m_cfg.trackingGeometry == nullptr) {
return true;
}
// turn the navigator into void when you are instructed to do nothing
Expand Down
16 changes: 8 additions & 8 deletions Examples/Python/tests/root_file_hashes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ test_digitization_example_input[smeared]__particles.root: 5fe7dda2933ee6b9615b06
test_digitization_example_input[smeared]__measurements.root: 243c2f69b7b0db9dbeaa7494d4ea0f3dd1691dc90f16e10df6c0491ff4dc7d62
test_digitization_example_input[geometric]__particles.root: 5fe7dda2933ee6b9615b064d192322fe07831133cd998e5ed99a3b992b713a10
test_digitization_example_input[geometric]__measurements.root: 393e5d0278dceedb9be0efccafc5fceb024e2ef8ed919f351910c60606399f88
test_ckf_tracks_example[generic-full_seeding]__trackstates_ckf.root: fa3460d2bed49028a9b6c0b3553486b8fddc979d6e508a1813780b4ea1a04f02
test_ckf_tracks_example[generic-full_seeding]__tracksummary_ckf.root: b8ddfc25b013ec181e2a9f77925b86e57528140ccb6250696a9869272e1afa10
test_ckf_tracks_example[generic-full_seeding]__trackstates_ckf.root: 506ac5761480a1288237de04090c889be56ba67ac32ebd4c3e9c3685f01159c5
test_ckf_tracks_example[generic-full_seeding]__tracksummary_ckf.root: f55551fccb8fb7fd859725a8b5398a40d80d62c790dcc2f2676343000f9165cd
test_ckf_tracks_example[generic-full_seeding]__performance_seeding_trees.root: 0e0676ffafdb27112fbda50d1cf627859fa745760f98073261dcf6db3f2f991e
test_ckf_tracks_example[generic-truth_estimated]__trackstates_ckf.root: e3a3412df2169c321ce76454e5c9fa21563d3abe8b0743170d7003462879b6f3
test_ckf_tracks_example[generic-truth_estimated]__tracksummary_ckf.root: 2fab4f59cc4c919cb2449b1a335701d2a417782dfa38b233f68495c002308a64
test_ckf_tracks_example[generic-truth_estimated]__performance_seeding.root: 1facb05c066221f6361b61f015cdf0918e94d9f3fce2269ec7b6a4dffeb2bc7e
test_ckf_tracks_example[generic-truth_smeared]__trackstates_ckf.root: 7b45ed4c0079d15128e62b0068810c23545f5965188c7b9a3cb6768a0ad5d4b8
test_ckf_tracks_example[generic-truth_smeared]__tracksummary_ckf.root: 472cd838f89f11498211f6f4d4412a21992fa1d76a511f3299e50cc5cb1d5ea3
test_ckf_tracks_example[odd-full_seeding]__trackstates_ckf.root: b746ecc33657442f2c0a7094907cf75cf65cdfeb960adc64fd2c57478c5ce3b1
test_ckf_tracks_example[odd-full_seeding]__tracksummary_ckf.root: 331758a5c689733302eda21571ced8b3c3c513834f276ab31c0872f35e646d34
test_ckf_tracks_example[generic-truth_smeared]__trackstates_ckf.root: f53e94c4e074470af29ca92989466f80ee502bbf087347d70e6043ae47b674bf
test_ckf_tracks_example[generic-truth_smeared]__tracksummary_ckf.root: 9c43bdbb40b798bd56a11c4583640b680109aed57fa40d27f1217de5f85acd47
test_ckf_tracks_example[odd-full_seeding]__trackstates_ckf.root: 3e924c1a9375712e81315241dfa73d5fdbe2a7319c5b1e3db0a07762024a1fb6
test_ckf_tracks_example[odd-full_seeding]__tracksummary_ckf.root: 5d4baf4c33c2fbb4c6b86925f13485c523f27b1efb6cfa4fa966ae77ae222df4
test_ckf_tracks_example[odd-full_seeding]__performance_seeding_trees.root: 43c58577aafe07645e5660c4f43904efadf91d8cda45c5c04c248bbe0f59814f
test_ckf_tracks_example[odd-truth_estimated]__trackstates_ckf.root: 8d6f6092c3de68bfc67451684de0e1d81902f718e852459de8dc7b6701d97ab8
test_ckf_tracks_example[odd-truth_estimated]__tracksummary_ckf.root: 5611ea2a2aef8fcd3c159acddf011d62bc5d4a8b8a04e87941f5044dadeaac80
test_ckf_tracks_example[odd-truth_estimated]__trackstates_ckf.root: 17e793123839dbb881580e4790f67803347d18012634404b2260b7a0651afbbd
test_ckf_tracks_example[odd-truth_estimated]__tracksummary_ckf.root: d41383352928c20df319800026f1a01a09d0f3027c514b1c90513057c5779ee1
test_ckf_tracks_example[odd-truth_estimated]__performance_seeding.root: 1a36b7017e59f1c08602ef3c2cb0483c51df248f112e3780c66594110719c575
test_ckf_tracks_example[odd-truth_smeared]__trackstates_ckf.root: 9dbd4b23e05914b50c981d9d0f73314cc8527b80d26b238a385dbdeec45c87e5
test_ckf_tracks_example[odd-truth_smeared]__tracksummary_ckf.root: e2aaf2bdafb5757698ee7a1db542c4612ab35ea305dbfb7908dc204974a85ffe
Expand Down

0 comments on commit b58a4b4

Please sign in to comment.