|
||||
File indexing completed on 2025-01-18 09:10:52
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 /// standard constructor 0055 Config() = default; 0056 }; 0057 0058 /// Constructor 0059 /// 0060 /// @param lcConfig is the configuration object 0061 /// @param logger logging instance 0062 LayerCreator(const Config& lcConfig, 0063 std::unique_ptr<const Logger> logger = 0064 getDefaultLogger("LayerCreator", Logging::INFO)); 0065 0066 /// Destructor 0067 ~LayerCreator() = default; 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 Config getConfiguration() const; 0202 0203 /// set logging instance 0204 /// @param newLogger the logger instance 0205 void setLogger(std::unique_ptr<const Logger> newLogger); 0206 0207 /// associate surfaces contained by this layer to this layer 0208 void associateSurfacesToLayer(Layer& layer) const; 0209 0210 private: 0211 /// Validates that all the sensitive surfaces are actually accessible through 0212 /// the binning 0213 /// 0214 /// @param gctx Geometry context to work with 0215 /// @param sArray @c SurfaceArray instance to check 0216 bool checkBinning(const GeometryContext& gctx, 0217 const SurfaceArray& sArray) const; 0218 0219 /// configuration object 0220 Config m_cfg; 0221 0222 /// Private access method to the logger 0223 const Logger& logger() const { return *m_logger; } 0224 0225 /// logging instance 0226 std::unique_ptr<const Logger> m_logger; 0227 }; 0228 0229 inline LayerCreator::Config LayerCreator::getConfiguration() const { 0230 return m_cfg; 0231 } 0232 0233 } // 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 |