Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-03 07:52:04

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 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/GeometryContext.hpp"
0013 #include "Acts/Navigation/NavigationState.hpp"
0014 #include "Acts/Surfaces/BoundaryTolerance.hpp"
0015 #include "Acts/Utilities/Intersection.hpp"
0016 
0017 #include <ranges>
0018 #include <vector>
0019 
0020 namespace Acts {
0021 
0022 class Surface;
0023 
0024 namespace Experimental {
0025 
0026 class Portal;
0027 class Detector;
0028 class DetectorVolume;
0029 
0030 /// Filler of the current volume
0031 struct DetectorVolumeFiller {
0032   /// Helper struct that allows to fill a volume into the
0033   /// navigation state, it allows to use common navigation
0034   /// structs for volume, portal, surfaces
0035   ///
0036   /// @param nState the navigation state
0037   /// @param volume the volume that is filled
0038   inline static void fill(NavigationState& nState,
0039                           const DetectorVolume* volume) {
0040     nState.currentVolume = volume;
0041   }
0042 };
0043 
0044 /// Fillers and attachers for surfaces to act on the navigation state
0045 struct SurfacesFiller {
0046   /// Helper struct that allows to fill surfaces into the candidate vector it
0047   /// allows to use common navigation structs for volume, portal, surfaces
0048   ///
0049   /// @param nState the navigation state
0050   /// @param surfaces the surfaces that are filled in
0051   inline static void fill(NavigationState& nState,
0052                           const std::vector<const Surface*>& surfaces) {
0053     std::ranges::for_each(surfaces, [&](const auto& s) {
0054       nState.surfaceCandidates.push_back(NavigationState::SurfaceCandidate{
0055           ObjectIntersection<Surface>::invalid(), s, nullptr,
0056           nState.surfaceBoundaryTolerance});
0057     });
0058   }
0059 };
0060 
0061 /// Fillers and attachers for portals to act on the navigation state
0062 struct PortalsFiller {
0063   /// Helper struct that allows to fill surfaces into the candidate vector it
0064   /// allows to use common navigation structs for volume, portal, surfaces
0065   ///
0066   /// @param nState the navigation state
0067   /// @param portals the portals that are filled in
0068   inline static void fill(NavigationState& nState,
0069                           const std::vector<const Portal*>& portals) {
0070     std::ranges::for_each(portals, [&](const auto& p) {
0071       nState.surfaceCandidates.push_back(NavigationState::SurfaceCandidate{
0072           ObjectIntersection<Surface>::invalid(), nullptr, p,
0073           BoundaryTolerance::None()});
0074     });
0075   }
0076 };
0077 
0078 }  // namespace Experimental
0079 }  // namespace Acts