Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-27 09:36:03

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/BoundarySurfaceFace.hpp"
0013 #include "Acts/Geometry/BoundarySurfaceT.hpp"
0014 #include "Acts/Geometry/GeometryContext.hpp"
0015 #include "Acts/Geometry/GeometryIdentifier.hpp"
0016 #include "Acts/Geometry/IVolumeLookup.hpp"
0017 #include "Acts/Geometry/Layer.hpp"
0018 #include "Acts/Geometry/Portal.hpp"
0019 #include "Acts/Geometry/TrackingGeometryVisitor.hpp"
0020 #include "Acts/Geometry/TrackingVolumeVisitorConcept.hpp"
0021 #include "Acts/Geometry/Volume.hpp"
0022 #include "Acts/Material/IVolumeMaterial.hpp"
0023 #include "Acts/Navigation/NavigationDelegate.hpp"
0024 #include "Acts/Navigation/NavigationStream.hpp"
0025 #include "Acts/Propagator/NavigationTarget.hpp"
0026 #include "Acts/Surfaces/Surface.hpp"
0027 #include "Acts/Surfaces/SurfaceVisitorConcept.hpp"
0028 #include "Acts/Utilities/BinnedArray.hpp"
0029 #include "Acts/Utilities/Logger.hpp"
0030 #include "Acts/Utilities/TransformRange.hpp"
0031 #include "Acts/Utilities/TypeTraits.hpp"
0032 #include "Acts/Visualization/ViewConfig.hpp"
0033 
0034 #include <cstddef>
0035 #include <iterator>
0036 #include <memory>
0037 #include <ranges>
0038 #include <span>
0039 #include <string>
0040 #include <type_traits>
0041 #include <utility>
0042 #include <vector>
0043 
0044 #include <boost/container/container_fwd.hpp>
0045 
0046 namespace Acts {
0047 
0048 class GlueVolumesDescriptor;
0049 class VolumeBounds;
0050 template <typename object_t>
0051 struct NavigationOptions;
0052 class IMaterialDecorator;
0053 class ISurfaceMaterial;
0054 class IVolumeMaterial;
0055 class Surface;
0056 class RegularSurface;
0057 class TrackingVolume;
0058 struct GeometryIdentifierHook;
0059 class Portal;
0060 class INavigationPolicy;
0061 /// Interface types of the Gen1 geometry model
0062 /// @note This interface is being replaced, and is subject to removal
0063 /// @{
0064 
0065 // master typedefs
0066 using TrackingVolumePtr = std::shared_ptr<const TrackingVolume>;
0067 using MutableTrackingVolumePtr = std::shared_ptr<TrackingVolume>;
0068 
0069 /// @typedef TrackingVolumeBoundaryPtr
0070 /// Shared pointer to a constant BoundarySurfaceT of a TrackingVolume.
0071 using TrackingVolumeBoundaryPtr =
0072     std::shared_ptr<const BoundarySurfaceT<TrackingVolume>>;
0073 /// Type alias for collection of tracking volume boundaries
0074 using TrackingVolumeBoundaries = std::vector<TrackingVolumeBoundaryPtr>;
0075 
0076 // possible contained
0077 using TrackingVolumeArray = BinnedArray<TrackingVolumePtr>;
0078 using TrackingVolumeVector = std::vector<TrackingVolumePtr>;
0079 using MutableTrackingVolumeVector = std::vector<MutableTrackingVolumePtr>;
0080 using LayerArray = BinnedArray<LayerPtr>;
0081 using LayerVector = std::vector<LayerPtr>;
0082 
0083 /// @}
0084 
0085 /// @class TrackingVolume
0086 ///
0087 /// Full Volume description used in Tracking,
0088 /// it inherits from Volume to get the geometrical structure.
0089 ///
0090 ///     A TrackingVolume at navigation level can provide the (layer) material
0091 /// information / internal navigation with in
0092 ///     5 different ways:
0093 ///
0094 ///         --- a) Static confinement of Layers
0095 ///         --- b) detached sub volumes
0096 ///         --- b) unordered (arbitrarily oriented) layers
0097 ///         --- d) unordered sub volumes
0098 ///         --- e) unordered layers AND unordered subvolumes
0099 ///
0100 ///    The TrackingVolume can also be a simple container of other
0101 ///    TrackingVolumes
0102 ///
0103 /// In addition it is capable of holding a subarray of Layers and
0104 /// TrackingVolumes.
0105 ///
0106 class TrackingVolume : public Volume {
0107   friend class TrackingGeometry;
0108 
0109  public:
0110   TrackingVolume() = delete;
0111   ~TrackingVolume() override;
0112   TrackingVolume(const TrackingVolume&) = delete;
0113   TrackingVolume& operator=(const TrackingVolume&) = delete;
0114 
0115   // The move constructors are declared here and defined in the .cpp file to
0116   // enable forward declarations.
0117 
0118   /// Move constructor for transferring ownership of tracking volume resources.
0119   TrackingVolume(TrackingVolume&&) noexcept;
0120   /// Move assignment operator for transferring ownership of tracking volume
0121   /// resources.
0122   /// @return Reference to this TrackingVolume after move assignment
0123   TrackingVolume& operator=(TrackingVolume&&) noexcept;
0124 
0125   /// Constructor for an aligned container volume container Volume
0126   /// - vacuum filled volume either as a for other tracking volumes
0127   ///
0128   /// @param placement is the volume placement object dynamically positioning
0129   ///                  the volume in space
0130   /// @param volbounds is the description of the volume boundaries
0131   /// @param volumeName is a string identifier
0132   TrackingVolume(VolumePlacementBase& placement,
0133                  std::shared_ptr<VolumeBounds> volbounds,
0134                  const std::string& volumeName = "undefined");
0135 
0136   /// Constructor for a container Volume
0137   /// - vacuum filled volume either as a for other tracking volumes
0138   ///
0139   /// @param transform is the global 3D transform to position the volume in
0140   /// space
0141   /// @param volbounds is the description of the volume boundaries
0142   /// @param volumeName is a string identifier
0143   TrackingVolume(const Transform3& transform,
0144                  std::shared_ptr<VolumeBounds> volbounds,
0145                  const std::string& volumeName = "undefined");
0146 
0147   /// Constructor for a full equipped Tracking Volume
0148   ///
0149   /// @param transform is the global 3D transform to position the volume in
0150   /// space
0151   /// @param volumeBounds is the description of the volume boundaries
0152   /// @param volumeMaterial is are materials of the tracking volume
0153   /// @param staticLayerArray is the confined layer array (optional)
0154   /// @param containedVolumeArray are the sub volumes if the volume is a
0155   /// container
0156   /// @param denseVolumeVector  The contained dense volumes
0157   /// @param volumeName is a string identifier
0158   TrackingVolume(
0159       const Transform3& transform, std::shared_ptr<VolumeBounds> volumeBounds,
0160       std::shared_ptr<const IVolumeMaterial> volumeMaterial,
0161       std::unique_ptr<const LayerArray> staticLayerArray = nullptr,
0162       std::shared_ptr<const TrackingVolumeArray> containedVolumeArray = nullptr,
0163       MutableTrackingVolumeVector denseVolumeVector = {},
0164       const std::string& volumeName = "undefined");
0165 
0166   /// Constructor from a regular volume
0167   /// @param volume is the volume to be converted
0168   /// @param volumeName is a string identifier
0169   explicit TrackingVolume(const Volume& volume,
0170                           const std::string& volumeName = "undefined");
0171 
0172   /// Return the associated sub Volume, returns THIS if no subVolume exists
0173   /// @param gctx The current geometry context object, e.g. alignment
0174   /// @param position is the global position associated with that search
0175   /// @param tol Search position tolerance for dense volumes
0176   ///
0177   /// @return plain pointer to associated with the position
0178   const TrackingVolume* lowestTrackingVolume(const GeometryContext& gctx,
0179                                              const Vector3& position,
0180                                              const double tol = 0.) const;
0181 
0182   /// Install a subtree lookup; nullptr restores the implicit linear scan.
0183   /// Explicit policies stop enclosing indices, including explicit linear ones.
0184   /// Install local policies before enclosing indices and concurrent queries.
0185   /// Rebuild after changes to bounds, transforms, hierarchy, local policies,
0186   /// or the volume's address. Construct the policy for this volume.
0187   /// @param lookup Policy owned by this volume, or nullptr for the default scan
0188   void setVolumeLookup(std::unique_ptr<const IVolumeLookup> lookup);
0189 
0190   /// Return the explicitly installed lookup, or nullptr for the default scan.
0191   /// @return Optional installed policy
0192   const IVolumeLookup* volumeLookup() const;
0193 
0194   /// @brief Visit all reachable surfaces
0195   ///
0196   /// @tparam visitor_t Type of the callable visitor
0197   ///
0198   /// @param visitor The callable. Will be called for each reachable surface
0199   /// that is found, a selection of the surfaces can be done in the visitor
0200   /// @param restrictToSensitives If true, only sensitive surfaces are visited
0201   ///
0202   /// @note If a context is needed for the visit, the vistitor has to provide
0203   /// this, e.g. as a private member
0204   template <SurfaceVisitor visitor_t>
0205   void visitSurfaces(visitor_t&& visitor, bool restrictToSensitives) const {
0206     if (restrictToSensitives) {
0207       apply([&visitor](const Surface& surface) {
0208         if (surface.geometryId().sensitive() == 0) {
0209           return;
0210         }
0211         visitor(&surface);
0212       });
0213 
0214     } else {
0215       apply(overloaded{
0216           [&visitor](const Surface& surface) { visitor(&surface); },
0217           [&visitor](const Portal& portal) { visitor(&portal.surface()); },
0218           [&visitor](const BoundarySurface& bs) {
0219             visitor(&bs.surfaceRepresentation());
0220           }});
0221     }
0222   }
0223 
0224   /// @brief Visit all sensitive surfaces
0225   ///
0226   /// @tparam visitor_t Type of the callable visitor
0227   ///
0228   /// @param visitor The callable. Will be called for each sensitive surface
0229   /// that is found, a selection of the surfaces can be done in the visitor
0230   ///
0231   /// @note If a context is needed for the visit, the vistitor has to provide
0232   /// this, e.g. as a private member
0233   template <SurfaceVisitor visitor_t>
0234   void visitSurfaces(visitor_t&& visitor) const {
0235     visitSurfaces(std::forward<visitor_t>(visitor), true);
0236   }
0237 
0238   /// @brief Visit all reachable tracking volumes
0239   ///
0240   /// @tparam visitor_t Type of the callable visitor
0241   ///
0242   /// @param visitor The callable. Will be called for each reachable volume
0243   /// that is found, a selection of the volumes can be done in the visitor
0244   ///
0245   /// @note If a context is needed for the visit, the vistitor has to provide
0246   /// this, e.g. as a private member
0247   template <TrackingVolumeVisitor visitor_t>
0248   void visitVolumes(visitor_t&& visitor) const {
0249     apply([&visitor](const TrackingVolume& volume) { visitor(&volume); });
0250   }
0251 
0252   /// @brief Apply a visitor to the tracking volume
0253   ///
0254   /// @param visitor The visitor to apply
0255   ///
0256   void apply(TrackingGeometryVisitor& visitor) const;
0257 
0258   /// @brief Apply a mutable visitor to the tracking volume
0259   ///
0260   /// @param visitor The visitor to apply
0261   ///
0262   void apply(TrackingGeometryMutableVisitor& visitor);
0263 
0264   /// @brief Apply an arbitrary callable as a visitor to the tracking volume
0265   ///
0266   /// @param callable The callable to apply
0267   ///
0268   /// @note The visitor can be overloaded on any of the arguments that
0269   ///       the methods in @c TrackingGeometryVisitor receive.
0270   template <typename Callable>
0271   void apply(Callable&& callable)
0272     requires(detail::callableWithAnyMutable<Callable>() &&
0273              !detail::callableWithAnyConst<Callable>())
0274   {
0275     detail::TrackingGeometryLambdaMutableVisitor visitor{
0276         std::forward<Callable>(callable)};
0277     apply(visitor);
0278   }
0279 
0280   /// @brief Apply an arbitrary callable as a visitor to the tracking volume
0281   ///
0282   /// @param callable The callable to apply
0283   ///
0284   /// @note The visitor can be overloaded on any of the arguments that
0285   ///       the methods in @c TrackingGeometryMutableVisitor receive.
0286   template <typename Callable>
0287   void apply(Callable&& callable) const
0288     requires(detail::callableWithAnyConst<Callable>())
0289   {
0290     detail::TrackingGeometryLambdaVisitor visitor{
0291         std::forward<Callable>(callable)};
0292     apply(visitor);
0293   }
0294 
0295   /// Returns the VolumeName - for debug reason, might be depreciated later
0296   /// @return Reference to the volume name string
0297   const std::string& volumeName() const;
0298 
0299   /// Set the volume name to @p volumeName
0300   /// @param volumeName is the new name of
0301   void setVolumeName(std::string_view volumeName);
0302 
0303   /// Check if the volume has an associated material description
0304   /// @return True if the volume has an associated material, false otherwise
0305   bool hasMaterial() const;
0306 
0307   /// Return the material of the volume
0308   /// @return Pointer to volume material or nullptr if no material assigned
0309   const IVolumeMaterial* volumeMaterial() const;
0310 
0311   /// Return the material of the volume as shared pointer
0312   /// @return Shared pointer to volume material
0313   const std::shared_ptr<const IVolumeMaterial>& volumeMaterialPtr() const;
0314 
0315   /// Set the volume material description
0316   ///
0317   /// The material is usually derived in a complicated way and loaded from
0318   /// a framework given source. As various volumes could potentially share the
0319   /// the same material description, it is provided as a shared object
0320   ///
0321   /// @param material Material description of this volume
0322   void assignVolumeMaterial(std::shared_ptr<const IVolumeMaterial> material);
0323 
0324   /// Return the MotherVolume - if it exists
0325   /// @return Pointer to mother volume or nullptr if this is the root volume
0326   const TrackingVolume* motherVolume() const;
0327 
0328   /// Return the MotherVolume - if it exists
0329   /// @return Mutable pointer to mother volume or nullptr if this is the root volume
0330   TrackingVolume* motherVolume();
0331 
0332   /// Set the MotherVolume
0333   ///
0334   /// @param mvol is the mother volume
0335   void setMotherVolume(TrackingVolume* mvol);
0336 
0337   /// Type alias for mutable range of tracking volumes in container
0338   using MutableVolumeRange =
0339       detail::TransformRange<detail::Dereference,
0340                              std::vector<std::unique_ptr<TrackingVolume>>>;
0341   /// Type alias for const range of tracking volumes in container
0342   using VolumeRange = detail::TransformRange<
0343       detail::ConstDereference,
0344       const std::vector<std::unique_ptr<TrackingVolume>>>;
0345 
0346   /// Return all volumes registered under this tracking volume
0347   /// @return the range of volumes
0348   VolumeRange volumes() const;
0349 
0350   /// Return mutable view of the registered volumes under this tracking volume
0351   /// @return the range of volumes
0352   MutableVolumeRange volumes();
0353 
0354   /// Type alias for mutable range of portals in tracking volume
0355   using MutablePortalRange =
0356       detail::TransformRange<detail::Dereference,
0357                              std::vector<std::shared_ptr<Portal>>>;
0358 
0359   /// Type alias for const range of portals in tracking volume
0360   using PortalRange =
0361       detail::TransformRange<detail::ConstDereference,
0362                              const std::vector<std::shared_ptr<Portal>>>;
0363   /// Abrivation of the shared ptr variant holding the placements
0364   using PlacementOwnPtr =
0365       std::variant<std::shared_ptr<const VolumePlacementBase>,
0366                    std::shared_ptr<const SurfacePlacementBase>>;
0367   /// Return all portals registered under this tracking volume
0368   /// @return the range of portals
0369   PortalRange portals() const;
0370 
0371   /// Return mutable view of the registered portals under this tracking volume
0372   /// @return the range of portals
0373   MutablePortalRange portals();
0374 
0375   /// Add a portal to this tracking volume
0376   /// @note This clears the portal faces found when the tracking geometry was
0377   ///       built (see @ref portalFace), so portal candidates of this volume
0378   ///       are intersected against the full portal surfaces afterwards.
0379   /// @param portal The portal to add
0380   void addPortal(std::shared_ptr<Portal> portal);
0381 
0382   /// Return the face of this volume that a portal lies on, if the portal
0383   /// surface is larger than that face, e.g. after merging
0384   /// @param portal The portal of this volume
0385   /// @return the volume-sized face, or nullptr if the portal surface is the face
0386   const Surface* portalFace(const Portal& portal) const;
0387 
0388   /// Type alias for mutable range of surfaces in tracking volume
0389   using MutableSurfaceRange =
0390       detail::TransformRange<detail::Dereference,
0391                              std::vector<std::shared_ptr<Surface>>>;
0392   /// Type alias for const range of surfaces in tracking volume
0393   using SurfaceRange =
0394       detail::TransformRange<detail::ConstDereference,
0395                              const std::vector<std::shared_ptr<Surface>>>;
0396 
0397   /// Return all surfaces registered under this tracking volume
0398   /// @return the range of surfaces
0399   SurfaceRange surfaces() const;
0400 
0401   /// Return mutable view of the registered surfaces under this tracking volume
0402   /// @return the range of surfaces
0403   MutableSurfaceRange surfaces();
0404 
0405   /// Add a surface to this tracking volume
0406   /// @param surface The surface to add
0407   /// @note The volume takes shared ownership of the placement
0408   void addSurface(std::shared_ptr<Surface> surface);
0409 
0410   /// Add a child volume to this tracking volume
0411   /// @param volume The volume to add
0412   /// @note The @p volume will have its mother volume assigned to @p this.
0413   ///       It will throw if @p volume already has a mother volume set
0414   /// @return Reference to the added volume
0415   TrackingVolume& addVolume(std::unique_ptr<TrackingVolume> volume);
0416 
0417   /// Interface of @c TrackingVolume in the Gen1 geometry model
0418   /// @note This interface is being replaced, and is subject to removal
0419   ///
0420   /// @{
0421 
0422   /// Return the associated Layer to the global position
0423   ///
0424   /// @param gctx The current geometry context object, e.g. alignment
0425   /// @param position is the associated global position
0426   ///
0427   /// @return plain pointer to layer object
0428   const Layer* associatedLayer(const GeometryContext& gctx,
0429                                const Vector3& position) const;
0430 
0431   /// @brief Resolves the volume into (compatible) Layers
0432   ///
0433   /// This is the method for the propagator/extrapolator
0434   /// @tparam options_t Type of navigation options object for decomposition
0435   ///
0436   /// @param gctx The current geometry context object, e.g. alignment
0437   /// @param position Position for the search
0438   /// @param direction Direction for the search
0439   /// @param options The templated navigation options
0440   ///
0441   /// @return vector of compatible intersections with layers
0442   boost::container::small_vector<NavigationTarget, 10> compatibleLayers(
0443       const GeometryContext& gctx, const Vector3& position,
0444       const Vector3& direction, const NavigationOptions<Layer>& options) const;
0445 
0446   /// @brief Returns all boundary surfaces sorted by the user.
0447   ///
0448   /// @tparam options_t Type of navigation options object for decomposition
0449   /// @tparam sorter_t Type of the boundary surface sorter
0450   ///
0451   /// @param gctx The current geometry context object, e.g. alignment
0452   /// @param position The position for searching
0453   /// @param direction The direction for searching
0454   /// @param options The templated navigation options
0455   /// @param logger A @c Logger instance
0456   ///
0457   /// @return is the templated boundary intersection
0458   boost::container::small_vector<NavigationTarget, 4> compatibleBoundaries(
0459       const GeometryContext& gctx, const Vector3& position,
0460       const Vector3& direction, const NavigationOptions<Surface>& options,
0461       const Logger& logger = getDummyLogger()) const;
0462 
0463   /// Return the confined static layer array - if it exists
0464   /// @return the BinnedArray of static layers if exists
0465   const LayerArray* confinedLayers() const;
0466 
0467   /// Return the confined volumes of this container array - if it exists
0468   /// @return Shared pointer to array of contained tracking volumes or nullptr
0469   std::shared_ptr<const TrackingVolumeArray> confinedVolumes() const;
0470 
0471   /// Return the confined dense volumes
0472   /// @return Vector of pointers to dense tracking volumes
0473   MutableTrackingVolumeVector denseVolumes() const;
0474 
0475   /// Method to return the BoundarySurfaces
0476   /// @return Reference to vector of boundary surface pointers
0477   const TrackingVolumeBoundaries& boundarySurfaces() const;
0478 
0479   /// Set the boundary surface material description
0480   ///
0481   /// The material is usually derived in a complicated way and loaded from
0482   /// a framework given source. As various volumes could potentially share the
0483   /// the same material description, it is provided as a shared object
0484   ///
0485   /// @param surfaceMaterial Material description of this volume
0486   /// @param bsFace Specifies which boundary surface to assign the material to
0487   void assignBoundaryMaterial(
0488       std::shared_ptr<const ISurfaceMaterial> surfaceMaterial,
0489       BoundarySurfaceFace bsFace);
0490 
0491   /// Glue another tracking volume to this one
0492   ///  - if common face is set the glued volumes are sharing the boundary, down
0493   /// to the last navigation volume
0494   ///
0495   /// @param gctx The current geometry context object, e.g. alignment
0496   /// @param bsfMine is the boundary face indicator where to glue
0497   /// @param neighbor is the TrackingVolume to be glued
0498   /// @param bsfNeighbor is the boundary surface of the neighbor
0499   void glueTrackingVolume(const GeometryContext& gctx,
0500                           BoundarySurfaceFace bsfMine, TrackingVolume* neighbor,
0501                           BoundarySurfaceFace bsfNeighbor);
0502 
0503   /// Glue another tracking volume to this one
0504   ///  - if common face is set the glued volumes are sharing the boundary, down
0505   /// to the last navigation volume
0506   ///
0507   /// @param gctx The current geometry context object, e.g. alignment
0508   /// @param bsfMine is the boundary face indicator where to glue
0509   /// @param neighbors are the TrackingVolumes to be glued
0510   /// @param bsfNeighbor are the boundary surface of the neighbors
0511   void glueTrackingVolumes(
0512       const GeometryContext& gctx, BoundarySurfaceFace bsfMine,
0513       const std::shared_ptr<TrackingVolumeArray>& neighbors,
0514       BoundarySurfaceFace bsfNeighbor);
0515 
0516   /// Provide a new BoundarySurface from the glueing
0517   ///
0518   /// @param bsf is the boundary face indicator where to glue
0519   /// @param bs is the new boundary surface
0520   /// @param checkmaterial is a flag how to deal with material, if true:
0521   /// - if the old boundary surface had a material description
0522   ///   but the new one has not, keep the current one
0523   /// - in all other cases just assign the new boundary surface
0524   void updateBoundarySurface(
0525       BoundarySurfaceFace bsf,
0526       std::shared_ptr<const BoundarySurfaceT<TrackingVolume>> bs,
0527       bool checkmaterial = true);
0528 
0529   /// Register the outside glue volumes -
0530   /// ordering is in the TrackingVolume Frame:
0531   ///  - negativeFaceXY
0532   ///  - (faces YZ, ZY, radial faces)
0533   ///  - positiveFaceXY
0534   ///
0535   /// @param gvd register a new GlueVolumeDescriptor
0536   void registerGlueVolumeDescriptor(std::unique_ptr<GlueVolumesDescriptor> gvd);
0537 
0538   /// Clear boundary surfaces for this tracking volume
0539   void clearBoundarySurfaces();
0540 
0541   /// Register the outside glue volumes -
0542   /// ordering is in the TrackingVolume Frame:
0543   ///  - negativeFaceXY
0544   ///  - (faces YZ, ZY, radial faces)
0545   ///  - positiveFaceXY
0546   /// @return Reference to the glue volumes descriptor
0547   GlueVolumesDescriptor& glueVolumesDescriptor();
0548 
0549   /// @param helper The visualization helper that implement the output
0550   /// @param gctx The geometry context
0551   /// @param viewConfig The view configuration
0552   /// @param portalViewConfig View configuration for portals
0553   /// @param sensitiveViewConfig View configuration for sensitive surfaces
0554   /// @deprecated Use the ViewConfigFunc overload instead
0555   [[deprecated("Use the ViewConfigFunc overload instead")]]
0556   void visualize(IVisualization3D& helper, const GeometryContext& gctx,
0557                  const ViewConfig& viewConfig,
0558                  const ViewConfig& portalViewConfig,
0559                  const ViewConfig& sensitiveViewConfig) const;
0560 
0561   /// Produces a 3D visualization of this tracking volume
0562   /// @param helper The visualization helper describing the output format
0563   /// @param gctx The geometry context
0564   /// @param viewConfigFactory Function determining the ViewConfig for each GeometryObject
0565   void visualize(
0566       IVisualization3D& helper, const GeometryContext& gctx,
0567       const ViewConfigFunc& viewConfigFactory = defaultGeometryColoring) const;
0568 
0569   /// @cond
0570   using Volume::visualize;
0571   /// @endcond
0572 
0573   /// Access the navigation policy if any that is registered on this volume
0574   /// @return a pointer to the navigation policy, or nullptr if none is set
0575   const INavigationPolicy* navigationPolicy() const;
0576 
0577   /// Access the navigation policy if any that is registered on this volume
0578   /// @return a pointer to the navigation policy, or nullptr if none is set
0579   INavigationPolicy* navigationPolicy();
0580 
0581   /// Register a navigation policy with this volume. The argument can not be
0582   /// nullptr.
0583   /// @param policy is the navigation policy to be registered
0584   void setNavigationPolicy(std::unique_ptr<INavigationPolicy> policy);
0585 
0586   /// Populate the navigation stream with navigation candidates from this
0587   /// volume. Internally, this consults the registered navigation policy, where
0588   /// the default is a noop.
0589   /// @param gctx The current geometry context object, e.g. alignment
0590   /// @param args are the navigation arguments
0591   /// @param state is the navigation policy state
0592   /// @param stream is the navigation stream to be updated
0593   /// @param logger is the logger
0594   void initializeNavigationCandidates(const GeometryContext& gctx,
0595                                       const NavigationArguments& args,
0596                                       NavigationPolicyState& state,
0597                                       AppendOnlyNavigationStream& stream,
0598                                       const Logger& logger) const;
0599 
0600   /// Pass over a (Volume / Surface) placement to share owner ship
0601   /// with the volume
0602   /// @param placement: Pointer to the placement to be managed by the
0603   ///                   tracking volume
0604   void retainPlacement(PlacementOwnPtr placement) {
0605     m_placements.emplace_back(std::move(placement));
0606   }
0607 
0608   /// Returns the view on all the placements owned by the tracking volume
0609   /// @returns The const view on all the placements owned by this volume
0610   std::span<const PlacementOwnPtr> placements() const;
0611 
0612  private:
0613   /// Find the faces of this volume that its portals are larger than. Portals
0614   /// with an alignable surface are skipped.
0615   /// @param gctx The geometry context
0616   /// @throws std::logic_error if the volume is alignable
0617   void findPortalFaces(const GeometryContext& gctx);
0618 
0619   void connectDenseBoundarySurfaces(
0620       MutableTrackingVolumeVector& confinedDenseVolumes);
0621 
0622   /// interlink the layers in this TrackingVolume
0623   void interlinkLayers();
0624 
0625   /// Create Boundary Surface
0626   void createBoundarySurfaces();
0627 
0628   /// method to synchronize the layers with potentially updated volume bounds:
0629   /// - adapts the layer dimensions to the new volumebounds + envelope
0630   ///
0631   /// @param envelope is the clearance between volume boundary and layer
0632   void synchronizeLayers(double envelope = 1.) const;
0633 
0634   // the boundary surfaces
0635   std::vector<TrackingVolumeBoundaryPtr> m_boundarySurfaces;
0636 
0637   ///(a) static configuration ordered by Binned arrays
0638   /// static layers
0639   std::unique_ptr<const LayerArray> m_confinedLayers = nullptr;
0640 
0641   /// Array of Volumes inside the Volume when acting as container
0642   std::shared_ptr<const TrackingVolumeArray> m_confinedVolumes = nullptr;
0643 
0644   /// confined dense
0645   MutableTrackingVolumeVector m_confinedDenseVolumes;
0646 
0647   /// Volumes to glue Volumes from the outside
0648   std::unique_ptr<GlueVolumesDescriptor> m_glueVolumeDescriptor{nullptr};
0649 
0650   /// @}
0651 
0652   /// The volume based material the TrackingVolume consists of
0653   std::shared_ptr<const IVolumeMaterial> m_volumeMaterial{nullptr};
0654 
0655   /// Remember the mother volume
0656   TrackingVolume* m_motherVolume{nullptr};
0657 
0658   /// Volume name for debug reasons & screen output
0659   std::string m_name;
0660 
0661   std::vector<std::unique_ptr<TrackingVolume>> m_volumes;
0662   std::vector<std::shared_ptr<Portal>> m_portals;
0663   /// Volume-sized face for each portal in @c m_portals that is larger than it
0664   std::vector<std::shared_ptr<const RegularSurface>> m_portalFaces;
0665   std::vector<std::shared_ptr<Surface>> m_surfaces;
0666   std::vector<PlacementOwnPtr> m_placements;
0667 
0668   std::unique_ptr<INavigationPolicy> m_navigationPolicy;
0669 
0670   // Destroy the lookup before the children it references.
0671   std::unique_ptr<const IVolumeLookup> m_volumeLookup;
0672 
0673   NavigationDelegate m_navigationDelegate{};
0674 };
0675 
0676 }  // namespace Acts