![]() |
|
|||
File indexing completed on 2025-06-30 07:51:44
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/ProtoLayer.hpp" 0012 #include "Acts/Geometry/StaticBlueprintNode.hpp" 0013 0014 #include <memory> 0015 #include <ostream> 0016 0017 namespace Acts::Experimental { 0018 0019 namespace detail { 0020 struct LayerBlueprintNodeImpl; 0021 } 0022 0023 /// The layer node is essentially an auto-sizing wrapper around a set of 0024 /// surfaces. 0025 /// @note This implementation is **preliminary** and will likely change 0026 /// in the future. 0027 /// It defers most of the functionality to @ref Acts::Experimental::StaticBlueprintNode, 0028 /// after the initial volume creation is completed. 0029 /// 0030 /// The layer volume is created to wrap around the surfaces registered with 0031 /// this node. The orientation of the resulting volume defaults to the identity 0032 /// matrix. If another orientation is desired, this can be set with the @ref 0033 /// Acts::Experimental::LayerBlueprintNode::setTransform. See @ref Acts::ProtoLayer for 0034 /// details on the auto-sizing from surfaces. 0035 /// 0036 class LayerBlueprintNode final : public StaticBlueprintNode { 0037 public: 0038 /// Enum that lists out the supported layer types. 0039 enum class LayerType { 0040 /// A cylinder layer 0041 Cylinder, 0042 0043 /// A disc layer 0044 Disc, 0045 0046 /// A plane layer 0047 /// @note This is not yet implemented 0048 Plane 0049 }; 0050 0051 /// Constructor for a layer node. 0052 /// @param name The name of the layer 0053 explicit LayerBlueprintNode(std::string_view name); 0054 0055 ~LayerBlueprintNode() override; 0056 0057 /// @copydoc BlueprintNode::name 0058 const std::string& name() const override; 0059 0060 /// This function participates in the geometry construction. 0061 /// It will: 0062 /// -# Analyze the surfaces provided and produce a wrapping volume 0063 /// -# Register the surfaces with the volume 0064 /// -# Return the volume 0065 /// @note At least one surfaces needs to be registered via 0066 /// @ref Acts::Experimental::LayerBlueprintNode::setSurfaces before 0067 /// geometry construction. 0068 Volume& build(const BlueprintOptions& options, const GeometryContext& gctx, 0069 const Logger& logger = Acts::getDummyLogger()) override; 0070 0071 /// Register a set of surfaces with the layer node. 0072 /// @param surfaces The surfaces to register 0073 /// @note This will clear any previously registered proto layer 0074 /// @return Reference to this node for chaining 0075 LayerBlueprintNode& setSurfaces( 0076 std::vector<std::shared_ptr<Surface>> surfaces); 0077 0078 /// Access the registered surfaces. 0079 /// @return The registered surfaces 0080 const std::vector<std::shared_ptr<Surface>>& surfaces() const; 0081 0082 /// Register a proto layer with the layer node. 0083 /// @param protoLayer The proto layer to register 0084 /// @note This will clear any previously registered surfaces 0085 /// @return Reference to this node for chaining 0086 LayerBlueprintNode& setProtoLayer( 0087 std::optional<MutableProtoLayer> protoLayer); 0088 0089 /// Access the registered proto layer. 0090 /// @note This will return nullptr if no proto layer is registered or built yet 0091 /// @return The registered proto layer 0092 const MutableProtoLayer* protoLayer() const; 0093 0094 /// Set the transformation of the layer node. 0095 /// This can be used to specifically orient the resulting layer volume. 0096 /// @param transform The transformation to set 0097 /// @return Reference to this node for chaining 0098 LayerBlueprintNode& setTransform(const Transform3& transform); 0099 0100 /// Access the transformation of the layer node. 0101 /// @return The transformation 0102 const Transform3& transform() const; 0103 0104 /// Set the envelope of the layer node. This configures the amount of space to 0105 /// add around the contained surfaces. 0106 /// @param envelope The envelope to set 0107 /// @return Reference to this node for chaining 0108 LayerBlueprintNode& setEnvelope(const ExtentEnvelope& envelope); 0109 0110 /// Access the envelope of the layer node. 0111 /// @return The envelope 0112 const ExtentEnvelope& envelope() const; 0113 0114 /// Set the layer type of the layer node. 0115 /// @param layerType The layer type to set 0116 /// @return Reference to this node for chaining 0117 LayerBlueprintNode& setLayerType(LayerType layerType); 0118 0119 /// Set the layer volume to be centered on the center of gravity of the 0120 /// surfaces. 0121 /// @param x Whether to center the layer volume on the x-axis 0122 /// @param y Whether to center the layer volume on the y-axis 0123 /// @param z Whether to center the layer volume on the z-axis 0124 /// @return Reference to this node for chaining 0125 LayerBlueprintNode& setUseCenterOfGravity(bool x, bool y, bool z); 0126 0127 /// Access the layer type of the layer node. 0128 /// @return The layer type 0129 const LayerType& layerType() const; 0130 0131 /// Output operator for the layer type enum. 0132 /// @param os The output stream 0133 /// @param type The layer type 0134 friend std::ostream& operator<<(std::ostream& os, 0135 LayerBlueprintNode::LayerType type) { 0136 switch (type) { 0137 using enum LayerBlueprintNode::LayerType; 0138 case Cylinder: 0139 os << "Cylinder"; 0140 break; 0141 case Disc: 0142 os << "Disc"; 0143 break; 0144 case Plane: 0145 os << "Plane"; 0146 break; 0147 } 0148 return os; 0149 } 0150 0151 private: 0152 /// @copydoc Acts::Experimental::BlueprintNode::addToGraphviz 0153 void addToGraphviz(std::ostream& os) const override; 0154 0155 /// Helper method that performs the volume creation from the configured 0156 /// surfaces. It converts from an @p extent object to an instance of @ref 0157 /// Acts::VolumeBounds. 0158 /// @param extent The extent to use for the volume creation 0159 /// @param logger The logger to use 0160 void buildVolume(const Extent& extent, const Logger& logger); 0161 0162 detail::LayerBlueprintNodeImpl& impl(); 0163 const detail::LayerBlueprintNodeImpl& impl() const; 0164 0165 std::unique_ptr<detail::LayerBlueprintNodeImpl> m_impl; 0166 }; 0167 0168 } // 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 |
![]() ![]() |