|
||||
File indexing completed on 2025-01-18 09:27:41
0001 // This file is part of the Acts project. 0002 // 0003 // Copyright (C) 2017-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 0011 #include "Acts/Definitions/Algebra.hpp" 0012 #include "Acts/Definitions/Units.hpp" 0013 #include "Acts/Geometry/GeometryContext.hpp" 0014 #include "Acts/Geometry/ILayerBuilder.hpp" 0015 #include "Acts/Geometry/LayerCreator.hpp" 0016 #include "Acts/Surfaces/Surface.hpp" 0017 #include "Acts/Utilities/BinUtility.hpp" 0018 #include "Acts/Utilities/BinningType.hpp" 0019 #include "Acts/Utilities/Logger.hpp" 0020 0021 #include <memory> 0022 #include <string> 0023 #include <vector> 0024 0025 #include <DD4hep/DetElement.h> 0026 0027 class TGeoMatrix; 0028 0029 namespace Acts { 0030 class LayerCreator; 0031 class Logger; 0032 class Surface; 0033 0034 /// @brief build layers of one cylinder-endcap setup from DD4hep input 0035 /// 0036 /// This class is an implementation of the Acts::ILayerBuilder, 0037 /// creating the central (layers of barrel), the negative and positive layers 0038 /// (layers of endcaps) of one hierarchy (e.g. PixelDetector, StripDetector,...) 0039 /// with input from DD4hep. 0040 0041 class DD4hepLayerBuilder : public ILayerBuilder { 0042 public: 0043 /// @struct Config 0044 /// nested configuration struct for steering of the layer builder 0045 struct Config { 0046 /// string based identification 0047 std::string configurationName = "undefined"; 0048 /// layer creator which is internally used to build layers 0049 std::shared_ptr<const LayerCreator> layerCreator = nullptr; 0050 /// the binning type of the contained surfaces in phi 0051 /// (equidistant/arbitrary) 0052 BinningType bTypePhi = equidistant; 0053 /// the binning type of the contained surfaces in r 0054 /// (equidistant/arbitrary) 0055 BinningType bTypeR = equidistant; 0056 /// the binning type of the contained surfaces in z 0057 /// (equidistant/arbitrary) 0058 BinningType bTypeZ = equidistant; 0059 /// the DD4hep::DetElements of the layers of the negative volume (negative 0060 /// endcap) 0061 /// @note if the current volume has no endcaps or no layers this parameter 0062 /// will not be set 0063 std::vector<dd4hep::DetElement> negativeLayers; 0064 /// the DD4hep::DetElements of the layers of the central volume (barrel) 0065 /// @note if the current volume has no layers this parameter will not be set 0066 std::vector<dd4hep::DetElement> centralLayers; 0067 /// the DD4hep::DetElements of the layers of the positive volume (positive 0068 /// endcap) 0069 /// @note if the current volume has no endcaps or no layers this parameter 0070 /// will not be set 0071 std::vector<dd4hep::DetElement> positiveLayers; 0072 /// In case no surfaces (to be contained by the layer) are handed over, the 0073 /// layer thickness will be set to this value 0074 /// @note Layers containing surfaces per default are not allowed to be 0075 /// attached to each other (navigation will bail at this point). 0076 /// However, to allow material layers (not containing surfaces) to be 0077 /// attached to each other, this default thickness is needed. In this 0078 /// way, the layer will be thin (with space to the next layer), but 0079 /// the material will have the 'real' thickness. 0080 /// @attention The default thickness should be set thin enough that no 0081 /// touching or overlapping with the next layer can happen. 0082 double defaultThickness = UnitConstants::fm; 0083 }; 0084 0085 /// Constructor 0086 /// @param config is the configuration struct 0087 /// @param logger is the logging instance 0088 DD4hepLayerBuilder(const Acts::DD4hepLayerBuilder::Config& config, 0089 std::unique_ptr<const Logger> logger); 0090 /// Destructor 0091 ~DD4hepLayerBuilder() override; 0092 0093 /// LayerBuilder interface method 0094 /// 0095 /// @param gctx the geometry context for this build call 0096 /// 0097 /// @return the layers at negative side 0098 const LayerVector negativeLayers(const GeometryContext& gctx) const final; 0099 0100 /// LayerBuilder interface method 0101 /// 0102 /// @param gctx the geometry context for this build call 0103 /// 0104 /// @return the layers at the central sector 0105 const LayerVector centralLayers(const GeometryContext& gctx) const final; 0106 0107 /// LayerBuilder interface method 0108 /// 0109 /// @param gctx the geometry context for this build call 0110 /// 0111 /// @return the layers at positive side 0112 const LayerVector positiveLayers(const GeometryContext& gctx) const final; 0113 0114 /// Name identification 0115 /// @return the string based identification of this configuration 0116 const std::string& identification() const final; 0117 0118 /// set the configuration object 0119 /// @param config is the configuration struct 0120 void setConfiguration(const Config& config); 0121 0122 /// get the configuration object 0123 Config getConfiguration() const; 0124 0125 /// set logging instance 0126 void setLogger(std::unique_ptr<const Logger> logger); 0127 0128 private: 0129 /// configuration object 0130 Config m_cfg; 0131 0132 /// logging instance 0133 std::unique_ptr<const Logger> m_logger; 0134 0135 /// Private access to the logger 0136 const Logger& logger() const { return *m_logger; } 0137 0138 /// Private helper method to be called for endcap layers 0139 /// 0140 /// @param gctx the geometry context for this build call 0141 /// @param dendcapLayers Vector of detector elements for the endcap layers 0142 /// @param side Which endcap side it is 0143 /// 0144 /// @return the layers for either endcap side 0145 const LayerVector endcapLayers( 0146 const GeometryContext& gctx, 0147 const std::vector<dd4hep::DetElement>& dendcapLayers, 0148 const std::string& side) const; 0149 0150 /// Private helper function collecting all sensitive detector elements of a 0151 /// layer 0152 /// @param detElement the DD4hep::DetElement of the layer 0153 /// @param surfaces the vector of surfaces which should be filled with the 0154 /// sensitive detector elements 0155 void resolveSensitive( 0156 const dd4hep::DetElement& detElement, 0157 std::vector<std::shared_ptr<const Acts::Surface>>& surfaces) const; 0158 0159 /// Private helper function to create a sensitive surface from a given 0160 /// detector element 0161 /// @param detElement the DD4hep::DetElement of sensitive surface to be 0162 /// created 0163 /// @param isDisc in case the sensitive detector module should be translated 0164 /// as disc (e.g. for endcaps) this flag should be set to true 0165 std::shared_ptr<const Acts::Surface> createSensitiveSurface( 0166 const dd4hep::DetElement& detElement, bool isDisc = false) const; 0167 0168 // Private helper function to convert the TGeo transformation matrix into 0169 // an Acts transformation matrix 0170 // @param tGeoTrans TGeo transformation matrix which should be converted 0171 Acts::Transform3 convertTransform(const TGeoMatrix* tGeoTrans) const; 0172 }; 0173 0174 inline const std::string& DD4hepLayerBuilder::identification() const { 0175 return m_cfg.configurationName; 0176 } 0177 0178 inline DD4hepLayerBuilder::Config DD4hepLayerBuilder::getConfiguration() const { 0179 return m_cfg; 0180 } 0181 0182 } // namespace Acts
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |