File indexing completed on 2026-06-22 08:01:24
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Geometry/Extent.hpp"
0012 #include "Acts/Utilities/AxisDefinitions.hpp"
0013
0014 #include <memory>
0015 #include <regex>
0016 #include <string>
0017 #include <string_view>
0018
0019 namespace dd4hep {
0020 class Detector;
0021 }
0022
0023 namespace Acts {
0024 class GeometryContext;
0025 class Logger;
0026 class TrackingGeometry;
0027 }
0028
0029 namespace ActsPlugins::DD4hep {
0030
0031 namespace detail {
0032
0033 inline const std::regex kPixelLayerFilter{
0034 "(?:PixelLayer|PixelEndcap[NP])(\\d)"};
0035 inline const std::regex kShortStripLayerFilter{
0036 "(?:ShortStripLayer|ShortStripEndcap[NP])(\\d)"};
0037 inline const std::regex kLongStripLayerFilter{
0038 "(?:LongStripLayer|LongStripEndcap[NP])(\\d)"};
0039 inline const std::regex kPixelBarrelLayerFilter{"PixelLayer\\d"};
0040 inline const std::regex kPixelNegativeEndcapLayerFilter{"PixelEndcapN\\d"};
0041 inline const std::regex kPixelPositiveEndcapLayerFilter{"PixelEndcapP\\d"};
0042 inline const std::regex kShortStripBarrelLayerFilter{"ShortStripLayer\\d"};
0043 inline const std::regex kShortStripNegativeEndcapLayerFilter{
0044 "ShortStripEndcapN\\d"};
0045 inline const std::regex kShortStripPositiveEndcapLayerFilter{
0046 "ShortStripEndcapP\\d"};
0047 inline const std::regex kLongStripBarrelLayerFilter{"LongStripLayer\\d"};
0048 inline const std::regex kLongStripNegativeEndcapLayerFilter{
0049 "LongStripEndcapN\\d"};
0050 inline const std::regex kLongStripPositiveEndcapLayerFilter{
0051 "LongStripEndcapP\\d"};
0052
0053 inline const Acts::ExtentEnvelope kBlueprintEnvelope =
0054 Acts::ExtentEnvelope::Zero()
0055 .set(Acts::AxisDirection::AxisZ, {20., 20.})
0056 .set(Acts::AxisDirection::AxisR, {0., 20.});
0057
0058 inline const Acts::ExtentEnvelope kLayerEnvelope =
0059 Acts::ExtentEnvelope::Zero()
0060 .set(Acts::AxisDirection::AxisZ, {2., 2.})
0061 .set(Acts::AxisDirection::AxisR, {2., 2.});
0062
0063 inline int layerIndexFromName(std::string_view elemName,
0064 const std::regex& layerFilter) {
0065 std::cmatch match;
0066 if (std::regex_search(elemName.begin(), elemName.end(), match, layerFilter) &&
0067 match.size() > 1) {
0068 return std::stoi(match[1].str());
0069 }
0070
0071 if (std::regex groupedLayerNameFilter{"layer(\\d+)"};
0072 std::regex_search(elemName.begin(), elemName.end(), match,
0073 groupedLayerNameFilter) &&
0074 match.size() > 1) {
0075 return std::stoi(match[1].str());
0076 }
0077
0078 return 0;
0079 }
0080
0081 }
0082
0083
0084
0085 std::unique_ptr<Acts::TrackingGeometry> buildOpenDataDetectorBarrelEndcap(
0086 const dd4hep::Detector& detector, const Acts::GeometryContext& gctx,
0087 const Acts::Logger& logger);
0088
0089
0090
0091 std::unique_ptr<Acts::TrackingGeometry>
0092 buildOpenDataDetectorBarrelEndcapViaTGeo(const dd4hep::Detector& detector,
0093 const Acts::GeometryContext& gctx,
0094 const Acts::Logger& logger);
0095
0096
0097
0098 std::unique_ptr<Acts::TrackingGeometry> buildOpenDataDetectorDirectLayer(
0099 const dd4hep::Detector& detector, const Acts::GeometryContext& gctx,
0100 const Acts::Logger& logger);
0101
0102
0103
0104 std::unique_ptr<Acts::TrackingGeometry> buildOpenDataDetectorDirectLayerGrouped(
0105 const dd4hep::Detector& detector, const Acts::GeometryContext& gctx,
0106 const Acts::Logger& logger);
0107
0108 }