Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-05 08:11:30

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/.
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 
0019 #include <cstddef>
0020 #include <ostream>
0021 #include <utility>
0022 
0023 namespace Acts {
0024 
0025 PassiveLayerBuilder::PassiveLayerBuilder(
0026     const PassiveLayerBuilder::Config& plConfig,
0027     std::unique_ptr<const Logger> logger)
0028     : m_cfg(), m_logger(std::move(logger)) {
0029   setConfiguration(plConfig);
0030 }
0031 
0032 void PassiveLayerBuilder::setConfiguration(
0033     const PassiveLayerBuilder::Config& plConfig) {
0034   //!< @todo add configuration check
0035   m_cfg = plConfig;
0036 }
0037 
0038 void PassiveLayerBuilder::setLogger(std::unique_ptr<const Logger> newLogger) {
0039   m_logger = std::move(newLogger);
0040 }
0041 
0042 const LayerVector PassiveLayerBuilder::positiveLayers(
0043     const GeometryContext& gctx) const {
0044   return endcapLayers(gctx, 1);
0045 }
0046 
0047 const LayerVector PassiveLayerBuilder::negativeLayers(
0048     const GeometryContext& gctx) const {
0049   return endcapLayers(gctx, -1);
0050 }
0051 
0052 const LayerVector PassiveLayerBuilder::endcapLayers(
0053     const GeometryContext& /*gctx*/, int side) const {
0054   LayerVector eLayers;
0055   // pos/neg layers
0056   std::size_t numpnLayers = m_cfg.posnegLayerPositionZ.size();
0057   if (numpnLayers != 0u) {
0058     ACTS_DEBUG("Configured to build " << numpnLayers
0059                                       << " passive layers on side :" << side);
0060     eLayers.reserve(numpnLayers);
0061     // loop through
0062     for (std::size_t ipnl = 0; ipnl < numpnLayers; ++ipnl) {
0063       // some screen output
0064       ACTS_VERBOSE("- build layers "
0065                    << (ipnl)
0066                    << " at  = " << side * m_cfg.posnegLayerPositionZ.at(ipnl)
0067                    << " and rMin/rMax = " << m_cfg.posnegLayerRmin.at(ipnl)
0068                    << " / " << m_cfg.posnegLayerRmax.at(ipnl));
0069       // create the share disc bounds
0070       std::shared_ptr<const DiscBounds> dBounds =
0071           std::make_shared<const RadialBounds>(m_cfg.posnegLayerRmin.at(ipnl),
0072                                                m_cfg.posnegLayerRmax.at(ipnl));
0073       // create the layer transforms
0074       const Transform3 eTransform(
0075           Translation3(0., 0., side * m_cfg.posnegLayerPositionZ.at(ipnl)));
0076       // create the layers
0077       MutableLayerPtr eLayer = DiscLayer::create(
0078           eTransform, dBounds, nullptr, m_cfg.posnegLayerThickness.at(ipnl));
0079 
0080       // assign the material to the layer surface
0081       std::shared_ptr<const ISurfaceMaterial> material = nullptr;
0082       // create the material from jobOptions
0083       if (!m_cfg.posnegLayerMaterial.empty()) {
0084         // create homogeneous material
0085         material = m_cfg.posnegLayerMaterial.at(ipnl);
0086         // sign it to the surface
0087         eLayer->surfaceRepresentation().assignSurfaceMaterial(material);
0088       }
0089       // push it into the layer vector
0090       eLayers.push_back(eLayer);
0091     }
0092   }
0093   return eLayers;
0094 }
0095 
0096 const LayerVector PassiveLayerBuilder::centralLayers(
0097     const GeometryContext& /*gctx*/) const {
0098   LayerVector cLayers;
0099   // the central layers
0100   std::size_t numcLayers = m_cfg.centralLayerRadii.size();
0101   if (numcLayers != 0u) {
0102     ACTS_DEBUG("Configured to build " << numcLayers
0103                                       << " passive central layers.");
0104     cLayers.reserve(numcLayers);
0105     // loop through
0106     for (std::size_t icl = 0; icl < numcLayers; ++icl) {
0107       // some screen output
0108       ACTS_VERBOSE("- build layer "
0109                    << icl
0110                    << " with radius = " << m_cfg.centralLayerRadii.at(icl)
0111                    << " and halfZ = " << m_cfg.centralLayerHalflengthZ.at(icl));
0112       // create the layer and push it back
0113       auto cBounds = std::make_shared<const CylinderBounds>(
0114           m_cfg.centralLayerRadii[icl], m_cfg.centralLayerHalflengthZ.at(icl));
0115       // create the layer
0116       MutableLayerPtr cLayer =
0117           CylinderLayer::create(Transform3::Identity(), cBounds, nullptr,
0118                                 m_cfg.centralLayerThickness.at(icl));
0119       // assign the material to the layer surface
0120       std::shared_ptr<const ISurfaceMaterial> material = nullptr;
0121       // create the material from jobOptions
0122       if (!m_cfg.centralLayerMaterial.empty()) {
0123         // create homogeneous material
0124         material = m_cfg.centralLayerMaterial.at(icl);
0125         // sign it to the surface
0126         cLayer->surfaceRepresentation().assignSurfaceMaterial(material);
0127       }
0128       // push it into the layer vector
0129       cLayers.push_back(cLayer);
0130     }
0131   }
0132   return cLayers;
0133 }
0134 
0135 }  // namespace Acts