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