ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
13 namespace 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());
24  ATH_CHECK(m_detStore->retrieve(m_detManager, m_detectorName.value()));
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!");
41  return PixelModuleType::NONE;
42  }
43 
44  if (m_idHelper->barrel_ec(id) == 0) {
46  }
47 
48  if (std::abs(m_idHelper->barrel_ec(id)) == 2) {
50  }
51 
52  return PixelModuleType::NONE;
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!");
72  return PixelDiodeType::NONE;
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){
79  return PixelDiodeType::NONE;
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) {
94  return PixelDiodeType::LONG;
95  }
96  if (col > columnsPerFE - 3 && row < rowsPerFE - 2) {
97  return PixelDiodeType::LONG;
98  }
99  // corner big pixels
100  if (row > rowsPerFE - 3 && col > columnsPerFE - 3) {
101  return PixelDiodeType::LARGE;
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  }
107  return PixelDiodeType::NORMAL;
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 
116  Identifier
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
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
InDetDD::ITk::PixelReadoutManager::getPixelId
virtual Identifier getPixelId(Identifier offlineId, uint32_t FE, uint32_t row, uint32_t column) const override final
Definition: ITkPixelReadoutManager.cxx:117
query_example.row
row
Definition: query_example.py:24
PixelID::phi_index
int phi_index(const Identifier &id) const
Definition: PixelID.h:658
InDetDD::invalidColumn
constexpr uint32_t invalidColumn
Definition: PixelReadoutDefinitions.h:46
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
InDetDD::PixelModuleDesign
Definition: PixelModuleDesign.h:48
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
PixelID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: PixelID.h:619
InDetDD::ITk::PixelReadoutManager::getPixelIdfromHash
virtual Identifier getPixelIdfromHash(IdentifierHash offlineIdHash, uint32_t FE, uint32_t row, uint32_t column) const override final
Definition: ITkPixelReadoutManager.cxx:110
InDetDD::invalidFrontEnd
constexpr uint32_t invalidFrontEnd
Definition: PixelReadoutDefinitions.h:47
InDetDD::PixelModuleTypeName
std::string PixelModuleTypeName(const PixelModuleType &t)
Definition: PixelReadoutDefinitions.cxx:10
InDetDD::PixelDiodeType
PixelDiodeType
Definition: PixelReadoutDefinitions.h:28
InDetDD::ITk::PixelReadoutManager::getModuleType
virtual PixelModuleType getModuleType(Identifier id) const override final
Definition: ITkPixelReadoutManager.cxx:29
DeMoUpdate.column
dictionary column
Definition: DeMoUpdate.py:1110
InDetDD::ITk::PixelReadoutManager::m_idHelper
const PixelID * m_idHelper
Definition: ITkPixelReadoutManager.h:73
PixelID::wafer_id
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
Definition: PixelID.h:364
InDetDD::PixelReadoutTechnology::RD53
@ RD53
InDetDD::ITk::PixelReadoutManager::m_detManager
const PixelDetectorManager * m_detManager
Definition: ITkPixelReadoutManager.h:72
InDetDD::PixelModuleType::NONE
@ NONE
InDetDD::ITk::PixelReadoutManager::initialize
virtual StatusCode initialize() override final
Definition: ITkPixelReadoutManager.cxx:21
PixelDetectorManager.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
InDetDD::PixelDiodeType::LONG
@ LONG
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
InDetDD::PixelModuleDesign::numberOfCircuits
int numberOfCircuits() const
Total number of circuits:
Definition: PixelModuleDesign.h:315
InDetDD::ITk::PixelReadoutManager::m_detectorName
Gaudi::Property< std::string > m_detectorName
Definition: ITkPixelReadoutManager.h:76
InDetDD::ITk::PixelReadoutManager::m_detStore
ServiceHandle< StoreGateSvc > m_detStore
Definition: ITkPixelReadoutManager.h:70
PixelID::eta_index
int eta_index(const Identifier &id) const
Definition: PixelID.h:664
InDetDD::PixelDiodeType::LARGE
@ LARGE
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
InDetDD::PixelModuleType
PixelModuleType
Definition: PixelReadoutDefinitions.h:18
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
createCablingJSON.eta_index
int eta_index
Definition: createCablingJSON.py:14
ITkPixelReadoutManager.h
InDetDD::PixelModuleDesign::numberOfCircuitsPerRow
int numberOfCircuitsPerRow() const
Number of circuits per row:
Definition: PixelModuleDesign.h:325
ITk
Definition: ITkPixelOfflineCalibCondAlg.cxx:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
InDetDD::ITk::PixelReadoutManager::getColumn
virtual uint32_t getColumn(Identifier diodeId, Identifier offlineId) const override final
Definition: ITkPixelReadoutManager.cxx:210
InDetDD::PixelModuleDesign::getReadoutTechnology
PixelReadoutTechnology getReadoutTechnology() const
Definition: PixelModuleDesign.h:386
query_example.col
col
Definition: query_example.py:7
InDetDD::ITk::PixelReadoutManager::getRow
virtual uint32_t getRow(Identifier diodeId, Identifier offlineId) const override final
Definition: ITkPixelReadoutManager.cxx:252
InDetDD::invalidRow
constexpr uint32_t invalidRow
Definition: PixelReadoutDefinitions.h:45
InDetDD::ITk::PixelReadoutManager::getDiodeType
virtual PixelDiodeType getDiodeType(Identifier id) const override final
Definition: ITkPixelReadoutManager.cxx:56
InDetDD::PixelModuleType::PIX_ENDCAP
@ PIX_ENDCAP
InDetDD::ITk::PixelReadoutManager::getFE
virtual uint32_t getFE(Identifier diodeId, Identifier offlineId) const override final
Definition: ITkPixelReadoutManager.cxx:165
InDetDD::PixelModuleDesign::rowsPerCircuit
int rowsPerCircuit() const
Number of cell rows per circuit:
Definition: PixelModuleDesign.h:335
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
PixelModuleDesign.h
InDetDD::PixelDiodeType::NONE
@ NONE
InDetDD::ITk::PixelReadoutManager::m_pixelIDName
Gaudi::Property< std::string > m_pixelIDName
Definition: ITkPixelReadoutManager.h:78
PixelID::pixel_id
Identifier pixel_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int phi_index, int eta_index) const
For an individual pixel.
Definition: PixelID.h:432
InDetDD::PixelDiodeType::NORMAL
@ NORMAL
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
InDetDD::PixelModuleType::PIX_BARREL
@ PIX_BARREL
InDetDD::SiDetectorElement::design
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
PixelID::phi_module
int phi_module(const Identifier &id) const
Definition: PixelID.h:644
InDetDD::PixelModuleDesign::columnsPerCircuit
int columnsPerCircuit() const
Number of cell columns per circuit:
Definition: PixelModuleDesign.h:330
InDetDD::ITk::PixelReadoutManager::PixelReadoutManager
PixelReadoutManager(const std::string &name, ISvcLocator *svc)
Definition: ITkPixelReadoutManager.cxx:15
InDetDD::PixelDiodeTypeName
std::string PixelDiodeTypeName(const PixelDiodeType &t)
Definition: PixelReadoutDefinitions.cxx:19
InDetDD::SolidStateDetectorElementBase::identify
virtual Identifier identify() const override final
identifier of this detector element (inline)
InDetDD::PixelDetectorManager::getDetectorElement
virtual SiDetectorElement * getDetectorElement(const Identifier &id) const override
access to individual elements : via Identifier
Definition: PixelDetectorManager.cxx:80
Identifier
Definition: IdentifierFieldParser.cxx:14