Back to home page

EIC code displayed by LXR

 
 

    


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

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/ProtoBinning.hpp"
0014 #include "Acts/Detector/interface/IDetectorComponentBuilder.hpp"
0015 #include "Acts/Geometry/GeometryContext.hpp"
0016 #include "Acts/Utilities/AxisDefinitions.hpp"
0017 #include "Acts/Utilities/Logger.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, BinningDescription> portalMaterialBinning = {};
0060     /// An eventual reverse geometry id generation
0061     bool geoIdReverseGen = false;
0062     /// Auxiliary information, mainly for screen output
0063     std::string auxiliary = "";
0064   };
0065 
0066   /// Constructor with configuration struct
0067   ///
0068   /// @param cfg is the configuration struct
0069   /// @param logger logging instance for screen output
0070   CylindricalContainerBuilder(
0071       const Config& cfg,
0072       std::unique_ptr<const Logger> logger =
0073           getDefaultLogger("CylindricalContainerBuilder", Logging::INFO));
0074 
0075   /// Constructor from blueprint and logging level
0076   ///
0077   /// It will create recursively the builders of sub volumes
0078   ///
0079   /// @param bpNode is the entry blue print node
0080   /// @param logLevel is the logging output level for the builder tools
0081   ///
0082   /// @note no checking is being done on consistency of the blueprint,
0083   /// it is assumed it has passed first through gap filling via the
0084   /// blueprint helper.
0085   ///
0086   /// @note that the naming of the builders is taken from the bluprint nodes
0087   ///
0088   /// @return a cylindrical container builder representing this blueprint
0089   CylindricalContainerBuilder(
0090       const Acts::Experimental::Blueprint::Node& bpNode,
0091       Acts::Logging::Level logLevel = Acts::Logging::INFO);
0092 
0093   /// The final implementation of the cylindrical container builder
0094   ///
0095   /// @param gctx The geometry context for this call
0096   ///
0097   /// @return an outgoing detector component
0098   DetectorComponent construct(const GeometryContext& gctx) const final;
0099 
0100  private:
0101   /// configuration object
0102   Config m_cfg;
0103 
0104   /// Private access method to the logger
0105   const Logger& logger() const { return *m_logger; }
0106 
0107   /// logging instance
0108   std::unique_ptr<const Logger> m_logger;
0109 };
0110 
0111 }  // namespace Acts::Experimental