6 #include "Acts/Surfaces/BoundaryTolerance.hpp"
15 const typename ActsTrk::TrackContainer::ConstTrackProxy &track,
19 &measurement_to_summary_type,
22 std::vector<ActsTrk::TrackStateBackend::ConstTrackStateProxy::IndexType > ¶m_state_idx_out,
26 chi2_stat_out.
reset();
29 param_state_idx_out.clear();
31 const auto lastMeasurementIndex = track.tipIndex();
32 tracksContainer.trackStateContainer().visitBackwards(
35 &measurement_to_summary_type,
39 &special_hit_counts_out
40 ](
const typename ActsTrk::TrackStateBackend::ConstTrackStateProxy &state) ->
void
43 auto flag = state.typeFlags();
44 if (
flag.test(Acts::TrackStateFlag::HoleFlag)) {
45 xAOD::UncalibMeasType det_type = xAOD::UncalibMeasType::Other;
46 if (state.hasReferenceSurface()) {
47 if (state.referenceSurface().associatedDetectorElement()) {
48 const ActsDetectorElement *
49 actsDetEl = dynamic_cast<const ActsDetectorElement *>(state.referenceSurface().associatedDetectorElement());
51 const InDetDD::SiDetectorElement *
52 detEl = dynamic_cast<const InDetDD::SiDetectorElement *>(actsDetEl->upstreamDetectorElement());
54 if (detEl->isPixel()) {
55 det_type = xAOD::UncalibMeasType::PixelClusterType;
57 else if (detEl->isSCT()) {
58 det_type = xAOD::UncalibMeasType::StripClusterType;
65 Acts::BoundaryTolerance
tolerance = Acts::BoundaryTolerance::AbsoluteBound(
68 || state.referenceSurface().bounds().type() != Acts::SurfaceBounds::eAnnulus)
69 ? 0.0 : std::numeric_limits<double>::infinity(),
72 || state.referenceSurface().bounds().type() == Acts::SurfaceBounds::eAnnulus)
73 ? 0.0 : std::numeric_limits<double>::infinity()
75 Acts::Vector2 localPos(state.predicted()[Acts::eBoundLoc0],state.predicted()[Acts::eBoundLoc1]);
76 if (state.referenceSurface().insideBounds(localPos,
tolerance)) {
81 ++special_hit_counts_out.at(to_underlying(det_type)).at(HitCategory::Hole);
85 else if (
flag.test(Acts::TrackStateFlag::MeasurementFlag)) {
87 param_state_idx_out.push_back(state.index());
91 if (state.hasUncalibratedSourceLink()) {
92 auto sl = state.getUncalibratedSourceLink().template get<ActsTrk::ATLASUncalibSourceLink>();
93 assert( sl != nullptr );
94 const xAOD::UncalibratedMeasurement &uncalibMeas = getUncalibratedMeasurement(sl);
95 if (measurement_to_summary_type.at(to_underlying(uncalibMeas.type())) < xAOD::numberOfTrackSummaryTypes ) {
96 if (static_cast<unsigned int>(to_underlying(uncalibMeas.type())) < siDetEleColl.size()) {
97 HitSummaryData::EHitSelection hit_selection = (flag.test(Acts::TrackStateFlag::OutlierFlag)
98 ? HitSummaryData::Outlier
99 : HitSummaryData::Hit);
100 if (flag.test(Acts::TrackStateFlag::SharedHitFlag)) {
101 hit_selection = HitSummaryData::EHitSelection(hit_selection | HitSummaryData::SharedHit);
103 hit_info_out.addHit(siDetEleColl[to_underlying(uncalibMeas.type())],
104 uncalibMeas.identifierHash(),
108 if (state.calibratedSize()>0 && !
flag.test(Acts::TrackStateFlag::OutlierFlag)) {
111 double chi2add = std::min(state.chi2(),1e5f) / state.calibratedSize();
112 chi2_stat_out.add(chi2add );