![]() |
|
|||
File indexing completed on 2025-06-30 07:51: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/Geometry/ApproachDescriptor.hpp" 0013 #include "Acts/Geometry/GeometryContext.hpp" 0014 #include "Acts/Geometry/ProtoLayer.hpp" 0015 #include "Acts/Surfaces/SurfaceArray.hpp" 0016 #include "Acts/Utilities/AxisDefinitions.hpp" 0017 #include "Acts/Utilities/BinningType.hpp" 0018 #include "Acts/Utilities/Logger.hpp" 0019 0020 #include <cstddef> 0021 #include <memory> 0022 #include <optional> 0023 #include <vector> 0024 0025 namespace Acts { 0026 0027 namespace Test { 0028 struct LayerCreatorFixture; 0029 } 0030 class Surface; 0031 class SurfaceArrayCreator; 0032 class Layer; 0033 0034 using MutableLayerPtr = std::shared_ptr<Layer>; 0035 0036 /// @class LayerCreator 0037 /// 0038 /// The LayerCreator is able to build cylinder disc layers or plane layers from 0039 /// detector elements 0040 /// 0041 class LayerCreator { 0042 public: 0043 friend Acts::Test::LayerCreatorFixture; 0044 /// @struct Config 0045 /// Configuration for the LayerCreator 0046 /// This is the nexted configuration struct for the LayerCreator class 0047 struct Config { 0048 /// surface array helper 0049 std::shared_ptr<const SurfaceArrayCreator> surfaceArrayCreator = nullptr; 0050 /// cylinder module z tolerance: it counts as same z, if ... 0051 double cylinderZtolerance{10.}; 0052 /// cylinder module phi tolerance: it counts as same phi, if ... 0053 double cylinderPhiTolerance{0.1}; 0054 /// Default z envelope. Can be overridden by proto layer 0055 Envelope defaultEnvelopeZ = zeroEnvelope; 0056 /// Default r envelope. Can be overridden by proto layer 0057 Envelope defaultEnvelopeR = zeroEnvelope; 0058 }; 0059 0060 /// Constructor 0061 /// 0062 /// @param lcConfig is the configuration object 0063 /// @param logger logging instance 0064 explicit LayerCreator(const Config& lcConfig, 0065 std::unique_ptr<const Logger> logger = 0066 getDefaultLogger("LayerCreator", Logging::INFO)); 0067 0068 /// returning a cylindrical layer 0069 /// 0070 /// @param gctx is the geometry context with which the geometry is built 0071 /// @param surfaces is the vector of pointers to sensitive surfaces 0072 /// represented by this layer 0073 /// @pre the pointers to the sensitive surfaces in the surfaces vectors all 0074 /// need to be valid, since no check is performed 0075 /// @param binsPhi is number of bins the sensitive surfaces are ordered in phi 0076 /// @param binsZ is number of bins the sensitive surfaces are ordered in Z 0077 /// @param _protoLayer (optional) proto layer specifying the dimensions and 0078 /// envelopes 0079 /// @param transform is the (optional) transform of the layer 0080 /// @param ad possibility to hand over a specific ApproachDescriptor, which is 0081 /// needed for material mapping. Otherwise the default ApproachDescriptor will 0082 /// be taken used for this layer 0083 /// 0084 /// @return shared pointer to a newly created layer 0085 MutableLayerPtr cylinderLayer( 0086 const GeometryContext& gctx, 0087 std::vector<std::shared_ptr<const Surface>> surfaces, std::size_t binsPhi, 0088 std::size_t binsZ, std::optional<ProtoLayer> _protoLayer = std::nullopt, 0089 const Transform3& transform = Transform3::Identity(), 0090 std::unique_ptr<ApproachDescriptor> ad = nullptr) const; 0091 0092 /// returning a cylindrical layer 0093 /// 0094 /// @param gctx is the geometry context with which the geometry is built 0095 /// @param surfaces is the vector of pointers to sensitive surfaces 0096 /// represented by this layer 0097 /// @pre the pointers to the sensitive surfaces in the surfaces vectors all 0098 /// need to be valid, since no check is performed 0099 /// @param bTypePhi binning type in phi (equidistant/arbitrary) 0100 /// @param bTypeZ binning type in z (equidistant/arbitrary) 0101 /// @param _protoLayer (optional) proto layer specifying the dimensions and 0102 /// envelopes 0103 /// @param transform is the (optional) transform of the layer 0104 /// @param ad possibility to hand over a specific ApproachDescriptor, which is 0105 /// needed for material mapping. Otherwise the default ApproachDescriptor will 0106 /// be taken used for this layer 0107 /// 0108 /// @return shared pointer to a newly created layer 0109 MutableLayerPtr cylinderLayer( 0110 const GeometryContext& gctx, 0111 std::vector<std::shared_ptr<const Surface>> surfaces, 0112 BinningType bTypePhi, BinningType bTypeZ, 0113 std::optional<ProtoLayer> _protoLayer = std::nullopt, 0114 const Transform3& transform = Transform3::Identity(), 0115 std::unique_ptr<ApproachDescriptor> ad = nullptr) const; 0116 0117 /// returning a disc layer 0118 /// 0119 /// @param gctx is the geometry context with which the geometry is built 0120 /// @param surfaces is the vector of pointers to sensitive surfaces 0121 /// represented by this layer 0122 /// @pre the pointers to the sensitive surfaces in the surfaces vectors all 0123 /// need to be valid, since no check is performed 0124 /// @param binsR is number of bins the sensitive surfaces are ordered in R 0125 /// @param binsPhi is number of bins the sensitive surfaces are ordered in Phi 0126 /// @param transform is the (optional) transform of the layer 0127 /// @param _protoLayer (optional) proto layer specifying the dimensions and 0128 /// envelopes 0129 /// @param ad possibility to hand over a specific ApproachDescriptor, which is 0130 /// needed for material mapping. Otherwise the default ApproachDescriptor will 0131 /// be taken used for this layer 0132 /// 0133 /// @return shared pointer to a newly created layer 0134 MutableLayerPtr discLayer( 0135 const GeometryContext& gctx, 0136 std::vector<std::shared_ptr<const Surface>> surfaces, std::size_t binsR, 0137 std::size_t binsPhi, std::optional<ProtoLayer> _protoLayer = std::nullopt, 0138 const Transform3& transform = Transform3::Identity(), 0139 std::unique_ptr<ApproachDescriptor> ad = nullptr) const; 0140 0141 /// returning a disc layer 0142 /// 0143 /// @param gctx is the geometry context with which the geometry is built 0144 /// @param surfaces is the vector of pointers to sensitive surfaces 0145 /// represented by this layer 0146 /// @pre the pointers to the sensitive surfaces in the surfaces vectors all 0147 /// need to be valid, since no check is performed 0148 /// @param bTypeR binning type in r (equidistant/arbitrary) 0149 /// @param bTypePhi binning type in phi (equidistant/arbitrary) 0150 /// @param transform is the (optional) transform of the layer 0151 /// @param _protoLayer (optional) proto layer specifying the dimensions and 0152 /// envelopes 0153 /// @param ad possibility to hand over a specific ApproachDescriptor, which is 0154 /// needed for material mapping. Otherwise the default ApproachDescriptor will 0155 /// be taken used for this layer 0156 /// 0157 /// @return shared pointer to a newly created layer 0158 MutableLayerPtr discLayer( 0159 const GeometryContext& gctx, 0160 std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypeR, 0161 BinningType bTypePhi, 0162 std::optional<ProtoLayer> _protoLayer = std::nullopt, 0163 const Transform3& transform = Transform3::Identity(), 0164 std::unique_ptr<ApproachDescriptor> ad = nullptr) const; 0165 0166 /// returning a plane layer 0167 /// 0168 /// @param gctx is the geometry context with which the geometry is built 0169 /// @param [in] surfaces is the vector of pointers to sensitive surfaces 0170 /// represented by this layer 0171 /// @pre the pointers to the sensitive surfaces in the surfaces vectors all 0172 /// need to be valid, since no check is performed 0173 /// @param [in] bins1 is the number of bins in the orthogonal direction to @p 0174 /// bValue 0175 /// @param [in] bins2 is the number of bins in the orthogonal direction to @p 0176 /// bValue 0177 /// @param [in] aDir Direction of the aligned surfaces 0178 /// @param [in] transform is the (optional) transform of the layer 0179 /// @param [in] _protoLayer (optional) proto layer specifying the dimensions 0180 /// and 0181 /// envelopes 0182 /// @param [in] ad possibility to hand over a specific ApproachDescriptor, 0183 /// which is needed for material mapping. Otherwise the default 0184 /// ApproachDescriptor will be taken used for this layer 0185 /// 0186 /// @return shared pointer to a newly created layer 0187 MutableLayerPtr planeLayer( 0188 const GeometryContext& gctx, 0189 std::vector<std::shared_ptr<const Surface>> surfaces, std::size_t bins1, 0190 std::size_t bins2, AxisDirection aDir, 0191 std::optional<ProtoLayer> _protoLayer = std::nullopt, 0192 const Transform3& transform = Transform3::Identity(), 0193 std::unique_ptr<ApproachDescriptor> ad = nullptr) const; 0194 0195 /// Set the configuration object 0196 /// @param lcConfig is the configuration struct 0197 void setConfiguration(const Config& lcConfig); 0198 0199 /// Access th configuration object 0200 Config getConfiguration() const; 0201 0202 /// set logging instance 0203 /// @param newLogger the logger instance 0204 void setLogger(std::unique_ptr<const Logger> newLogger); 0205 0206 /// associate surfaces contained by this layer to this layer 0207 void associateSurfacesToLayer(Layer& layer) const; 0208 0209 private: 0210 /// Validates that all the sensitive surfaces are actually accessible through 0211 /// the binning 0212 /// 0213 /// @param gctx Geometry context to work with 0214 /// @param sArray @c SurfaceArray instance to check 0215 bool checkBinning(const GeometryContext& gctx, 0216 const SurfaceArray& sArray) const; 0217 0218 /// configuration object 0219 Config m_cfg; 0220 0221 /// Private access method to the logger 0222 const Logger& logger() const { return *m_logger; } 0223 0224 /// logging instance 0225 std::unique_ptr<const Logger> m_logger; 0226 }; 0227 0228 inline LayerCreator::Config LayerCreator::getConfiguration() const { 0229 return m_cfg; 0230 } 0231 0232 } // 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 |
![]() ![]() |