Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-14 08:10:57

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/CylinderLayer.hpp"
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/BoundarySurfaceFace.hpp"
0013 #include "Acts/Geometry/CylinderVolumeBounds.hpp"
0014 #include "Acts/Geometry/GenericApproachDescriptor.hpp"
0015 #include "Acts/Geometry/Volume.hpp"
0016 #include "Acts/Geometry/VolumeBounds.hpp"
0017 #include "Acts/Surfaces/Surface.hpp"
0018 
0019 #include <cstddef>
0020 #include <vector>
0021 
0022 namespace Acts {
0023 
0024 using VectorHelpers::phi;
0025 
0026 CylinderLayer::CylinderLayer(
0027     const Transform3& transform,
0028     const std::shared_ptr<const CylinderBounds>& cBounds,
0029     std::unique_ptr<SurfaceArray> surfaceArray, double thickness,
0030     std::unique_ptr<ApproachDescriptor> ades, LayerType laytyp)
0031     : CylinderSurface(transform, cBounds),
0032       Layer(std::move(surfaceArray), thickness, std::move(ades), laytyp) {
0033   // create the representing volume
0034   auto cVolumeBounds = std::make_shared<CylinderVolumeBounds>(
0035       *CylinderSurface::m_bounds, thickness);
0036   // @todo rotate around x for the avePhi if you have a sector
0037   m_representingVolume = std::make_unique<Volume>(*m_transform, cVolumeBounds);
0038 
0039   // associate the layer to the surface
0040   CylinderSurface::associateLayer(*this);
0041   // an approach descriptor is automatically created if there's a surface array
0042   if (!m_approachDescriptor && m_surfaceArray) {
0043     buildApproachDescriptor();
0044   }
0045   // register the layer to the approach descriptor surfaces
0046   if (m_approachDescriptor) {
0047     approachDescriptor()->registerLayer(*this);
0048   }
0049 }
0050 
0051 const CylinderSurface& CylinderLayer::surfaceRepresentation() const {
0052   return (*this);
0053 }
0054 
0055 CylinderSurface& CylinderLayer::surfaceRepresentation() {
0056   return (*this);
0057 }
0058 
0059 void CylinderLayer::buildApproachDescriptor() {
0060   // delete and reset as you build a new one
0061   m_approachDescriptor.reset(nullptr);
0062 
0063   // take the boundary surfaces of the representving volume if they exist
0064   if (m_representingVolume != nullptr) {
0065     // get the boundary surfaces
0066     std::vector<OrientedSurface> bSurfaces =
0067         m_representingVolume->volumeBounds().orientedSurfaces(
0068             m_representingVolume->transform());
0069 
0070     // fill in the surfaces into the vector
0071     std::vector<std::shared_ptr<const Surface>> aSurfaces;
0072     if (bSurfaces.size() > static_cast<std::size_t>(tubeInnerCover)) {
0073       aSurfaces.push_back(bSurfaces.at(tubeInnerCover).surface);
0074     }
0075     aSurfaces.push_back(bSurfaces.at(tubeOuterCover).surface);
0076     // create an ApproachDescriptor with Boundary surfaces
0077     m_approachDescriptor =
0078         std::make_unique<const GenericApproachDescriptor>(std::move(aSurfaces));
0079   }
0080 
0081   for (auto& sfPtr : (m_approachDescriptor->containedSurfaces())) {
0082     if (sfPtr != nullptr) {
0083       auto& mutableSf = *(const_cast<Surface*>(sfPtr));
0084       mutableSf.associateLayer(*this);
0085     }
0086   }
0087 }
0088 
0089 }  // namespace Acts