Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:27:41

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 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/Blueprint.hpp"
0012 #include "Acts/Detector/Detector.hpp"
0013 #include "Acts/Geometry/GeometryContext.hpp"
0014 #include "Acts/Plugins/DD4hep/DD4hepDetectorElement.hpp"
0015 #include "Acts/Utilities/Logger.hpp"
0016 
0017 #include <memory>
0018 #include <string>
0019 #include <tuple>
0020 
0021 namespace dd4hep {
0022 class DetElement;
0023 }
0024 
0025 namespace Acts {
0026 
0027 class IMaterialDecorator;
0028 
0029 namespace Experimental {
0030 
0031 /// @brief This class allows to generate layer structure builders for dd4hep sub detectors
0032 /// It performs an intermediate step by taking dd4hep::DetElemnent objects that
0033 /// describe a detector structure and prepares the translation of the detector
0034 /// element and eventual passive surfaces.
0035 ///
0036 /// It would also build passive support structures if configured to do so.
0037 ///
0038 class DD4hepDetectorStructure {
0039  public:
0040   /// @brief  Nested options struct for the building
0041   struct Options {
0042     /// The log level of the tools
0043     Logging::Level logLevel = Logging::INFO;
0044     /// If this string is not empty, the detector is not built, but only
0045     /// a building graph is generated as `.dot` file with the given name
0046     std::string emulateToGraph = "";
0047     /// A Top level geometry id generator
0048     std::shared_ptr<const IGeometryIdGenerator> geoIdGenerator = nullptr;
0049     /// A Top level material decorator
0050     std::shared_ptr<const IMaterialDecorator> materialDecorator = nullptr;
0051   };
0052 
0053   /// Constructor with from file name
0054   ///
0055   /// @param logger is the screen output logger
0056   ///
0057   /// @note this needs to be provided
0058   DD4hepDetectorStructure(std::unique_ptr<const Logger> logger =
0059                               getDefaultLogger("DD4hepLayerStructure",
0060                                                Acts::Logging::INFO));
0061 
0062   DD4hepDetectorStructure() = delete;
0063 
0064   /// @brief This method builds a DD4hep detector
0065   ///
0066   /// @param gctx the geometry context
0067   /// @param dd4hepElement is the dd4hep::DetElement of the world volume
0068   /// @param options is the options struct
0069   ///
0070   /// @note the lifetime of the detector elements in the returned store
0071   /// has to exceed the lifetime of the detector for memory management
0072   /// reasons.
0073   ///
0074   /// @return a detector, and the detector element store
0075   std::tuple<std::shared_ptr<const Detector>, DD4hepDetectorElement::Store>
0076   construct(const GeometryContext& gctx,
0077             const dd4hep::DetElement& dd4hepElement,
0078             const Options& options) const;
0079 
0080  private:
0081   /// Logging instance
0082   std::unique_ptr<const Logger> m_logger;
0083 
0084   /// Private access to the logger
0085   const Logger& logger() const { return *m_logger; }
0086 };
0087 
0088 }  // namespace Experimental
0089 }  // namespace Acts