ATLAS Offline Software
GNN_DataStorage.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 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 
13 #define MAX_SEG_PER_NODE 1000 //was 30
14 #define N_SEG_CONNS 6 //was 6
15 
17 
19 
20 
22 
23  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_pSP(nullptr) {};
24 
25  inline float x() const {return m_x;}
26  inline float y() const {return m_y;}
27 
28  inline float phi() const {return m_phi;}
29  inline float z() const {return m_z;}
30  inline float r() const {return m_r;}
31  inline unsigned short layer() const {return m_layer;}
32 
33  inline const Trk::SpacePoint* sp() const {return m_pSP;}
34 
35  float m_x, m_y, m_z, m_r, m_phi;
36  unsigned short m_layer{10000};
37  const Trk::SpacePoint* m_pSP{nullptr};
38 
39 };
40 
41 
43 public:
44 
46 
47  bool operator()(const TrigFTF_GNN_Node* n1, const TrigFTF_GNN_Node* n2) {
48  return n1->phi() < n2->phi();
49  }
50 
51  };
52 
55 
56  void sortByPhi();
57  void initializeNodes();
58  bool empty() const {
59  return m_vn.empty();
60  }
61 
62  void generatePhiIndexing(float);
63 
64  float getMinBinRadius() const {
65  return m_minRadius;
66  }
67 
68  float getMaxBinRadius() const {
69  return m_maxRadius;
70  }
71 
72  std::vector<const TrigFTF_GNN_Node*> m_vn;//nodes of the graph
73  std::vector<std::pair<float, unsigned int> > m_vPhiNodes;
74  std::vector<std::vector<unsigned int> > m_in;//vectors of incoming edges
75  std::vector<std::array<float,5> > m_params;//node attributes: m_minCutOnTau, m_maxCutOnTau, m_phi, m_r, m_z;
76 
78 
79 };
80 
82 public:
85 
86  int loadPixelGraphNodes(short, const std::vector<TrigFTF_GNN_Node>&, bool);
87  int loadStripGraphNodes(short, const std::vector<TrigFTF_GNN_Node>&);
88 
89  unsigned int numberOfNodes() const;
90  void sortByPhi();
91  void initializeNodes(bool);
92  void generatePhiIndexing(float);
93 
94 
96  if(idx >= static_cast<int>(m_etaBins.size())) idx = idx-1;
97  return m_etaBins.at(idx);
98  }
99 
100 protected:
101 
103 
104  std::vector<TrigFTF_GNN_EtaBin> m_etaBins;
105 
106 };
107 
109 public:
110 
111  struct CompareLevel {
112  public:
113  bool operator()(const TrigFTF_GNN_Edge* pS1, const TrigFTF_GNN_Edge* pS2) {
114  return pS1->m_level > pS2->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
TrigFTF_GNN_EtaBin
Definition: GNN_DataStorage.h:42
TrigFTF_GNN_Node::m_pSP
const Trk::SpacePoint * m_pSP
Definition: GNN_DataStorage.h:37
Trk::SpacePoint
Definition: Tracking/TrkEvent/TrkSpacePoint/TrkSpacePoint/SpacePoint.h:35
TrigFTF_GNN_DataStorage
Definition: GNN_DataStorage.h:81
TrigFTF_GNN_EtaBin::m_in
std::vector< std::vector< unsigned int > > m_in
Definition: GNN_DataStorage.h:74
TrigFTF_GNN_Edge::CompareLevel
Definition: GNN_DataStorage.h:111
TrigFTF_GNN_DataStorage::sortByPhi
void sortByPhi()
Definition: GNN_DataStorage.cxx:187
TrigFTF_GNN_Node::y
float y() const
Definition: GNN_DataStorage.h:26
TrigFTF_GNN_Node::phi
float phi() const
Definition: GNN_DataStorage.h:28
TrigFTF_GNN_Edge::m_vNei
unsigned int m_vNei[N_SEG_CONNS]
Definition: GNN_DataStorage.h:135
TrigFTF_GNN_Edge::CompareLevel::operator()
bool operator()(const TrigFTF_GNN_Edge *pS1, const TrigFTF_GNN_Edge *pS2)
Definition: GNN_DataStorage.h:113
TrigFTF_GNN_EtaBin::TrigFTF_GNN_EtaBin
TrigFTF_GNN_EtaBin()
Definition: GNN_DataStorage.cxx:17
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
TrigFTF_GNN_EtaBin::CompareNodesByPhi::operator()
bool operator()(const TrigFTF_GNN_Node *n1, const TrigFTF_GNN_Node *n2)
Definition: GNN_DataStorage.h:47
TrigFTF_GNN_Node::m_layer
unsigned short m_layer
Definition: GNN_DataStorage.h:36
TrigFTF_GNN_Node::sp
const Trk::SpacePoint * sp() const
Definition: GNN_DataStorage.h:33
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
TrigFTF_GNN_EtaBin::~TrigFTF_GNN_EtaBin
~TrigFTF_GNN_EtaBin()
Definition: GNN_DataStorage.cxx:25
TrigFTF_GNN_EtaBin::m_minRadius
float m_minRadius
Definition: GNN_DataStorage.h:77
TrigFTF_GNN_Node
Definition: GNN_DataStorage.h:21
TrigFTF_GNN_Edge::m_n2
const TrigFTF_GNN_Node * m_n2
Definition: GNN_DataStorage.h:128
TrigFTF_GNN_Edge::TrigFTF_GNN_Edge
TrigFTF_GNN_Edge()
Definition: GNN_DataStorage.h:124
N_SEG_CONNS
#define N_SEG_CONNS
Definition: GNN_DataStorage.h:14
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
TrigFTF_GNN_EtaBin::empty
bool empty() const
Definition: GNN_DataStorage.h:58
TrigFTF_GNN_Node::m_x
float m_x
Definition: GNN_DataStorage.h:35
TrigFTF_GNN_Edge::m_next
signed char m_next
Definition: GNN_DataStorage.h:130
TrigFTF_GNN_DataStorage::m_etaBins
std::vector< TrigFTF_GNN_EtaBin > m_etaBins
Definition: GNN_DataStorage.h:104
TrigFTF_GNN_DataStorage::TrigFTF_GNN_DataStorage
TrigFTF_GNN_DataStorage(const TrigFTF_GNN_Geometry &)
Definition: GNN_DataStorage.cxx:104
TrigFTF_GNN_Edge
Definition: GNN_DataStorage.h:108
TrigFTF_GNN_DataStorage::generatePhiIndexing
void generatePhiIndexing(float)
Definition: GNN_DataStorage.cxx:240
TrigFTF_GNN_EtaBin::m_vPhiNodes
std::vector< std::pair< float, unsigned int > > m_vPhiNodes
Definition: GNN_DataStorage.h:73
TrigFTF_GNN_EtaBin::initializeNodes
void initializeNodes()
Definition: GNN_DataStorage.cxx:56
TrigFTF_GNN_Edge::m_level
signed char m_level
Definition: GNN_DataStorage.h:130
TrigFTF_GNN_Node::m_y
float m_y
Definition: GNN_DataStorage.h:35
TrigFTF_GNN_Node::m_phi
float m_phi
Definition: GNN_DataStorage.h:35
SpacePoint.h
TrigFTF_GNN_EtaBin::m_maxRadius
float m_maxRadius
Definition: GNN_DataStorage.h:77
TrigFTF_GNN_DataStorage::numberOfNodes
unsigned int numberOfNodes() const
Definition: GNN_DataStorage.cxx:177
TrigFTF_GNN_DataStorage::getEtaBin
TrigFTF_GNN_EtaBin & getEtaBin(int idx)
Definition: GNN_DataStorage.h:95
TrigFTF_GNN_DataStorage::loadPixelGraphNodes
int loadPixelGraphNodes(short, const std::vector< TrigFTF_GNN_Node > &, bool)
Definition: GNN_DataStorage.cxx:112
TrigFTF_GNN_Node::m_r
float m_r
Definition: GNN_DataStorage.h:35
TrigFTF_GNN_EtaBin::getMaxBinRadius
float getMaxBinRadius() const
Definition: GNN_DataStorage.h:68
TrigFTF_GNN_Node::TrigFTF_GNN_Node
TrigFTF_GNN_Node(unsigned short l)
Definition: GNN_DataStorage.h:23
TrigFTF_GNN_Node::layer
unsigned short layer() const
Definition: GNN_DataStorage.h:31
TrigFTF_GNN_DataStorage::initializeNodes
void initializeNodes(bool)
Definition: GNN_DataStorage.cxx:192
TrigFTF_GNN_EtaBin::generatePhiIndexing
void generatePhiIndexing(float)
Definition: GNN_DataStorage.cxx:80
TrigFTF_GNN_Geometry
Definition: GNN_Geometry.h:50
TrigFTF_GNN_Edge::m_nNei
unsigned char m_nNei
Definition: GNN_DataStorage.h:132
Rtt_histogram.n1
n1
Definition: Rtt_histogram.py:21
TrigFTF_GNN_EtaBin::CompareNodesByPhi
Definition: GNN_DataStorage.h:45
TrigFTF_GNN_Edge::m_p
float m_p[3]
Definition: GNN_DataStorage.h:133
TrigFTF_GNN_Node::x
float x() const
Definition: GNN_DataStorage.h:25
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
TrigFTF_GNN_DataStorage::loadStripGraphNodes
int loadStripGraphNodes(short, const std::vector< TrigFTF_GNN_Node > &)
Definition: GNN_DataStorage.cxx:151
TrigFTF_GNN_DataStorage::m_geo
const TrigFTF_GNN_Geometry & m_geo
Definition: GNN_DataStorage.h:102
TrigFTF_GNN_EtaBin::sortByPhi
void sortByPhi()
Definition: GNN_DataStorage.cxx:31
TrigFTF_GNN_Node::z
float z() const
Definition: GNN_DataStorage.h:29
TRTCalib_cfilter.p3
p3
Definition: TRTCalib_cfilter.py:132
TrigFTF_GNN_EtaBin::m_vn
std::vector< const TrigFTF_GNN_Node * > m_vn
Definition: GNN_DataStorage.h:72
TrigFTF_GNN_DataStorage::~TrigFTF_GNN_DataStorage
~TrigFTF_GNN_DataStorage()
Definition: GNN_DataStorage.cxx:108
TrigFTF_GNN_Edge::TrigFTF_GNN_Edge
TrigFTF_GNN_Edge(const TrigFTF_GNN_Node *n1, const TrigFTF_GNN_Node *n2, float p1, float p2, float p3)
Definition: GNN_DataStorage.h:118
TrigFTF_GNN_Node::r
float r() const
Definition: GNN_DataStorage.h:30
TrigFTF_GNN_Edge::m_n1
const TrigFTF_GNN_Node * m_n1
Definition: GNN_DataStorage.h:127
TrigFTF_GNN_Node::m_z
float m_z
Definition: GNN_DataStorage.h:35
TrigFTF_GNN_EtaBin::getMinBinRadius
float getMinBinRadius() const
Definition: GNN_DataStorage.h:64
TrigFTF_GNN_EtaBin::m_params
std::vector< std::array< float, 5 > > m_params
Definition: GNN_DataStorage.h:75