|
||||
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/Geometry/BlueprintNode.hpp" 0012 #include "Acts/Geometry/CylinderVolumeStack.hpp" 0013 #include "Acts/Geometry/PortalShell.hpp" 0014 #include "Acts/Utilities/AxisDefinitions.hpp" 0015 #include "Acts/Utilities/Logger.hpp" 0016 0017 #include <map> 0018 0019 namespace Acts { 0020 0021 /// This class handles the case of wrapping a set of cylinder-shaped children 0022 /// and stacking them in a configured direction. 0023 /// The stacking is done using @ref CylinderVolumeStack. 0024 /// The container does not result in an extra volume in the hierarchy, as all 0025 /// input volumes and any gap volumes produced are directly registered in the 0026 /// volume of the parent of this node. 0027 /// @note This node assumes all children produce only cylinder volumes! It throws 0028 /// if this is not the case. 0029 class CylinderContainerBlueprintNode final : public BlueprintNode { 0030 public: 0031 /// Main constructor for the cylinder container node. 0032 /// @param name The name of the node (for debug only) 0033 /// @param direction The stacking direction 0034 /// @param attachmentStrategy The attachment strategy for the stack 0035 /// @param resizeStrategy The resize strategy 0036 /// @note The parameters are passed through to @ref CylinderVolumeStack, 0037 /// see documentation of that class for more information 0038 CylinderContainerBlueprintNode( 0039 const std::string& name, AxisDirection direction, 0040 CylinderVolumeStack::AttachmentStrategy attachmentStrategy = 0041 CylinderVolumeStack::AttachmentStrategy::Midpoint, 0042 CylinderVolumeStack::ResizeStrategy resizeStrategy = 0043 CylinderVolumeStack::ResizeStrategy::Expand); 0044 0045 /// @copydoc BlueprintNode::name 0046 const std::string& name() const override; 0047 0048 /// This participates in the construction of the geometry via the blueprint 0049 /// tree. The steps are approximately as follows: 0050 /// -# Collect all child volumes 0051 /// -# Package them into a @ref Acts::CylinderVolumeStack, which performs 0052 /// sizing and/or gap creation 0053 /// -# Return the @ref Acts::CylinderVolumeStack as a volume up the tree 0054 /// 0055 /// @param options The global blueprint options 0056 /// @param gctx The geometry context (nominal usually) 0057 /// @param logger The logger to use 0058 /// @return The combined @ref Acts::CylinderVolumeStack 0059 Volume& build(const BlueprintOptions& options, const GeometryContext& gctx, 0060 const Logger& logger = Acts::getDummyLogger()) override; 0061 0062 /// This participates in the construction of the geometry via the blueprint 0063 /// tree. The steps are approximately as follows: 0064 /// -# Walk through all volumes that were created by the build phase 0065 /// -# Check if they are: *real* child volumes or gap volumes 0066 /// - If gap volume: produce a @ref Acts::TrackingVolume, and wrap it in a single use shell 0067 /// - If child volume: locate the right child node it came from, call 0068 /// ` connect` and collect the returned shell 0069 /// -# Produce a combined @ref Acts::CylinderStackPortalShell from all the shells 0070 /// -# Return that shell representation 0071 /// 0072 /// @param options The global blueprint options 0073 /// @param gctx The geometry context (nominal usually) 0074 /// @param logger The logger to use 0075 /// @return The combined @ref Acts::CylinderStackPortalShell 0076 CylinderStackPortalShell& connect( 0077 const BlueprintOptions& options, const GeometryContext& gctx, 0078 const Logger& logger = Acts::getDummyLogger()) override; 0079 0080 /// This participates in the construction of the geometry via the blueprint 0081 /// tree. The steps are approximately as follows: 0082 /// -# Register portals created for gap volumes, as they're not handled by 0083 /// dedicated nodes 0084 /// -# Register gap volumes in the @p parent volume 0085 /// -# Create a configured @ref Acts::INavigationPolicy for the gap 0086 /// -# Call `finalize` on all children while passing through @p parent. 0087 /// 0088 /// @param options The global blueprint options 0089 /// @param gctx The geometry context (nominal usually) 0090 /// @param parent The parent volume 0091 /// @param logger The logger to use 0092 void finalize(const BlueprintOptions& options, const GeometryContext& gctx, 0093 TrackingVolume& parent, const Logger& logger) override; 0094 0095 /// Setter for the stacking direction 0096 /// @param direction The stacking direction 0097 /// @return This node for chaining 0098 CylinderContainerBlueprintNode& setDirection(AxisDirection direction); 0099 0100 /// Setter for the attachment strategy 0101 /// @param attachmentStrategy The attachment strategy 0102 /// @return This node for chaining 0103 CylinderContainerBlueprintNode& setAttachmentStrategy( 0104 CylinderVolumeStack::AttachmentStrategy attachmentStrategy); 0105 0106 /// Setter for the resize strategy 0107 /// @param resizeStrategy The resize strategy 0108 /// @return This node for chaining 0109 CylinderContainerBlueprintNode& setResizeStrategy( 0110 CylinderVolumeStack::ResizeStrategy resizeStrategy); 0111 0112 /// Accessor to the stacking direction 0113 /// @return The stacking direction 0114 AxisDirection direction() const; 0115 0116 /// Accessor to the attachment strategy 0117 /// @return The attachment strategy 0118 CylinderVolumeStack::AttachmentStrategy attachmentStrategy() const; 0119 0120 /// Accessor to the resize strategy 0121 /// @return The resize strategy 0122 CylinderVolumeStack::ResizeStrategy resizeStrategy() const; 0123 0124 private: 0125 /// @copydoc BlueprintNode::addToGraphviz 0126 void addToGraphviz(std::ostream& os) const override; 0127 0128 /// Helper function to check if a volume was created as a gap volume. 0129 /// @param volume The volume to check 0130 /// @return True if the volume is a gap volume, false otherwise 0131 bool isGapVolume(const Volume& volume) const; 0132 0133 std::vector<CylinderPortalShell*> collectChildShells( 0134 const BlueprintOptions& options, const GeometryContext& gctx, 0135 const Logger& logger); 0136 0137 std::string m_name; 0138 0139 AxisDirection m_direction = AxisDirection::AxisZ; 0140 0141 CylinderVolumeStack::AttachmentStrategy m_attachmentStrategy{ 0142 CylinderVolumeStack::AttachmentStrategy::Midpoint}; 0143 0144 CylinderVolumeStack::ResizeStrategy m_resizeStrategy{ 0145 CylinderVolumeStack::ResizeStrategy::Expand}; 0146 0147 // Is only initialized during `build` 0148 std::vector<Volume*> m_childVolumes; 0149 std::unique_ptr<CylinderVolumeStack> m_stack{nullptr}; 0150 std::map<const Volume*, BlueprintNode*> m_volumeToNode; 0151 std::vector<std::pair<std::unique_ptr<SingleCylinderPortalShell>, 0152 std::unique_ptr<TrackingVolume>>> 0153 m_gaps; 0154 std::unique_ptr<CylinderStackPortalShell> m_shell{nullptr}; 0155 }; 0156 0157 } // 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 |