File indexing completed on 2025-12-29 08:55:39
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011
0012 #include "Acts/Seeding/GbtsGeometry.hpp"
0013 #include "Acts/Seeding/SeedFinderGbtsConfig.hpp"
0014
0015 #include <array>
0016 #include <limits>
0017 #include <vector>
0018 namespace Acts::Experimental {
0019
0020 #define MAX_SEG_PER_NODE 1000
0021 #define N_SEG_CONNS 6
0022
0023 class GbtsGeometry;
0024
0025 struct GbtsNode {
0026 explicit GbtsNode(unsigned short l) : m_layer(l) {};
0027
0028 inline float x() const { return m_x; }
0029 inline float y() const { return m_y; }
0030
0031 inline float phi() const { return m_phi; }
0032 inline float z() const { return m_z; }
0033 inline float r() const { return m_r; }
0034 inline unsigned short layer() const { return m_layer; }
0035 inline float pixelClusterWidth() const { return m_pcw; }
0036 inline float localPositionY() const { return m_locPosY; }
0037 inline int sp_idx() const { return m_idx; }
0038
0039 float m_x{}, m_y{}, m_z{}, m_r{}, m_phi{};
0040 unsigned short m_layer{10000};
0041 unsigned int m_idx{std::numeric_limits<unsigned int>::max()};
0042 float m_pcw{}, m_locPosY{};
0043 };
0044
0045 class GbtsEtaBin {
0046 public:
0047 struct CompareNodesByPhi {
0048 bool operator()(const GbtsNode* n1, const GbtsNode* n2) {
0049 return n1->phi() < n2->phi();
0050 }
0051 };
0052
0053 GbtsEtaBin();
0054 ~GbtsEtaBin();
0055
0056 void sortByPhi();
0057 void initializeNodes();
0058 bool empty() const { return m_vn.empty(); }
0059
0060 void generatePhiIndexing(float dphi);
0061
0062 float getMinBinRadius() const { return m_minRadius; }
0063
0064 float getMaxBinRadius() const { return m_maxRadius; }
0065
0066 std::vector<const GbtsNode*> m_vn;
0067 std::vector<std::pair<float, unsigned int>> m_vPhiNodes;
0068 std::vector<std::vector<unsigned int>>
0069 m_in;
0070
0071 std::vector<std::array<float, 5>>
0072 m_params;
0073
0074
0075 float m_minRadius{}, m_maxRadius{};
0076
0077 unsigned int m_layerKey{0};
0078 };
0079
0080 class GbtsDataStorage {
0081 public:
0082 explicit GbtsDataStorage(const GbtsGeometry& geometry,
0083 const SeedFinderGbtsConfig& config);
0084 ~GbtsDataStorage();
0085
0086 int loadPixelGraphNodes(short layerIndex, const std::vector<GbtsNode>& coll,
0087 bool useML);
0088 int loadStripGraphNodes(short layerIndex, const std::vector<GbtsNode>& coll);
0089
0090 unsigned int numberOfNodes() const;
0091 void sortByPhi();
0092 void initializeNodes(bool useML);
0093 void generatePhiIndexing(float dphi);
0094
0095 GbtsEtaBin& getEtaBin(int idx) {
0096 if (idx >= static_cast<int>(m_etaBins.size())) {
0097 idx = idx - 1;
0098 }
0099 return m_etaBins.at(idx);
0100 }
0101
0102 protected:
0103 const GbtsGeometry& m_geo;
0104 const SeedFinderGbtsConfig& m_config;
0105 std::vector<std::array<float, 5>> m_mlLUT;
0106 std::vector<GbtsEtaBin> m_etaBins;
0107 };
0108
0109 class GbtsEdge {
0110 public:
0111 struct CompareLevel {
0112 public:
0113 bool operator()(const GbtsEdge* pE1, const GbtsEdge* pE2) {
0114 return pE1->m_level > pE2->m_level;
0115 }
0116 };
0117
0118 GbtsEdge(const GbtsNode* n1, const GbtsNode* n2, float p1, float p2, float p3)
0119 : m_n1(n1), m_n2(n2), m_level(1), m_next(1) {
0120 m_p[0] = p1;
0121 m_p[1] = p2;
0122 m_p[2] = p3;
0123 }
0124
0125 GbtsEdge() = default;
0126
0127 const GbtsNode* m_n1{nullptr};
0128 const GbtsNode* m_n2{nullptr};
0129
0130 signed char m_level{-1}, m_next{-1};
0131
0132 unsigned char m_nNei{0};
0133 float m_p[3]{};
0134
0135 unsigned int m_vNei[N_SEG_CONNS]{};
0136 };
0137
0138 }