ATLAS Offline Software
Loading...
Searching...
No Matches
ITkPixelReadoutManager.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
10
11
12
13namespace InDetDD{
14 namespace ITk{
16 ISvcLocator *svc)
17 : base_class(name, svc){
18 }
19
20
22 ATH_MSG_DEBUG("ITkPixelReadoutManager::initialize()");
23 ATH_CHECK(m_detStore.retrieve());
25 ATH_CHECK(m_detStore->retrieve(m_idHelper, m_pixelIDName.value()));
26 return StatusCode::SUCCESS;
27 }
28
30 const Identifier wafer_id = m_idHelper->wafer_id(id);
31 const SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id);
32 return getModuleType(id,element);
33 }
34
36 const SiDetectorElement* element) const {
37
38 const PixelModuleDesign *p_design = static_cast<const PixelModuleDesign *>(&element->design());
40 ATH_MSG_ERROR("Non-RD53 readout technologies not supported!");
42 }
43
44 if (m_idHelper->barrel_ec(id) == 0) {
46 }
47
48 if (std::abs(m_idHelper->barrel_ec(id)) == 2) {
50 }
51
53 }
54
57 const Identifier wafer_id = m_idHelper->wafer_id(id);
58 const SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id);
59
60 return getDiodeType(id, element);
61
62 }
63
65 const SiDetectorElement* element) const {
66
67 const Identifier wafer_id = element->identify();
68
69 const PixelModuleDesign *p_design = static_cast<const PixelModuleDesign *>(&element->design());
71 ATH_MSG_ERROR("Non-RD53 readout technologies not supported!");
73 }
74
75 uint32_t col = getColumn(diodeId, wafer_id, element);
76 uint32_t row = getRow(diodeId, wafer_id, element);
77
78 if (col == invalidColumn or row == invalidRow){
80 }
81
82 // ---------------------
83 // Get the pixel type
84 // ---------------------
85 unsigned int FEs = p_design->numberOfCircuits();
86 unsigned int rowsPerFE = p_design->rowsPerCircuit();
87 unsigned int columnsPerFE = p_design->columnsPerCircuit();
88
89 if (FEs == 4) {
90 // long pixel row and columns
91 // 2 per row/column side
92 // TODO: avoid hardcoding this
93 if (row > rowsPerFE - 3 && col < columnsPerFE - 2) {
95 }
96 if (col > columnsPerFE - 3 && row < rowsPerFE - 2) {
98 }
99 // corner big pixels
100 if (row > rowsPerFE - 3 && col > columnsPerFE - 3) {
102 }
103 } else if (FEs != 1) {
104 ATH_MSG_WARNING("Module with a number of circuits which is not 1 or 4.");
105 ATH_MSG_WARNING("Long/pixel identification not implemented");
106 }
108 }
109
111 uint32_t FE,uint32_t row,uint32_t column) const{
112 return getPixelId(m_idHelper->wafer_id(offlineIdHash), FE, row, column);
113 }
114
115
117 PixelReadoutManager::getPixelId(Identifier offlineId,uint32_t FE, uint32_t row, uint32_t column) const{
118 const SiDetectorElement *element = m_detManager->getDetectorElement(offlineId);
119 const PixelModuleDesign *p_design = static_cast<const PixelModuleDesign *>(&element->design());
121 ATH_MSG_ERROR("Non-RD53 readout technologies not supported!");
122 return {};// illegal Identifier, standardized for PixelRodDecoder
123 }
124 unsigned int FEs = p_design->numberOfCircuits();
125 unsigned int FEsPerRow = p_design->numberOfCircuitsPerRow();
126 unsigned int rowsPerFE = p_design->rowsPerCircuit();
127 unsigned int columnsPerFE = p_design->columnsPerCircuit();
128 // ---------------------
129 // Check input sanity
130 // ---------------------
131 if (row >= rowsPerFE || column >= columnsPerFE || FE >= FEs) {
132 ATH_MSG_DEBUG("Illegal pixel requested OfflineID: " << std::hex << offlineId << std::dec << " FE: " << FE << " row: " << row << " column: " << column);
133 ATH_MSG_DEBUG("Limits are: FE < " << FEs << ", row < " << rowsPerFE << ", column < " << columnsPerFE);
134 return {}; // illegal Identifier, standardized for PixelRodDecoder
135 }
136 // ---------------------
137 // Convert row/column to eta/phi indices
138 // ---------------------
139 unsigned int phi_index{}, eta_index{};
140 if (FE >= 2) {
141 phi_index = 2 * rowsPerFE - 1 - row;
142 } else {
143 phi_index = row;
144 }
145 if (FE % 2 == 1) {
146 eta_index = 2 * columnsPerFE - 1 - column;
147 } else {
148 eta_index = column;
149 }
150
151 // Identify the module type
152 PixelModuleType moduleType = getModuleType(offlineId, element);
153 if (moduleType == PixelModuleType::PIX_ENDCAP) {
154 // Swap phi_index for even endcap modules
155 int module_phi = m_idHelper->phi_module(offlineId);
156 if (module_phi % 2 == 0) {
157 phi_index = FEsPerRow * rowsPerFE - phi_index - 1;
158 ATH_MSG_DEBUG("Even disk module found, phi module: " << module_phi << " swapped phi index to : " << phi_index);
159 }
160 }
161 return m_idHelper->pixel_id(offlineId, phi_index, eta_index);
162 }
163
164 uint32_t
166 const SiDetectorElement *element = m_detManager->getDetectorElement(offlineId);
167 return getFE(diodeId, offlineId, element);
168 }
169
170
171 uint32_t
173 Identifier offlineId,
174 const SiDetectorElement* element) const{
175 const PixelModuleDesign *p_design = static_cast<const PixelModuleDesign *>(&element->design());
177 ATH_MSG_WARNING("Non-RD53 readout technologies not supported!");
178 return invalidFrontEnd;
179 }
180 unsigned int FEsPerRow = p_design->numberOfCircuitsPerRow();
181 unsigned int rowsPerFE = p_design->rowsPerCircuit();
182 unsigned int columnsPerFE = p_design->columnsPerCircuit();
183 // ---------------------
184 // Set module properties
185 // ---------------------
186 unsigned int phi_index = m_idHelper->phi_index(diodeId);
187 unsigned int eta_index = m_idHelper->eta_index(diodeId);
188 PixelModuleType moduleType = getModuleType(offlineId, element);
189 if (moduleType == PixelModuleType::PIX_ENDCAP) {
190 // Swap phi_index for even endcap modules
191 int module_phi = m_idHelper->phi_module(offlineId);
192 if (module_phi % 2 == 0) {
193 phi_index = FEsPerRow * rowsPerFE - phi_index - 1;
194 }
195 }
196 // ---------------------
197 // Compute FE number
198 // ---------------------
199 // ITk has up to 4 FEs
200 unsigned int FErow = static_cast<unsigned int>(std::floor(phi_index / rowsPerFE));
201 unsigned int FEcol = static_cast<unsigned int>(std::floor(eta_index / columnsPerFE));
202 if (FErow > 0) {
203 return 2 + FEcol;
204 } else {
205 return FEcol;
206 }
207 }
208
209 uint32_t
211 Identifier offlineId) const {
212
213 const SiDetectorElement *element = m_detManager->getDetectorElement(offlineId);
214 return getColumn(diodeId, offlineId, element);
215 }
216
217 uint32_t
219 Identifier offlineId,
220 const SiDetectorElement *element) const {
221
222 const PixelModuleDesign *p_design = static_cast<const PixelModuleDesign *>(&element->design());
224 ATH_MSG_ERROR("Non-RD53 readout technologies not supported!");
225 return invalidColumn;
226 }
227 unsigned int columnsPerFE = p_design->columnsPerCircuit();
228 unsigned int eta_index = m_idHelper->eta_index(diodeId);
229 // ---------------------
230 // Convert eta index to column number
231 // ---------------------
232 unsigned int column{};
233 if (eta_index >= columnsPerFE) {
234 column = 2 * columnsPerFE - eta_index - 1;
235 } else {
236 column = eta_index;
237 }
238 // ---------------------
239 // Check output sanity
240 // ---------------------
241 if (column >= columnsPerFE) {
242 ATH_MSG_WARNING("Computed column number exceeds maximum value: col = " << column << " (max = " << columnsPerFE << ")");
243 ATH_MSG_INFO("diodeId = "<<diodeId<<", offlineId= "<<offlineId);
244 ATH_MSG_INFO("ModuleType: "<<PixelModuleTypeName(getModuleType(offlineId,element)));
245 ATH_MSG_INFO("DiodeType: "<<PixelDiodeTypeName(getDiodeType(offlineId,element)));
246 return invalidColumn;
247 }
248 return column;
249 }
250
251 uint32_t
253 const SiDetectorElement *element = m_detManager->getDetectorElement(offlineId);
254 return getRow(diodeId, offlineId, element);
255 }
256
257
258 uint32_t
260 Identifier offlineId,
261 const SiDetectorElement *element) const {
262
263 const PixelModuleDesign *p_design = static_cast<const PixelModuleDesign *>(&element->design());
265 ATH_MSG_WARNING("Non-RD53 readout technologies not supported!");
266 return invalidRow;
267 }
268 unsigned int FEsPerRow = p_design->numberOfCircuitsPerRow();
269 unsigned int rowsPerFE = p_design->rowsPerCircuit();
270 unsigned int phi_index = m_idHelper->phi_index(diodeId);
271 // Identify the module type
272 PixelModuleType moduleType = getModuleType(offlineId, element);
273 if (moduleType == PixelModuleType::PIX_ENDCAP) {
274 // Swap phi_index for even endcap modules
275 int module_phi = m_idHelper->phi_module(offlineId);
276 if (module_phi % 2 == 0) {
277 phi_index = FEsPerRow * rowsPerFE - phi_index - 1;
278 }
279 }
280 // ---------------------
281 // Convert phi index to row number
282 // ---------------------
283 unsigned int row{};
284 if (phi_index >= rowsPerFE) {
285 row = 2 * rowsPerFE - phi_index - 1;
286 } else {
287 row = phi_index;
288 }
289 // ---------------------
290 // Check output sanity
291 // ---------------------
292 if (row >= rowsPerFE) {
293 ATH_MSG_WARNING("Computed row number exceeds maximum value: row = " << row << "(max = " << rowsPerFE << ")");
294 return invalidRow;
295 }
296 return row;
297 }
298 } // namespace ITk
299} // namespace InDetDD
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
This is an Identifier helper class for the Pixel subdetector.
This is a "hash" representation of an Identifier.
virtual PixelModuleType getModuleType(Identifier id) const override final
ServiceHandle< StoreGateSvc > m_detStore
const PixelDetectorManager * m_detManager
virtual StatusCode initialize() override final
virtual PixelDiodeType getDiodeType(Identifier id) const override final
virtual uint32_t getColumn(Identifier diodeId, Identifier offlineId) const override final
Gaudi::Property< std::string > m_detectorName
virtual Identifier getPixelId(Identifier offlineId, uint32_t FE, uint32_t row, uint32_t column) const override final
PixelReadoutManager(const std::string &name, ISvcLocator *svc)
virtual uint32_t getRow(Identifier diodeId, Identifier offlineId) const override final
virtual uint32_t getFE(Identifier diodeId, Identifier offlineId) const override final
virtual Identifier getPixelIdfromHash(IdentifierHash offlineIdHash, uint32_t FE, uint32_t row, uint32_t column) const override final
Gaudi::Property< std::string > m_pixelIDName
Class used to describe the design of a module (diode segmentation and readout scheme)
PixelReadoutTechnology getReadoutTechnology() const
int numberOfCircuitsPerRow() const
Number of circuits per row:
int rowsPerCircuit() const
Number of cell rows per circuit:
int numberOfCircuits() const
Total number of circuits:
int columnsPerCircuit() const
Number of cell columns per circuit:
Class to hold geometrical description of a silicon detector element.
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
virtual Identifier identify() const override final
identifier of this detector element (inline)
Message Stream Member.
std::string PixelModuleTypeName(const PixelModuleType &t)
std::string PixelDiodeTypeName(const PixelDiodeType &t)
constexpr uint32_t invalidColumn
constexpr uint32_t invalidRow
constexpr uint32_t invalidFrontEnd