9 #include "Acts/Geometry/TrackingGeometry.hpp"
16 if (
parent() != toolSvc()) {
17 ATH_MSG_ERROR(
"The tool is initialized as a private tool but should be public");
18 return StatusCode::FAILURE;
20 ATH_CHECK(m_trackingGeometrySvc.retrieve());
22 m_detIdMap = createDetectorElementToGeoIdMap();
24 return StatusCode::FAILURE;
26 return StatusCode::SUCCESS;
30 return m_trackingGeometrySvc->trackingGeometry();
33 return m_detIdMap.get();
39 if (!
SG::get(geoCtx, m_rchk, ctx).isSuccess()) {
40 ATH_MSG_ERROR(
"Creating alignment context failed: read cond handle invalid!");
46 return m_trackingGeometrySvc->getNominalContext();
50 std::unique_ptr<ActsTrk::DetectorElementToActsGeometryIdMap>
53 auto detector_element_to_geoid = std::make_unique<DetectorElementToActsGeometryIdMap>();
56 unsigned n_detector_elements{0};
57 unsigned n_missing_detector_elements{0};
58 unsigned n_wrong_type{0};
61 trackingGeometry()->visitSurfaces([
this, &
counter, &detector_element_to_geoid](
const Acts::Surface *surface) {
62 if (!surface || !surface->associatedDetectorElement()) {
63 ++counter.n_wrong_type;
66 const auto* detEl =
dynamic_cast<const IDetectorElementBase*
>(surface->associatedDetectorElement());
68 ++
counter.n_missing_detector_elements;
72 const IdentifierHash&
hash) {
77 switch(detEl->detectorType()) {
107 counter.n_detector_elements = 0;
111 ATH_MSG_INFO(
"Surfaces without associated detector elements " <<
counter.n_missing_detector_elements
112 <<
" (with " <<
counter.n_detector_elements <<
")" );
113 if (
counter.n_detector_elements==0) {
114 ATH_MSG_ERROR(
"No surface with associated detector element" );
118 ATH_MSG_WARNING(
"Surfaces associated to detector elements not of type Trk::TrkDetElementBase :" <<
counter.n_wrong_type);
120 return detector_element_to_geoid;