Classify a measurement as a valid one or an outlier.
58 {
59
60 if (not state.hasCalibrated() or not state.hasPredicted()) {
61 return false;
62 }
63 return Acts::visit_measurement(
64 state.calibratedSize(),
65 [&] (auto N) -> bool {
66 constexpr size_t kMeasurementSize = decltype(N)::value;
67
68 auto subspaceHelper = state.template projectorSubspaceHelper<kMeasurementSize>();
69
70 typename Acts::TrackStateTraits<kMeasurementSize, true>::Calibrated calibrated{
71 state.template calibrated<Acts::MultiTrajectoryTraits::MeasurementSizeMax>().data()};
72
73 typename Acts::TrackStateTraits<kMeasurementSize, true>::CalibratedCovariance
74 calibratedCovariance{state.template calibratedCovariance<Acts::MultiTrajectoryTraits::MeasurementSizeMax>().data()};
75
76
77
78 const auto H = subspaceHelper.projector();
79
80 const auto residual = calibrated -
H * state.predicted();
81 double chi2 = (
residual.transpose() * (calibratedCovariance +
H * state.predictedCovariance() *
H.transpose()).inverse() * residual).value();
83 });
84 }
double chi2(TH1 *h0, TH1 *h1)
double StateChiSquaredPerNumberDoFCut