File indexing completed on 2025-01-18 09:11:23
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Geometry/PassiveLayerBuilder.hpp"
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/CylinderLayer.hpp"
0013 #include "Acts/Geometry/DiscLayer.hpp"
0014 #include "Acts/Geometry/Layer.hpp"
0015 #include "Acts/Surfaces/CylinderBounds.hpp"
0016 #include "Acts/Surfaces/RadialBounds.hpp"
0017 #include "Acts/Surfaces/Surface.hpp"
0018 #include "Acts/Surfaces/SurfaceArray.hpp"
0019
0020 #include <cstddef>
0021 #include <ostream>
0022 #include <utility>
0023
0024 namespace Acts {
0025 class DiscBounds;
0026 }
0027
0028 Acts::PassiveLayerBuilder::PassiveLayerBuilder(
0029 const PassiveLayerBuilder::Config& plConfig,
0030 std::unique_ptr<const Logger> logger)
0031 : m_cfg(), m_logger(std::move(logger)) {
0032 setConfiguration(plConfig);
0033 }
0034
0035 void Acts::PassiveLayerBuilder::setConfiguration(
0036 const PassiveLayerBuilder::Config& plConfig) {
0037
0038 m_cfg = plConfig;
0039 }
0040
0041 void Acts::PassiveLayerBuilder::setLogger(
0042 std::unique_ptr<const Logger> newLogger) {
0043 m_logger = std::move(newLogger);
0044 }
0045
0046 const Acts::LayerVector Acts::PassiveLayerBuilder::positiveLayers(
0047 const GeometryContext& gctx) const {
0048 return endcapLayers(gctx, 1);
0049 }
0050
0051 const Acts::LayerVector Acts::PassiveLayerBuilder::negativeLayers(
0052 const GeometryContext& gctx) const {
0053 return endcapLayers(gctx, -1);
0054 }
0055
0056 const Acts::LayerVector Acts::PassiveLayerBuilder::endcapLayers(
0057 const Acts::GeometryContext& , int side) const {
0058 LayerVector eLayers;
0059
0060 std::size_t numpnLayers = m_cfg.posnegLayerPositionZ.size();
0061 if (numpnLayers != 0u) {
0062 ACTS_DEBUG("Configured to build " << numpnLayers
0063 << " passive layers on side :" << side);
0064 eLayers.reserve(numpnLayers);
0065
0066 for (std::size_t ipnl = 0; ipnl < numpnLayers; ++ipnl) {
0067
0068 ACTS_VERBOSE("- build layers "
0069 << (ipnl)
0070 << " at = " << side * m_cfg.posnegLayerPositionZ.at(ipnl)
0071 << " and rMin/rMax = " << m_cfg.posnegLayerRmin.at(ipnl)
0072 << " / " << m_cfg.posnegLayerRmax.at(ipnl));
0073
0074 std::shared_ptr<const DiscBounds> dBounds =
0075 std::make_shared<const RadialBounds>(m_cfg.posnegLayerRmin.at(ipnl),
0076 m_cfg.posnegLayerRmax.at(ipnl));
0077
0078 const Transform3 eTransform(
0079 Translation3(0., 0., side * m_cfg.posnegLayerPositionZ.at(ipnl)));
0080
0081 MutableLayerPtr eLayer = DiscLayer::create(
0082 eTransform, dBounds, nullptr, m_cfg.posnegLayerThickness.at(ipnl));
0083
0084
0085 std::shared_ptr<const ISurfaceMaterial> material = nullptr;
0086
0087 if (!m_cfg.posnegLayerMaterial.empty()) {
0088
0089 material = m_cfg.posnegLayerMaterial.at(ipnl);
0090
0091 eLayer->surfaceRepresentation().assignSurfaceMaterial(material);
0092 }
0093
0094 eLayers.push_back(eLayer);
0095 }
0096 }
0097 return eLayers;
0098 }
0099
0100 const Acts::LayerVector Acts::PassiveLayerBuilder::centralLayers(
0101 const Acts::GeometryContext& ) const {
0102 LayerVector cLayers;
0103
0104 std::size_t numcLayers = m_cfg.centralLayerRadii.size();
0105 if (numcLayers != 0u) {
0106 ACTS_DEBUG("Configured to build " << numcLayers
0107 << " passive central layers.");
0108 cLayers.reserve(numcLayers);
0109
0110 for (std::size_t icl = 0; icl < numcLayers; ++icl) {
0111
0112 ACTS_VERBOSE("- build layer "
0113 << icl
0114 << " with radius = " << m_cfg.centralLayerRadii.at(icl)
0115 << " and halfZ = " << m_cfg.centralLayerHalflengthZ.at(icl));
0116
0117 auto cBounds = std::make_shared<const CylinderBounds>(
0118 m_cfg.centralLayerRadii[icl], m_cfg.centralLayerHalflengthZ.at(icl));
0119
0120 MutableLayerPtr cLayer =
0121 CylinderLayer::create(Transform3::Identity(), cBounds, nullptr,
0122 m_cfg.centralLayerThickness.at(icl));
0123
0124 std::shared_ptr<const ISurfaceMaterial> material = nullptr;
0125
0126 if (!m_cfg.centralLayerMaterial.empty()) {
0127
0128 material = m_cfg.centralLayerMaterial.at(icl);
0129
0130 cLayer->surfaceRepresentation().assignSurfaceMaterial(material);
0131 }
0132
0133 cLayers.push_back(cLayer);
0134 }
0135 }
0136 return cLayers;
0137 }