File indexing completed on 2025-01-18 09:27:41
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Detector/GeometryIdMapper.hpp"
0012 #include "Acts/Plugins/DD4hep/DD4hepDetectorElement.hpp"
0013 #include "Acts/Surfaces/Surface.hpp"
0014
0015 #include <climits>
0016
0017 namespace Acts {
0018
0019 using DD4hepIdentifier = DD4hepDetectorElement::DD4hepVolumeID;
0020
0021
0022
0023
0024
0025 struct DD4hepIdentifierCapture {
0026
0027
0028 DD4hepIdentifier operator()(
0029 const Acts::Experimental::DetectorVolume& ) const {
0030 return std::numeric_limits<DD4hepIdentifier>::max();
0031 }
0032
0033
0034
0035 DD4hepIdentifier operator()(
0036 const Acts::Experimental::Portal& ) const {
0037 return std::numeric_limits<DD4hepIdentifier>::max();
0038 }
0039
0040
0041
0042
0043 DD4hepIdentifier operator()(const Acts::Surface& surface) const {
0044
0045 const auto* dde = surface.associatedDetectorElement();
0046 const auto* dd4hepDetElement =
0047 dynamic_cast<const Acts::DD4hepDetectorElement*>(dde);
0048
0049 if (dd4hepDetElement) {
0050 return dd4hepDetElement->sourceElement().volumeID();
0051 }
0052 return std::numeric_limits<DD4hepIdentifier>::max();
0053 }
0054 };
0055
0056 using DD4hepIdentifierMapper =
0057 Experimental::GeometryIdMapper<DD4hepIdentifier, DD4hepIdentifierCapture>;
0058
0059 }