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 
16 
18 
20 
22 public:
23 
24  struct CompareByPhi {
25 
27  return n1->phi() < n2->phi();
28  }
29 
30  };
31 
34 
35  void sortByPhi();
36  void initializeNodes();
37  bool empty() const {
38  return m_vn.empty();
39  }
40 
41  void generatePhiIndexing(float);
42 
43  std::vector<const TrigSiSpacePointBase*> m_vn;//nodes of the graph
44  std::vector<std::pair<float, unsigned int> > m_vPhiNodes;
45  std::vector<std::vector<unsigned int> > m_in;//vectors of incoming edges
46  std::vector<std::array<float,5> > m_params;//node attributes: m_minCutOnTau, m_maxCutOnTau, m_phi, m_r, m_z;
47 };
48 
50 public:
53 
54  int addSpacePoint(const TrigSiSpacePointBase*, bool);
55  unsigned int numberOfNodes() const;
56  void sortByPhi();
57  void initializeNodes(bool);
58  void generatePhiIndexing(float);
59 
60 
62  if(idx >= static_cast<int>(m_etaBins.size())) idx = idx-1;
63  return m_etaBins.at(idx);
64  }
65 
66 protected:
67 
69 
70  std::vector<TrigFTF_GNN_EtaBin> m_etaBins;
71 
72 };
73 
75 public:
76 
77  struct CompareLevel {
78  public:
79  bool operator()(const TrigFTF_GNN_Edge* pS1, const TrigFTF_GNN_Edge* pS2) {
80  return pS1->m_level > pS2->m_level;
81  }
82  };
83 
84  TrigFTF_GNN_Edge(const TrigSiSpacePointBase* n1, const TrigSiSpacePointBase* n2, float p1, float p2, float p3) : m_n1(n1), m_n2(n2), m_level(1), m_next(1), m_nNei(0) {
85  m_p[0] = p1;
86  m_p[1] = p2;
87  m_p[2] = p3;
88  }
89 
90  TrigFTF_GNN_Edge() : m_n1(nullptr), m_n2(nullptr), m_level(-1), m_next(-1), m_nNei(0) {};
91 
92  const TrigSiSpacePointBase* m_n1{nullptr};
93  const TrigSiSpacePointBase* m_n2{nullptr};
94 
95  signed char m_level{-1}, m_next{-1};
96 
97  unsigned char m_nNei{0};
98  float m_p[3]{};
99 
100  unsigned int m_vNei[N_SEG_CONNS]{};//global indices of the connected edges
101 
102 };
103 
104 #endif
TrigFTF_GNN_EtaBin
Definition: GNN_DataStorage.h:21
TrigSiSpacePointBase::phi
void phi(const double phi)
Definition: TrigSiSpacePointBase.h:52
TrigFTF_GNN_DataStorage
Definition: GNN_DataStorage.h:49
TrigFTF_GNN_Edge::TrigFTF_GNN_Edge
TrigFTF_GNN_Edge(const TrigSiSpacePointBase *n1, const TrigSiSpacePointBase *n2, float p1, float p2, float p3)
Definition: GNN_DataStorage.h:84
TrigFTF_GNN_EtaBin::m_in
std::vector< std::vector< unsigned int > > m_in
Definition: GNN_DataStorage.h:45
TrigFTF_GNN_Edge::CompareLevel
Definition: GNN_DataStorage.h:77
TrigFTF_GNN_EtaBin::m_vn
std::vector< const TrigSiSpacePointBase * > m_vn
Definition: GNN_DataStorage.h:43
TrigFTF_GNN_DataStorage::sortByPhi
void sortByPhi()
Definition: GNN_DataStorage.cxx:123
TrigFTF_GNN_Edge::m_vNei
unsigned int m_vNei[N_SEG_CONNS]
Definition: GNN_DataStorage.h:100
TrigFTF_GNN_Edge::CompareLevel::operator()
bool operator()(const TrigFTF_GNN_Edge *pS1, const TrigFTF_GNN_Edge *pS2)
Definition: GNN_DataStorage.h:79
TrigFTF_GNN_EtaBin::TrigFTF_GNN_EtaBin
TrigFTF_GNN_EtaBin()
Definition: GNN_DataStorage.cxx:15
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
TrigFTF_GNN_EtaBin::~TrigFTF_GNN_EtaBin
~TrigFTF_GNN_EtaBin()
Definition: GNN_DataStorage.cxx:21
TrigFTF_GNN_Edge::TrigFTF_GNN_Edge
TrigFTF_GNN_Edge()
Definition: GNN_DataStorage.h:90
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:37
TrigFTF_GNN_Edge::m_next
signed char m_next
Definition: GNN_DataStorage.h:95
TrigFTF_GNN_DataStorage::m_etaBins
std::vector< TrigFTF_GNN_EtaBin > m_etaBins
Definition: GNN_DataStorage.h:70
TrigFTF_GNN_DataStorage::TrigFTF_GNN_DataStorage
TrigFTF_GNN_DataStorage(const TrigFTF_GNN_Geometry &)
Definition: GNN_DataStorage.cxx:69
TrigFTF_GNN_Edge
Definition: GNN_DataStorage.h:74
TrigFTF_GNN_DataStorage::generatePhiIndexing
void generatePhiIndexing(float)
Definition: GNN_DataStorage.cxx:174
TrigFTF_GNN_EtaBin::CompareByPhi
Definition: GNN_DataStorage.h:24
TrigFTF_GNN_EtaBin::m_vPhiNodes
std::vector< std::pair< float, unsigned int > > m_vPhiNodes
Definition: GNN_DataStorage.h:44
TrigFTF_GNN_EtaBin::initializeNodes
void initializeNodes()
Definition: GNN_DataStorage.cxx:31
TrigFTF_GNN_Edge::m_level
signed char m_level
Definition: GNN_DataStorage.h:95
TrigSiSpacePointBase.h
TrigFTF_GNN_EtaBin::CompareByPhi::operator()
bool operator()(const TrigSiSpacePointBase *n1, const TrigSiSpacePointBase *n2)
Definition: GNN_DataStorage.h:26
TrigFTF_GNN_DataStorage::numberOfNodes
unsigned int numberOfNodes() const
Definition: GNN_DataStorage.cxx:113
TrigFTF_GNN_DataStorage::getEtaBin
TrigFTF_GNN_EtaBin & getEtaBin(int idx)
Definition: GNN_DataStorage.h:61
TrigFTF_GNN_DataStorage::addSpacePoint
int addSpacePoint(const TrigSiSpacePointBase *, bool)
Definition: GNN_DataStorage.cxx:75
TrigFTF_GNN_DataStorage::initializeNodes
void initializeNodes(bool)
Definition: GNN_DataStorage.cxx:127
TrigFTF_GNN_EtaBin::generatePhiIndexing
void generatePhiIndexing(float)
Definition: GNN_DataStorage.cxx:46
TrigFTF_GNN_Geometry
Definition: GNN_Geometry.h:50
TrigFTF_GNN_Edge::m_nNei
unsigned char m_nNei
Definition: GNN_DataStorage.h:97
Rtt_histogram.n1
n1
Definition: Rtt_histogram.py:21
TrigFTF_GNN_Edge::m_n2
const TrigSiSpacePointBase * m_n2
Definition: GNN_DataStorage.h:93
TrigFTF_GNN_Edge::m_p
float m_p[3]
Definition: GNN_DataStorage.h:98
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
TrigFTF_GNN_DataStorage::m_geo
const TrigFTF_GNN_Geometry & m_geo
Definition: GNN_DataStorage.h:68
TrigFTF_GNN_EtaBin::sortByPhi
void sortByPhi()
Definition: GNN_DataStorage.cxx:27
TrigSiSpacePointBase
Definition: TrigSiSpacePointBase.h:23
TRTCalib_cfilter.p3
p3
Definition: TRTCalib_cfilter.py:132
TrigFTF_GNN_DataStorage::~TrigFTF_GNN_DataStorage
~TrigFTF_GNN_DataStorage()
Definition: GNN_DataStorage.cxx:73
TrigFTF_GNN_Edge::m_n1
const TrigSiSpacePointBase * m_n1
Definition: GNN_DataStorage.h:92
TrigFTF_GNN_EtaBin::m_params
std::vector< std::array< float, 5 > > m_params
Definition: GNN_DataStorage.h:46