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