Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:23

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