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

#include <FasTrackConnector.h>

Collaboration diagram for FasTrackConnector:

Classes

struct  LayerGroup
 

Public Member Functions

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

Public Attributes

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

Detailed Description

Definition at line 23 of file FasTrackConnector.h.

Constructor & Destructor Documentation

◆ FasTrackConnector()

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

Definition at line 17 of file 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<FASTRACK_CONNECTION*> >::iterator it = m_connMap.find(stage);
60 
61  if(it == m_connMap.end()) {
62  std::vector<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 FASTRACK_CONNECTION*> lConns;
70 
71  std::map<int, std::vector<const 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 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 FASTRACK_CONNECTION*> >::reverse_iterator it = newConnMap.rbegin();it!=newConnMap.rend();++it, currentStage++) {
141 
142  const std::vector<const 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 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 FASTRACK_CONNECTION*> >::iterator l1MapIt = l1ConnMap.find(dst);
153  if(l1MapIt != l1ConnMap.end())
154  (*l1MapIt).second.push_back(conn);
155  else {
156  std::vector<const 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 }

◆ ~FasTrackConnector()

FasTrackConnector::~FasTrackConnector ( )

Definition at line 176 of file FasTrackConnector.cxx.

176  {
177  m_layerGroups.clear();
178  for(std::map<int, std::vector<FASTRACK_CONNECTION*> >::iterator it = m_connMap.begin();it!=m_connMap.end();++it) {
179  for(std::vector<FASTRACK_CONNECTION*>::iterator cIt=(*it).second.begin();cIt!=(*it).second.end();++cIt) {
180  delete (*cIt);
181  }
182  (*it).second.clear();
183  }
184  m_connMap.clear();
185 
186 }

Member Data Documentation

◆ m_connMap

std::map<int, std::vector<FASTRACK_CONNECTION*> > FasTrackConnector::m_connMap

Definition at line 42 of file FasTrackConnector.h.

◆ m_etaBin

float FasTrackConnector::m_etaBin

Definition at line 39 of file FasTrackConnector.h.

◆ m_layerGroups

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

Definition at line 41 of file FasTrackConnector.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
FasTrackConnection
Definition: FasTrackConnector.h:12
checkCorrelInHIST.conn
conn
Definition: checkCorrelInHIST.py:25
python.FPGATrackSimAnalysisConfig.stage
stage
Definition: FPGATrackSimAnalysisConfig.py:475
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
FASTRACK_CONNECTION
struct FasTrackConnection FASTRACK_CONNECTION
lumiFormat.i
int i
Definition: lumiFormat.py:85
python.xAODType.dummy
dummy
Definition: xAODType.py:4
FasTrackConnector::m_connMap
std::map< int, std::vector< FASTRACK_CONNECTION * > > m_connMap
Definition: FasTrackConnector.h:42
FasTrackConnector::m_etaBin
float m_etaBin
Definition: FasTrackConnector.h:39
python.PyAthena.v
v
Definition: PyAthena.py:154
Base_Fragment.width
width
Definition: Sherpa_i/share/common/Base_Fragment.py:59
FasTrackConnector::m_layerGroups
std::map< int, std::vector< struct LayerGroup > > m_layerGroups
Definition: FasTrackConnector.h:41
calibdata.copy
bool copy
Definition: calibdata.py:27
dqBeamSpot.nEntries
int nEntries
Definition: dqBeamSpot.py:73