ATLAS Offline Software
Classes | Public Member Functions | Public Attributes | List of all members
GNN_FasTrackConnector Class Reference

#include <GNN_FasTrackConnector.h>

Collaboration diagram for GNN_FasTrackConnector:

Classes

struct  LayerGroup
 

Public Member Functions

 GNN_FasTrackConnector (std::ifstream &, bool LRTmode)
 
 ~GNN_FasTrackConnector ()
 

Public Attributes

float m_etaBin
 
std::map< int, std::vector< struct LayerGroup > > m_layerGroups
 
std::map< int, std::vector< GNN_FASTRACK_CONNECTION * > > m_connMap
 

Detailed Description

Definition at line 23 of file GNN_FasTrackConnector.h.

Constructor & Destructor Documentation

◆ GNN_FasTrackConnector()

GNN_FasTrackConnector::GNN_FasTrackConnector ( std::ifstream &  inFile,
bool  LRTmode 
)

Definition at line 17 of file GNN_FasTrackConnector.cxx.

17  {
18 
19  m_connMap.clear();
20  m_layerGroups.clear();
21 
22  int nLinks;
23 
24  inFile >> nLinks >> m_etaBin;
25 
26 
27  for(int l=0;l<nLinks;l++) {
28 
29  unsigned int stage, lIdx, src, dst, nEntries;
30  int height, width;
31 
32  inFile >> lIdx >> stage >> src >> dst >> height >> width >> nEntries;
33 
35 
36  int dummy;
37 
38  for(int i=0;i<height;i++) {
39  for(int j=0;j<width;j++) inFile >> dummy;//pC->m_binTable[j+i*width];
40  }
41 
42  int srcvol_id = src / 1000;
43  int dstvol_id = src / 1000;
44 
45  bool srcIsStrip = (srcvol_id == 13 || srcvol_id == 12 || srcvol_id == 14);
46  bool dstIsStrip = (dstvol_id == 13 || dstvol_id == 12 || dstvol_id == 14);
47  if (LRTmode) {
48  if ( !srcIsStrip || !dstIsStrip) {
49  delete pC;
50  continue;
51  }
52  } else {
53  if ( srcIsStrip || dstIsStrip) {
54  delete pC;
55  continue;
56  }
57  }
58 
59  std::map<int, std::vector<GNN_FASTRACK_CONNECTION*> >::iterator it = m_connMap.find(stage);
60 
61  if(it == m_connMap.end()) {
62  std::vector<GNN_FASTRACK_CONNECTION*> v = {pC};
63  m_connMap.insert(std::make_pair(stage, v));
64  } else (*it).second.push_back(pC);
65  }
66 
67  //re-arrange the connection stages
68 
69  std::list<const GNN_FASTRACK_CONNECTION*> lConns;
70 
71  std::map<int, std::vector<const GNN_FASTRACK_CONNECTION*> > newConnMap;
72 
73  for(const auto& conn : m_connMap) {
74  std::copy(conn.second.begin(), conn.second.end(), std::back_inserter(lConns));
75  }
76 
77  int stageCounter = 0;
78 
79  while(!lConns.empty()) {
80 
81  std::unordered_map<unsigned int, std::pair<int, int> > mCounter;//layerKey, nDst, nSrc
82 
83  for(const auto& conn : lConns) {
84  auto entryIt = mCounter.find(conn->m_dst);
85  if(entryIt != mCounter.end()) {
86  (*entryIt).second.first++;
87  }
88  else {
89  int nDst = 1;
90  int nSrc = 0;
91  mCounter.insert(std::make_pair(conn->m_dst, std::make_pair(nDst, nSrc)));
92  }
93 
94  entryIt = mCounter.find(conn->m_src);
95  if(entryIt != mCounter.end()) {
96  (*entryIt).second.second++;
97  }
98  else {
99  int nDst = 0;
100  int nSrc = 1;
101  mCounter.insert(std::make_pair(conn->m_src, std::make_pair(nDst, nSrc)));
102  }
103  }
104 
105  //find layers with nSrc = 0
106 
107  std::set<unsigned int> zeroLayers;
108 
109  for(const auto& layerCounts : mCounter) {
110 
111  if(layerCounts.second.second!=0) continue;
112 
113  zeroLayers.insert(layerCounts.first);
114  }
115 
116  //remove connections which use zeroLayer as destination
117 
118  std::vector<const GNN_FASTRACK_CONNECTION*> theStage;
119 
121 
122  while(cIt!=lConns.end()) {
123  if(zeroLayers.find((*cIt)->m_dst) != zeroLayers.end()) {//check if contains
124  theStage.push_back(*cIt);
125  cIt = lConns.erase(cIt);
126  continue;
127  }
128  ++cIt;
129  }
130  newConnMap.insert(std::make_pair(stageCounter, theStage));
131  stageCounter++;
132  }
133 
134  //create layer groups
135 
136  int currentStage = 0;
137 
138  //the doublet making is done using "outside-in" approach hence the reverse iterations
139 
140  for(std::map<int, std::vector<const GNN_FASTRACK_CONNECTION*> >::reverse_iterator it = newConnMap.rbegin();it!=newConnMap.rend();++it, currentStage++) {
141 
142  const std::vector<const GNN_FASTRACK_CONNECTION*> & vConn = (*it).second;
143 
144  //loop over links, extract all connections for the stage, group sources by L1 (dst) index
145 
146  std::map<unsigned int, std::vector<const GNN_FASTRACK_CONNECTION*> > l1ConnMap;
147 
148  for(const auto* conn : vConn) {
149 
150  unsigned int dst = conn->m_dst;
151 
152  std::map<unsigned int, std::vector<const GNN_FASTRACK_CONNECTION*> >::iterator l1MapIt = l1ConnMap.find(dst);
153  if(l1MapIt != l1ConnMap.end())
154  (*l1MapIt).second.push_back(conn);
155  else {
156  std::vector<const GNN_FASTRACK_CONNECTION*> v = {conn};
157  l1ConnMap.insert(std::make_pair(dst, v));
158  }
159  }
160 
161  std::vector<LayerGroup> lgv;
162 
163  lgv.reserve(l1ConnMap.size());
164 
165  for(const auto& l1Group : l1ConnMap) {
166  lgv.push_back(LayerGroup(l1Group.first, l1Group.second));
167  }
168 
169  m_layerGroups.insert(std::make_pair(currentStage, lgv));
170  }
171 
172  newConnMap.clear();
173 
174 }

◆ ~GNN_FasTrackConnector()

GNN_FasTrackConnector::~GNN_FasTrackConnector ( )

Definition at line 176 of file GNN_FasTrackConnector.cxx.

176  {
177 
178  m_layerGroups.clear();
179 
180  for(auto& conn : m_connMap) {
181  for(auto& link : conn.second) delete link;
182  conn.second.clear();
183  }
184 
185  m_connMap.clear();
186 
187 }

Member Data Documentation

◆ m_connMap

std::map<int, std::vector<GNN_FASTRACK_CONNECTION*> > GNN_FasTrackConnector::m_connMap

Definition at line 42 of file GNN_FasTrackConnector.h.

◆ m_etaBin

float GNN_FasTrackConnector::m_etaBin

Definition at line 39 of file GNN_FasTrackConnector.h.

◆ m_layerGroups

std::map<int, std::vector<struct LayerGroup> > GNN_FasTrackConnector::m_layerGroups

Definition at line 41 of file GNN_FasTrackConnector.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
checkCorrelInHIST.conn
conn
Definition: checkCorrelInHIST.py:25
python.FPGATrackSimAnalysisConfig.stage
stage
Definition: FPGATrackSimAnalysisConfig.py:558
WriteCellNoiseToCool.src
src
Definition: WriteCellNoiseToCool.py:513
makeTOC.inFile
string inFile
Definition: makeTOC.py:5
skel.it
it
Definition: skel.GENtoEVGEN.py:396
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
lumiFormat.i
int i
Definition: lumiFormat.py:85
python.xAODType.dummy
dummy
Definition: xAODType.py:4
GNN_FasTrackConnector::m_layerGroups
std::map< int, std::vector< struct LayerGroup > > m_layerGroups
Definition: GNN_FasTrackConnector.h:41
GNN_FASTRACK_CONNECTION
struct GNN_FasTrackConnection GNN_FASTRACK_CONNECTION
python.PyAthena.v
v
Definition: PyAthena.py:154
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
GNN_FasTrackConnection
Definition: GNN_FasTrackConnector.h:12
calibdata.copy
bool copy
Definition: calibdata.py:27
dqBeamSpot.nEntries
int nEntries
Definition: dqBeamSpot.py:73
GNN_FasTrackConnector::m_connMap
std::map< int, std::vector< GNN_FASTRACK_CONNECTION * > > m_connMap
Definition: GNN_FasTrackConnector.h:42
GNN_FasTrackConnector::m_etaBin
float m_etaBin
Definition: GNN_FasTrackConnector.h:39