![]() |
|
|||
File indexing completed on 2025-07-03 07:52:01
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/ApproachDescriptor.hpp" 0013 #include "Acts/Geometry/GeometryContext.hpp" 0014 #include "Acts/Geometry/GeometryIdentifier.hpp" 0015 #include "Acts/Geometry/GeometryObject.hpp" 0016 #include "Acts/Geometry/Volume.hpp" 0017 #include "Acts/Material/IMaterialDecorator.hpp" 0018 #include "Acts/Surfaces/BoundaryTolerance.hpp" 0019 #include "Acts/Surfaces/SurfaceArray.hpp" 0020 #include "Acts/Utilities/BinnedArray.hpp" 0021 #include "Acts/Utilities/Intersection.hpp" 0022 #include "Acts/Utilities/Logger.hpp" 0023 0024 #include <memory> 0025 #include <utility> 0026 0027 namespace Acts { 0028 0029 class Surface; 0030 class ISurfaceMaterial; 0031 class BinUtility; 0032 class Volume; 0033 class VolumeBounds; 0034 class TrackingVolume; 0035 class ApproachDescriptor; 0036 class IMaterialDecorator; 0037 template <typename object_t> 0038 struct NavigationOptions; 0039 0040 // Simple surface intersection 0041 using SurfaceIntersection = ObjectIntersection<Surface>; 0042 0043 // master typedef 0044 class Layer; 0045 0046 using LayerPtr = std::shared_ptr<const Layer>; 0047 using MutableLayerPtr = std::shared_ptr<Layer>; 0048 using NextLayers = std::pair<const Layer*, const Layer*>; 0049 0050 /// @enum LayerType 0051 /// 0052 /// For code readability, it distinguishes between different 0053 /// type of layers, which steers the behaviour in the navigation 0054 enum LayerType { navigation = -1, passive = 0, active = 1 }; 0055 0056 /// @class Layer 0057 /// 0058 /// Base Class for a Detector Layer in the Tracking Geometry 0059 /// 0060 /// An actual implemented Detector Layer inheriting from this base 0061 /// class has to inherit from a specific type of Surface as well. 0062 /// In addition, a Layer can carry: 0063 /// 0064 /// A SurfaceArray of Surfaces holding the actual detector elements or 0065 /// subSurfaces. 0066 /// A pointer to the TrackingVolume (can only be set by such) 0067 /// An active/passive code : 0068 /// 0 - active 0069 /// 1 - passive 0070 /// [....] - other 0071 /// 0072 /// The search type for compatible surfaces on a layer is 0073 /// [ the higher the number, the faster ]: 0074 /// --------- Layer internal ------------------------------------------------ 0075 /// -1 - provide all intersection tested without boundary check 0076 /// 0 - provide all intersection tested with boundary check 0077 /// 1 - provide overlap descriptor based without boundary check 0078 /// 2 - provide overlap descriptor based with boundary check 0079 /// 0080 /// A layer can have substructure regarding: 0081 /// - m_ssRepresentingSurface -> always exists (1), can have material (2) 0082 /// - m_ssSensitiveSurfaces -> can or not exist (0,1), can have material (2) 0083 /// - m_ssApproachSurfaces -> can or not exist (0,1) cam have material (2) 0084 /// 0085 class Layer : public virtual GeometryObject { 0086 /// Declare the TrackingVolume as a friend, to be able to register previous, 0087 /// next and set the enclosing TrackingVolume 0088 friend class TrackingVolume; 0089 friend class Gen1GeometryClosureVisitor; 0090 0091 public: 0092 /// Default Constructor - deleted 0093 Layer() = delete; 0094 0095 /// Copy Constructor - deleted 0096 Layer(const Layer&) = delete; 0097 0098 /// Destructor 0099 virtual ~Layer() = default; 0100 0101 /// Assignment operator - forbidden, layer assignment must not be ambiguous 0102 /// 0103 /// @param layer is the source layer for assignment 0104 Layer& operator=(const Layer& layer) = delete; 0105 0106 /// Return the entire SurfaceArray, returns a nullptr if no SurfaceArray 0107 const SurfaceArray* surfaceArray() const; 0108 0109 /// Non-const version 0110 SurfaceArray* surfaceArray(); 0111 0112 /// Transforms the layer into a Surface representation for extrapolation 0113 /// @note the layer can be hosting many surfaces, but this is the global 0114 /// one to which one can extrapolate 0115 virtual const Surface& surfaceRepresentation() const = 0; 0116 0117 // Non-const version 0118 virtual Surface& surfaceRepresentation() = 0; 0119 0120 /// Return the Thickness of the Layer 0121 /// this is by definition along the normal vector of the surfaceRepresentation 0122 double thickness() const; 0123 0124 /// geometrical isOnLayer() method 0125 /// 0126 /// @note using isOnSurface() with Layer specific tolerance 0127 /// 0128 /// @param gctx The current geometry context object, e.g. alignment 0129 /// @param position is the global position to be checked 0130 /// @param boundaryTolerance is the boundary check directive 0131 /// 0132 /// @return boolean that indicates success of the operation 0133 virtual bool isOnLayer(const GeometryContext& gctx, const Vector3& position, 0134 const BoundaryTolerance& boundaryTolerance = 0135 BoundaryTolerance::None()) const; 0136 0137 /// Return method for the approach descriptor, can be nullptr 0138 const ApproachDescriptor* approachDescriptor() const; 0139 0140 /// Non-const version of the approach descriptor 0141 ApproachDescriptor* approachDescriptor(); 0142 0143 /// Accept layer according to the following collection directives 0144 /// 0145 /// @tparam options_t Type of the options for navigation 0146 /// 0147 /// @return a boolean whether the layer is accepted for processing 0148 template <typename options_t> 0149 bool resolve(const options_t& options) const { 0150 return resolve(options.resolveSensitive, options.resolveMaterial, 0151 options.resolvePassive); 0152 } 0153 0154 /// Accept layer according to the following collection directives 0155 /// 0156 /// @param resolveSensitive is the prescription to find the sensitive surfaces 0157 /// @param resolveMaterial is the precription to find material surfaces 0158 /// @param resolvePassive is the prescription to find all passive surfaces 0159 /// 0160 /// @return a boolean whether the layer is accepted for processing 0161 virtual bool resolve(bool resolveSensitive, bool resolveMaterial, 0162 bool resolvePassive) const; 0163 0164 /// @brief Decompose Layer into (compatible) surfaces 0165 /// 0166 /// @param gctx The current geometry context object, e.g. alignment 0167 /// @param position Position parameter for searching 0168 /// @param direction Direction of the parameters for searching 0169 /// @param options The navigation options 0170 /// 0171 /// @return list of intersection of surfaces on the layer 0172 boost::container::small_vector<SurfaceIntersection, 10> compatibleSurfaces( 0173 const GeometryContext& gctx, const Vector3& position, 0174 const Vector3& direction, 0175 const NavigationOptions<Surface>& options) const; 0176 0177 /// Surface seen on approach 0178 /// for layers without sub structure, this is the surfaceRepresentation 0179 /// for layers with sub structure, this is the approachSurface 0180 /// 0181 /// @param gctx The current geometry context object, e.g. alignment 0182 /// @param position Position for searching 0183 /// @param direction Direction for searching 0184 /// @param options The navigation options 0185 /// 0186 /// @return the Surface intersection of the approach surface 0187 SurfaceIntersection surfaceOnApproach( 0188 const GeometryContext& gctx, const Vector3& position, 0189 const Vector3& direction, const NavigationOptions<Layer>& options) const; 0190 0191 /// Fast navigation to next layer 0192 /// 0193 /// @param gctx The current geometry context object, e.g. alignment 0194 /// @param position is the start position for the search 0195 /// @param direction is the direction for the search 0196 /// 0197 /// @return the pointer to the next layer 0198 const Layer* nextLayer(const GeometryContext& gctx, const Vector3& position, 0199 const Vector3& direction) const; 0200 0201 /// Get the confining TrackingVolume 0202 /// 0203 /// @return the pointer to the enclosing volume 0204 const TrackingVolume* trackingVolume() const; 0205 0206 /// Return the abstract volume that represents the layer 0207 /// 0208 /// @return the representing volume of the layer 0209 const Volume* representingVolume() const; 0210 0211 /// return the LayerType 0212 LayerType layerType() const; 0213 0214 protected: 0215 /// Constructor with pointer to SurfaceArray (passing ownership) 0216 /// 0217 /// @param surfaceArray is the array of sensitive surfaces 0218 /// @param thickness is the normal thickness of the Layer 0219 /// @param ades oapproach descriptor 0220 /// @param laytyp is the layer type if active or passive 0221 explicit Layer(std::unique_ptr<SurfaceArray> surfaceArray, 0222 double thickness = 0., 0223 std::unique_ptr<ApproachDescriptor> ades = nullptr, 0224 LayerType laytyp = passive); 0225 0226 /// private method to set enclosing TrackingVolume, called by friend class 0227 /// only 0228 /// optionally, the layer can be resized to the dimensions of the 0229 /// TrackingVolume 0230 /// - Bounds of the Surface are resized 0231 /// - MaterialSlab dimensions are resized 0232 /// - SubSurface array boundaries are NOT resized 0233 /// 0234 /// @param tvol is the tracking volume the layer is confined 0235 void encloseTrackingVolume(const TrackingVolume& tvol); 0236 0237 /// the previous Layer according to BinGenUtils 0238 NextLayers m_nextLayers; 0239 0240 /// A binutility to find the next layer 0241 /// @todo check if this is needed 0242 const BinUtility* m_nextLayerUtility = nullptr; 0243 0244 /// SurfaceArray on this layer Surface 0245 /// 0246 /// This array will be modified during signature and constant afterwards, but 0247 /// the C++ type system unfortunately cannot cleanly express this. 0248 /// 0249 std::unique_ptr<const SurfaceArray> m_surfaceArray = nullptr; 0250 0251 /// Thickness of the Layer 0252 double m_layerThickness = 0.; 0253 0254 /// descriptor for surface on approach 0255 /// 0256 /// The descriptor may need to be modified during geometry building, and will 0257 /// remain constant afterwards, but again C++ cannot currently express this. 0258 /// 0259 std::unique_ptr<const ApproachDescriptor> m_approachDescriptor = nullptr; 0260 0261 /// the enclosing TrackingVolume 0262 const TrackingVolume* m_trackingVolume = nullptr; 0263 0264 /// Representing Volume 0265 /// can be used as approach surface sources 0266 std::unique_ptr<Volume> m_representingVolume = nullptr; 0267 0268 /// make a passive/active either way 0269 LayerType m_layerType; 0270 0271 /// sub structure indication 0272 int m_ssRepresentingSurface = 0; 0273 int m_ssSensitiveSurfaces = 0; 0274 int m_ssApproachSurfaces = 0; 0275 0276 private: 0277 /// Private helper method to close the geometry 0278 /// - it will assign material to the surfaces if needed 0279 /// - it will set the layer geometry ID for a unique identification 0280 /// - it will also register the internal sub structure 0281 /// 0282 /// @param materialDecorator is a decorator that assigns 0283 /// optionally the surface material to where they belong 0284 /// @param layerID is the geometry id of the volume 0285 /// as calculated by the TrackingGeometry 0286 /// @param hook Identifier hook to be applied to surfaces 0287 /// @param logger A @c Logger instance 0288 /// 0289 void closeGeometry(const IMaterialDecorator* materialDecorator, 0290 const GeometryIdentifier& layerID, 0291 const GeometryIdentifierHook& hook, 0292 const Logger& logger = getDummyLogger()); 0293 }; 0294 0295 /// Layers are constructed with shared_ptr factories, hence the layer array is 0296 /// describes as: 0297 using LayerArray = BinnedArray<LayerPtr>; 0298 0299 } // namespace Acts 0300 0301 #include "Acts/Geometry/Layer.ipp"
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |