Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-13 09:21:12

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/detail/BoundDeduplicator.hpp"
0010 
0011 #include "Acts/Geometry/BoundarySurfaceT.hpp"
0012 #include "Acts/Geometry/Portal.hpp"
0013 #include "Acts/Geometry/TrackingVolume.hpp"
0014 #include "Acts/Surfaces/ConeSurface.hpp"
0015 #include "Acts/Surfaces/CylinderBounds.hpp"
0016 #include "Acts/Surfaces/CylinderSurface.hpp"
0017 #include "Acts/Surfaces/DiscSurface.hpp"
0018 #include "Acts/Surfaces/PlanarBounds.hpp"
0019 #include "Acts/Surfaces/PlaneSurface.hpp"
0020 #include "Acts/Surfaces/StrawSurface.hpp"
0021 
0022 #include <format>
0023 
0024 #define IMPL_SURF_DEDUPLICATION(ENUM_CASE, SURFACE_T)   \
0025   case ENUM_CASE: {                                     \
0026     auto& castSurf = dynamic_cast<SURFACE_T&>(surface); \
0027     if (castSurf.boundsPtr()) {                         \
0028       castSurf.assignSurfaceBounds(                     \
0029           m_surfFactory.insert(castSurf.boundsPtr()));  \
0030     }                                                   \
0031     break;                                              \
0032   }
0033 
0034 namespace Acts::detail {
0035 
0036 void BoundDeduplicator::visitVolume(TrackingVolume& volume) {
0037   volume.assignVolumeBounds(m_volFactory.insert(volume.volumeBoundsPtr()));
0038 }
0039 
0040 void BoundDeduplicator::visitPortal(Portal& portal) {
0041   visitSurface(portal.surface());
0042 }
0043 
0044 void BoundDeduplicator::visitSurface(Surface& surface) {
0045   switch (surface.type()) {
0046     using enum Surface::SurfaceType;
0047     IMPL_SURF_DEDUPLICATION(Cone, ConeSurface);
0048     IMPL_SURF_DEDUPLICATION(Cylinder, CylinderSurface);
0049     IMPL_SURF_DEDUPLICATION(Disc, DiscSurface);
0050     IMPL_SURF_DEDUPLICATION(Plane, PlaneSurface);
0051     IMPL_SURF_DEDUPLICATION(Straw, LineSurface);
0052     default:
0053       throw std::invalid_argument(std::format(
0054           "BoundDeduplicator::visitSurface() - The surface {:} is not yet "
0055           "supported",
0056           Surface::s_surfaceTypeNames[toUnderlying(surface.type())]));
0057   }
0058 }
0059 
0060 void BoundDeduplicator::visitBoundarySurface(
0061     BoundarySurfaceT<TrackingVolume>& boundary) {
0062   visitSurface(boundary.surfaceRepresentation());
0063 }
0064 
0065 }  // namespace Acts::detail