Back to home page

EIC code displayed by LXR

 
 

    


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

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/DiscLayer.hpp"
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/BoundarySurfaceFace.hpp"
0013 #include "Acts/Geometry/BoundarySurfaceT.hpp"
0014 #include "Acts/Geometry/CylinderVolumeBounds.hpp"
0015 #include "Acts/Geometry/GenericApproachDescriptor.hpp"
0016 #include "Acts/Geometry/Layer.hpp"
0017 #include "Acts/Geometry/Volume.hpp"
0018 #include "Acts/Surfaces/RadialBounds.hpp"
0019 #include "Acts/Surfaces/Surface.hpp"
0020 
0021 #include <vector>
0022 
0023 using Acts::VectorHelpers::perp;
0024 using Acts::VectorHelpers::phi;
0025 
0026 Acts::DiscLayer::DiscLayer(const Transform3& transform,
0027                            const std::shared_ptr<const DiscBounds>& dbounds,
0028                            std::unique_ptr<SurfaceArray> surfaceArray,
0029                            double thickness,
0030                            std::unique_ptr<ApproachDescriptor> ades,
0031                            LayerType laytyp)
0032     : DiscSurface(transform, dbounds),
0033       Layer(std::move(surfaceArray), thickness, std::move(ades), laytyp) {
0034   // In case we have Radial bounds
0035   const RadialBounds* rBounds =
0036       dynamic_cast<const RadialBounds*>(DiscSurface::m_bounds.get());
0037   if (rBounds != nullptr) {
0038     // The volume bounds
0039     auto rVolumeBounds =
0040         std::make_shared<CylinderVolumeBounds>(*rBounds, thickness);
0041     // @todo rotate around x for the avePhi if you have a sector
0042     m_representingVolume =
0043         std::make_unique<Volume>(*m_transform, rVolumeBounds);
0044   }
0045   // associate the layer to the layer surface itself
0046   DiscSurface::associateLayer(*this);
0047   // build an approach descriptor if none provided
0048   if (!m_approachDescriptor && m_surfaceArray) {
0049     buildApproachDescriptor();
0050   }
0051   // register the layer to the approach descriptor
0052   if (m_approachDescriptor) {
0053     approachDescriptor()->registerLayer(*this);
0054   }
0055 }
0056 
0057 const Acts::DiscSurface& Acts::DiscLayer::surfaceRepresentation() const {
0058   return (*this);
0059 }
0060 
0061 Acts::DiscSurface& Acts::DiscLayer::surfaceRepresentation() {
0062   return (*this);
0063 }
0064 
0065 void Acts::DiscLayer::buildApproachDescriptor() {
0066   // delete it
0067   m_approachDescriptor.reset(nullptr);
0068   // take the boundary surfaces of the representving volume if they exist
0069   if (m_representingVolume != nullptr) {
0070     // get the boundary surfaces
0071     std::vector<OrientedSurface> bSurfaces =
0072         m_representingVolume->volumeBounds().orientedSurfaces(
0073             m_representingVolume->transform());
0074     // fill in the surfaces into the vector
0075     std::vector<std::shared_ptr<const Surface>> aSurfaces;
0076     aSurfaces.push_back(bSurfaces.at(negativeFaceXY).surface);
0077     aSurfaces.push_back(bSurfaces.at(positiveFaceXY).surface);
0078     aSurfaces.push_back(bSurfaces.at(tubeInnerCover).surface);
0079     aSurfaces.push_back(bSurfaces.at(tubeOuterCover).surface);
0080     // create an ApproachDescriptor with Boundary surfaces
0081     m_approachDescriptor =
0082         std::make_unique<const GenericApproachDescriptor>(std::move(aSurfaces));
0083   }
0084 
0085   // @todo check if we can give the layer at curface creation
0086   for (auto& sfPtr : (m_approachDescriptor->containedSurfaces())) {
0087     if (sfPtr != nullptr) {
0088       auto& mutableSf = *(const_cast<Surface*>(sfPtr));
0089       mutableSf.associateLayer(*this);
0090     }
0091   }
0092 }