ATLAS Offline Software
Loading...
Searching...
No Matches
GNNR3_FasTrackConnector Class Reference

#include <GNNR3_FasTrackConnector.h>

Collaboration diagram for GNNR3_FasTrackConnector:

Classes

struct  LayerGroup

Public Member Functions

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

Public Attributes

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

Detailed Description

Definition at line 23 of file GNNR3_FasTrackConnector.h.

Constructor & Destructor Documentation

◆ GNNR3_FasTrackConnector()

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

Definition at line 17 of file GNNR3_FasTrackConnector.cxx.

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

◆ ~GNNR3_FasTrackConnector()

GNNR3_FasTrackConnector::~GNNR3_FasTrackConnector ( )

Definition at line 178 of file GNNR3_FasTrackConnector.cxx.

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

Member Data Documentation

◆ m_connMap

std::map<int, std::vector<GNNR3_FASTRACK_CONNECTION*> > GNNR3_FasTrackConnector::m_connMap

Definition at line 42 of file GNNR3_FasTrackConnector.h.

◆ m_etaBin

float GNNR3_FasTrackConnector::m_etaBin

Definition at line 39 of file GNNR3_FasTrackConnector.h.

◆ m_layerGroups

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

Definition at line 41 of file GNNR3_FasTrackConnector.h.


The documentation for this class was generated from the following files: