File indexing completed on 2025-01-18 09:11:06
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/EventData/MeasurementHelpers.hpp"
0012 #include "Acts/EventData/MultiTrajectory.hpp"
0013 #include "Acts/EventData/Types.hpp"
0014 #include "Acts/Geometry/GeometryContext.hpp"
0015 #include "Acts/TrackFitting/KalmanFitterError.hpp"
0016 #include "Acts/Utilities/Logger.hpp"
0017 #include "Acts/Utilities/Result.hpp"
0018
0019 #include <cassert>
0020 #include <system_error>
0021 #include <tuple>
0022
0023 namespace Acts {
0024
0025
0026 class GainMatrixUpdater {
0027 struct InternalTrackState {
0028 unsigned int calibratedSize;
0029
0030 const double* calibrated;
0031 const double* calibratedCovariance;
0032 BoundSubspaceIndices projector;
0033
0034 TrackStateTraits<MultiTrajectoryTraits::MeasurementSizeMax,
0035 false>::Parameters predicted;
0036 TrackStateTraits<MultiTrajectoryTraits::MeasurementSizeMax,
0037 false>::Covariance predictedCovariance;
0038 TrackStateTraits<MultiTrajectoryTraits::MeasurementSizeMax,
0039 false>::Parameters filtered;
0040 TrackStateTraits<MultiTrajectoryTraits::MeasurementSizeMax,
0041 false>::Covariance filteredCovariance;
0042 };
0043
0044 public:
0045
0046
0047
0048
0049
0050 template <typename traj_t>
0051 Result<void> operator()(const GeometryContext& ,
0052 typename traj_t::TrackStateProxy trackState,
0053 const Logger& logger = getDummyLogger()) const {
0054 ACTS_VERBOSE("Invoked GainMatrixUpdater");
0055
0056
0057 assert(trackState.hasCalibrated());
0058
0059 assert(trackState.hasPredicted());
0060
0061 assert(trackState.hasFiltered());
0062
0063
0064
0065
0066
0067 ACTS_VERBOSE(
0068 "Predicted parameters: " << trackState.predicted().transpose());
0069 ACTS_VERBOSE("Predicted covariance:\n" << trackState.predictedCovariance());
0070
0071
0072
0073
0074
0075
0076 auto [chi2, error] = visitMeasurement(
0077 InternalTrackState{
0078 trackState.calibratedSize(),
0079
0080
0081 trackState.effectiveCalibrated().data(),
0082 trackState.effectiveCalibratedCovariance().data(),
0083 trackState.projectorSubspaceIndices(),
0084 trackState.predicted(),
0085 trackState.predictedCovariance(),
0086 trackState.filtered(),
0087 trackState.filteredCovariance(),
0088 },
0089 logger);
0090
0091 trackState.chi2() = chi2;
0092
0093 return error ? Result<void>::failure(error) : Result<void>::success();
0094 }
0095
0096 private:
0097 std::tuple<double, std::error_code> visitMeasurement(
0098 InternalTrackState trackState, const Logger& logger) const;
0099
0100 template <std::size_t N>
0101 std::tuple<double, std::error_code> visitMeasurementImpl(
0102 InternalTrackState trackState, const Logger& logger) const;
0103 };
0104
0105 }