5 #ifndef ACTSGEOMETRY_FITTERHELPER_H
6 #define ACTSGEOMETRY_FITTERHELPER_H
12 #include "Acts/TrackFitting/GainMatrixSmoother.hpp"
13 #include "Acts/TrackFitting/GainMatrixUpdater.hpp"
20 template<
typename trajectory_t>
22 typename trajectory_t::TrackStateProxy trackState,
23 Acts::Direction direction,
24 const Acts::Logger&
logger) {
25 Acts::GainMatrixUpdater updater;
26 return updater.template operator()<trajectory_t>(gctx, trackState, direction,
logger);
29 template<
typename trajectory_t>
31 trajectory_t& trajectory,
33 const Acts::Logger&
logger) {
34 Acts::GainMatrixSmoother smoother;
35 return smoother.template operator()<trajectory_t>(gctx, trajectory, entryIndex,
logger);
47 template<
typename trajectory_t>
48 bool operator()(
typename Acts::MultiTrajectory<trajectory_t>::ConstTrackStateProxy state)
const {
50 if (not state.hasCalibrated() or not state.hasPredicted()) {
53 return Acts::visit_measurement(
54 state.calibratedSize(),
55 [&] (
auto N) ->
bool {
56 constexpr size_t kMeasurementSize = decltype(N)::value;
58 typename Acts::TrackStateTraits<kMeasurementSize, true>::Measurement calibrated{
59 state.template calibrated<Acts::MultiTrajectoryTraits::MeasurementSizeMax>().data()};
61 typename Acts::TrackStateTraits<kMeasurementSize, true>::MeasurementCovariance
62 calibratedCovariance{state.template calibratedCovariance<Acts::MultiTrajectoryTraits::MeasurementSizeMax>().data()};
67 .template topLeftCorner<kMeasurementSize, Acts::BoundIndices::eBoundSize>()
70 const auto residual = calibrated -
H * state.predicted();
71 double chi2 = (
residual.transpose() * (calibratedCovariance +
H * state.predictedCovariance() *
H.transpose()).inverse() *
residual).value();
89 template<
typename trajectory_t>
90 bool operator()(
typename Acts::MultiTrajectory<trajectory_t>::ConstTrackStateProxy trackState)
const {
92 auto momentum = std::abs(1. / trackState.filtered()[Acts::eBoundQOverP]);