Back to home page

EIC code displayed by LXR

 
 

    


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

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/Definitions/Common.hpp"
0013 #include "Acts/Definitions/Direction.hpp"
0014 #include "Acts/Detector/Portal.hpp"
0015 #include "Acts/Geometry/GeometryContext.hpp"
0016 #include "Acts/Utilities/BinningType.hpp"
0017 
0018 #include <map>
0019 #include <memory>
0020 #include <tuple>
0021 #include <vector>
0022 
0023 namespace Acts {
0024 class Direction;
0025 
0026 namespace Experimental {
0027 
0028 class DetectorVolume;
0029 class Portal;
0030 
0031 /// @brief Definition of a portal replacement when building proto containers
0032 ///
0033 /// It consists of the new portal, the index, the direction, the parameters
0034 /// gathered from the sub volumes, the binning description
0035 using PortalReplacement =
0036     std::tuple<std::shared_ptr<Experimental::Portal>, unsigned int, Direction,
0037                std::vector<double>, AxisDirection>;
0038 
0039 namespace detail::PortalHelper {
0040 
0041 /// @brief Method to attach a single detector volume to a portal
0042 ///
0043 /// @param portal is the portal where the detector volume is going to be attached
0044 /// @param volume is the volume that is attached to the portal
0045 /// @param direction is the direction to which it is attached
0046 ///
0047 void attachExternalNavigationDelegate(
0048     Portal& portal, const std::shared_ptr<DetectorVolume>& volume,
0049     const Direction& direction);
0050 
0051 /// @brief Create and attach the multi link updator, the portal will get
0052 /// a volume updator attached, that points to the different sub volumes
0053 /// depending on the global position and binning - single assignment case
0054 ///
0055 /// @param gctx the geometry context
0056 /// @param portal is the portal where the detector volume is going to be attached
0057 /// @param volumes are the volumes that are pointed to
0058 /// @param direction is the direction to which it is attached
0059 /// @param boundaries are the value boundaries
0060 /// @param binning is the binning type
0061 ///
0062 void attachDetectorVolumesUpdater(
0063     const GeometryContext& gctx, Portal& portal,
0064     const std::vector<std::shared_ptr<DetectorVolume>>& volumes,
0065     const Direction& direction, const std::vector<double>& boundaries,
0066     const AxisDirection& binning);
0067 
0068 /// @brief Create and attach the multi link updator, the portal will get
0069 /// a volume updator attached, that points to the different sub volumes
0070 /// depending on the global position and binning
0071 ///
0072 /// @param gctx the geometry context
0073 /// @param volumes are the volumes that are pointed to
0074 /// @param pReplacements are the portal replacements that are newly connected
0075 ///
0076 void attachExternalNavigationDelegates(
0077     const GeometryContext& gctx,
0078     const std::vector<std::shared_ptr<DetectorVolume>>& volumes,
0079     std::vector<PortalReplacement>& pReplacements);
0080 
0081 /// @brief Method that strips out attached volumes from portals and
0082 /// provides them back to the caller.
0083 ///
0084 /// @note it throws an exception if both sides are already taken
0085 ///
0086 /// @param portal the portal to be resolved
0087 ///
0088 /// @return a vector of attached volumes
0089 std::vector<std::shared_ptr<DetectorVolume>> attachedDetectorVolumes(
0090     Portal& portal) noexcept(false);
0091 
0092 /// @brief Method that strips out attached volumes from portals and
0093 /// provides them back to the caller.
0094 ///
0095 /// @param pContainers the portal containers to be resolved
0096 /// @param sides the sides to be handled
0097 /// @param selectedOnly the selected only volumes, e.g. for complex containers
0098 /// to chose only outside skins,
0099 /// @param logLevel the logging level
0100 ///
0101 std::map<unsigned int,
0102          std::vector<std::shared_ptr<Acts::Experimental::DetectorVolume>>>
0103 stripSideVolumes(
0104     const std::vector<std::map<unsigned int, std::shared_ptr<Portal>>>&
0105         pContainers,
0106     const std::vector<unsigned int>& sides,
0107     const std::vector<unsigned int>& selectedOnly = {},
0108     Acts::Logging::Level logLevel = Acts::Logging::INFO);
0109 
0110 }  // namespace detail::PortalHelper
0111 }  // namespace Experimental
0112 }  // namespace Acts