Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-26 07:46:01

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/CuboidVolumeBounds.hpp"
0013 #include "Acts/Geometry/CylinderVolumeBounds.hpp"
0014 
0015 #include <string_view>
0016 
0017 namespace Acts::Experimental {
0018 
0019 namespace detail {
0020 class PortalDesignatorBlueprintNodeImpl;
0021 }
0022 
0023 /// This node type assigns string tags to specific portal faces of its child
0024 /// volume during the blueprint construction. The tags can be used to look up
0025 /// the corresponding portals from the final @ref Acts::TrackingGeometry, e.g.
0026 /// "the portal connecting the tracker and the calorimeter".
0027 ///
0028 /// Tagging happens in the *finalize* phase, after all portal merging and
0029 /// fusing has completed, so the tagged portal is the final, shared portal that
0030 /// ends up in the geometry. The position of this node in the blueprint tree
0031 /// determines which face is meant, which makes the lookup robust against volume
0032 /// subdivision and portal ordering.
0033 /// @note This node can only have a single child. This is not an error during
0034 ///       tree building, but during geometry construction.
0035 class PortalDesignatorBlueprintNode final : public BlueprintNode {
0036  public:
0037   /// Main constructor for the portal designator node.
0038   /// @param name The name of the node (for debug only)
0039   explicit PortalDesignatorBlueprintNode(std::string_view name);
0040 
0041   ~PortalDesignatorBlueprintNode() override;
0042 
0043   /// @copydoc BlueprintNode::name
0044   const std::string& name() const override;
0045 
0046   /// @copydoc BlueprintNode::toStream
0047   void toStream(std::ostream& os) const override;
0048 
0049   /// This method participates in the geometry construction.
0050   /// It checks that this node only has a single child and forwards the call.
0051   /// @param options The global blueprint options
0052   /// @param gctx The geometry context (nominal usually)
0053   /// @param logger The logger to use
0054   /// @return The child volume
0055   Volume& build(const BlueprintOptions& options, const GeometryContext& gctx,
0056                 const Logger& logger = Acts::getDummyLogger()) override;
0057 
0058   /// This method participates in the geometry construction.
0059   /// It captures the populated portal shell from its only child so the tags can
0060   /// be applied in the finalize phase (after all merging/fusing), and forwards
0061   /// the call.
0062   /// @param options The global blueprint options
0063   /// @param gctx The geometry context (nominal usually)
0064   /// @param logger The logger to use
0065   /// @return The portal shell of the child
0066   PortalShellBase& connect(
0067       const BlueprintOptions& options, const GeometryContext& gctx,
0068       const Logger& logger = Acts::getDummyLogger()) override;
0069 
0070   /// This method participates in the geometry construction.
0071   /// It applies the configured tags to the (now final) portals of the captured
0072   /// shell, then passes the call through to its only child.
0073   /// @param options The global blueprint options
0074   /// @param gctx The geometry context (nominal usually)
0075   /// @param parent The parent volume
0076   /// @param logger The logger to use during construction
0077   void finalize(const BlueprintOptions& options, const GeometryContext& gctx,
0078                 TrackingVolume& parent, const Logger& logger) override;
0079 
0080   /// Tag a cylinder face with a string label.
0081   /// @note This method can be called multiple times to tag different faces.
0082   /// @param face The face of the cylinder to tag
0083   /// @param label The tag to assign to the portal at that face
0084   /// @return The portal designator node
0085   /// @note If this node has previously been configured with a different volume
0086   ///       shape, this will throw an exception during geometry construction.
0087   PortalDesignatorBlueprintNode& tagFace(CylinderVolumeBounds::Face face,
0088                                          const std::string& label);
0089 
0090   /// Tag a cuboid face with a string label.
0091   /// @note This method can be called multiple times to tag different faces.
0092   /// @param face The face of the cuboid to tag
0093   /// @param label The tag to assign to the portal at that face
0094   /// @return The portal designator node
0095   /// @note If this node has previously been configured with a different volume
0096   ///       shape, this will throw an exception during geometry construction.
0097   PortalDesignatorBlueprintNode& tagFace(CuboidVolumeBounds::Face face,
0098                                          const std::string& label);
0099 
0100  private:
0101   /// @copydoc BlueprintNode::addToGraphviz
0102   void addToGraphviz(std::ostream& os) const override;
0103 
0104   detail::PortalDesignatorBlueprintNodeImpl& impl();
0105   const detail::PortalDesignatorBlueprintNodeImpl& impl() const;
0106 
0107   std::unique_ptr<detail::PortalDesignatorBlueprintNodeImpl> m_impl;
0108 };
0109 
0110 }  // namespace Acts::Experimental