ATLAS Offline Software
Loading...
Searching...
No Matches
GNN_DataStorage.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGINDETPATTRECOTOOLS_GNN_DATA_STORAGE_H
6#define TRIGINDETPATTRECOTOOLS_GNN_DATA_STORAGE_H
7
8#include<vector>
9#include<map>
10#include<algorithm>
11#include<array>
12#include<limits>
13#define MAX_SEG_PER_NODE 1000 //was 30
14#define N_SEG_CONNS 6 //was 6
15
17
19
20 TrigFTF_GNN_Node(unsigned short l) : m_x(0), m_y(0), m_z(0), m_r(0), m_phi(0), m_layer(l), m_pcw(0), m_locPosY(0) {};
21
22 inline float x() const {return m_x;}
23 inline float y() const {return m_y;}
24
25 inline float phi() const {return m_phi;}
26 inline float z() const {return m_z;}
27 inline float r() const {return m_r;}
28 inline unsigned short layer() const {return m_layer;}
29 inline float pixelClusterWidth() const {return m_pcw;}
30 inline float localPositionY() const {return m_locPosY;}
31
32 inline int sp_idx() const {return m_idx;}
33
34 float m_x, m_y, m_z, m_r, m_phi;
35 unsigned short m_layer{10000};
36 unsigned int m_idx{std::numeric_limits<unsigned int>::max()};
38};
39
40
42public:
43
45
46 bool operator()(const TrigFTF_GNN_Node* n1, const TrigFTF_GNN_Node* n2) {
47 return n1->phi() < n2->phi();
48 }
49
50 };
51
54
55 void sortByPhi();
56 void initializeNodes();
57 bool empty() const {
58 return m_vn.empty();
59 }
60
61 void generatePhiIndexing(float);
62
63 float getMinBinRadius() const {
64 return m_minRadius;
65 }
66
67 float getMaxBinRadius() const {
68 return m_maxRadius;
69 }
70
71 std::vector<const TrigFTF_GNN_Node*> m_vn;//nodes of the graph
72 std::vector<std::pair<float, unsigned int> > m_vPhiNodes;
73 std::vector<std::vector<unsigned int> > m_in;//vectors of incoming edges, stores indicies of edges in the edge vector
74 std::vector<std::array<float,5> > m_params;//node attributes: m_minCutOnTau, m_maxCutOnTau, m_phi, m_r, m_z;
75
77 unsigned int m_layerKey{0};
78};
79
81public:
82 TrigFTF_GNN_DataStorage(const TrigFTF_GNN_Geometry&, const std::vector<std::array<float, 5> >&);
84
85 int loadPixelGraphNodes(short, const std::vector<TrigFTF_GNN_Node>&, bool);
86 int loadStripGraphNodes(short, const std::vector<TrigFTF_GNN_Node>&);
87
88 unsigned int numberOfNodes() const;
89 void sortByPhi();
90 void initializeNodes(bool);
91 void generatePhiIndexing(float);
92
93
95 if(idx >= static_cast<int>(m_etaBins.size())) idx = idx-1;
96 return m_etaBins.at(idx);
97 }
98
99protected:
100
102 const std::vector<std::array<float, 5> >& m_mlLUT;
103
104 std::vector<TrigFTF_GNN_EtaBin> m_etaBins;
105
106};
107
109public:
110
112 public:
113 bool operator()(const TrigFTF_GNN_Edge* pE1, const TrigFTF_GNN_Edge* pE2) {
114 return pE1->m_level > pE2->m_level;
115 }
116 };
117
118 TrigFTF_GNN_Edge(const TrigFTF_GNN_Node* n1, const TrigFTF_GNN_Node* n2, float p1, float p2, float p3) : m_n1(n1), m_n2(n2), m_level(1), m_next(1), m_nNei(0) {
119 m_p[0] = p1;
120 m_p[1] = p2;
121 m_p[2] = p3;
122 }
123
124 TrigFTF_GNN_Edge() : m_n1(nullptr), m_n2(nullptr), m_level(-1), m_next(-1), m_nNei(0) {};
125
126
127 const TrigFTF_GNN_Node* m_n1{nullptr};
128 const TrigFTF_GNN_Node* m_n2{nullptr};
129
130 signed char m_level{-1}, m_next{-1};
131
132 unsigned char m_nNei{0};
133 float m_p[3]{};
134
135 unsigned int m_vNei[N_SEG_CONNS]{};//global indices of the connected edges
136
137};
138
139#endif
140
#define N_SEG_CONNS
std::vector< TrigFTF_GNN_EtaBin > m_etaBins
TrigFTF_GNN_EtaBin & getEtaBin(int idx)
unsigned int numberOfNodes() const
const TrigFTF_GNN_Geometry & m_geo
const std::vector< std::array< float, 5 > > & m_mlLUT
TrigFTF_GNN_DataStorage(const TrigFTF_GNN_Geometry &, const std::vector< std::array< float, 5 > > &)
int loadStripGraphNodes(short, const std::vector< TrigFTF_GNN_Node > &)
int loadPixelGraphNodes(short, const std::vector< TrigFTF_GNN_Node > &, bool)
unsigned int m_vNei[N_SEG_CONNS]
const TrigFTF_GNN_Node * m_n1
TrigFTF_GNN_Edge(const TrigFTF_GNN_Node *n1, const TrigFTF_GNN_Node *n2, float p1, float p2, float p3)
unsigned char m_nNei
const TrigFTF_GNN_Node * m_n2
std::vector< const TrigFTF_GNN_Node * > m_vn
float getMinBinRadius() const
float getMaxBinRadius() const
void generatePhiIndexing(float)
std::vector< std::vector< unsigned int > > m_in
std::vector< std::pair< float, unsigned int > > m_vPhiNodes
std::vector< std::array< float, 5 > > m_params
unsigned int m_layerKey
bool operator()(const TrigFTF_GNN_Edge *pE1, const TrigFTF_GNN_Edge *pE2)
bool operator()(const TrigFTF_GNN_Node *n1, const TrigFTF_GNN_Node *n2)
float y() const
float x() const
unsigned int m_idx
float localPositionY() const
unsigned short layer() const
TrigFTF_GNN_Node(unsigned short l)
float z() const
unsigned short m_layer
float pixelClusterWidth() const
float phi() const
float r() const