|
||||
File indexing completed on 2025-01-18 09:10:51
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/Tolerance.hpp" 0012 #include "Acts/Geometry/PortalLinkBase.hpp" 0013 0014 #include <iosfwd> 0015 0016 #include <boost/container/small_vector.hpp> 0017 0018 namespace Acts { 0019 0020 class GridPortalLink; 0021 class Surface; 0022 0023 /// Composite portal links can graft together other portal link instances, for 0024 /// example grids that could not be merged due to invalid binnings. 0025 /// 0026 /// ``` 0027 /// +-------+ +-------+ 0028 /// | | | | 0029 /// | | | | 0030 /// | | | | 0031 /// +-------+ | | 0032 /// | | | | 0033 /// | | + +-------+ 0034 /// | | | | 0035 /// +-------+ | | 0036 /// | | | | 0037 /// | | +-------+ 0038 /// | | | | 0039 /// +-------+ +-------+ 0040 /// ``` 0041 /// 0042 /// During resolution, it will consult each of it's children and return 0043 /// the result on the first surface where the lookup position is within 0044 /// bounds. 0045 class CompositePortalLink final : public PortalLinkBase { 0046 public: 0047 /// Construct a composite portal from two arbitrary other portal links. The 0048 /// only requirement is that the portal link surfaces are mergeable. 0049 /// @param a The first portal link 0050 /// @param b The second portal link 0051 /// @param direction The binning direction 0052 /// @param flatten If true, the composite will flatten any nested composite 0053 CompositePortalLink(std::unique_ptr<PortalLinkBase> a, 0054 std::unique_ptr<PortalLinkBase> b, 0055 AxisDirection direction, bool flatten = true); 0056 0057 /// Construct a composite portal from any number of arbitrary other portal 0058 /// links. The only requirement is that the portal link surfaces are 0059 /// mergeable. 0060 /// @param links The portal links 0061 /// @param direction The binning direction 0062 /// @param flatten If true, the composite will flatten any nested composite 0063 CompositePortalLink(std::vector<std::unique_ptr<PortalLinkBase>> links, 0064 AxisDirection direction, bool flatten = true); 0065 0066 /// Print the composite portal link 0067 /// @param os The output stream 0068 void toStream(std::ostream& os) const override; 0069 0070 /// Resolve the volume for a 2D position 0071 /// @note This will transform the position to global coordinates before 0072 /// consulting its children. 0073 /// @note @p position is assumed to be on surface 0074 /// @param gctx The geometry context 0075 /// @param position The 2D position 0076 /// @param tolerance The on-surface tolerance 0077 Result<const TrackingVolume*> resolveVolume( 0078 const GeometryContext& gctx, const Vector2& position, 0079 double tolerance = s_onSurfaceTolerance) const override; 0080 0081 /// Resolve the volume for a 3D position 0082 /// @note @p position is assumed to be on surface 0083 /// @param gctx The geometry context 0084 /// @param position The 3D position 0085 /// @param tolerance The tolerance 0086 Result<const TrackingVolume*> resolveVolume( 0087 const GeometryContext& gctx, const Vector3& position, 0088 double tolerance = s_onSurfaceTolerance) const override; 0089 0090 /// Get the depth of the composite tree 0091 /// @return The depth 0092 std::size_t depth() const; 0093 0094 /// Get the number of children 0095 /// @return The number of children 0096 std::size_t size() const; 0097 0098 /// (Potentially) create a grid portal link that represents this composite 0099 /// portal link. 0100 /// @note This only works, if the composite is **flat** and only contains 0101 /// **trivial portal links**. If these preconditions are not met, this 0102 /// function returns a nullptr. 0103 /// @param gctx The geometry context 0104 /// @param logger The logger 0105 /// @return The grid portal link 0106 std::unique_ptr<GridPortalLink> makeGrid(const GeometryContext& gctx, 0107 const Logger& logger) const; 0108 0109 private: 0110 boost::container::small_vector<std::unique_ptr<PortalLinkBase>, 4> 0111 m_children{}; 0112 0113 AxisDirection m_direction; 0114 }; 0115 0116 } // 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 |