Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 08:12:16

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 #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   //!< @todo add configuration check
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& /*gctx*/, int side) const {
0055   LayerVector eLayers;
0056   // pos/neg layers
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     // loop through
0063     for (std::size_t ipnl = 0; ipnl < numpnLayers; ++ipnl) {
0064       // some screen output
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       // create the share disc bounds
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       // create the layer transforms
0075       const Transform3 eTransform(
0076           Translation3(0., 0., side * m_cfg.posnegLayerPositionZ.at(ipnl)));
0077       // create the layers
0078       MutableLayerPtr eLayer = DiscLayer::create(
0079           eTransform, dBounds, nullptr, m_cfg.posnegLayerThickness.at(ipnl));
0080 
0081       // assign the material to the layer surface
0082       std::shared_ptr<const ISurfaceMaterial> material = nullptr;
0083       // create the material from jobOptions
0084       if (!m_cfg.posnegLayerMaterial.empty()) {
0085         // create homogeneous material
0086         material = m_cfg.posnegLayerMaterial.at(ipnl);
0087         // sign it to the surface
0088         eLayer->surfaceRepresentation().assignSurfaceMaterial(material);
0089       }
0090       // push it into the layer vector
0091       eLayers.push_back(eLayer);
0092     }
0093   }
0094   return eLayers;
0095 }
0096 
0097 const LayerVector PassiveLayerBuilder::centralLayers(
0098     const GeometryContext& /*gctx*/) const {
0099   LayerVector cLayers;
0100   // the central layers
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     // loop through
0107     for (std::size_t icl = 0; icl < numcLayers; ++icl) {
0108       // some screen output
0109       ACTS_VERBOSE("- build layer "
0110                    << icl
0111                    << " with radius = " << m_cfg.centralLayerRadii.at(icl)
0112                    << " and halfZ = " << m_cfg.centralLayerHalflengthZ.at(icl));
0113       // create the layer and push it back
0114       auto cBounds = std::make_shared<const CylinderBounds>(
0115           m_cfg.centralLayerRadii[icl], m_cfg.centralLayerHalflengthZ.at(icl));
0116       // create the layer
0117       MutableLayerPtr cLayer =
0118           CylinderLayer::create(Transform3::Identity(), cBounds, nullptr,
0119                                 m_cfg.centralLayerThickness.at(icl));
0120       // assign the material to the layer surface
0121       std::shared_ptr<const ISurfaceMaterial> material = nullptr;
0122       // create the material from jobOptions
0123       if (!m_cfg.centralLayerMaterial.empty()) {
0124         // create homogeneous material
0125         material = m_cfg.centralLayerMaterial.at(icl);
0126         // sign it to the surface
0127         cLayer->surfaceRepresentation().assignSurfaceMaterial(material);
0128       }
0129       // push it into the layer vector
0130       cLayers.push_back(cLayer);
0131     }
0132   }
0133   return cLayers;
0134 }
0135 
0136 }  // namespace Acts