![]() |
|
|||
File indexing completed on 2025-09-17 08:21:22
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 LayerCreator(const Config& lcConfig, 0065 std::unique_ptr<const Logger> logger = 0066 getDefaultLogger("LayerCreator", Logging::INFO)); 0067 0068 /// Destructor 0069 ~LayerCreator() = default; 0070 0071 /// returning a cylindrical layer 0072 /// 0073 /// @param gctx is the geometry context with which the geometry is built 0074 /// @param surfaces is the vector of pointers to sensitive surfaces 0075 /// represented by this layer 0076 /// @pre the pointers to the sensitive surfaces in the surfaces vectors all 0077 /// need to be valid, since no check is performed 0078 /// @param binsPhi is number of bins the sensitive surfaces are ordered in phi 0079 /// @param binsZ is number of bins the sensitive surfaces are ordered in Z 0080 /// @param _protoLayer (optional) proto layer specifying the dimensions and 0081 /// envelopes 0082 /// @param transform is the (optional) transform of the layer 0083 /// @param ad possibility to hand over a specific ApproachDescriptor, which is 0084 /// needed for material mapping. Otherwise the default ApproachDescriptor will 0085 /// be taken used for this layer 0086 /// 0087 /// @return shared pointer to a newly created layer 0088 MutableLayerPtr cylinderLayer( 0089 const GeometryContext& gctx, 0090 std::vector<std::shared_ptr<const Surface>> surfaces, std::size_t binsPhi, 0091 std::size_t binsZ, std::optional<ProtoLayer> _protoLayer = std::nullopt, 0092 const Transform3& transform = Transform3::Identity(), 0093 std::unique_ptr<ApproachDescriptor> ad = nullptr) const; 0094 0095 /// returning a cylindrical layer 0096 /// 0097 /// @param gctx is the geometry context with which the geometry is built 0098 /// @param surfaces is the vector of pointers to sensitive surfaces 0099 /// represented by this layer 0100 /// @pre the pointers to the sensitive surfaces in the surfaces vectors all 0101 /// need to be valid, since no check is performed 0102 /// @param bTypePhi binning type in phi (equidistant/arbitrary) 0103 /// @param bTypeZ binning type in z (equidistant/arbitrary) 0104 /// @param _protoLayer (optional) proto layer specifying the dimensions and 0105 /// envelopes 0106 /// @param transform is the (optional) transform of the layer 0107 /// @param ad possibility to hand over a specific ApproachDescriptor, which is 0108 /// needed for material mapping. Otherwise the default ApproachDescriptor will 0109 /// be taken used for this layer 0110 /// 0111 /// @return shared pointer to a newly created layer 0112 MutableLayerPtr cylinderLayer( 0113 const GeometryContext& gctx, 0114 std::vector<std::shared_ptr<const Surface>> surfaces, 0115 BinningType bTypePhi, BinningType bTypeZ, 0116 std::optional<ProtoLayer> _protoLayer = std::nullopt, 0117 const Transform3& transform = Transform3::Identity(), 0118 std::unique_ptr<ApproachDescriptor> ad = nullptr) const; 0119 0120 /// returning a disc layer 0121 /// 0122 /// @param gctx is the geometry context with which the geometry is built 0123 /// @param surfaces is the vector of pointers to sensitive surfaces 0124 /// represented by this layer 0125 /// @pre the pointers to the sensitive surfaces in the surfaces vectors all 0126 /// need to be valid, since no check is performed 0127 /// @param binsR is number of bins the sensitive surfaces are ordered in R 0128 /// @param binsPhi is number of bins the sensitive surfaces are ordered in Phi 0129 /// @param transform is the (optional) transform of the layer 0130 /// @param _protoLayer (optional) proto layer specifying the dimensions and 0131 /// envelopes 0132 /// @param ad possibility to hand over a specific ApproachDescriptor, which is 0133 /// needed for material mapping. Otherwise the default ApproachDescriptor will 0134 /// be taken used for this layer 0135 /// 0136 /// @return shared pointer to a newly created layer 0137 MutableLayerPtr discLayer( 0138 const GeometryContext& gctx, 0139 std::vector<std::shared_ptr<const Surface>> surfaces, std::size_t binsR, 0140 std::size_t binsPhi, std::optional<ProtoLayer> _protoLayer = std::nullopt, 0141 const Transform3& transform = Transform3::Identity(), 0142 std::unique_ptr<ApproachDescriptor> ad = nullptr) const; 0143 0144 /// returning a disc layer 0145 /// 0146 /// @param gctx is the geometry context with which the geometry is built 0147 /// @param surfaces is the vector of pointers to sensitive surfaces 0148 /// represented by this layer 0149 /// @pre the pointers to the sensitive surfaces in the surfaces vectors all 0150 /// need to be valid, since no check is performed 0151 /// @param bTypeR binning type in r (equidistant/arbitrary) 0152 /// @param bTypePhi binning type in phi (equidistant/arbitrary) 0153 /// @param transform is the (optional) transform of the layer 0154 /// @param _protoLayer (optional) proto layer specifying the dimensions and 0155 /// envelopes 0156 /// @param ad possibility to hand over a specific ApproachDescriptor, which is 0157 /// needed for material mapping. Otherwise the default ApproachDescriptor will 0158 /// be taken used for this layer 0159 /// 0160 /// @return shared pointer to a newly created layer 0161 MutableLayerPtr discLayer( 0162 const GeometryContext& gctx, 0163 std::vector<std::shared_ptr<const Surface>> surfaces, BinningType bTypeR, 0164 BinningType bTypePhi, 0165 std::optional<ProtoLayer> _protoLayer = std::nullopt, 0166 const Transform3& transform = Transform3::Identity(), 0167 std::unique_ptr<ApproachDescriptor> ad = nullptr) const; 0168 0169 /// returning a plane layer 0170 /// 0171 /// @param gctx is the geometry context with which the geometry is built 0172 /// @param [in] surfaces is the vector of pointers to sensitive surfaces 0173 /// represented by this layer 0174 /// @pre the pointers to the sensitive surfaces in the surfaces vectors all 0175 /// need to be valid, since no check is performed 0176 /// @param [in] bins1 is the number of bins in the orthogonal direction to @p 0177 /// bValue 0178 /// @param [in] bins2 is the number of bins in the orthogonal direction to @p 0179 /// bValue 0180 /// @param [in] aDir Direction of the aligned surfaces 0181 /// @param [in] transform is the (optional) transform of the layer 0182 /// @param [in] _protoLayer (optional) proto layer specifying the dimensions 0183 /// and 0184 /// envelopes 0185 /// @param [in] ad possibility to hand over a specific ApproachDescriptor, 0186 /// which is needed for material mapping. Otherwise the default 0187 /// ApproachDescriptor will be taken used for this layer 0188 /// 0189 /// @return shared pointer to a newly created layer 0190 MutableLayerPtr planeLayer( 0191 const GeometryContext& gctx, 0192 std::vector<std::shared_ptr<const Surface>> surfaces, std::size_t bins1, 0193 std::size_t bins2, AxisDirection aDir, 0194 std::optional<ProtoLayer> _protoLayer = std::nullopt, 0195 const Transform3& transform = Transform3::Identity(), 0196 std::unique_ptr<ApproachDescriptor> ad = nullptr) const; 0197 0198 /// Set the configuration object 0199 /// @param lcConfig is the configuration struct 0200 void setConfiguration(const Config& lcConfig); 0201 0202 /// Access th configuration object 0203 Config getConfiguration() const; 0204 0205 /// set logging instance 0206 /// @param newLogger the logger instance 0207 void setLogger(std::unique_ptr<const Logger> newLogger); 0208 0209 /// associate surfaces contained by this layer to this layer 0210 void associateSurfacesToLayer(Layer& layer) const; 0211 0212 private: 0213 /// Validates that all the sensitive surfaces are actually accessible through 0214 /// the binning 0215 /// 0216 /// @param gctx Geometry context to work with 0217 /// @param sArray @c SurfaceArray instance to check 0218 bool checkBinning(const GeometryContext& gctx, 0219 const SurfaceArray& sArray) const; 0220 0221 /// configuration object 0222 Config m_cfg; 0223 0224 /// Private access method to the logger 0225 const Logger& logger() const { return *m_logger; } 0226 0227 /// logging instance 0228 std::unique_ptr<const Logger> m_logger; 0229 }; 0230 0231 inline LayerCreator::Config LayerCreator::getConfiguration() const { 0232 return m_cfg; 0233 } 0234 0235 } // 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 |
![]() ![]() |