ATLAS Offline Software
Loading...
Searching...
No Matches
PixelReadoutScheme.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
6// PixelReadoutScheme.cxx
7// Implementation file for class PixelReadoutScheme
9// (c) ATLAS Pixel Detector software
11// Version 2.1 08/06/2001 David Calvet
12// Modified: Grant Gorfine
14
18
19namespace InDetDD {
20
21// Constructor with parameters:
22PixelReadoutScheme::PixelReadoutScheme(const int circuitsPerColumn,
23 const int circuitsPerRow,
24 const int cellColumnsPerCircuit,
25 const int cellRowsPerCircuit,
26 const int diodeColumnsPerCircuit,
27 const int diodeRowsPerCircuit) :
28 m_numberOfCircuits(circuitsPerColumn*circuitsPerRow),
29 m_numberOfCircuitsPerColumn(circuitsPerColumn),
30 m_numberOfCircuitsPerRow(circuitsPerRow),
31 m_columnsPerCircuit(cellColumnsPerCircuit),
32 m_rowsPerCircuit(cellRowsPerCircuit),
33 m_columns(circuitsPerRow*diodeColumnsPerCircuit),
34 m_rows(circuitsPerColumn*diodeRowsPerCircuit)
35{
36 // protect against 0 columns or rows
37 if (!m_columns) throw std::runtime_error("PixelReadoutScheme: Number of columns is 0");
38 if (!m_rows) throw std::runtime_error("PixelReadoutScheme: Number of columns is 0");
39}
40
41
42
43// Number of cells connected to this readout. 2 means its ganged.
44int
46{
47 if (!readoutId.isValid()) return 0;
48
49 // Do quick check to see if it is outside ganged pixel range.
50 int phiIndex = readoutId.phiIndex();
51 if (m_rowConnections.outsideReadout(phiIndex)) return 1;
52
53 return m_rowConnections.numberOfConnectedCells(phiIndex);
54
55}
56
57// Id of diodes connected to this readout. 0 is the primary cell.
59PixelReadoutScheme::connectedCell(const SiReadoutCellId & readoutId, unsigned int number) const
60{
61 if (!readoutId.isValid()) return {};
62
63 // Do quick check to see if it is outside ganged pixel range.
64 int phiIndex = readoutId.phiIndex();
65 if (m_rowConnections.outsideReadout(phiIndex)) return readoutId;
66
67 int numConnected = m_rowConnections.numberOfConnectedCells(phiIndex);
68 if (!numConnected || static_cast<int>(number) >= numConnected) return {};
69
70 int newPhiIndex = m_rowConnections.connectedCell(phiIndex, number);
71 return {newPhiIndex, readoutId.etaIndex()};
72}
73
74// Id of the readout cell for this diode.
77{
78 if (!cellId.isValid()) return {};
79
80 int phiIndex = cellId.phiIndex();
81 int newPhiIndex = phiIndex;
82 if (!m_rowConnections.outsideDiode(phiIndex)) {
83 newPhiIndex = m_rowConnections.readoutOfDiode(phiIndex);
84 }
85
86 return {newPhiIndex, cellId.etaIndex()};
87
88}
89
92{
93 if (!cellId.isValid()) return cellId;
94 int phiIndex = cellId.phiIndex();
95 if (m_rowConnections.outsideReadout(phiIndex)) return {}; // Invalid ID
96 int newPhiIndex = m_rowConnections.gangedCell(phiIndex);
97 if (newPhiIndex == phiIndex) return {}; // Invalid ID
98 return {newPhiIndex, cellId.etaIndex()};
99}
100
101
103 const std::vector<int> &connections)
104{
105
106 m_rowConnections.set(lowerIndex, connections);
107}
108
109
110} // namespace InDetDD
int m_numberOfCircuitsPerColumn
number of circuits per column
int m_numberOfCircuitsPerRow
number of circuits per row
int m_numberOfCircuits
total number of circuits
SiCellId connectedCell(const SiReadoutCellId &readoutId, unsigned int number) const
Cell ids of cell connected to this readout.
SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const
Readout id of this diode.
PixelMultipleConnection1D m_rowConnections
multiple connections for rows
int m_rowsPerCircuit
number of cell rows per circuit
int m_columns
Number of columns.
SiCellId gangedCell(const SiCellId &cellId) const
If cell is ganged return the other cell, otherwise return an invalid id.
int numberOfConnectedCells(const SiReadoutCellId &readoutId) const
number of cells connected to this readout.
void addMultipleRowConnection(const int lowerRow, const std::vector< int > &connections)
Add a new multiple connection for rows: lower diode row for which the connection scheme is given vect...
int m_columnsPerCircuit
number of cell columns per circuit
Identifier for the strip or pixel cell.
Definition SiCellId.h:29
int phiIndex() const
Get phi index. Equivalent to strip().
Definition SiCellId.h:122
bool isValid() const
Test if its in a valid state.
Definition SiCellId.h:136
int etaIndex() const
Get eta index.
Definition SiCellId.h:114
Identifier for the strip or pixel readout cell.
Message Stream Member.
std::string number(const double &d, const std::string &s)
Definition utils.cxx:186