ATLAS Offline Software
Loading...
Searching...
No Matches
PixelMultipleConnection1D.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// PixelMultipleConnection1D.cxx
7// Implementation file for class PixelMultipleConnection1D
9// (c) ATLAS Pixel Detector software
11// Version 1.1 05/04/2001 David Calvet
12// 06/02/2008 Grant Gorfine
14
16#include <iostream>
17
18namespace InDetDD {
19
20// Constructor with parameters:
22 const std::vector<int> &connections)
23 : m_lowerDiode(0),
24 m_upperDiode(-1),
27{
28 set(lowerIndex, connections);
29}
30
37
38void
39PixelMultipleConnection1D::set(const int lowerIndex,
40 const std::vector<int> &connections)
41{
42
43 // extract lower and upper diode and readout cell numbers from connections vector
44 bool firstDiode = true;
45 bool firstReadout = true;
46 for(unsigned int index = 0; index < connections.size(); ++index) {
47 int readout = connections[index];
48 int diode = lowerIndex + index;
49 if (firstDiode && readout != diode) {
50 m_lowerDiode = diode;
51 m_upperDiode = diode;
52 firstDiode = false;
53 }
54 if (firstReadout) {
55 m_lowerReadout=readout;
56 m_upperReadout=readout;
57 firstReadout = false;
58 }
59 if (readout<m_lowerReadout) m_lowerReadout=readout;
60 if (readout>m_upperReadout) m_upperReadout=readout;
61 if (readout != diode && diode < m_lowerDiode) m_lowerDiode = diode;
62 if (readout != diode && diode > m_upperDiode) m_upperDiode = diode;
63 }
64
65 // Fource readout range to be include diode range (this is generally already the case)
68
71
72 // First fill primary cell. ie diode and readout the same.
73 for(unsigned int index = 0; index < connections.size(); ++index) {
74 int readout = connections[index];
75 int diode = lowerIndex + index;
76 if (readout == diode) m_readoutToDiode[readout-m_lowerReadout].push_back(diode);
77 }
78
79
80 // Now the rest of readoutToDiode ie diode and readout not the same.
81 // Fill also diodeToReadout
82 for(unsigned int index = 0; index < connections.size(); ++index) {
83 int readout = connections[index];
84 int diode = lowerIndex + index;
85 if (readout != diode) m_readoutToDiode[readout - m_lowerReadout].push_back(diode);
86 if (diode >= m_lowerDiode && diode <= m_upperDiode) m_diodeToReadout[diode - m_lowerDiode] = readout;
87 }
88
89 // Created ganged map. If the diode is ganged it points to the other diode.
91 for(int iDiode = m_lowerReadout; iDiode <= m_upperReadout; iDiode++) {
92 // Fill with the same index which indicates its not ganged.
93 m_diodeGanged[iDiode - m_lowerReadout] = iDiode;
94 int readout = iDiode;
95 if (!outsideDiode(iDiode)) readout = readoutOfDiode(iDiode);
96 if (numberOfConnectedCells(readout) >= 2) {
97 int cell0 = connectedCell(readout, 0);
98 int cell1 = connectedCell(readout, 1);
99 if (iDiode == cell0) {
100 m_diodeGanged[iDiode - m_lowerReadout] = cell1;
101 } else {
102 m_diodeGanged[iDiode - m_lowerReadout] = cell0;
103 }
104 }
105 }
106
107 // For debugging only
108 //debugPrintout();
109}
110
112{
113 // Debug printout
114 std::cout << "m_lowerDiode = " << m_lowerDiode << std::endl;
115 std::cout << "m_upperDiode = " << m_upperDiode << std::endl;
116 std::cout << "m_lowerReadout = " << m_lowerReadout << std::endl;
117 std::cout << "m_upperReadout = " << m_upperReadout << std::endl;
118 std::cout << "m_readoutToDiode: ";
119 for (unsigned int i = 0; i < m_readoutToDiode.size(); i++) {
120 std::cout << "(" << m_lowerReadout + i << ": ";
121 for (int j : m_readoutToDiode[i]) {
122 std::cout << j << " ";
123 }
124 std::cout << ") ";
125 }
126 std::cout << std::endl;
127
128 for (unsigned int i = 0; i < m_diodeToReadout.size(); i++) {
129 std::cout << "(" << m_lowerDiode + i << ": " << m_diodeToReadout[i] << ") ";
130 }
131 std::cout << std::endl;
132
133 for (unsigned int i = 0; i < m_diodeGanged.size(); i++) {
134 std::cout << "(" << m_lowerReadout + i << ": " << m_diodeGanged[i] << ") ";
135 }
136 std::cout << std::endl;
137}
138
139
140
141} // namespace InDetDD
int m_lowerDiode
lower diode index to which it applies
std::vector< int > m_diodeGanged
connection table diode -> other diode.
bool outsideDiode(const int cell) const
Check if the diode is in the range:
int m_upperReadout
upper cell to which it applies
void set(const int lowerIndex, const std::vector< int > &connections)
int m_upperDiode
upper diode index to which it applies
std::vector< std::vector< int > > m_readoutToDiode
connection table readout -> diodes
int connectedCell(const int index, unsigned int number) const
Return the diode index corresponding the this readout.
int m_lowerReadout
lower cell to which it applies
int numberOfConnectedCells(const int index) const
Return the number of diodes that are connected to this readout cell, Must check outsideReadout first.
int readoutOfDiode(const int index) const
Return readout cell id of this diode, Must check outsideDiode first.
std::vector< int > m_diodeToReadout
connection table diode -> readout
Message Stream Member.
Definition index.py:1