Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:23:17

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/DetectorComponents.hpp"
0012 #include "Acts/Detector/ProtoBinning.hpp"
0013 #include "Acts/Detector/interface/IDetectorComponentBuilder.hpp"
0014 #include "Acts/Geometry/GeometryContext.hpp"
0015 #include "Acts/Utilities/Logger.hpp"
0016 
0017 #include <memory>
0018 #include <string>
0019 
0020 namespace Acts::Experimental {
0021 class IExternalStructureBuilder;
0022 class IInternalStructureBuilder;
0023 class IGeometryIdGenerator;
0024 
0025 /// @brief A generic detector volume builder that uses
0026 /// an external builder for shape and portals and an internal
0027 /// structure builder for volume internals.
0028 ///
0029 /// @note Although this helper builds only a single volume,
0030 /// it is to the outside presented as a DetectorComponent with
0031 /// shell; like this it can be transparently be used for the
0032 /// downstream detector construction process.
0033 class DetectorVolumeBuilder : public IDetectorComponentBuilder {
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 IExternalStructureBuilder> externalsBuilder = nullptr;
0041     /// An internal builder
0042     std::shared_ptr<const IInternalStructureBuilder> internalsBuilder = nullptr;
0043     /// The geometry id generator
0044     std::shared_ptr<const IGeometryIdGenerator> geoIdGenerator = nullptr;
0045     /// Material binning to be assigned to portals
0046     std::map<unsigned int, BinningDescription> portalMaterialBinning = {};
0047     /// Add eventual internal volume to root
0048     bool addInternalsToRoot = false;
0049     /// Auxiliary information
0050     std::string auxiliary = "";
0051   };
0052 
0053   /// Constructor with configuration arguments
0054   ///
0055   /// @param cfg is the configuration struct
0056   /// @param mlogger logging instance for screen output
0057   DetectorVolumeBuilder(const Config& cfg,
0058                         std::unique_ptr<const Logger> mlogger =
0059                             getDefaultLogger("DetectorVolumeBuilder",
0060                                              Logging::INFO));
0061 
0062   /// Final implementation of a volume builder that is purely defined
0063   /// by an internal and external structure builder
0064   ///
0065   /// @param gctx The geometry context for this call
0066   ///
0067   /// @return an outgoing detector component
0068   DetectorComponent construct(const GeometryContext& gctx) const final;
0069 
0070  private:
0071   /// configuration object
0072   Config m_cfg;
0073 
0074   /// Private access method to the logger
0075   const Logger& logger() const { return *m_logger; }
0076 
0077   /// logging instance
0078   std::unique_ptr<const Logger> m_logger;
0079 };
0080 
0081 }  // namespace Acts::Experimental