File indexing completed on 2025-01-18 09:11:24
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Geometry/TrackingGeometry.hpp"
0010
0011 #include "Acts/Definitions/Tolerance.hpp"
0012 #include "Acts/Geometry/GeometryIdentifier.hpp"
0013 #include "Acts/Geometry/TrackingVolume.hpp"
0014 #include "Acts/Surfaces/Surface.hpp"
0015
0016 #include <cstddef>
0017
0018 Acts::TrackingGeometry::TrackingGeometry(
0019 const MutableTrackingVolumePtr& highestVolume,
0020 const IMaterialDecorator* materialDecorator,
0021 const GeometryIdentifierHook& hook, const Logger& logger)
0022 : m_world(highestVolume) {
0023
0024 std::size_t volumeID = 0;
0025 highestVolume->closeGeometry(materialDecorator, m_volumesById, volumeID, hook,
0026 logger);
0027 m_volumesById.rehash(0);
0028
0029 m_world->visitSurfaces([this](const Acts::Surface* srf) {
0030 if (srf != nullptr) {
0031 m_surfacesById[srf->geometryId()] = srf;
0032 }
0033 });
0034 m_surfacesById.rehash(0);
0035 }
0036
0037 Acts::TrackingGeometry::~TrackingGeometry() = default;
0038
0039 const Acts::TrackingVolume* Acts::TrackingGeometry::lowestTrackingVolume(
0040 const GeometryContext& gctx, const Acts::Vector3& gp) const {
0041 return m_world->lowestTrackingVolume(gctx, gp, s_onSurfaceTolerance);
0042 }
0043
0044 const Acts::TrackingVolume* Acts::TrackingGeometry::highestTrackingVolume()
0045 const {
0046 return m_world.get();
0047 }
0048
0049 std::shared_ptr<const Acts::TrackingVolume>
0050 Acts::TrackingGeometry::highestTrackingVolumePtr() const {
0051 return m_world;
0052 }
0053
0054 const Acts::Layer* Acts::TrackingGeometry::associatedLayer(
0055 const GeometryContext& gctx, const Acts::Vector3& gp) const {
0056 const TrackingVolume* lowestVol = lowestTrackingVolume(gctx, gp);
0057 if (lowestVol == nullptr) {
0058 return nullptr;
0059 }
0060 return lowestVol->associatedLayer(gctx, gp);
0061 }
0062
0063 const Acts::TrackingVolume* Acts::TrackingGeometry::findVolume(
0064 GeometryIdentifier id) const {
0065 auto vol = m_volumesById.find(id);
0066 if (vol == m_volumesById.end()) {
0067 return nullptr;
0068 }
0069 return vol->second;
0070 }
0071
0072 const Acts::Surface* Acts::TrackingGeometry::findSurface(
0073 GeometryIdentifier id) const {
0074 auto srf = m_surfacesById.find(id);
0075 if (srf == m_surfacesById.end()) {
0076 return nullptr;
0077 }
0078 return srf->second;
0079 }
0080
0081 const std::unordered_map<Acts::GeometryIdentifier, const Acts::Surface*>&
0082 Acts::TrackingGeometry::geoIdSurfaceMap() const {
0083 return m_surfacesById;
0084 }
0085
0086 void Acts::TrackingGeometry::visualize(
0087 IVisualization3D& helper, const GeometryContext& gctx,
0088 const ViewConfig& viewConfig, const ViewConfig& portalViewConfig,
0089 const ViewConfig& sensitiveViewConfig) const {
0090 highestTrackingVolume()->visualize(helper, gctx, viewConfig, portalViewConfig,
0091 sensitiveViewConfig);
0092 }