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/DetectorComponents.hpp"
0012 #include "Acts/Detector/interface/IDetectorComponentBuilder.hpp"
0013 #include "Acts/Geometry/GeometryContext.hpp"
0014 #include "Acts/Utilities/Logger.hpp"
0015 #include "Acts/Utilities/ProtoAxis.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, std::vector<DirectedProtoAxis>>
0047         portalMaterialBinning = {};
0048     /// Add eventual internal volume to root
0049     bool addInternalsToRoot = false;
0050     /// Auxiliary information
0051     std::string auxiliary = "";
0052   };
0053 
0054   /// Constructor with configuration arguments
0055   ///
0056   /// @param cfg is the configuration struct
0057   /// @param mlogger logging instance for screen output
0058   explicit DetectorVolumeBuilder(const Config& cfg,
0059                                  std::unique_ptr<const Logger> mlogger =
0060                                      getDefaultLogger("DetectorVolumeBuilder",
0061                                                       Logging::INFO));
0062 
0063   /// Final implementation of a volume builder that is purely defined
0064   /// by an internal and external structure builder
0065   ///
0066   /// @param gctx The geometry context for this call
0067   ///
0068   /// @return an outgoing detector component
0069   DetectorComponent construct(const GeometryContext& gctx) const final;
0070 
0071  private:
0072   /// configuration object
0073   Config m_cfg;
0074 
0075   /// Private access method to the logger
0076   const Logger& logger() const { return *m_logger; }
0077 
0078   /// logging instance
0079   std::unique_ptr<const Logger> m_logger;
0080 };
0081 
0082 }  // namespace Acts::Experimental