File KalmanFitter.hpp

namespace Acts

Set the Geometry Context PLUGIN.

Set the Calibration Context PLUGIN.

Convenience functions to ease creation of and Acts::InterpolatedMaterialMap and to avoid code duplication.

Set the Mangetic Field Context PLUGIN.

Convenience functions to ease creation of and Acts::InterpolatedBFieldMap and to avoid code duplication.

Currently implemented for the two most common formats: rz and xyz.

template<typename propagator_t, typename updater_t = VoidKalmanUpdater, typename smoother_t = VoidKalmanSmoother>
class KalmanFitter
#include <Acts/TrackFitting/KalmanFitter.hpp>

Kalman fitter implementation.

The Kalman filter contains an Actor and a Sequencer sub-class. The Sequencer has to be part of the Navigator of the Propagator in order to initialize and provide the measurement surfaces.

tparam propagator_t

Type of the propagation class

tparam updater_t

Type of the kalman updater class

tparam smoother_t

Type of the kalman smoother class

The Actor is part of the Propagation call and does the Kalman update and eventually the smoothing. Updater, Smoother and Calibrator are given to the Actor for further use:

  • The Updater is the implemented kalman updater formalism, it runs via a visitor pattern through the measurements.

  • The Smoother is called at the end of the filtering by the Actor.

Measurements are not required to be ordered for the KalmanFilter, measurement ordering needs to be figured out by the navigation of the propagator.

The void components are provided mainly for unit testing.

Public Functions

inline KalmanFitter(propagator_t pPropagator)

Fit implementation of the foward filter, calls the the filter and smoother/reversed filter.

Note

The input measurements are given in the form of SourceLinks. It’s calibrator_t's job to turn them into calibrated measurements used in the fit.

Template Parameters
  • source_link_t – Type of the source link

  • start_parameters_t – Type of the initial parameters

  • calibrator_t – Type of the source link calibrator

  • outlier_finder_t – Type of the outlier finder

  • parameters_t – Type of parameters used for local parameters

Parameters
  • sourcelinks – The fittable uncalibrated measurements

  • sParameters – The initial track parameters

  • kfOptions – KalmanOptions steering the fit

Returns

the output as an output track

Fit implementation of the foward filter, calls the the filter and smoother/reversed filter.

Note

The input measurements are given in the form of SourceLinks. It’s calibrator_t's job to turn them into calibrated measurements used in the fit.

Template Parameters
  • source_link_t – Type of the source link

  • start_parameters_t – Type of the initial parameters

  • calibrator_t – Type of the source link calibrator

  • outlier_finder_t – Type of the outlier finder

  • parameters_t – Type of parameters used for local parameters

Parameters
  • sourcelinks – The fittable uncalibrated measurements

  • sParameters – The initial track parameters

  • kfOptions – KalmanOptions steering the fit

  • sSequence – surface sequence used to initialize a DirectNavigator

Returns

the output as an output track

Private Types

using KalmanNavigator = typename propagator_t::Navigator

The navigator type.

Private Members

propagator_t m_propagator

The propgator for the transport and material update.

Private Static Attributes

static constexpr bool isDirectNavigator = std::is_same<KalmanNavigator, DirectNavigator>::value

The navigator has DirectNavigator type or not.

template<typename source_link_t, typename parameters_t, typename calibrator_t, typename outlier_finder_t>
class Aborter

Public Types

using action_type = Actor<source_link_t, parameters_t, calibrator_t, outlier_finder_t>

Broadcast the result_type.

Public Functions

template<typename propagator_state_t, typename stepper_t, typename result_t>
inline bool operator()(propagator_state_t&, const stepper_t&, const result_t &result) const
template<typename source_link_t, typename parameters_t, typename calibrator_t, typename outlier_finder_t>
class Actor

Propagator Actor plugin for the KalmanFilter.

The KalmanActor does not rely on the measurements to be sorted along the track.

tparam source_link_t

is an type fulfilling the SourceLinkConcept

tparam parameters_t

The type of parameters used for “local” paremeters.

tparam calibrator_t

The type of calibrator

tparam outlier_finder_t

Type of the outlier finder class

Public Types

using result_type = KalmanFitterResult<source_link_t>

Broadcast the result_type.

Public Functions

template<typename propagator_state_t, typename stepper_t>
inline Result<void> filter(const Surface *surface, propagator_state_t &state, const stepper_t &stepper, result_type &result) const

Kalman actor operation : update.

Template Parameters
  • propagator_state_t – is the type of Propagagor state

  • stepper_t – Type of the stepper

Parameters
  • surface – The surface where the update happens

  • state – The mutable propagator state object

  • stepper – The stepper in use

  • result – The mutable result state object

template<typename propagator_state_t, typename stepper_t>
inline Result<void> finalize(propagator_state_t &state, const stepper_t &stepper, result_type &result) const

Kalman actor operation : finalize.

Template Parameters
  • propagator_state_t – is the type of Propagagor state

  • stepper_t – Type of the stepper

Parameters
  • state – is the mutable propagator state object

  • stepper – The stepper in use

  • result – is the mutable result state object

template<typename propagator_state_t, typename stepper_t>
inline void materialInteractor(const Surface *surface, propagator_state_t &state, stepper_t &stepper, const MaterialUpdateStage &updateStage = fullUpdate) const

Kalman actor operation : material interaction.

Template Parameters
  • propagator_state_t – is the type of Propagagor state

  • stepper_t – Type of the stepper

Parameters
  • surface – The surface where the material interaction happens

  • state – The mutable propagator state object

  • stepper – The stepper in use

  • updateStage – The materal update stage

template<typename propagator_state_t, typename stepper_t>
inline void operator()(propagator_state_t &state, const stepper_t &stepper, result_type &result) const

Kalman actor operation.

Template Parameters
  • propagator_state_t – is the type of Propagagor state

  • stepper_t – Type of the stepper

Parameters
  • state – is the mutable propagator state object

  • stepper – The stepper in use

  • result – is the mutable result state object

template<typename propagator_state_t, typename stepper_t>
inline Result<void> reverse(propagator_state_t &state, stepper_t &stepper, result_type &result) const

Kalman actor operation : reverse direction.

Template Parameters
  • propagator_state_t – is the type of Propagagor state

  • stepper_t – Type of the stepper

Parameters
  • state – is the mutable propagator state object

  • stepper – The stepper in use

  • result – is the mutable result state objecte

template<typename propagator_state_t, typename stepper_t>
inline Result<void> reversedFilter(const Surface *surface, propagator_state_t &state, const stepper_t &stepper, result_type &result) const

Kalman actor operation : update in reversed direction.

Template Parameters
  • propagator_state_t – is the type of Propagagor state

  • stepper_t – Type of the stepper

Parameters
  • surface – The surface where the update happens

  • state – The mutable propagator state object

  • stepper – The stepper in use

  • result – The mutable result state object

Public Members

bool energyLoss = true

Whether to consider energy loss.

const std::map<GeometryIdentifier, source_link_t> *inputMeasurements = nullptr

Allows retrieving measurements for a surface.

calibrator_t m_calibrator

The measurement calibrator.

outlier_finder_t m_outlierFinder

The outlier finder.

smoother_t m_smoother

The Kalman smoother.

updater_t m_updater

The Kalman updater.

bool multipleScattering = true

Whether to consider multiple scattering.

bool reversedFiltering = false

Whether run reversed filtering.

SurfaceReached targetReached

The Surface beeing.

const Surface *targetSurface = nullptr

The target surface.

template<typename calibrator_t, typename outlier_finder_t>
struct KalmanFitterOptions
#include <Acts/TrackFitting/KalmanFitter.hpp>

Combined options for the Kalman fitter.

tparam calibrator_t

Source link type, should be semiregular.

tparam outlier_finder_t

Outlier finder type, shoule be semiregular.

Public Types

using Calibrator = calibrator_t
using OutlierFinder = outlier_finder_t

Public Functions

inline KalmanFitterOptions(const GeometryContext &gctx, const MagneticFieldContext &mctx, std::reference_wrapper<const CalibrationContext> cctx, Calibrator calibrator_, OutlierFinder outlierFinder_, LoggerWrapper logger_, const PropagatorPlainOptions &pOptions, const Surface *rSurface = nullptr, bool mScattering = true, bool eLoss = true, bool rFiltering = false)

PropagatorOptions with context.

Parameters
  • gctx – The goemetry context for this fit

  • mctx – The magnetic context for this fit

  • cctx – The calibration context for this fit

  • calibrator_ – The source link calibrator

  • outlierFinder_ – The outlier finder

  • logger_ – The logger wrapper

  • pOptions – The plain propagator options

  • rSurface – The reference surface for the fit to be expressed at

  • mScattering – Whether to include multiple scattering

  • eLoss – Whether to include energy loss

  • rFiltering – Whether to run filtering in reversed direction as smoothing

KalmanFitterOptions() = delete

Contexts are required and the options must not be default-constructible.

Public Members

std::reference_wrapper<const CalibrationContext> calibrationContext

context object for the calibration

Calibrator calibrator

The source link calibrator.

bool energyLoss = true

Whether to consider energy loss.

std::reference_wrapper<const GeometryContext> geoContext

Context object for the geometry.

LoggerWrapper logger

Logger.

std::reference_wrapper<const MagneticFieldContext> magFieldContext

Context object for the magnetic field.

bool multipleScattering = true

Whether to consider multiple scattering.

OutlierFinder outlierFinder

The outlier finder.

PropagatorPlainOptions propagatorPlainOptions

The trivial propagator options.

const Surface *referenceSurface = nullptr

The reference Surface.

bool reversedFiltering = false

Whether to run filtering in reversed direction.

template<typename source_link_t>
struct KalmanFitterResult
#include <Acts/TrackFitting/KalmanFitter.hpp>

Public Members

bool finished = false
std::optional<BoundTrackParameters> fittedParameters
MultiTrajectory<source_link_t> fittedStates
size_t lastMeasurementIndex = SIZE_MAX
size_t lastTrackIndex = SIZE_MAX
size_t measurementHoles = 0
size_t measurementStates = 0
std::vector<const Surface*> missedActiveSurfaces
std::vector<const Surface*> passedAgainSurfaces
size_t processedStates = 0
Result<void> result = {Result<void>::success()}
bool reversed = false
bool smoothed = false