-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move track state creator etc. out of the CKF.
Merge retrieval of source link ranges, measurement selection and track state creation into one unit which the CKF interacts with via a single delegate. The delegates for measurement selection track state creation and calibration are removed from the CKF options/extensions. The original building blocks (SourceLink accessor, measurement selector, and track state creator, or the combined measurement selector and track state creator) can still be used, however require to setup an additional helper object which combines these independent components. The algorithmic code is unchanged.
- Loading branch information
Goetz Gaycken
committed
Nov 28, 2024
1 parent
e10cd54
commit 9493657
Showing
7 changed files
with
560 additions
and
407 deletions.
There are no files selected for viewing
399 changes: 24 additions & 375 deletions
399
Core/include/Acts/TrackFinding/CombinatorialKalmanFilter.hpp
Large diffs are not rendered by default.
Oops, something went wrong.
101 changes: 101 additions & 0 deletions
101
Core/include/Acts/TrackFinding/CombinatorialKalmanFilterExtensions.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// This file is part of the ACTS project. | ||
// | ||
// Copyright (C) 2016 CERN for the benefit of the ACTS project | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
#pragma once | ||
|
||
#include "Acts/TrackFitting/KalmanFitter.hpp" | ||
#include "Acts/Utilities/Result.hpp" | ||
|
||
#include <vector> | ||
|
||
namespace Acts { | ||
|
||
/// expected max number of track states that are expected to be added by | ||
/// stateCandidateCreator | ||
/// @note if the number of states exceeds this number dynamic memory allocation will occur. | ||
/// the number is chosen to yield a container size of 64 bytes. | ||
static constexpr std::size_t s_maxBranchesPerSurface = 10; | ||
|
||
namespace CkfTypes { | ||
|
||
template <typename T> | ||
using BranchVector = boost::container::small_vector<T, s_maxBranchesPerSurface>; | ||
|
||
using BoundState = std::tuple<BoundTrackParameters, BoundMatrix, double>; | ||
|
||
} // namespace CkfTypes | ||
|
||
/// Return type of the `BranchStopper` delegate for the | ||
/// CombinatorialKalmanFilter | ||
enum class CombinatorialKalmanFilterBranchStopperResult { | ||
Continue, | ||
StopAndDrop, | ||
StopAndKeep, | ||
}; | ||
|
||
/// Extension struct which holds the delegates to customize the CKF behavior | ||
template <typename track_container_t> | ||
struct CombinatorialKalmanFilterExtensions { | ||
using traj_t = typename track_container_t::TrackStateContainerBackend; | ||
using TrackProxy = typename track_container_t::TrackProxy; | ||
using TrackStateProxy = typename track_container_t::TrackStateProxy; | ||
|
||
using BranchStopperResult = CombinatorialKalmanFilterBranchStopperResult; | ||
|
||
using Updater = typename KalmanFitterExtensions<traj_t>::Updater; | ||
using BranchStopper = | ||
Delegate<BranchStopperResult(const TrackProxy&, const TrackStateProxy&)>; | ||
|
||
/// The updater incorporates measurement information into the track parameters | ||
Updater updater{DelegateFuncTag<detail::voidFitterUpdater<traj_t>>{}}; | ||
|
||
/// The branch stopper is called during the filtering by the Actor. | ||
BranchStopper branchStopper{DelegateFuncTag<voidBranchStopper>{}}; | ||
|
||
/// @brief Delegate the extension of the trajectory onto the given surface to | ||
/// an external unit. | ||
/// | ||
/// @note Expected to create track states for measurements associated to the | ||
/// given surface which match the given bound state. Moreover the | ||
/// The "filtered" data is not expected to be set, but the outlier | ||
/// flag should be set for states that are considered to be outlier. | ||
/// | ||
/// @param geoContext The current geometry context | ||
/// @param calibrationContext pointer to the current calibration context | ||
/// @param surface the surface at which new track states are to be created | ||
/// @param boundState the current bound state of the trajectory | ||
/// @param prevTip Index pointing at previous trajectory state (i.e. tip) | ||
/// @param bufferTrajectory a temporary trajectory which can be used to create temporary track states | ||
/// @param trackStateCandidates a temporary buffer that can be used to collect track states | ||
/// @param trajectory the trajectory to which the new states are to be added | ||
/// @param logger a logger for messages | ||
/// @return indices of new track states which extend the trajectory given by prevTip | ||
|
||
using TrajectoryExtender = | ||
Delegate<Result<CkfTypes::BranchVector<TrackIndexType>>( | ||
const GeometryContext& geoContext, | ||
const CalibrationContext& calibrationContext, const Surface& surface, | ||
const CkfTypes::BoundState& boundState, TrackIndexType prevTip, | ||
traj_t& bufferTrajectory, | ||
std::vector<TrackStateProxy>& trackStateCandidates, | ||
traj_t& trajectory, const Logger& logger)>; | ||
|
||
/// The delegate to create new track states. | ||
/// @note a reference implementation can be found in @ref ComposableTrackStateCreator | ||
/// which makes uses of @ref MeasurementSelector and SourceLinkAccessor | ||
TrajectoryExtender extendOrBranchTrajectory; | ||
|
||
private: | ||
/// Default branch stopper which will never stop | ||
/// @return false | ||
static BranchStopperResult voidBranchStopper( | ||
const TrackProxy& /*track*/, const TrackStateProxy& /*trackState*/) { | ||
return BranchStopperResult::Continue; | ||
} | ||
}; | ||
} // namespace Acts |
Oops, something went wrong.