File indexing completed on 2025-04-16 07:59:47
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "ActsExamples/GenericDetector/LayerBuilder.hpp"
0010
0011 namespace ActsExamples::Generic {
0012
0013 const Acts::LayerVector LayerBuilder::centralLayers(
0014 const Acts::GeometryContext& gctx) const {
0015
0016 Acts::LayerVector cLayers;
0017 cLayers.reserve(m_cfg.centralProtoLayers.size());
0018
0019 std::size_t icl = 0;
0020 for (auto& cpl : m_cfg.centralProtoLayers) {
0021
0022 Acts::MutableLayerPtr cLayer = m_cfg.layerCreator->cylinderLayer(
0023 gctx, cpl.surfaces, cpl.bins0, cpl.bins1, cpl.protoLayer);
0024
0025
0026 if (!m_cfg.centralLayerMaterial.empty()) {
0027 std::shared_ptr<const Acts::ISurfaceMaterial> layerMaterialPtr =
0028 m_cfg.centralLayerMaterial.at(icl);
0029
0030 if (m_cfg.centralLayerMaterialConcentration.at(icl) == 0.) {
0031
0032 cLayer->surfaceRepresentation().assignSurfaceMaterial(layerMaterialPtr);
0033 ACTS_VERBOSE("- and material at central layer surface.");
0034 } else {
0035
0036
0037
0038 auto approachSurfaces =
0039 cLayer->approachDescriptor()->containedSurfaces();
0040 if (m_cfg.centralLayerMaterialConcentration.at(icl) > 0) {
0041 auto mutableOuterSurface =
0042 const_cast<Acts::Surface*>(approachSurfaces.at(1));
0043 mutableOuterSurface->assignSurfaceMaterial(layerMaterialPtr);
0044 ACTS_VERBOSE("- and material at outer approach surface");
0045 } else {
0046 auto mutableInnerSurface =
0047 const_cast<Acts::Surface*>(approachSurfaces.at(0));
0048 mutableInnerSurface->assignSurfaceMaterial(layerMaterialPtr);
0049 ACTS_VERBOSE("- and material at inner approach surface");
0050 }
0051 }
0052 }
0053
0054 cLayers.push_back(cLayer);
0055 ++icl;
0056 }
0057 return cLayers;
0058 }
0059
0060 const Acts::LayerVector LayerBuilder::negativeLayers(
0061 const Acts::GeometryContext& gctx) const {
0062 return constructEndcapLayers(gctx, -1);
0063 }
0064
0065 const Acts::LayerVector LayerBuilder::positiveLayers(
0066 const Acts::GeometryContext& gctx) const {
0067 return constructEndcapLayers(gctx, 1);
0068 }
0069
0070 LayerBuilder::LayerBuilder(const Config& cfg,
0071 std::unique_ptr<const Acts::Logger> log)
0072 : Acts::ILayerBuilder(), m_cfg(cfg), m_logger(std::move(log)) {}
0073
0074 const Acts::LayerVector LayerBuilder::constructEndcapLayers(
0075 const Acts::GeometryContext& gctx, int side) const {
0076
0077 const auto& protoLayers =
0078 (side < 0) ? m_cfg.negativeProtoLayers : m_cfg.positiveProtoLayers;
0079
0080
0081 Acts::LayerVector eLayers;
0082 eLayers.reserve(protoLayers.size());
0083
0084
0085 std::size_t ipnl = 0;
0086
0087 for (auto& ple : protoLayers) {
0088
0089 Acts::MutableLayerPtr eLayer = m_cfg.layerCreator->discLayer(
0090 gctx, ple.surfaces, ple.bins0, ple.bins1, ple.protoLayer);
0091
0092
0093 if (!m_cfg.posnegLayerMaterial.empty()) {
0094 std::shared_ptr<const Acts::ISurfaceMaterial> layerMaterialPtr =
0095 m_cfg.posnegLayerMaterial[ipnl];
0096
0097 if (m_cfg.posnegLayerMaterialConcentration.at(ipnl) == 0.) {
0098
0099
0100 eLayer->surfaceRepresentation().assignSurfaceMaterial(layerMaterialPtr);
0101 ACTS_VERBOSE("- and material at central layer surface.");
0102 } else {
0103
0104
0105
0106 auto approachSurfaces =
0107 eLayer->approachDescriptor()->containedSurfaces();
0108 if (m_cfg.posnegLayerMaterialConcentration.at(ipnl) > 0.) {
0109 int sf = side < 0 ? 0 : 1;
0110 auto mutableInnerSurface =
0111 const_cast<Acts::Surface*>(approachSurfaces.at(sf));
0112 mutableInnerSurface->assignSurfaceMaterial(layerMaterialPtr);
0113 ACTS_VERBOSE("- and material at outer approach surfaces.");
0114 } else {
0115 int sf = side < 0 ? 1 : 0;
0116 auto mutableOuterSurface =
0117 const_cast<Acts::Surface*>(approachSurfaces.at(sf));
0118 mutableOuterSurface->assignSurfaceMaterial(layerMaterialPtr);
0119 ACTS_VERBOSE("- and material at inner approach surfaces.");
0120 }
0121 }
0122 }
0123
0124 eLayers.push_back(eLayer);
0125 ++ipnl;
0126 }
0127 return eLayers;
0128 }
0129
0130 }