File indexing completed on 2026-09-05 08:17:33
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Utilities/Logger.hpp"
0012
0013 #include <cstdint>
0014 #include <memory>
0015 #include <optional>
0016 #include <span>
0017 #include <unordered_map>
0018 #include <unordered_set>
0019 #include <vector>
0020
0021 namespace Acts::Experimental {
0022
0023
0024 class GbtsLayerConnectionTool {
0025 public:
0026
0027 struct LayerDescription {
0028
0029
0030
0031
0032
0033
0034 LayerDescription(float minR_, float maxR_, float minZ_, float maxZ_,
0035 std::int32_t gbtsId_);
0036
0037
0038 float minR{};
0039
0040 float maxR{};
0041
0042 float minZ{};
0043
0044 float maxZ{};
0045
0046 std::int32_t gbtsId{};
0047 };
0048
0049
0050 struct Config {
0051
0052 std::vector<LayerDescription> detectorGeometry{};
0053
0054
0055
0056
0057 float zMinTol = 0.2340f;
0058
0059 float zMaxTol = 0.2340f;
0060
0061 float rMinTol = 2.5337f;
0062
0063 float rMaxTol = 2.5337f;
0064
0065
0066 bool doSymmetrization = false;
0067
0068 float probThreshold = -1;
0069 };
0070
0071
0072 struct HitCoordinates {
0073
0074 float r{};
0075
0076 float z{};
0077 };
0078
0079
0080 using LayerIdPair = std::pair<std::int32_t, std::int32_t>;
0081
0082
0083 struct LayerIdPairHash {
0084
0085
0086
0087
0088 std::size_t operator()(const LayerIdPair& pair) const noexcept {
0089 const auto h1 = std::hash<std::int32_t>{}(pair.first);
0090 const auto h2 = std::hash<std::int32_t>{}(pair.second);
0091
0092 return h1 ^ (h2 << 1);
0093 }
0094 };
0095
0096
0097 using LayerIdPairs = std::unordered_set<LayerIdPair, LayerIdPairHash>;
0098
0099 using LayerIdPairMap =
0100 std::unordered_map<LayerIdPair, std::uint32_t, LayerIdPairHash>;
0101
0102
0103
0104 explicit GbtsLayerConnectionTool(
0105 const Config& config,
0106 std::unique_ptr<const Logger> logger =
0107 getDefaultLogger("GbtsLayerConnectionTool", Logging::Level::INFO));
0108
0109
0110
0111 void addTrack(std::span<const HitCoordinates> track);
0112
0113
0114
0115 GbtsLayerConnectionTool::LayerIdPairs createConnectionTable() const;
0116
0117 private:
0118
0119 const Logger& logger() const { return *m_logger; }
0120
0121
0122
0123
0124 std::optional<std::int32_t> findGbtsIdByCoord(
0125 const HitCoordinates& hit) const;
0126
0127
0128
0129
0130 std::uint32_t getIndexByGbtsId(std::int32_t gbtsId) const;
0131
0132
0133
0134
0135
0136 std::optional<std::int32_t> oppositeSideLayer(std::int32_t layer) const;
0137
0138
0139 Config m_cfg;
0140
0141 std::unique_ptr<const Acts::Logger> m_logger;
0142
0143 LayerIdPairMap m_layerPairs{};
0144
0145 std::uint32_t m_totalTracks = 0;
0146 };
0147
0148 }