ATLAS Offline Software
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 
19 namespace InDetDD {
20 
21 // Constructor with parameters:
22 PixelReadoutScheme::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.
44 int
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();
52 
54 
55 }
56 
57 // Id of diodes connected to this readout. 0 is the primary cell.
58 SiCellId
59 PixelReadoutScheme::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 
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;
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
InDetDD::PixelMultipleConnection1D::set
void set(const int lowerIndex, const std::vector< int > &connections)
Definition: PixelMultipleConnection1D.cxx:39
InDetDD::PixelReadoutScheme::numberOfConnectedCells
int numberOfConnectedCells(const SiReadoutCellId &readoutId) const
number of cells connected to this readout.
Definition: PixelReadoutScheme.cxx:45
InDetDD::SiCellId::isValid
bool isValid() const
Test if its in a valid state.
Definition: SiCellId.h:136
InDetDD::PixelReadoutScheme::PixelReadoutScheme
PixelReadoutScheme()
InDetDD::SiCellId::phiIndex
int phiIndex() const
Get phi index. Equivalent to strip().
Definition: SiCellId.h:122
PixelReadoutScheme.h
InDetDD::PixelReadoutScheme::readoutIdOfCell
SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const
Readout id of this diode.
Definition: PixelReadoutScheme.cxx:76
InDetDD::PixelMultipleConnection1D::readoutOfDiode
int readoutOfDiode(const int index) const
Return readout cell id of this diode, Must check outsideDiode first.
Definition: PixelMultipleConnection1D.h:116
SiReadoutCellId.h
InDetDD::SiCellId::etaIndex
int etaIndex() const
Get eta index.
Definition: SiCellId.h:114
InDetDD::PixelMultipleConnection1D::gangedCell
int gangedCell(const int index) const
If the diode is gnaged return the other diode.
Definition: PixelMultipleConnection1D.h:121
InDetDD::PixelMultipleConnection1D::outsideReadout
bool outsideReadout(const int index) const
Check if the readout cell is in the range; Also for index of gangedCell.
Definition: PixelMultipleConnection1D.h:94
InDetDD::PixelReadoutScheme::connectedCell
SiCellId connectedCell(const SiReadoutCellId &readoutId, unsigned int number) const
Cell ids of cell connected to this readout.
Definition: PixelReadoutScheme.cxx:59
InDetDD::PixelReadoutScheme::m_rowConnections
PixelMultipleConnection1D m_rowConnections
multiple connections for rows
Definition: PixelReadoutScheme.h:122
InDetDD::PixelMultipleConnection1D::connectedCell
int connectedCell(const int index, unsigned int number) const
Return the diode index corresponding the this readout.
Definition: PixelMultipleConnection1D.h:111
python.selection.number
number
Definition: selection.py:20
InDetDD::PixelReadoutScheme::addMultipleRowConnection
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...
Definition: PixelReadoutScheme.cxx:102
InDetDD::PixelReadoutScheme::m_columns
int m_columns
Number of columns.
Definition: PixelReadoutScheme.h:128
InDetDD::SiCellId
Definition: SiCellId.h:29
eflowRec::phiIndex
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition: EtaPhiLUT.cxx:23
InDetDD::PixelReadoutScheme::m_rows
int m_rows
Number of rows.
Definition: PixelReadoutScheme.h:129
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
InDetDD::SiReadoutCellId
Definition: SiReadoutCellId.h:42
InDetDD::PixelMultipleConnection1D::outsideDiode
bool outsideDiode(const int cell) const
Check if the diode is in the range:
Definition: PixelMultipleConnection1D.h:100
InDetDD::PixelReadoutScheme::gangedCell
SiCellId gangedCell(const SiCellId &cellId) const
If cell is ganged return the other cell, otherwise return an invalid id.
Definition: PixelReadoutScheme.cxx:91
SiCellId.h
InDetDD::PixelMultipleConnection1D::numberOfConnectedCells
int numberOfConnectedCells(const int index) const
Return the number of diodes that are connected to this readout cell, Must check outsideReadout first.
Definition: PixelMultipleConnection1D.h:106