ATLAS Offline Software
Loading...
Searching...
No Matches
HitSummaryDataUtils.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "Acts/Surfaces/BoundaryTolerance.hpp"
9
12
13namespace ActsTrk::detail {
14
16 const typename ActsTrk::TrackContainer::ConstTrackProxy &track,
17 const std::array<const InDetDD::SiDetectorElementCollection *,
19 const std::array<unsigned short, to_underlying(xAOD::UncalibMeasType::nTypes)>
20 &measurement_to_summary_type,
21 SumOfValues &chi2_stat_out,
22 HitSummaryData &hit_info_out,
23 std::vector<ActsTrk::TrackStateBackend::ConstTrackStateProxy::IndexType > &param_state_idx_out,
24 std::array<std::array<uint8_t, to_underlying(HitCategory::N)>,
25 to_underlying(xAOD::UncalibMeasType::nTypes)> &special_hit_counts_out)
26 {
27 chi2_stat_out.reset();
28
29 hit_info_out.reset();
30 param_state_idx_out.clear();
31
32 const auto lastMeasurementIndex = track.tipIndex();
33 tracksContainer.trackStateContainer().visitBackwards(
34 lastMeasurementIndex,
35 [&siDetEleColl,
36 &measurement_to_summary_type,
37 &chi2_stat_out,
38 &hit_info_out,
39 &param_state_idx_out,
40 &special_hit_counts_out
41 ](const typename ActsTrk::TrackStateBackend::ConstTrackStateProxy &state) -> void
42 {
43
44 auto flag = state.typeFlags();
45 if (flag.test(Acts::TrackStateFlag::HoleFlag)) {
47 if (state.hasReferenceSurface()) {
48 if (state.referenceSurface().associatedDetectorElement()) {
50 actsDetEl = dynamic_cast<const ActsDetectorElement *>(state.referenceSurface().associatedDetectorElement());
51 if (actsDetEl) {
53 detEl = dynamic_cast<const InDetDD::SiDetectorElement *>(actsDetEl->upstreamDetectorElement());
54 if (detEl) {
55 if (detEl->isPixel()) {
57 }
58 else if (detEl->isSCT()) {
60 }
61 }
62 }
63 }
64 }
65
66 Acts::Vector2 localPos(state.predicted()[Acts::eBoundLoc0],state.predicted()[Acts::eBoundLoc1]);
67 if (state.referenceSurface().insideBounds(localPos)) {
68 // @TODO check whether detector element is dead..
69 // if (dead) {
70 // ++specialHitCounts.at(to_underlying(det_type)).at(HitCategory::DeadSensor);
71 // } else {
72 ++special_hit_counts_out.at(to_underlying(det_type)).at(HitCategory::Hole);
73 }
74
75 }
76 else if (flag.test(Acts::TrackStateFlag::MeasurementFlag)) {
77 // do not consider material states
78 param_state_idx_out.push_back(state.index());
79 }
80 // @TODO dead elements
81
82 if (state.hasUncalibratedSourceLink()) {
83 auto sl = state.getUncalibratedSourceLink().template get<ActsTrk::ATLASUncalibSourceLink>();
84 assert( sl != nullptr );
86 if (measurement_to_summary_type.at(to_underlying(uncalibMeas.type())) < xAOD::numberOfTrackSummaryTypes ) {
87 if (static_cast<unsigned int>(to_underlying(uncalibMeas.type())) < siDetEleColl.size()) {
88 HitSummaryData::EHitSelection hit_selection = (flag.test(Acts::TrackStateFlag::OutlierFlag)
91 if (flag.test(Acts::TrackStateFlag::SharedHitFlag)) {
92 hit_selection = HitSummaryData::EHitSelection(hit_selection | HitSummaryData::SharedHit);
93 }
94 hit_info_out.addHit(siDetEleColl[to_underlying(uncalibMeas.type())],
95 uncalibMeas.identifierHash(),
96 hit_selection);
97 }
98 }
99 if (state.calibratedSize()>0 && !flag.test(Acts::TrackStateFlag::OutlierFlag)) {
100 // from Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx
101 // processTrackState
102 double chi2add = std::min(state.chi2(),1e5f) / state.calibratedSize();
103 chi2_stat_out.add(chi2add );
104 }
105 }
106
107 });
108 hit_info_out.computeSummaries();
109 }
110
111}
const GeoVDetectorElement * upstreamDetectorElement() const
Returns the underllying GeoModel detectorelement that this one is based on.
Helper class to gather hit summary information for e.g.
void reset()
reset all summary counters to zero.
bool addHit(const InDetDD::SiDetectorElementCollection *detector_elements, unsigned int id_hash, EHitSelection hit_selection)
update summaries to take the given hit into account.
void computeSummaries()
Compute the varius summaries.
Helper class to gather statistics and compute the biased variance.
Class to hold the SiDetectorElement objects to be put in the detector store.
Class to hold geometrical description of a silicon detector element.
DetectorIDHashType identifierHash() const
Returns the IdentifierHash of the measurement (corresponds to the detector element IdentifierHash)
virtual xAOD::UncalibMeasType type() const =0
Returns the type of the measurement type as a simple enumeration.
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130
Athena definition of the Eigen plugin.
void gatherTrackSummaryData(const ActsTrk::TrackContainer &tracksContainer, const typename ActsTrk::TrackContainer::ConstTrackProxy &track, const std::array< const InDetDD::SiDetectorElementCollection *, to_underlying(xAOD::UncalibMeasType::nTypes)> &siDetEleColl, const std::array< unsigned short, to_underlying(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, to_underlying(HitCategory::N)>, to_underlying(xAOD::UncalibMeasType::nTypes)> &special_hit_counts_out)
Helper to gather track summary information from the track states of the specified track.
constexpr std::underlying_type< T_EnumClass >::type to_underlying(T_EnumClass an_enum)
Helper to convert class enum into an integer.
const xAOD::UncalibratedMeasurement & getUncalibratedMeasurement(const ATLASUncalibSourceLink &source_link)
UncalibMeasType
Define the type of the uncalibrated measurement.
@ numberOfTrackSummaryTypes
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.