Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-13 08:28:01

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/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/IConfinedTrackingVolumeBuilder.hpp"
0013 #include "Acts/Geometry/TrackingVolume.hpp"
0014 #include "Acts/Surfaces/Surface.hpp"
0015 #include "Acts/Utilities/Logger.hpp"
0016 
0017 #include <memory>
0018 #include <string>
0019 #include <vector>
0020 
0021 #include "DD4hep/DetElement.h"
0022 
0023 class TrackingVolume;
0024 namespace Acts {
0025 class Logger;
0026 }  // namespace Acts
0027 
0028 using MutableTrackingVolumePtr = std::shared_ptr<TrackingVolume>;
0029 using MutableTrackingVolumeVector = std::vector<MutableTrackingVolumePtr>;
0030 
0031 class TGeoMatrix;
0032 
0033 namespace Acts {
0034 
0035 /// @brief build confined TrackingVolumes of one cylinder setup from DD4hep
0036 /// input.
0037 ///
0038 /// This class is an implementation of the Acts::IConfinedTrackingVolumeBuilder,
0039 /// creating the central (volumes of barrel), the negative and positive volumes
0040 /// (volumes of endcaps) of one hierarchy (e.g. ECal, HCal...) with input from
0041 /// DD4hep.
0042 
0043 class DD4hepVolumeBuilder : public IConfinedTrackingVolumeBuilder {
0044  public:
0045   /// @struct Config
0046   /// Nested configuration struct for steering of the volume builder
0047   struct Config {
0048     /// string based identification
0049     std::string configurationName = "undefined";
0050     /// Vector of central confined volumes
0051     std::vector<dd4hep::DetElement> centralVolumes;
0052   };
0053 
0054   /// Constructor
0055   /// @param [in] config is the configuration struct
0056   /// @param [in] logger is the logging instance
0057   DD4hepVolumeBuilder(const Acts::DD4hepVolumeBuilder::Config& config,
0058                       std::unique_ptr<const Logger> logger);
0059 
0060   /// Destructor
0061   ~DD4hepVolumeBuilder() override;
0062 
0063   /// @brief Builder method for cylindrical, confined volume
0064   ///
0065   /// @return The vector of TrackingVolumes at the central sector
0066   MutableTrackingVolumeVector centralVolumes() const final;
0067 
0068   /// Name identification
0069   /// @return The string based identification of this configuration
0070   const std::string& identification() const final;
0071 
0072   /// Set the configuration object
0073   /// @param [in] config is the configuration struct
0074   void setConfiguration(const Config& config);
0075 
0076   /// Get the configuration object
0077   /// @return The used configuration struct
0078   Config getConfiguration() const;
0079 
0080   /// Set logging instance
0081   /// @param [in] logger Logger in use
0082   void setLogger(std::unique_ptr<const Logger> logger);
0083 
0084  private:
0085   /// Configuration object
0086   Config m_cfg;
0087 
0088   /// Logging instance
0089   std::unique_ptr<const Logger> m_logger;
0090 
0091   /// Private access to the logger
0092   /// @return Used logger
0093   const Logger& logger() const { return *m_logger; }
0094 
0095   /// @brief Converter of the transformation of a volume from DD4hep to Acts
0096   /// formalism
0097   ///
0098   /// @param [in] tGeoTrans Transformation of the DD4hep DetElement
0099   /// @return Pointer to the corresponding Acts transformation
0100   Acts::Transform3 convertTransform(const TGeoMatrix* tGeoTrans) const;
0101 };
0102 
0103 inline const std::string& DD4hepVolumeBuilder::identification() const {
0104   return m_cfg.configurationName;
0105 }
0106 
0107 inline DD4hepVolumeBuilder::Config DD4hepVolumeBuilder::getConfiguration()
0108     const {
0109   return m_cfg;
0110 }
0111 
0112 }  // namespace Acts