Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PassiveLayerBuilder.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PassiveLayerBuilder.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
10 
14 #include "Acts/Geometry/Layer.hpp"
19 
20 #include <cstddef>
21 #include <ostream>
22 #include <utility>
23 
24 namespace Acts {
25 class DiscBounds;
26 } // namespace Acts
27 
29  const PassiveLayerBuilder::Config& plConfig,
30  std::unique_ptr<const Logger> logger)
31  : m_cfg(), m_logger(std::move(logger)) {
32  setConfiguration(plConfig);
33 }
34 
36  const PassiveLayerBuilder::Config& plConfig) {
38  m_cfg = plConfig;
39 }
40 
42  std::unique_ptr<const Logger> newLogger) {
43  m_logger = std::move(newLogger);
44 }
45 
47  const GeometryContext& gctx) const {
48  return endcapLayers(gctx, 1);
49 }
50 
52  const GeometryContext& gctx) const {
53  return endcapLayers(gctx, -1);
54 }
55 
57  const Acts::GeometryContext& /*gctx*/, int side) const {
58  LayerVector eLayers;
59  // pos/neg layers
60  size_t numpnLayers = m_cfg.posnegLayerPositionZ.size();
61  if (numpnLayers != 0u) {
62  ACTS_DEBUG("Configured to build " << numpnLayers
63  << " passive layers on side :" << side);
64  eLayers.reserve(numpnLayers);
65  // loop through
66  for (size_t ipnl = 0; ipnl < numpnLayers; ++ipnl) {
67  // some screen output
68  ACTS_VERBOSE("- build layers "
69  << (ipnl)
70  << " at = " << side * m_cfg.posnegLayerPositionZ.at(ipnl)
71  << " and rMin/rMax = " << m_cfg.posnegLayerRmin.at(ipnl)
72  << " / " << m_cfg.posnegLayerRmax.at(ipnl));
73  // create the share disc bounds
74  std::shared_ptr<const DiscBounds> dBounds =
75  std::make_shared<const RadialBounds>(m_cfg.posnegLayerRmin.at(ipnl),
76  m_cfg.posnegLayerRmax.at(ipnl));
77  // create the layer transforms
78  const Transform3 eTransform(
79  Translation3(0., 0., side * m_cfg.posnegLayerPositionZ.at(ipnl)));
80  // create the layers
82  eTransform, dBounds, nullptr, m_cfg.posnegLayerThickness.at(ipnl));
83 
84  // assign the material to the layer surface
85  std::shared_ptr<const ISurfaceMaterial> material = nullptr;
86  // create the material from jobOptions
87  if (!m_cfg.posnegLayerMaterial.empty()) {
88  // create homogeneous material
89  material = m_cfg.posnegLayerMaterial.at(ipnl);
90  // sign it to the surface
91  eLayer->surfaceRepresentation().assignSurfaceMaterial(material);
92  }
93  // push it into the layer vector
94  eLayers.push_back(eLayer);
95  }
96  }
97  return eLayers;
98 }
99 
101  const Acts::GeometryContext& /*gctx*/) const {
102  LayerVector cLayers;
103  // the central layers
104  size_t numcLayers = m_cfg.centralLayerRadii.size();
105  if (numcLayers != 0u) {
106  ACTS_DEBUG("Configured to build " << numcLayers
107  << " passive central layers.");
108  cLayers.reserve(numcLayers);
109  // loop through
110  for (size_t icl = 0; icl < numcLayers; ++icl) {
111  // some screen output
112  ACTS_VERBOSE("- build layer "
113  << icl
114  << " with radius = " << m_cfg.centralLayerRadii.at(icl)
115  << " and halfZ = " << m_cfg.centralLayerHalflengthZ.at(icl));
116  // create the layer and push it back
117  auto cBounds = std::make_shared<const CylinderBounds>(
118  m_cfg.centralLayerRadii[icl], m_cfg.centralLayerHalflengthZ.at(icl));
119  // create the layer
120  MutableLayerPtr cLayer =
121  CylinderLayer::create(Transform3::Identity(), cBounds, nullptr,
122  m_cfg.centralLayerThickness.at(icl));
123  // assign the material to the layer surface
124  std::shared_ptr<const ISurfaceMaterial> material = nullptr;
125  // create the material from jobOptions
126  if (!m_cfg.centralLayerMaterial.empty()) {
127  // create homogeneous material
128  material = m_cfg.centralLayerMaterial.at(icl);
129  // sign it to the surface
130  cLayer->surfaceRepresentation().assignSurfaceMaterial(material);
131  }
132  // push it into the layer vector
133  cLayers.push_back(cLayer);
134  }
135  }
136  return cLayers;
137 }