5 #ifndef ACTSGEOMETRY_FITTERHELPER_H 
    6 #define ACTSGEOMETRY_FITTERHELPER_H 
   12 #include "Acts/TrackFitting/GainMatrixSmoother.hpp" 
   13 #include "Acts/TrackFitting/GainMatrixUpdater.hpp" 
   14 #include "Acts/TrackFitting/MbfSmoother.hpp" 
   22   template<
typename trajectory_t>
 
   24                     typename trajectory_t::TrackStateProxy trackState, 
 
   25                     const Acts::Logger& 
logger) {
 
   26     Acts::GainMatrixUpdater updater;
 
   27     return updater.template operator()<trajectory_t>(gctx, trackState, 
logger);
 
   30   template<
typename trajectory_t>
 
   32                 trajectory_t& trajectory, 
 
   34                 const Acts::Logger& 
logger) {
 
   35     Acts::GainMatrixSmoother smoother;
 
   36     return smoother.template operator()<trajectory_t>(gctx, trajectory, entryIndex, 
logger);
 
   39   template<
typename trajectory_t>
 
   40   Acts::Result<void> 
mbfSmoother(
const Acts::GeometryContext& gctx,
 
   41                 trajectory_t& trajectory, 
 
   43                 const Acts::Logger& 
logger) {
 
   44     Acts::MbfSmoother smoother;
 
   45     return smoother.template operator()<trajectory_t>(gctx, trajectory, entryIndex, 
logger);
 
   57     template<
typename trajectory_t>
 
   58     bool operator()(
typename Acts::MultiTrajectory<trajectory_t>::ConstTrackStateProxy state)
 const {
 
   60       if (not state.hasCalibrated() or not state.hasPredicted()) {
 
   63       return Acts::visit_measurement(
 
   64           state.calibratedSize(),
 
   65     [&] (
auto N) -> 
bool {
 
   66       constexpr size_t kMeasurementSize = decltype(N)::value;
 
   68       auto subspaceHelper = state.template projectorSubspaceHelper<kMeasurementSize>();
 
   70       typename Acts::TrackStateTraits<kMeasurementSize, true>::Calibrated calibrated{
 
   71         state.template calibrated<Acts::MultiTrajectoryTraits::MeasurementSizeMax>().data()};
 
   73       typename Acts::TrackStateTraits<kMeasurementSize, true>::CalibratedCovariance
 
   74         calibratedCovariance{state.template calibratedCovariance<Acts::MultiTrajectoryTraits::MeasurementSizeMax>().data()};
 
   78       const auto H = subspaceHelper.projector();
 
   80       const auto residual = calibrated - 
H * state.predicted();
 
   81       double chi2 = (
residual.transpose() * (calibratedCovariance + 
H * state.predictedCovariance() * 
H.transpose()).inverse() * 
residual).value();     
 
   99     template<
typename trajectory_t>
 
  100     bool operator()(
typename Acts::MultiTrajectory<trajectory_t>::ConstTrackStateProxy trackState)
 const {
 
  102       auto momentum = std::abs(1. / trackState.filtered()[Acts::eBoundQOverP]);