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