17 #include "Acts/Geometry/TrackingGeometry.hpp"
28 return StatusCode::SUCCESS;
34 if (detectorElementToGeometryIdMap.isValid()) {
35 return StatusCode::SUCCESS;
40 ATH_CHECK( acts_tracking_geometry !=
nullptr);
42 std::unique_ptr<DetectorElementToActsGeometryIdMap>
43 detector_element_to_geoid = std::make_unique<DetectorElementToActsGeometryIdMap>();
45 *detector_element_to_geoid);
46 ATH_CHECK( detectorElementToGeometryIdMap.record( std::move(detector_element_to_geoid) ) );
48 return StatusCode::SUCCESS;
52 template <
typename T_EnumClass>
53 constexpr std::size_t maxType();
58 template <
typename T_EnumClass>
59 constexpr
unsigned char toChar(T_EnumClass
value) {
60 assert(
sizeof(T_EnumClass) <=
sizeof(std::size_t));
66 constexpr std::array<unsigned char, maxType<ActsTrk::DetectorType>()> makeMeasurementTypeMap() {
67 std::array<unsigned char, maxType<ActsTrk::DetectorType>()> measurement_type_map;
78 return measurement_type_map;
87 static constexpr std::array<unsigned char, maxType<ActsTrk::DetectorType>()> detector_to_measurement_type = makeMeasurementTypeMap();
89 using Counter =
struct {
unsigned int n_detector_elements, n_missing_detector_elements, n_wrong_type; };
91 acts_tracking_geometry.visitSurfaces([&
counter, &detector_element_to_geoid](
const Acts::Surface *surface_ptr) {
92 if (!surface_ptr)
return;
93 const Acts::Surface &surface = *surface_ptr;
94 const Acts::DetectorElementBase*detector_element = surface.associatedDetectorElement();
95 if (detector_element) {
97 if (acts_detector_element) {
101 if(trk_detector_element !=
nullptr) {
102 detector_element_to_geoid.insert( std::make_pair(
makeDetectorElementKey(meas_type, trk_detector_element->identifyHash()),
115 ++
counter.n_missing_detector_elements;
119 ATH_MSG_INFO(
"Surfaces without associated detector elements " <<
counter.n_missing_detector_elements
120 <<
" (with " <<
counter.n_detector_elements <<
")" );
121 if (
counter.n_detector_elements==0) {
122 ATH_MSG_ERROR(
"No surface with associated detector element" );
125 ATH_MSG_WARNING(
"Surfaces associated to detector elements not of type Trk::TrkDetElementBase :" <<
counter.n_wrong_type);