|
|
|||
File indexing completed on 2026-10-01 07:58:54
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/Geometry/GeometryIdentifier.hpp" 0012 #include "Acts/Geometry/TrackingVolume.hpp" 0013 #include "Acts/Navigation/INavigationPolicy.hpp" 0014 #include "Acts/Navigation/NavigationStream.hpp" 0015 #include "Acts/Utilities/BoundingBox.hpp" 0016 #include "Acts/Utilities/Frustum.hpp" 0017 0018 #include <numbers> 0019 0020 namespace Acts::Experimental { 0021 0022 /// A navigation policy that uses frustum-octree intersections to find portals. 0023 /// The frustum is a cone that points in the direction of the particle's travel. 0024 /// It is set at the start of navigation, and only updated if the particle 0025 /// leaves it. The octree is built from the first-level child volumes inside the 0026 /// top-level volume. Each level of the tree splits each piece of the previous 0027 /// level into eight equal pieces. The number of levels is the configurable 0028 /// depth parameter. Each child volume is assigned to the piece of the whole 0029 /// that contains it on each level. Navigation candidates are found by 0030 /// intersecting the frustum with the octree. On each level, the frustum only 0031 /// checks for intersections with pieces that descend from previously 0032 /// intersected pieces. This allows for a rapid determination of candidates in 0033 /// geometries with many volumes. 0034 0035 class FrustumNavigationPolicy : public INavigationPolicy { 0036 public: 0037 /// Typedef for the 3d bounding box 0038 using BoundingBox = AxisAlignedBoundingBox<Volume, double, 3>; 0039 /// Typedef for the 3d frustum 0040 using Frustum3 = Frustum<double, 3, 3>; 0041 0042 /// Configuration for the frustum navigation policy 0043 struct Config { 0044 /// The number of layers in the octree 0045 std::size_t depth = 3; 0046 }; 0047 0048 /// Frustum navigation policy state, which holds the frustum 0049 struct State { 0050 /// Stored frustum value, initialized to a default value 0051 Frustum3 frustum = 0052 Frustum3(Vector3::Zero(), Vector3::Zero(), std::numbers::pi / 4); 0053 /// Opening angle for the frustum, stored separately for easy access 0054 double openingAngle = std::numbers::pi / 4; 0055 }; 0056 0057 /// Main constructor, which takes the top-level volume and builds the octree 0058 /// @param gctx The geometrycontext object 0059 /// @param volume The tracking volume used to build the octree 0060 /// @param logger A logging instance 0061 /// @param config The configuration of the Navigation Policy 0062 explicit FrustumNavigationPolicy(const GeometryContext& gctx, 0063 const TrackingVolume& volume, 0064 const Logger& logger, const Config& config); 0065 0066 /// Update the navigation state 0067 /// @param gctx The geometry context 0068 /// @param state The navigation state for this policy 0069 /// @param stream The navigation stream to update 0070 /// @param logger The logger 0071 void initializeCandidates(const GeometryContext& gctx, 0072 const NavigationArguments& /*args*/, 0073 NavigationPolicyState& state, 0074 AppendOnlyNavigationStream& stream, 0075 const Logger& logger) const; 0076 0077 /// Connect this policy with a navigation delegate 0078 /// @param delegate The navigation delegate to connect to 0079 void connect(NavigationDelegate& delegate) const override; 0080 0081 /// Check the validity of the navigation state 0082 /// @param args The navigation arguments 0083 /// @param state The navigation state to check 0084 /// @param logger The logger 0085 /// @return True if the state is valid, false otherwise 0086 bool isValid(const GeometryContext& /*gctx*/, const NavigationArguments& args, 0087 NavigationPolicyState& state, 0088 const Logger& logger) const override; 0089 0090 /// Create and initialize a new navigation state 0091 /// @param args The navigation arguments 0092 /// @param stateManager The navigation state manager to push the new state onto 0093 /// @param logger The logger 0094 void createState(const GeometryContext& /*gctx*/, 0095 const NavigationArguments& args, 0096 NavigationPolicyStateManager& stateManager, 0097 const Logger& logger) const override; 0098 0099 /// Remove the state from the state manager 0100 /// @param stateManager The state manager to pop the state from 0101 /// @param logger The logger 0102 void popState(NavigationPolicyStateManager& stateManager, 0103 const Logger& logger) const override; 0104 0105 private: 0106 // The vector of unique pointers of bounding boxes 0107 std::vector<std::unique_ptr<BoundingBox> > m_boxes; 0108 0109 // The top-level bounding box with the octree 0110 BoundingBox* m_topBox; 0111 0112 // associated volume id 0113 GeometryIdentifier m_id; 0114 }; 0115 0116 static_assert(NavigationPolicyConcept<FrustumNavigationPolicy>); 0117 0118 } // namespace Acts::Experimental
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|