18 #include <unordered_map>
21 using namespace asg::msgUserCode;
27 std::ifstream
fin(filepath);
31 throw (
"FPGATrackSimSectorBank couldn't open " + filepath);
52 ok = ok && std::getline(
fin,
line);
55 std::istringstream sline(
line);
56 ok = ok && (sline >> nSectors >> m_nLayers);
58 if (!ok)
throw "Error reading header";
60 m_s2mMap.resize(nSectors, std::vector<module_t>(m_nLayers));
69 int sector_file, UNUSED, coverage;
73 if (
line.empty() ||
line[0] ==
'!')
continue;
75 std::istringstream sline(
line);
77 ok = ok && (sline >> sector_file);
78 ok = ok && (sector_file == sector);
80 for (
unsigned i = 0;
i < m_nLayers;
i++)
81 ok = ok && (sline >> m_s2mMap[sector][
i]);
83 ok = ok && (sline >> UNUSED >> coverage);
98 m_m2sMap.resize(m_nLayers);
101 for (
sector_t sector = 0; (size_t)sector < m_s2mMap.size(); sector++)
104 m_m2sMap[
layer].insert(std::make_pair(moduleID, sector));
112 std::vector<sector_t>
out;
114 for (
auto it_m2s =
range.first; it_m2s !=
range.second; it_m2s++)
115 out.push_back(it_m2s->second);
123 assert(modules.size() == m_nLayers);
125 std::set<sector_t> sectors_good;
128 std::set<sector_t> sectors_new;
131 for (
auto it_m2s =
range.first; it_m2s !=
range.second; it_m2s++)
132 if (
layer == 0 || sectors_good.count(it_m2s->second))
133 sectors_new.insert(it_m2s->second);
135 if (sectors_new.empty())
return -1;
136 sectors_good = sectors_new;
139 assert(sectors_good.size() == 1);
140 return *(sectors_good.begin());
148 std::vector<module_t> modules(
hits.size());
150 for (
size_t i = 0;
i <
hits.size();
i++)
158 modules[
i] =
hits[
i][0]->getIdentifierHash();
162 std::unordered_map<unsigned, unsigned> hashCount;
163 for (
auto const &
h :
hits[
i]) hashCount[
h->getIdentifierHash()]++;
164 modules[
i] = std::max_element(hashCount.begin(), hashCount.end())->first;
168 return findSector(modules);
175 m_absQOverPtBinning = absBinning;
179 m_qOverPtBins = qOverPtBins;
180 if (m_qOverPtBins.size() == 0) {