Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:10:55

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