Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-23 08:19:42

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