Skip to content

Commit

Permalink
fix (#996)
Browse files Browse the repository at this point in the history
The reason for #984 is that after #956, a track might have non-zero processedStates, but zero measurementStates. So we return a failure explicity in KF if measurementStates is zero.
  • Loading branch information
XiaocongAi committed Sep 20, 2021
1 parent e11d1c4 commit ebe6b0e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
16 changes: 10 additions & 6 deletions Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,9 +709,9 @@ class CombinatorialKalmanFilter {
return res.error();
}
const auto boundState = *res;
// Add a hole track state to the multitrajectory
// Add a hole or material track state to the multitrajectory
currentTip = addNonSourcelinkState(stateMask, boundState, result,
prevTip, logger);
isSensitive, prevTip, logger);

// Check the branch
if (not m_branchStopper(tipState)) {
Expand Down Expand Up @@ -864,24 +864,28 @@ class CombinatorialKalmanFilter {
return std::make_pair(std::move(currentTip), std::move(tipState));
}

/// @brief CombinatorialKalmanFilter actor operation : add hole track state
/// @brief CombinatorialKalmanFilter actor operation : add hole or material track state
///
/// @param stateMask The bitmask that instructs which components to allocate
/// @param boundState The bound state on current surface
/// @param result is the mutable result state object
/// and which to leave invalid
/// @param isSensitive The surface is sensitive or passive
/// @param prevTip The index of the previous state
/// @param logger The logger wrapper
///
/// @return The tip of added state
size_t addNonSourcelinkState(
const TrackStatePropMask& stateMask, const BoundState& boundState,
result_type& result, size_t prevTip = SIZE_MAX,
result_type& result, bool isSensitive, size_t prevTip = SIZE_MAX,
LoggerWrapper logger = getDummyLogger()) const {
// Add a track state
auto currentTip = result.fittedStates.addTrackState(stateMask, prevTip);
ACTS_VERBOSE("Creating Hole track state with tip = " << currentTip);

if (isSensitive) {
ACTS_VERBOSE("Creating Hole track state with tip = " << currentTip);
} else {
ACTS_VERBOSE("Creating Material track state with tip = " << currentTip);
}
// now get track state proxy back
auto trackStateProxy = result.fittedStates.getTrackState(currentTip);

Expand Down
8 changes: 4 additions & 4 deletions Core/include/Acts/TrackFitting/KalmanFitter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1083,9 +1083,9 @@ class KalmanFitter {
/// Get the result of the fit
auto kalmanResult = propRes.template get<KalmanResult>();

/// It could happen that the fit ends in zero processed states.
/// It could happen that the fit ends in zero measurement states.
/// The result gets meaningless so such case is regarded as fit failure.
if (kalmanResult.result.ok() and not kalmanResult.processedStates) {
if (kalmanResult.result.ok() and not kalmanResult.measurementStates) {
kalmanResult.result = Result<void>(KalmanFitterError::NoMeasurementFound);
}

Expand Down Expand Up @@ -1185,9 +1185,9 @@ class KalmanFitter {
/// Get the result of the fit
auto kalmanResult = propRes.template get<KalmanResult>();

/// It could happen that the fit ends in zero processed states.
/// It could happen that the fit ends in zero measurement states.
/// The result gets meaningless so such case is regarded as fit failure.
if (kalmanResult.result.ok() and not kalmanResult.processedStates) {
if (kalmanResult.result.ok() and not kalmanResult.measurementStates) {
kalmanResult.result = Result<void>(KalmanFitterError::NoMeasurementFound);
}

Expand Down

0 comments on commit ebe6b0e

Please sign in to comment.