Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-30 07:51:39

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/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 {
0019 
0020 class IMaterialDecorator;
0021 
0022 namespace Experimental {
0023 
0024 class IGeometryIdGenerator;
0025 
0026 /// @brief Standard generic Detector builder that calls
0027 /// the top level component builder and transfers the
0028 /// result into a detector object
0029 ///
0030 /// @note This is the last builder in the chain and the
0031 /// the returned detector object is const and cannot be
0032 /// modified anymore.
0033 class DetectorBuilder final : public IDetectorBuilder {
0034  public:
0035   /// Nested configuration object
0036   struct Config {
0037     /// The name of the volume to be built
0038     std::string name = "unnamed";
0039     /// An external builder
0040     std::shared_ptr<const IDetectorComponentBuilder> builder = nullptr;
0041     /// A geometry id generator
0042     std::shared_ptr<const IGeometryIdGenerator> geoIdGenerator = nullptr;
0043     /// A material decorator
0044     std::shared_ptr<const IMaterialDecorator> materialDecorator = nullptr;
0045     /// Auxiliary information
0046     std::string auxiliary = "";
0047   };
0048 
0049   /// Constructor with configuration arguments
0050   ///
0051   /// @param cfg is the configuration struct
0052   /// @param mlogger logging instance for screen output
0053   explicit DetectorBuilder(const Config& cfg,
0054                            std::unique_ptr<const Logger> mlogger =
0055                                getDefaultLogger("DetectorBuilder",
0056                                                 Logging::INFO));
0057 
0058   /// Final implementation of a volume builder that is purely defined
0059   /// by an internal and external structure builder
0060   ///
0061   /// @param gctx The geometry context for this call
0062   ///
0063   /// @return an outgoing detector component
0064   std::shared_ptr<const Detector> construct(
0065       const GeometryContext& gctx) const final;
0066 
0067  private:
0068   /// configuration object
0069   Config m_cfg;
0070 
0071   /// Private access method to the logger
0072   const Logger& logger() const { return *m_logger; }
0073 
0074   /// logging instance
0075   std::unique_ptr<const Logger> m_logger;
0076 };
0077 
0078 }  // namespace Experimental
0079 }  // namespace Acts