Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:09:11

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2022-2023 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 http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Detector/interface/IDetectorBuilder.hpp"
0012 #include "Acts/Detector/interface/IDetectorComponentBuilder.hpp"
0013 #include "Acts/Utilities/Logger.hpp"
0014 
0015 #include <memory>
0016 #include <string>
0017 
0018 namespace Acts::Experimental {
0019 
0020 class IGeometryIdGenerator;
0021 
0022 /// @brief Standard generic Detector builder that calls
0023 /// the top level component builder and transfers the
0024 /// result into a detector object
0025 ///
0026 /// @note This is the last builder in the chain and the
0027 /// the returned detector object is const and cannot be
0028 /// modified anymore.
0029 class DetectorBuilder final : public IDetectorBuilder {
0030  public:
0031   /// Nested configuration object
0032   struct Config {
0033     /// The name of the volume to be built
0034     std::string name = "unnamed";
0035     /// An external builder
0036     std::shared_ptr<const IDetectorComponentBuilder> builder = nullptr;
0037     /// A geometry id generator
0038     std::shared_ptr<const IGeometryIdGenerator> geoIdGenerator = nullptr;
0039     /// Auxiliary information
0040     std::string auxiliary = "";
0041   };
0042 
0043   /// Constructor with configuration arguments
0044   ///
0045   /// @param cfg is the configuration struct
0046   /// @param mlogger logging instance for screen output
0047   DetectorBuilder(const Config& cfg,
0048                   std::unique_ptr<const Logger> mlogger =
0049                       getDefaultLogger("DetectorBuilder", Logging::INFO));
0050 
0051   /// Final implementation of a volume builder that is purely defined
0052   /// by an internal and external structure builder
0053   ///
0054   /// @param gctx The geometry context for this call
0055   ///
0056   /// @return an outgoing detector component
0057   std::shared_ptr<const Detector> construct(
0058       const GeometryContext& gctx) const final;
0059 
0060  private:
0061   /// configuration object
0062   Config m_cfg;
0063 
0064   /// Private access method to the logger
0065   const Logger& logger() const { return *m_logger; }
0066 
0067   /// logging instance
0068   std::unique_ptr<const Logger> m_logger;
0069 };
0070 
0071 }  // namespace Acts::Experimental