Skip to content

Commit

Permalink
refactor: Add early stop mechanism for GSF forward pass (#1542)
Browse files Browse the repository at this point in the history
Very simple PR that stops the GSF forward pass if all measurements are found similar to the mechanism in the KF. Should mainly reduce runtime since before the GSF always propagated until it reached end-of-world.

Also changes a related variable from `int` to `std::size_t` for consistency.
  • Loading branch information
benjaminhuth authored and paulgessinger committed Oct 20, 2022
1 parent 9296a35 commit 52b33f1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Core/include/Acts/Propagator/MultiEigenStepperLoop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class MultiEigenStepperLoop
bool covTransport = false;
NavigationDirection navDir;
double pathAccumulated = 0.;
int steps = 0;
std::size_t steps = 0;

/// geoContext
std::reference_wrapper<const GeometryContext> geoContext;
Expand Down
1 change: 1 addition & 0 deletions Core/include/Acts/TrackFitting/GaussianSumFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ struct GaussianSumFitter {
actor.m_cfg.abortOnError = options.abortOnError;
actor.m_cfg.disableAllMaterialHandling =
options.disableAllMaterialHandling;
actor.m_cfg.numberMeasurements = inputMeasurements.size();

fwdPropOptions.direction = gsfForward;

Expand Down
10 changes: 10 additions & 0 deletions Core/include/Acts/TrackFitting/detail/GsfActor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ struct GsfActor {
/// Whether to abort immediately when an error occurs
bool abortOnError = false;

/// We can stop the propagation if we reach this number of measuerement
/// states
std::optional<std::size_t> numberMeasurements;

/// The extensions
GsfExtensions extensions;
} m_cfg;
Expand Down Expand Up @@ -307,6 +311,12 @@ struct GsfActor {
MaterialUpdateStage::PostUpdate);
}
}

// Break the navigation if we found all measurements
if (m_cfg.numberMeasurements &&
result.measurementStates == m_cfg.numberMeasurements) {
state.navigation.targetReached = true;
}
}

template <typename propagator_state_t, typename stepper_t>
Expand Down
4 changes: 2 additions & 2 deletions Examples/Python/tests/root_file_hashes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ test_truth_tracking_kalman[odd-1000.0]__trackstates_fitter.root: 5ea6ca504f89355
test_truth_tracking_kalman[odd-1000.0]__tracksummary_fitter.root: c7b3ff9d8d3c19ac378ed7f7c63f396fe504674999efb3131d1009a9c5d3bf2f
test_truth_tracking_kalman[odd-1000.0]__performance_track_finder.root: 76a990d595b6e097da2bed447783bd63044956e5649a5dd6fd7a6a3434786877

test_truth_tracking_gsf[generic]__trackstates_gsf.root: 841b167672a19a8a8b92ce347228267815216a6e2436f221c2cb235616210771
test_truth_tracking_gsf[generic]__trackstates_gsf.root: c9f3d30d13ee8eac8c69a01600ea89a8bd80cf89154ecc69a48d60a6afd26405
test_truth_tracking_gsf[generic]__tracksummary_gsf.root: 14fd6b28b8ac3722af4fde22fedd48ec9bfed6075109a8e6f327d551acaf44a8
test_truth_tracking_gsf[odd]__trackstates_gsf.root: ecb5759cd2719266321bb79117bf5faa17b160f8e6e5a21dc9f0d5fb09963972
test_truth_tracking_gsf[odd]__trackstates_gsf.root: 97ebc8f5ab5d5242596eaca2dfbed864a65580cc18c02cad634c6357cf449ab7
test_truth_tracking_gsf[odd]__tracksummary_gsf.root: 928277c50d249abd548185f8536e1614e9ab958e0e7a9521ef0966acdcccb9d2

test_digitization_example_input__measurements.root: ccc92f0ad538d1b62d98f19f947970bcc491843e54d8ffeed16ad2e226b8caee
Expand Down

0 comments on commit 52b33f1

Please sign in to comment.