ATLAS Offline Software
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 
11 
12 
13 
14 namespace InDetDD{
15  namespace ITk{
17  ISvcLocator *svc)
18  : base_class(name, svc){
19  }
20 
21 
23  ATH_MSG_DEBUG("ITkPixelReadoutManager::initialize()");
24  ATH_CHECK(m_detStore.retrieve());
25  ATH_CHECK(m_detStore->retrieve(m_detManager, m_detectorName.value()));
26  ATH_CHECK(m_detStore->retrieve(m_idHelper, m_pixelIDName.value()));
27  return StatusCode::SUCCESS;
28  }
29 
30 
32  const Identifier wafer_id = m_idHelper->wafer_id(id);
33  const SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id);
34  const PixelModuleDesign *p_design = static_cast<const PixelModuleDesign *>(&element->design());
36  ATH_MSG_ERROR("Non-RD53 readout technologies not supported!");
37  return PixelModuleType::NONE;
38  }
39 
40  if (m_idHelper->barrel_ec(id) == 0) {
42  }
43 
44  if (std::abs(m_idHelper->barrel_ec(id)) == 2) {
46  }
47 
48  return PixelModuleType::NONE;
49  }
50 
51 
54  const Identifier wafer_id = m_idHelper->wafer_id(id);
55  const SiDetectorElement *element = m_detManager->getDetectorElement(wafer_id);
56  const PixelModuleDesign *p_design = static_cast<const PixelModuleDesign *>(&element->design());
58  ATH_MSG_ERROR("Non-RD53 readout technologies not supported!");
59  return PixelDiodeType::NONE;
60  }
61 
62  Identifier diodeId = id;
63  uint32_t col = getColumn(diodeId, wafer_id);
64  uint32_t row = getRow(diodeId, wafer_id);
65  if (col == invalidColumn or row == invalidRow){
66  return PixelDiodeType::NONE;
67  }
68  // ---------------------
69  // Get the pixel type
70  // ---------------------
71  unsigned int FEs = p_design->numberOfCircuits();
72  unsigned int rowsPerFE = p_design->rowsPerCircuit();
73  unsigned int columnsPerFE = p_design->columnsPerCircuit();
74 
75  if (FEs == 4) {
76  // long pixel row and columns
77  // 2 per row/column side
78  // TODO: avoid hardcoding this
79  if (row > rowsPerFE - 3 && col < columnsPerFE - 2) {
80  return PixelDiodeType::LONG;
81  }
82  if (col > columnsPerFE - 3 && row < rowsPerFE - 2) {
83  return PixelDiodeType::LONG;
84  }
85  // corner big pixels
86  if (row > rowsPerFE - 3 && col > columnsPerFE - 3) {
87  return PixelDiodeType::LARGE;
88  }
89  } else if (FEs != 1) {
90  ATH_MSG_WARNING("Module with a number of circuits which is not 1 or 4.");
91  ATH_MSG_WARNING("Long/pixel identification not implemented");
92  }
94  }
95 
96 
99  return getPixelId(m_idHelper->wafer_id(offlineIdHash), FE, row, column);
100  }
101 
102 
103  Identifier
105  const SiDetectorElement *element = m_detManager->getDetectorElement(offlineId);
106  const PixelModuleDesign *p_design = static_cast<const PixelModuleDesign *>(&element->design());
108  ATH_MSG_ERROR("Non-RD53 readout technologies not supported!");
109  return {};// illegal Identifier, standardized for PixelRodDecoder
110  }
111  unsigned int FEs = p_design->numberOfCircuits();
112  unsigned int FEsPerRow = p_design->numberOfCircuitsPerRow();
113  unsigned int rowsPerFE = p_design->rowsPerCircuit();
114  unsigned int columnsPerFE = p_design->columnsPerCircuit();
115  // ---------------------
116  // Check input sanity
117  // ---------------------
118  if (row >= rowsPerFE || column >= columnsPerFE || FE >= FEs) {
119  ATH_MSG_DEBUG("Illegal pixel requested OfflineID: " << std::hex << offlineId << std::dec << " FE: " << FE << " row: " << row << " column: " << column);
120  ATH_MSG_DEBUG("Limits are: FE < " << FEs << ", row < " << rowsPerFE << ", column < " << columnsPerFE);
121  return {}; // illegal Identifier, standardized for PixelRodDecoder
122  }
123  // ---------------------
124  // Convert row/column to eta/phi indices
125  // ---------------------
126  unsigned int phi_index{}, eta_index{};
127  if (FE >= 2) {
128  phi_index = 2 * rowsPerFE - 1 - row;
129  } else {
130  phi_index = row;
131  }
132  if (FE % 2 == 1) {
133  eta_index = 2 * columnsPerFE - 1 - column;
134  } else {
135  eta_index = column;
136  }
137 
138  // Identify the module type
139  PixelModuleType moduleType = getModuleType(offlineId);
140  if (moduleType == PixelModuleType::PIX_ENDCAP) {
141  // Swap phi_index for even endcap modules
142  int module_phi = m_idHelper->phi_module(offlineId);
143  if (module_phi % 2 == 0) {
144  phi_index = FEsPerRow * rowsPerFE - phi_index - 1;
145  ATH_MSG_DEBUG("Even disk module found, phi module: " << module_phi << " swapped phi index to : " << phi_index);
146  }
147  }
148  return m_idHelper->pixel_id(offlineId, phi_index, eta_index);
149  }
150 
151 
152  uint32_t
154  const SiDetectorElement *element = m_detManager->getDetectorElement(offlineId);
155  const PixelModuleDesign *p_design = static_cast<const PixelModuleDesign *>(&element->design());
157  ATH_MSG_WARNING("Non-RD53 readout technologies not supported!");
158  return invalidFrontEnd;
159  }
160  unsigned int FEsPerRow = p_design->numberOfCircuitsPerRow();
161  unsigned int rowsPerFE = p_design->rowsPerCircuit();
162  unsigned int columnsPerFE = p_design->columnsPerCircuit();
163  // ---------------------
164  // Set module properties
165  // ---------------------
166  unsigned int phi_index = m_idHelper->phi_index(diodeId);
167  unsigned int eta_index = m_idHelper->eta_index(diodeId);
168  PixelModuleType moduleType = getModuleType(offlineId);
169  if (moduleType == PixelModuleType::PIX_ENDCAP) {
170  // Swap phi_index for even endcap modules
171  int module_phi = m_idHelper->phi_module(offlineId);
172  if (module_phi % 2 == 0) {
173  phi_index = FEsPerRow * rowsPerFE - phi_index - 1;
174  }
175  }
176  // ---------------------
177  // Compute FE number
178  // ---------------------
179  // ITk has up to 4 FEs
180  unsigned int FErow = static_cast<unsigned int>(std::floor(phi_index / rowsPerFE));
181  unsigned int FEcol = static_cast<unsigned int>(std::floor(eta_index / columnsPerFE));
182  if (FErow > 0) {
183  return 2 + FEcol;
184  } else {
185  return FEcol;
186  }
187  }
188 
189 
190  uint32_t
192  const SiDetectorElement *element = m_detManager->getDetectorElement(offlineId);
193  const PixelModuleDesign *p_design = static_cast<const PixelModuleDesign *>(&element->design());
195  ATH_MSG_ERROR("Non-RD53 readout technologies not supported!");
196  return invalidColumn;
197  }
198  unsigned int columnsPerFE = p_design->columnsPerCircuit();
199  unsigned int eta_index = m_idHelper->eta_index(diodeId);
200  // ---------------------
201  // Convert eta index to column number
202  // ---------------------
203  unsigned int column{};
204  if (eta_index >= columnsPerFE) {
205  column = 2 * columnsPerFE - eta_index - 1;
206  } else {
207  column = eta_index;
208  }
209  // ---------------------
210  // Check output sanity
211  // ---------------------
212  if (column >= columnsPerFE) {
213  ATH_MSG_WARNING("Computed column number exceeds maximum value: col = " << column << " (max = " << columnsPerFE << ")");
214  ATH_MSG_INFO("diodeId = "<<diodeId<<", offlineId= "<<offlineId);
215  ATH_MSG_INFO("ModuleType: "<<PixelModuleTypeName(getModuleType(offlineId)));
216  ATH_MSG_INFO("DiodeType: "<<PixelDiodeTypeName(getDiodeType(offlineId)));
217  return invalidColumn;
218  }
219  return column;
220  }
221 
222 
223  uint32_t
225  const SiDetectorElement *element = m_detManager->getDetectorElement(offlineId);
226  const PixelModuleDesign *p_design = static_cast<const PixelModuleDesign *>(&element->design());
228  ATH_MSG_WARNING("Non-RD53 readout technologies not supported!");
229  return invalidRow;
230  }
231  unsigned int FEsPerRow = p_design->numberOfCircuitsPerRow();
232  unsigned int rowsPerFE = p_design->rowsPerCircuit();
233  unsigned int phi_index = m_idHelper->phi_index(diodeId);
234  // Identify the module type
235  PixelModuleType moduleType = getModuleType(offlineId);
236  if (moduleType == PixelModuleType::PIX_ENDCAP) {
237  // Swap phi_index for even endcap modules
238  int module_phi = m_idHelper->phi_module(offlineId);
239  if (module_phi % 2 == 0) {
240  phi_index = FEsPerRow * rowsPerFE - phi_index - 1;
241  }
242  }
243  // ---------------------
244  // Convert phi index to row number
245  // ---------------------
246  unsigned int row{};
247  if (phi_index >= rowsPerFE) {
248  row = 2 * rowsPerFE - phi_index - 1;
249  } else {
250  row = phi_index;
251  }
252  // ---------------------
253  // Check output sanity
254  // ---------------------
255  if (row >= rowsPerFE) {
256  ATH_MSG_WARNING("Computed row number exceeds maximum value: row = " << row << "(max = " << rowsPerFE << ")");
257  return invalidRow;
258  }
259  return row;
260  }
261  } // namespace ITk
262 } // 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:104
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:43
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:97
InDetDD::invalidFrontEnd
constexpr uint32_t invalidFrontEnd
Definition: PixelReadoutDefinitions.h:44
InDetDD::PixelModuleTypeName
std::string PixelModuleTypeName(const PixelModuleType &t)
Definition: PixelReadoutDefinitions.cxx:10
InDetDD::PixelDiodeType
PixelDiodeType
Definition: PixelReadoutDefinitions.h:25
InDetDD::ITk::PixelReadoutManager::getModuleType
virtual PixelModuleType getModuleType(Identifier id) const override final
Definition: ITkPixelReadoutManager.cxx:31
DeMoUpdate.column
dictionary column
Definition: DeMoUpdate.py:1110
InDetDD::ITk::PixelReadoutManager::m_idHelper
const PixelID * m_idHelper
Definition: ITkPixelReadoutManager.h:54
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:53
InDetDD::PixelModuleType::NONE
@ NONE
InDetDD::ITk::PixelReadoutManager::initialize
virtual StatusCode initialize() override final
Definition: ITkPixelReadoutManager.cxx:22
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:57
InDetDD::ITk::PixelReadoutManager::m_detStore
ServiceHandle< StoreGateSvc > m_detStore
Definition: ITkPixelReadoutManager.h:51
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:15
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:14
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
InDetDD::ITk::PixelReadoutManager::getColumn
virtual uint32_t getColumn(Identifier diodeId, Identifier offlineId) const override final
Definition: ITkPixelReadoutManager.cxx:191
InDetDD::PixelModuleDesign::getReadoutTechnology
PixelReadoutTechnology getReadoutTechnology() const
Definition: PixelModuleDesign.h:386
query_example.col
col
Definition: query_example.py:7
SiDetectorElement.h
InDetDD::ITk::PixelReadoutManager::getRow
virtual uint32_t getRow(Identifier diodeId, Identifier offlineId) const override final
Definition: ITkPixelReadoutManager.cxx:224
InDetDD::invalidRow
constexpr uint32_t invalidRow
Definition: PixelReadoutDefinitions.h:42
InDetDD::ITk::PixelReadoutManager::getDiodeType
virtual PixelDiodeType getDiodeType(Identifier id) const override final
Definition: ITkPixelReadoutManager.cxx:53
InDetDD::PixelModuleType::PIX_ENDCAP
@ PIX_ENDCAP
InDetDD::ITk::PixelReadoutManager::getFE
virtual uint32_t getFE(Identifier diodeId, Identifier offlineId) const override final
Definition: ITkPixelReadoutManager.cxx:153
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:59
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:16
InDetDD::PixelDiodeTypeName
std::string PixelDiodeTypeName(const PixelDiodeType &t)
Definition: PixelReadoutDefinitions.cxx:19
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