![]() |
|
|||
File indexing completed on 2025-10-15 08:03: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/Direction.hpp" 0012 #include "Acts/Geometry/GeometryContext.hpp" 0013 #include "Acts/Geometry/GeometryIdentifier.hpp" 0014 #include "Acts/Navigation/NavigationDelegates.hpp" 0015 #include "Acts/Surfaces/RegularSurface.hpp" 0016 #include "Acts/Surfaces/SurfaceVisitorConcept.hpp" 0017 0018 #include <array> 0019 #include <memory> 0020 #include <vector> 0021 0022 namespace Acts { 0023 0024 class ISurfaceMaterial; 0025 class Surface; 0026 0027 namespace Experimental { 0028 0029 class DetectorVolume; 0030 struct NavigationState; 0031 0032 /// A portal description between the detector volumes 0033 /// 0034 /// It has a Surface representation for navigation and propagation 0035 /// and guides from one volume to the next. 0036 /// 0037 /// The surface can carry material to allow mapping onto 0038 /// portal positions if required. 0039 /// 0040 class Portal { 0041 public: 0042 /// Constructor from surface w/o portal links 0043 /// 0044 /// @param surface is the representing surface 0045 explicit Portal(std::shared_ptr<RegularSurface> surface); 0046 0047 /// The vector of attached volumes forward/backward, this is useful in the 0048 /// geometry building 0049 using AttachedDetectorVolumes = 0050 std::array<std::vector<std::shared_ptr<DetectorVolume>>, 2u>; 0051 0052 /// Declare the DetectorVolume friend for portal setting 0053 friend class DetectorVolume; 0054 0055 Portal() = delete; 0056 0057 /// Const access to the surface representation 0058 /// @return Const reference to the surface 0059 const RegularSurface& surface() const; 0060 0061 /// Non-const access to the surface reference 0062 /// @return Mutable reference to the surface 0063 RegularSurface& surface(); 0064 0065 /// @brief Visit all reachable surfaces of the detector 0066 /// 0067 /// @tparam visitor_t Type of the callable visitor 0068 /// 0069 /// @param visitor will be called with the represented surface 0070 template <SurfaceVisitor visitor_t> 0071 void visitSurface(visitor_t&& visitor) const { 0072 visitor(m_surface.get()); 0073 } 0074 0075 /// @brief Visit all reachable surfaces of the detector - non-const 0076 /// 0077 /// @tparam visitor_t Type of the callable visitor 0078 /// 0079 /// @param visitor will be called with the represented surface 0080 template <MutableSurfaceVisitor visitor_t> 0081 void visitMutableSurface(visitor_t&& visitor) { 0082 visitor(m_surface.get()); 0083 } 0084 0085 /// Update the current volume 0086 /// 0087 /// @param gctx is the Geometry context of this call 0088 /// @param nState [in,out] the navigation state for the volume to be updated 0089 /// 0090 void updateDetectorVolume(const GeometryContext& gctx, 0091 NavigationState& nState) const noexcept(false); 0092 0093 /// Set the geometry identifier (to the underlying surface) 0094 /// 0095 /// @param geometryId the geometry identifier to be assigned 0096 void assignGeometryId(const GeometryIdentifier& geometryId); 0097 0098 /// Fuse with another portal, this one is kept 0099 /// 0100 /// @param aPortal is the first portal to fuse 0101 /// @param bPortal is the second portal to fuse 0102 /// @return Shared pointer to the fused portal 0103 /// 0104 /// @note this will combine the portal links from the both 0105 /// portals into a new one, it will throw an exception if the 0106 /// portals are not fusable 0107 /// 0108 /// @note if one portal carries material, it will be kept, 0109 /// however, if both portals carry material, an exception 0110 /// will be thrown and the portals are not fusable 0111 /// 0112 /// @note Both input portals become invalid, in that their update 0113 /// delegates and attached volumes are reset 0114 static std::shared_ptr<Portal> fuse( 0115 std::shared_ptr<Portal>& aPortal, 0116 std::shared_ptr<Portal>& bPortal) noexcept(false); 0117 0118 /// Update the volume link 0119 /// 0120 /// @param dir the direction of the link 0121 /// @param portalNavigation is the navigation delegate 0122 /// @param attachedVolumes is the list of attached volumes for book keeping 0123 /// 0124 /// @note this overwrites the existing link 0125 void assignPortalNavigation( 0126 Direction dir, ExternalNavigationDelegate portalNavigation, 0127 std::vector<std::shared_ptr<DetectorVolume>> attachedVolumes); 0128 0129 /// Update the volume link, w/o directive, i.e. it relies that there's only 0130 /// one remaining link to be set, throws an exception if that's not the case 0131 /// 0132 /// @param portalNavigation is the navigation delegate 0133 /// @param attachedVolumes is the list of attached volumes for book keeping 0134 /// 0135 /// @note this overwrites the existing link 0136 void assignPortalNavigation(ExternalNavigationDelegate portalNavigation, 0137 std::vector<std::shared_ptr<DetectorVolume>> 0138 attachedVolumes) noexcept(false); 0139 0140 /// Access to the portal targets: opposite/along normal vector 0141 /// @return Const reference to array of navigation delegates 0142 const std::array<ExternalNavigationDelegate, 2u>& portalNavigation() const; 0143 0144 /// Access to the attached volumes - non-const access 0145 /// @return Reference to attached detector volumes 0146 AttachedDetectorVolumes& attachedDetectorVolumes(); 0147 0148 private: 0149 /// The surface representation of this portal 0150 std::shared_ptr<RegularSurface> m_surface; 0151 0152 /// The portal targets along/opposite the normal vector 0153 std::array<ExternalNavigationDelegate, 2u> m_portalNavigation = { 0154 ExternalNavigationDelegate{}, ExternalNavigationDelegate{}}; 0155 0156 /// The portal attaches to the following volumes 0157 AttachedDetectorVolumes m_attachedVolumes; 0158 }; 0159 0160 } // namespace Experimental 0161 } // namespace Acts
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |