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/Detector/ProtoBinning.hpp"
0012 #include "Acts/Geometry/BlueprintNode.hpp"
0013 #include "Acts/Geometry/PortalShell.hpp"
0014 
0015 #include <variant>
0016 
0017 namespace Acts {
0018 
0019 /// This node type registers material proxies into its child volume during the
0020 /// blueprint construction. It is configured ahead of time which volume faces to
0021 /// mark up, and how do to so.
0022 /// @note This node can only have a single child. This is not an error during
0023 ///       tree building, but during geometry construction.
0024 /// @note This currently only supports a cylinder volume child
0025 class MaterialDesignatorBlueprintNode final : public BlueprintNode {
0026  public:
0027   // @TODO: This needs cuboid volume storage as well
0028   // @TODO: I don't love the type
0029   using BinningConfig = std::variant<std::vector<
0030       std::tuple<CylinderVolumeBounds::Face, Experimental::ProtoBinning,
0031                  Experimental::ProtoBinning>>>;
0032 
0033   /// Main constructor for the material designator node.
0034   /// @param name The name of the node (for debug only)
0035   explicit MaterialDesignatorBlueprintNode(const std::string& name)
0036       : m_name(name) {}
0037 
0038   /// @copydoc BlueprintNode::name
0039   const std::string& name() const override;
0040 
0041   /// @copydoc BlueprintNode::toStream
0042   void toStream(std::ostream& os) const override;
0043 
0044   /// This method participates in the geometry construction.
0045   /// It checks that this node only has a single child, is correctly configured,
0046   /// and forwards the call.
0047   /// @param options The global blueprint options
0048   /// @param gctx The geometry context (nominal usually)
0049   /// @param logger The logger to use
0050   /// @return The child volume
0051   Volume& build(const BlueprintOptions& options, const GeometryContext& gctx,
0052                 const Logger& logger = Acts::getDummyLogger()) override;
0053 
0054   /// This method participates in the geometry construction.
0055   /// It receives the populated portal shell from its only child and attaches
0056   /// material proxies by consulting the configuration stored in the node.
0057   /// @note Currently, this node will unconditionally attach
0058   ///       @ref Acts::ProtoGridSurfaceMaterial
0059   ///
0060   /// @param options The global blueprint options
0061   /// @param gctx The geometry context (nominal usually)
0062   /// @param logger The logger to use
0063   /// @return The portal shell with material proxies attached
0064   PortalShellBase& connect(
0065       const BlueprintOptions& options, const GeometryContext& gctx,
0066       const Logger& logger = Acts::getDummyLogger()) override;
0067 
0068   /// This method participates in the geometry construction.
0069   /// Passes through the call to its only child.
0070   /// @param options The global blueprint options
0071   /// @param gctx The geometry context (nominal usually)
0072   /// @param parent The parent volume
0073   /// @param logger The logger to use during construction
0074   void finalize(const BlueprintOptions& options, const GeometryContext& gctx,
0075                 TrackingVolume& parent, const Logger& logger) override;
0076 
0077   /// Retrieve the binning configuration
0078   /// @return The binning configuration
0079   const std::optional<BinningConfig>& binning() const;
0080 
0081   /// Set the binning configuration
0082   /// @param binning The binning configuration
0083   MaterialDesignatorBlueprintNode& setBinning(BinningConfig binning);
0084 
0085  private:
0086   /// @copydoc BlueprintNode::addToGraphviz
0087   void addToGraphviz(std::ostream& os) const override;
0088 
0089   void handleCylinderBinning(
0090       CylinderPortalShell& cylShell,
0091       const std::vector<
0092           std::tuple<CylinderPortalShell::Face, Experimental::ProtoBinning,
0093                      Experimental::ProtoBinning>>& binning,
0094       const Logger& logger);
0095 
0096   std::string m_name{};
0097 
0098   std::optional<BinningConfig> m_binning{};
0099 };
0100 
0101 }  // namespace Acts