|
||||
File indexing completed on 2024-11-15 09:01:32
0001 // This file is part of the Acts project. 0002 // 0003 // Copyright (C) 2016-2020 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 http://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/Geometry/GeometryIdentifier.hpp" 0014 #include "Acts/Geometry/TrackingVolume.hpp" 0015 #include "Acts/Geometry/TrackingVolumeVisitorConcept.hpp" 0016 #include "Acts/Surfaces/SurfaceVisitorConcept.hpp" 0017 #include "Acts/Utilities/Concepts.hpp" 0018 #include "Acts/Utilities/Logger.hpp" 0019 0020 #include <memory> 0021 #include <string> 0022 #include <unordered_map> 0023 #include <utility> 0024 0025 namespace Acts { 0026 0027 class Layer; 0028 class Surface; 0029 class PerigeeSurface; 0030 class IMaterialDecorator; 0031 class TrackingVolume; 0032 0033 using TrackingVolumePtr = std::shared_ptr<const TrackingVolume>; 0034 using MutableTrackingVolumePtr = std::shared_ptr<TrackingVolume>; 0035 0036 /// @class TrackingGeometry 0037 /// 0038 /// The TrackingGeometry class is the owner of the constructed TrackingVolumes. 0039 /// 0040 /// It enables both, a global search for an asociatedVolume 0041 /// (respectively, if existing, a global search of an associated Layer or the 0042 /// next associated Layer), such as a continuous navigation by BoundarySurfaces 0043 /// between the confined TrackingVolumes. 0044 class TrackingGeometry { 0045 /// Give the GeometryBuilder friend rights 0046 friend class TrackingGeometryBuilder; 0047 0048 public: 0049 /// Constructor 0050 /// 0051 /// @param highestVolume is the world volume 0052 /// @param materialDecorator is a dediated decorator that can assign 0053 /// surface or volume based material to the TrackingVolume 0054 /// @param hook Identifier hook to be applied to surfaces 0055 /// @param logger instance of a logger (defaulting to the "silent" one) 0056 TrackingGeometry(const MutableTrackingVolumePtr& highestVolume, 0057 const IMaterialDecorator* materialDecorator = nullptr, 0058 const GeometryIdentifierHook& hook = {}, 0059 const Logger& logger = getDummyLogger()); 0060 0061 /// Destructor 0062 ~TrackingGeometry(); 0063 0064 /// Access to the world volume 0065 /// @return plain pointer to the world volume 0066 const TrackingVolume* highestTrackingVolume() const; 0067 0068 /// Access to the world volume 0069 /// @return shared pointer to the world volume 0070 const std::shared_ptr<const TrackingVolume>& highestTrackingVolumeShared() 0071 const; 0072 0073 /// return the lowest tracking Volume 0074 /// 0075 /// @param gctx The current geometry context object, e.g. alignment 0076 /// @param gp is the global position of the call 0077 /// 0078 /// @return plain pointer to the lowest TrackingVolume 0079 const TrackingVolume* lowestTrackingVolume(const GeometryContext& gctx, 0080 const Vector3& gp) const; 0081 0082 /// Forward the associated Layer information 0083 /// 0084 /// @param gctx is the context for this request (e.g. alignment) 0085 /// @param gp is the global position of the call 0086 /// 0087 /// @return plain pointer to assocaiated layer 0088 const Layer* associatedLayer(const GeometryContext& gctx, 0089 const Vector3& gp) const; 0090 0091 /// Register the beam tube 0092 /// 0093 /// @param beam is the beam line surface 0094 void registerBeamTube(std::shared_ptr<const PerigeeSurface> beam); 0095 0096 /// @brief surface representing the beam pipe 0097 /// 0098 /// @note The ownership is not passed, e.g. do not delete the pointer 0099 /// 0100 /// @return raw pointer to surface representing the beam pipe 0101 /// (could be a null pointer) 0102 const Surface* getBeamline() const; 0103 0104 /// @brief Visit all reachable surfaces 0105 /// 0106 /// @tparam visitor_t Type of the callable visitor 0107 /// 0108 /// @param visitor The callable. Will be called for each reachable surface 0109 /// that is found, a selection of the surfaces can be done in the visitor 0110 /// @param restrictToSensitives If true, only sensitive surfaces are visited 0111 /// 0112 /// @note If a context is needed for the visit, the vistitor has to provide 0113 /// this, e.g. as a private member 0114 template <ACTS_CONCEPT(SurfaceVisitor) visitor_t> 0115 void visitSurfaces(visitor_t&& visitor, bool restrictToSensitives) const { 0116 highestTrackingVolume()->template visitSurfaces<visitor_t>( 0117 std::forward<visitor_t>(visitor), restrictToSensitives); 0118 } 0119 0120 /// @brief Visit all sensitive surfaces 0121 /// 0122 /// @tparam visitor_t Type of the callable visitor 0123 /// 0124 /// @param visitor The callable. Will be called for each sensitive surface 0125 /// that is found, a selection of the surfaces can be done in the visitor 0126 /// 0127 /// @note If a context is needed for the visit, the vistitor has to provide 0128 /// this, e.g. as a private member 0129 template <ACTS_CONCEPT(SurfaceVisitor) visitor_t> 0130 void visitSurfaces(visitor_t&& visitor) const { 0131 visitSurfaces(std::forward<visitor_t>(visitor), true); 0132 } 0133 0134 /// @brief Visit all reachable tracking volumes 0135 /// 0136 /// @tparam visitor_t Type of the callable visitor 0137 /// 0138 /// @param visitor The callable. Will be called for each reachable volume 0139 /// that is found, a selection of the volumes can be done in the visitor 0140 /// 0141 /// @note If a context is needed for the visit, the vistitor has to provide 0142 /// this, e.g. as a private member 0143 template <ACTS_CONCEPT(TrackingVolumeVisitor) visitor_t> 0144 void visitVolumes(visitor_t&& visitor) const { 0145 highestTrackingVolume()->template visitVolumes<visitor_t>( 0146 std::forward<visitor_t>(visitor)); 0147 } 0148 0149 /// Search for a volume with the given identifier. 0150 /// 0151 /// @param id is the geometry identifier of the volume 0152 /// @retval nullptr if no such volume exists 0153 /// @retval pointer to the found volume otherwise. 0154 const TrackingVolume* findVolume(GeometryIdentifier id) const; 0155 0156 /// Search for a surface with the given identifier. 0157 /// 0158 /// @param id is the geometry identifier of the surface 0159 /// @retval nullptr if no such surface exists 0160 /// @retval pointer to the found surface otherwise. 0161 const Surface* findSurface(GeometryIdentifier id) const; 0162 0163 private: 0164 // the known world 0165 TrackingVolumePtr m_world; 0166 // beam line 0167 std::shared_ptr<const PerigeeSurface> m_beam; 0168 // lookup containers 0169 std::unordered_map<GeometryIdentifier, const TrackingVolume*> m_volumesById; 0170 std::unordered_map<GeometryIdentifier, const Surface*> m_surfacesById; 0171 }; 0172 0173 } // namespace Acts
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |