461 Acts::Result<boost::container::small_vector< typename TrackStateProxy::IndexType, s_maxBranchesPerSurface> >
462 result = boost::container::small_vector< typename TrackStateProxy::IndexType, s_maxBranchesPerSurface>{};
464 using BaseElementType = std::remove_cv_t<std::remove_pointer_t< container_value_t > >;
466 using TheMatchingMeasurement = MatchingMeasurement<DIM, container_value_t >;
467 using MeasCovPair = TheMatchingMeasurement::MeasCovPair;
475 Acts::SubspaceIndices<DIM> parameter_map =
derived().template parameterMap<DIM>(geometryContext,
479 = std::make_pair( project<DIM, Predicted>(parameter_map,
481 project<DIM, PredictedCovariance>(parameter_map,
482 derived().boundParams(boundState).covariance().
value()));
485 auto preCalibrator =
derived().template preCalibrator<DIM, BaseElementType>();
488 for (
const auto &measurement : MeasurementRange<T_Container>(container, sourceLinkBegin, sourceLinkEnd) ) {
489 TheMatchingMeasurement &matching_measurement=selected_measurements.slot();
490 matching_measurement.m_measurement = preCalibrator(geometryContext,
492 derived().
template forwardToCalibrator(measurement),
493 derived().boundParams(boundState));
494 matching_measurement.m_chi2 =
computeChi2(matching_measurement.m_measurement.first,
495 matching_measurement.m_measurement.second,
499 if (matching_measurement.m_chi2<maxChi2Cut.second) {
500 matching_measurement.m_sourceLink=measurement;
501 selected_measurements.acceptAndSort([](
const TheMatchingMeasurement &
a,
502 const TheMatchingMeasurement &
b) {
503 return a.m_chi2 <
b.m_chi2;
510 auto postCalibrator =
derived().template postCalibrator<DIM, BaseElementType>();
511 using post_calib_meas_cov_pair_t
517 static constexpr
bool pre_and_post_calib_types_agree
523 using Empty =
struct {};
524 typename std::conditional< !pre_and_post_calib_types_agree,
525 std::array< post_calib_meas_cov_pair_t, NMeasMax>,
527 if (postCalibrator) {
532 idx: selected_measurements) {
533 TheMatchingMeasurement &a_selected_measurement = selected_measurements.
getSlot(
idx);
537 post_calib_meas_cov_pair_t &calibrated_measurement
538 = [&calibrated, &a_selected_measurement, calibrated_meas_cov_i]() -> post_calib_meas_cov_pair_t & {
539 if constexpr(pre_and_post_calib_types_agree) {
541 (void) calibrated_meas_cov_i;
542 return a_selected_measurement.m_measurement;
545 (void) a_selected_measurement;
546 assert(calibrated_meas_cov_i < calibrated.size());
547 return calibrated[calibrated_meas_cov_i];
552 calibrated_measurement = postCalibrator(geometryContext,
554 derived().
template forwardToCalibrator(a_selected_measurement.m_sourceLink.value()),
555 derived().boundParams(boundState));
557 a_selected_measurement.m_chi2 =
computeChi2(calibrated_measurement.first,
558 calibrated_measurement.second,
562 a_selected_measurement.m_isOutLier = (a_selected_measurement.m_chi2 >= maxChi2Cut.first);
563 if constexpr(!pre_and_post_calib_types_agree) {
564 ++calibrated_meas_cov_i;
571 idx: selected_measurements) {
572 TheMatchingMeasurement &a_selected_measurement = selected_measurements.
getSlot(
idx);
573 a_selected_measurement.m_isOutLier = (a_selected_measurement.m_chi2 >= maxChi2Cut.first);
583 Acts::BoundSubspaceIndices boundSubspaceIndices;
584 std::copy(parameter_map.begin(), parameter_map.end(), boundSubspaceIndices.begin());
589 boundSubspaceIndices,
592 (!selected_measurements.
empty()
593 ? selected_measurements.
getSlot( *(selected_measurements.
begin())).m_isOutLier
595 assert(
result->size() == selected_measurements.
size() );
598 auto use_calibrated_storage = [&postCalibrator]() ->
bool {
599 if constexpr(pre_and_post_calib_types_agree) {
600 (void) postCalibrator;
606 return postCalibrator;
611 unsigned int state_i=0;
613 idx: selected_measurements) {
614 assert( state_i < result->
size());
616 TheMatchingMeasurement &a_selected_measurement = selected_measurements.
getSlot(
idx);
617 trackState.setUncalibratedSourceLink(
derived().makeSourceLink(std::move(a_selected_measurement.m_sourceLink.value())));
619 trackState.typeFlags().set( a_selected_measurement.m_isOutLier
620 ? Acts::TrackStateFlag::OutlierFlag
621 : Acts::TrackStateFlag::MeasurementFlag );
622 trackState.allocateCalibrated(DIM);
623 if (use_calibrated_storage()) {
626 assert( use_calibrated_storage() == !pre_and_post_calib_types_agree);
627 if constexpr(!pre_and_post_calib_types_agree) {
628 assert( state_i < calibrated.size());
629 trackState.template calibrated<DIM>()
630 = MeasurementSelectorMatrixTraits::matrixTypeCast<typename MeasurementSelectorTraits<derived_t>::MatrixFloatType>(calibrated[state_i].first);
631 trackState.template calibratedCovariance<DIM>()
632 = MeasurementSelectorMatrixTraits::matrixTypeCast<typename MeasurementSelectorTraits<derived_t>::MatrixFloatType>(calibrated[state_i].second);
633 trackState.chi2() = a_selected_measurement.m_chi2;
637 trackState.template calibrated<DIM>()
638 = MeasurementSelectorMatrixTraits::matrixTypeCast<typename MeasurementSelectorTraits<derived_t>::MatrixFloatType>(a_selected_measurement.m_measurement.first);
639 trackState.template calibratedCovariance<DIM>()
640 = MeasurementSelectorMatrixTraits::matrixTypeCast<typename MeasurementSelectorTraits<derived_t>::MatrixFloatType>(a_selected_measurement.m_measurement.second);
641 trackState.chi2() = a_selected_measurement.m_chi2;