Skip to content

Commit

Permalink
Merge branch 'main' into feat/gen3-portal-links
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Aug 26, 2024
2 parents 70a3e83 + 666d7e4 commit ec1c1db
Showing 1 changed file with 27 additions and 18 deletions.
45 changes: 27 additions & 18 deletions Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,9 @@ class CombinatorialKalmanFilter {
result.pathLimitReached(state, stepper, navigator, logger());
const bool isTargetReached =
targetReached(state, stepper, navigator, logger());
if (isEndOfWorldReached || isPathLimitReached || isTargetReached) {
const bool allBranchesStopped = result.activeBranches.empty();
if (isEndOfWorldReached || isPathLimitReached || isTargetReached ||
allBranchesStopped) {
if (isEndOfWorldReached) {
ACTS_VERBOSE("End of world reached");
} else if (isPathLimitReached) {
Expand All @@ -617,20 +619,25 @@ class CombinatorialKalmanFilter {
stepper.releaseStepSize(state.stepping, ConstrainedStep::actor);
}

// Record the active branch and remove it from the list
storeLastActiveBranch(result);
result.activeBranches.pop_back();
if (!allBranchesStopped) {
// Record the active branch and remove it from the list
storeLastActiveBranch(result);
result.activeBranches.pop_back();
} else {
// This can happen if we stopped all branches in the filter step
ACTS_VERBOSE("All branches stopped");
}

// If no more active branches, done with filtering; Otherwise, reset
// propagation state to track state at next active branch
if (result.activeBranches.empty()) {
ACTS_VERBOSE("Kalman filtering finds "
<< result.collectedTracks.size() << " tracks");
result.finished = true;
} else {
if (!result.activeBranches.empty()) {
ACTS_VERBOSE("Propagation jumps to branch with tip = "
<< result.activeBranches.back().tipIndex());
reset(state, stepper, navigator, result);
} else {
ACTS_VERBOSE("Stop Kalman filtering with "
<< result.collectedTracks.size() << " found tracks");
result.finished = true;
}
}
}
Expand All @@ -649,7 +656,8 @@ class CombinatorialKalmanFilter {
typename navigator_t>
void reset(propagator_state_t& state, const stepper_t& stepper,
const navigator_t& navigator, result_type& result) const {
auto currentState = result.activeBranches.back().outermostTrackState();
auto currentBranch = result.activeBranches.back();
auto currentState = currentBranch.outermostTrackState();

// Reset the stepping state
stepper.resetState(state.stepping, currentState.filtered(),
Expand Down Expand Up @@ -791,8 +799,9 @@ class CombinatorialKalmanFilter {
currentBranch = result.activeBranches.back();
prevTip = currentBranch.tipIndex();

if (currentBranch.outermostTrackState().typeFlags().test(
TrackStateFlag::OutlierFlag)) {
auto currentState = currentBranch.outermostTrackState();

if (currentState.typeFlags().test(TrackStateFlag::OutlierFlag)) {
// We don't need to update the stepper given an outlier state
ACTS_VERBOSE("Outlier state detected on surface "
<< surface->geometryId());
Expand All @@ -802,16 +811,16 @@ class CombinatorialKalmanFilter {
<< nBranchesOnSurface << " branches");
// Update stepping state using filtered parameters of last track
// state on this surface
auto ts = result.activeBranches.back().outermostTrackState();
stepper.update(state.stepping,
MultiTrajectoryHelpers::freeFiltered(
state.options.geoContext, ts),
ts.filtered(), ts.filteredCovariance(), *surface);
state.options.geoContext, currentState),
currentState.filtered(),
currentState.filteredCovariance(), *surface);
ACTS_VERBOSE(
"Stepping state is updated with filtered parameter:");
ACTS_VERBOSE("-> "
<< ts.filtered().transpose()
<< " of track state with tip = " << ts.index());
ACTS_VERBOSE("-> " << currentState.filtered().transpose()
<< " of track state with tip = "
<< currentState.index());
}
}
}
Expand Down

0 comments on commit ec1c1db

Please sign in to comment.