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