ATLAS Offline Software
Loading...
Searching...
No Matches
HitSummaryDataUtils.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "Acts/Surfaces/BoundaryTolerance.hpp"
8
13
14namespace ActsTrk::detail {
15
16 void gatherTrackSummaryData(const typename ActsTrk::TrackContainer::ConstTrackProxy &track,
17 const std::array<unsigned short, Acts::toUnderlying(xAOD::UncalibMeasType::nTypes)>
18 &measurement_to_summary_type,
19 SumOfValues &chi2_stat_out,
20 HitSummaryData &hit_info_out,
21 std::vector<ActsTrk::TrackStateBackend::ConstTrackStateProxy::IndexType > &param_state_idx_out,
22 std::array<std::array<uint8_t, Acts::toUnderlying(HitCategory::N)>,
23 Acts::toUnderlying(xAOD::UncalibMeasType::nTypes)> &special_hit_counts_out)
24 {
25 chi2_stat_out.reset();
26
27 hit_info_out.reset();
28 param_state_idx_out.clear();
29
30 const auto lastMeasurementIndex = track.tipIndex();
31 track.container().trackStateContainer().visitBackwards(
32 lastMeasurementIndex,
33 [&measurement_to_summary_type,
34 &chi2_stat_out,
35 &hit_info_out,
36 &param_state_idx_out,
37 &special_hit_counts_out
38 ](const typename ActsTrk::TrackStateBackend::ConstTrackStateProxy &state) -> void
39 {
40
41 auto flag = state.typeFlags();
42 if (!state.hasReferenceSurface()) {
43 return;
44 }
46 const auto* detEl = dynamic_cast<const IDetectorElementBase*>(state.referenceSurface().surfacePlacement());
47 if (detEl != nullptr) {
48 det_type = toMeasType(detEl->detectorType());
49 }
50
51 if (flag.isHole()) {
52 const Amg::Vector2D localPos{state.parameters()[Acts::eBoundLoc0],
53 state.parameters()[Acts::eBoundLoc1]};
54 if (state.referenceSurface().insideBounds(localPos)) {
55 // @TODO check whether detector element is dead..
56 ++special_hit_counts_out.at(Acts::toUnderlying(det_type)).at(Acts::toUnderlying(HitCategory::Hole));
57 }
58 return;
59
60 }
61 // do not consider material states
62 if (!flag.hasMeasurement() || !state.hasUncalibratedSourceLink()) {
63 return;
64 }
65 param_state_idx_out.push_back(state.index());
66
67 // @TODO dead elements
68 auto uncalibMeas = detail::xAODUncalibMeasCalibrator::unpack(state.getUncalibratedSourceLink());
69 assert( uncalibMeas != nullptr );
70 assert( det_type == uncalibMeas->type());
71
72 if (measurement_to_summary_type.at(Acts::toUnderlying(uncalibMeas->type())) <
74 HitSummaryData::EHitSelection hit_selection = (flag.isOutlier()
77 if (flag.isSharedHit()) {
78 hit_selection = HitSummaryData::EHitSelection(hit_selection | HitSummaryData::SharedHit);
79 }
80 const InDetDD::SiDetectorElement* siDet{nullptr};
81 if (const auto* idDetEl = dynamic_cast<const ActsDetectorElement*>(detEl); idDetEl != nullptr) {
82 siDet = dynamic_cast<const InDetDD::SiDetectorElement*>(idDetEl->upstreamDetectorElement());
83 }
84 hit_info_out.addHit(siDet, hit_selection);
85
86
87 if (state.calibratedSize()>0 && !flag.isOutlier()) {
88 // from Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx
89 // processTrackState
90 double chi2add = std::min(state.chi2(),1e5f) / state.calibratedSize();
91 chi2_stat_out.add(chi2add );
92 }
93 }
94
95 });
96 hit_info_out.computeSummaries();
97 }
98
99}
base class interface providing the bare minimal interface extension.
Helper class to gather hit summary information for e.g.
void reset()
reset all summary counters to zero.
void computeSummaries()
Compute the varius summaries.
bool addHit(const InDetDD::SiDetectorElement *detEl, EHitSelection hit_selection)
update summaries to take the given hit into account.
Helper class to gather statistics and compute the biased variance.
static const xAOD::UncalibratedMeasurement * unpack(const Acts::SourceLink &sl)
Helper method to unpack an Acts source link to an uncalibrated measurement.
Class to hold geometrical description of a silicon detector element.
Hash functions to pack the source link into unordered_maps / unordered_sets.
void gatherTrackSummaryData(const typename ActsTrk::TrackContainer::ConstTrackProxy &track, const std::array< unsigned short, Acts::toUnderlying(xAOD::UncalibMeasType::nTypes)> &measurement_to_summary_type, SumOfValues &chi2_stat_out, HitSummaryData &hit_info_out, std::vector< ActsTrk::TrackStateBackend::ConstTrackStateProxy::IndexType > &param_state_idx_out, std::array< std::array< uint8_t, Acts::toUnderlying(HitCategory::N)>, Acts::toUnderlying(xAOD::UncalibMeasType::nTypes)> &special_hit_counts_out)
Helper to gather track summary information from the track states of the specified track.
xAOD::UncalibMeasType toMeasType(const DetectorType dType)
Conversts the detector type to an uncalibrated measurement type.
Eigen::Matrix< double, 2, 1 > Vector2D
UncalibMeasType
Define the type of the uncalibrated measurement.
@ numberOfTrackSummaryTypes