Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:52

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