30 if (volumeIdTodetectorElementCollMap.
isValid()) {
31 return StatusCode::SUCCESS;
37 ATH_CHECK( acts_tracking_geometry !=
nullptr);
39 std::unique_ptr<ActsTrk::ActsVolumeIdToDetectorElementCollectionMap>
40 volume_id_to_detector_element_collection_map = std::make_unique<ActsTrk::ActsVolumeIdToDetectorElementCollectionMap>();
43 std::unordered_map<unsigned long long, unsigned int> detector_element_to_volume_id;
45 detector_element_to_volume_id);
52 unsigned int vol_id = detector_element_to_volume_id.at(det_ele->identify().get_compact());
53 volume_id_to_detector_element_collection_map->registerCollection(vol_id, det_ele_col.
cptr());
58 for (
unsigned char col_i : volume_id_to_detector_element_collection_map->collecionMap()) {
60 ATH_MSG_DEBUG(
"Mapping " << vol_i <<
" -> " <<
static_cast<unsigned int>(col_i)
61 <<
" : " <<
static_cast<const void *
>(volume_id_to_detector_element_collection_map->collection(vol_i)));
67 ATH_CHECK( volumeIdTodetectorElementCollMap.
record( std::move(volume_id_to_detector_element_collection_map) ) );
69 return StatusCode::SUCCESS;
74 std::unordered_map<
unsigned long long,
75 unsigned int> &detector_element_to_volume_id)
78 struct Counter {
unsigned int n_detector_elements{0};
79 unsigned int n_missing_detector_elements{0};
80 unsigned int n_wrong_type{0}; };
81 Counter counter {0u,0u,0u};
82 acts_tracking_geometry.visitSurfaces([&counter, &detector_element_to_volume_id](
const Acts::Surface *surface_ptr) {
84 if (acts_detector_element) {
85 const auto*trk_detector_element =
dynamic_cast<const Trk::TrkDetElementBase*
>(acts_detector_element->upstreamDetectorElement());
86 if(trk_detector_element !=
nullptr) {
87 detector_element_to_volume_id.insert( std::make_pair( trk_detector_element->identify().get_compact(), surface_ptr->geometryId().volume()));
89 ++counter.n_wrong_type;
91 ++counter.n_detector_elements;
93 ++counter.n_missing_detector_elements;
97 ATH_MSG_DEBUG(
"Surfaces without associated detector elements " << counter.n_missing_detector_elements
98 <<
" (with " << counter.n_detector_elements <<
")" );
99 if (counter.n_detector_elements==0) {
100 ATH_MSG_ERROR(
"No surface with associated detector element" );
102 if (counter.n_wrong_type>0) {
103 ATH_MSG_WARNING(
"Surfaces associated to detector elements not of type Trk::TrkDetElementBase :" << counter.n_wrong_type);