![]() |
|
|||
File indexing completed on 2025-06-05 08:29:27
0001 // This file is part of the Acts project. 0002 // 0003 // Copyright (C) 2024 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 http://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 /// Composite portal links can graft together other portal link instances, for 0021 /// example grids that could not be merged due to invalid binnings. 0022 /// 0023 /// +-------+ +-------+ 0024 /// | | | | 0025 /// | | | | 0026 /// | | | | 0027 /// +-------+ | | 0028 /// | | | | 0029 /// | | + +-------+ 0030 /// | | | | 0031 /// +-------+ | | 0032 /// | | | | 0033 /// | | +-------+ 0034 /// | | | | 0035 /// +-------+ +-------+ 0036 /// 0037 /// During resolution, it will consult each of it's children and return 0038 /// the result on the first surface where the lookup position is within 0039 /// bounds. 0040 class CompositePortalLink final : public PortalLinkBase { 0041 public: 0042 /// Construct a composite portal from two arbitrary other portal links. The 0043 /// only requirement is that the portal link surfaces are mergeable. 0044 /// @param a The first portal link 0045 /// @param b The second portal link 0046 /// @param direction The binning direction 0047 /// @param flatten If true, the composite will flatten any nested composite 0048 CompositePortalLink(std::unique_ptr<PortalLinkBase> a, 0049 std::unique_ptr<PortalLinkBase> b, BinningValue direction, 0050 bool flatten = true); 0051 0052 /// Print the composite portal link 0053 /// @param os The output stream 0054 void toStream(std::ostream& os) const override; 0055 0056 /// Resolve the volume for a 2D position 0057 /// @note This will transform the position to global coordinates before 0058 /// consulting its children. 0059 /// @note @p position is assumed to be on surface 0060 /// @param gctx The geometry context 0061 /// @param position The 2D position 0062 /// @param tolerance The on-surface tolerance 0063 Result<const TrackingVolume*> resolveVolume( 0064 const GeometryContext& gctx, const Vector2& position, 0065 double tolerance = s_onSurfaceTolerance) const override; 0066 0067 /// Resolve the volume for a 3D position 0068 /// @note @p position is assumed to be on surface 0069 /// @param gctx The geometry context 0070 /// @param position The 3D position 0071 /// @param tolerance The tolerance 0072 Result<const TrackingVolume*> resolveVolume( 0073 const GeometryContext& gctx, const Vector3& position, 0074 double tolerance = s_onSurfaceTolerance) const override; 0075 0076 /// Get the depth of the composite tree 0077 /// @return The depth 0078 std::size_t depth() const; 0079 0080 /// Get the number of children 0081 /// @return The number of children 0082 std::size_t size() const; 0083 0084 private: 0085 /// Helper function to construct a merged surface from two portal links along 0086 /// a given direction 0087 /// @param a The first portal link 0088 /// @param b The second portal link 0089 /// @param direction The merging direction 0090 /// @return The merged surface 0091 static std::shared_ptr<RegularSurface> mergedSurface(const PortalLinkBase* a, 0092 const PortalLinkBase* b, 0093 BinningValue direction); 0094 0095 boost::container::small_vector<std::unique_ptr<PortalLinkBase>, 4> 0096 m_children{}; 0097 }; 0098 0099 } // 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 |
![]() ![]() |