ATLAS Offline Software
Loading...
Searching...
No Matches
ActsTrk::GbtsConnectionTable Namespace Reference

Classes

struct  Connection
 One row of the table: the two layers it connects, and the stage it is in. More...
struct  ReadResult
 The table as it is on file. More...

Functions

ReadResult read (std::istream &inputStream)
 Read the GBTS layer connection table.

Function Documentation

◆ read()

GbtsConnectionTable::ReadResult ActsTrk::GbtsConnectionTable::read ( std::istream & inputStream)

Read the GBTS layer connection table.

The whole table, as written: which of it applies to the detector and to the pass at hand is the caller's to decide. The bin table each connection carries is skipped, GBTS recomputes it from the layer geometry.

Parameters
inputStreamthe table
Exceptions
std::runtime_errorif the table cannot be read
Returns
the table

Definition at line 13 of file GbtsConnectionTableReader.cxx.

14 {
15 ReadResult result;
16
17 std::uint32_t nConnections{};
18 std::uint32_t iConnection{};
19
20 const auto fail = [&nConnections, &iConnection](const std::string& what) {
21 throw std::runtime_error("GBTS connection table: cannot read " + what +
22 " at connection " + std::to_string(iConnection) +
23 " of " + std::to_string(nConnections));
24 };
25
26 if (!(inputStream >> nConnections >> result.etaBinWidth)) {
27 throw std::runtime_error(
28 "GBTS connection table: cannot read the connection count and the eta "
29 "bin width");
30 }
31
32 for (; iConnection < nConnections; ++iConnection) {
33 std::uint32_t index{};
34 std::uint32_t height{};
35 std::uint32_t width{};
36 std::uint32_t nEntries{};
37 Connection connection;
38
39 if (!(inputStream >> index >> connection.stage >> connection.src >>
40 connection.dst >> height >> width >> nEntries)) {
41 fail("the header");
42 }
43
44 // GBTS recomputes the bin table from the layer geometry
45 const std::uint64_t nBins = std::uint64_t{height} * width;
46 for (std::uint64_t bin = 0; bin < nBins; ++bin) {
47 std::uint32_t unused{};
48 if (!(inputStream >> unused)) {
49 fail("the bin table");
50 }
51 }
52
53 result.connections.push_back(connection);
54 }
55
56 return result;
57}
const double width
void unused(Args &&...)
str index
Definition DeMoScan.py:362
fail(message)
One row of the table: the two layers it connects, and the stage it is in.