Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-03 07:51:55

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/Blueprint.hpp"
0012 #include "Acts/Detector/DetectorComponents.hpp"
0013 #include "Acts/Detector/interface/IDetectorComponentBuilder.hpp"
0014 #include "Acts/Geometry/GeometryContext.hpp"
0015 #include "Acts/Utilities/AxisDefinitions.hpp"
0016 #include "Acts/Utilities/Logger.hpp"
0017 #include "Acts/Utilities/ProtoAxis.hpp"
0018 
0019 #include <map>
0020 #include <memory>
0021 #include <string>
0022 #include <vector>
0023 
0024 namespace Acts::Experimental {
0025 
0026 class IRootVolumeFinderBuilder;
0027 class IGeometryIdGenerator;
0028 
0029 /// @brief A dedicated container builder for cylindrical detector containers
0030 ///
0031 /// It relies on the detailed implementation of the CylindricalDetectorHelper
0032 /// and allows for DetectorVolume attachment in z/r/phi, such as wrapping
0033 /// of bevelled cylinder objects in z/r
0034 ///
0035 /// There exists an option to create this container builder (recursively)
0036 /// from a blueprint tree, which attempts to fill in the gap volumes
0037 /// accordingly.
0038 ///
0039 /// @note the builder expects a fully consistent set of sub volume builders
0040 /// that will be executed in a chain
0041 ///
0042 /// @note allowed AxisDirection(s) for the cylindrical container builder are
0043 /// {AxisZ}, {AxisR}, {AxisPhi}, {AxisZ, AxisR}, whereas the last option
0044 /// indicates a wrapping setup.
0045 class CylindricalContainerBuilder : public IDetectorComponentBuilder {
0046  public:
0047   /// Nested configuration object
0048   struct Config {
0049     /// The configured volume builders
0050     std::vector<std::shared_ptr<const IDetectorComponentBuilder>> builders = {};
0051     /// The axis direction for the binning
0052     std::vector<AxisDirection> binning = {};
0053     /// The root volume finder
0054     std::shared_ptr<const IRootVolumeFinderBuilder> rootVolumeFinderBuilder =
0055         nullptr;
0056     /// The geometry id generator
0057     std::shared_ptr<const IGeometryIdGenerator> geoIdGenerator = nullptr;
0058     /// Material binning to be assigned to portals
0059     std::map<unsigned int, std::vector<DirectedProtoAxis>>
0060         portalMaterialBinning = {};
0061     /// An eventual reverse geometry id generation
0062     bool geoIdReverseGen = false;
0063     /// Auxiliary information, mainly for screen output
0064     std::string auxiliary = "";
0065   };
0066 
0067   /// Constructor with configuration struct
0068   ///
0069   /// @param cfg is the configuration struct
0070   /// @param logger logging instance for screen output
0071   explicit CylindricalContainerBuilder(
0072       const Config& cfg,
0073       std::unique_ptr<const Logger> logger =
0074           getDefaultLogger("CylindricalContainerBuilder", Logging::INFO));
0075 
0076   /// Constructor from blueprint and logging level
0077   ///
0078   /// It will create recursively the builders of sub volumes
0079   ///
0080   /// @param bpNode is the entry blue print node
0081   /// @param logLevel is the logging output level for the builder tools
0082   ///
0083   /// @note no checking is being done on consistency of the blueprint,
0084   /// it is assumed it has passed first through gap filling via the
0085   /// blueprint helper.
0086   ///
0087   /// @note that the naming of the builders is taken from the bluprint nodes
0088   ///
0089   /// @return a cylindrical container builder representing this blueprint
0090   explicit CylindricalContainerBuilder(
0091       const Acts::Experimental::Gen2Blueprint::Node& bpNode,
0092       Acts::Logging::Level logLevel = Acts::Logging::INFO);
0093 
0094   /// The final implementation of the cylindrical container builder
0095   ///
0096   /// @param gctx The geometry context for this call
0097   ///
0098   /// @return an outgoing detector component
0099   DetectorComponent construct(const GeometryContext& gctx) const final;
0100 
0101  private:
0102   /// configuration object
0103   Config m_cfg;
0104 
0105   /// Private access method to the logger
0106   const Logger& logger() const { return *m_logger; }
0107 
0108   /// logging instance
0109   std::unique_ptr<const Logger> m_logger;
0110 };
0111 
0112 }  // namespace Acts::Experimental