Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 08:21:00

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/GeometryIdentifier.hpp"
0013 #include "Acts/Utilities/Logger.hpp"
0014 
0015 #include <memory>
0016 
0017 namespace Acts {
0018 
0019 class TrackingVolume;
0020 class PortalShellBase;
0021 class Volume;
0022 
0023 struct GeometryIdentifierBlueprintNodeImpl;
0024 
0025 /// @brief Blueprint node for configuring and applying geometry identifiers to volumes
0026 ///
0027 /// This node must have exactly one child and applies geometry identifier
0028 /// configurations to the volumes in its subtree during finalization. Multiple
0029 /// configurations can be chained using the fluent interface.
0030 class GeometryIdentifierBlueprintNode : public BlueprintNode {
0031  public:
0032   /// Virtual destructor pushed to cpp file to avoid defining implementation
0033   /// details
0034   ~GeometryIdentifierBlueprintNode() override;
0035 
0036   /// Default constructor
0037   GeometryIdentifierBlueprintNode();
0038 
0039   /// @brief Build the volume hierarchy under this node
0040   /// @param options Blueprint build options
0041   /// @param gctx The geometry context
0042   /// @param logger The logger instance
0043   /// @return Reference to the built volume
0044   /// @note Requires exactly one child node
0045   Volume& build(const BlueprintOptions& options, const GeometryContext& gctx,
0046                 const Logger& logger = Acts::getDummyLogger()) override;
0047 
0048   /// @brief Connect portals in the volume hierarchy
0049   /// @param options Blueprint build options
0050   /// @param gctx The geometry context
0051   /// @param logger The logger instance
0052   /// @return Reference to the connected portal shell
0053   PortalShellBase& connect(
0054       const BlueprintOptions& options, const GeometryContext& gctx,
0055       const Logger& logger = Acts::getDummyLogger()) override;
0056 
0057   /// @brief Finalize the volume hierarchy and apply geometry identifier configurations
0058   /// @param options Blueprint build options
0059   /// @param gctx The geometry context
0060   /// @param parent The parent tracking volume
0061   /// @param logger The logger instance
0062   /// @note Applies all configured geometry ID assignments to new volumes in the subtree
0063   void finalize(const BlueprintOptions& options, const GeometryContext& gctx,
0064                 TrackingVolume& parent,
0065                 const Logger& logger = Acts::getDummyLogger()) override;
0066 
0067   /// @brief Set a fixed layer ID for volumes in this subtree
0068   /// @param layer The layer ID value to set
0069   /// @return Reference to this node for method chaining
0070   /// @note Will throw if volumes already have layer IDs assigned
0071   GeometryIdentifierBlueprintNode& setLayerIdTo(
0072       GeometryIdentifier::Value layer);
0073 
0074   /// @brief Incrementally assign layer IDs to volumes in this subtree
0075   /// @param start The starting layer ID value (default: 0)
0076   /// @return Reference to this node for method chaining
0077   /// @note Will throw if volumes already have layer IDs assigned
0078   /// @note Layer IDs are assigned sequentially starting from the given value
0079   GeometryIdentifierBlueprintNode& incrementLayerIds(
0080       GeometryIdentifier::Value start = 0);
0081 
0082   /// @brief Set the same volume ID for all volumes in this subtree
0083   /// @param volumeId The volume ID to set
0084   /// @return Reference to this node for method chaining
0085   /// @note Will throw if volumes already have volume IDs assigned
0086   /// @note Applies recursively to all descendant volumes
0087   GeometryIdentifierBlueprintNode& setAllVolumeIdsTo(
0088       GeometryIdentifier::Value volumeId);
0089 
0090   /// Predicate function to compare two @ref Acts::TrackingVolume with each other to determine their *closure order*.
0091   using CompareVolumes =
0092       std::function<bool(const TrackingVolume&, const TrackingVolume&)>;
0093 
0094   /// @brief Configure this node to order eligible tracking volumes using the provided
0095   /// function
0096   /// @param compare Function to use for sorting volumes
0097   /// @return Reference to this node for method chaining
0098   GeometryIdentifierBlueprintNode& sortBy(const CompareVolumes& compare);
0099 
0100   /// @brief Get the name of this node
0101   /// @return String containing concatenated configuration names
0102   const std::string& name() const override;
0103 
0104  private:
0105   std::unique_ptr<GeometryIdentifierBlueprintNodeImpl> m_impl;
0106 };
0107 
0108 namespace Experimental {
0109 /// @deprecated The blueprint geometry moved out of the `Acts::Experimental`
0110 ///             namespace. Use @ref Acts::GeometryIdentifierBlueprintNode
0111 ///             instead. This alias is kept for backward compatibility and will
0112 ///             be removed.
0113 using GeometryIdentifierBlueprintNode
0114     [[deprecated("Acts::Experimental::GeometryIdentifierBlueprintNode moved to "
0115                  "Acts::GeometryIdentifierBlueprintNode")]] =
0116         Acts::GeometryIdentifierBlueprintNode;
0117 }  // namespace Experimental
0118 
0119 }  // namespace Acts