ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
InDet::PixelModuleHelper Class Reference

Helper class to convert between offline column, row and hardware chip, column, row coordinates. More...

#include <PixelModuleHelper.h>

Collaboration diagram for InDet::PixelModuleHelper:

Public Member Functions

 PixelModuleHelper (const InDetDD::SiDetectorDesign &design)
 
 operator bool () const
 
unsigned int columns () const
 
unsigned int rows () const
 
unsigned int columnsPerCircuit () const
 
unsigned int rowsPerCircuit () const
 
unsigned int circuitsPerColumn () const
 
unsigned int circuitsPerRow () const
 
bool swapOfflineRowsColumns () const
 
unsigned int hardwareCoordinates (unsigned int row, unsigned int column) const
 compute "hardware" coordinates from offline coordinates. More...
 
unsigned int columnGroupDefect (unsigned int row, unsigned int column) const
 Create a "column group" defect for the given offline coordinates. More...
 
unsigned int nPixels () const
 
unsigned int nColumns () const
 
unsigned int nRows () const
 
std::array< unsigned int, 4 > offlineRange (unsigned int key) const
 Convenience function to return oflline column and row ranges matching the defect-area of the given key. More...
 

Static Public Member Functions

static constexpr unsigned int getChip (unsigned int hardware_coordinates)
 
static constexpr unsigned int getRow (unsigned int hardware_coordinates)
 
static constexpr unsigned int getColumn (unsigned int hardware_coordinates)
 
static constexpr bool isColumnGroupDefect (unsigned int key)
 Test whether the column group flag is set in the packed hardware coordinate tripplet. More...
 
static constexpr bool inSameColumnGroup (unsigned int key_ref, unsigned int key_test)
 Test whether the two packed hardware coorindates refer to the same column group. More...
 
constexpr static bool isSameDefect (unsigned int key_ref, unsigned int key_test)
 Test whether the given packed hardware coordinates refer to the same pixel. More...
 
constexpr static bool isSameDefectWithGroups (unsigned int key_ref, unsigned int key_test)
 Convenience function to test whether the given packed hardware coordinates refer to overlapping defects. More...
 

Static Public Attributes

static constexpr unsigned int COLGROUP_DEFECT_BIT_MASK = (1u<<31)
 
static constexpr unsigned int CHIP_MASK = MaskUtils::createMask<24,28>()
 
static constexpr unsigned int COL_MASK = MaskUtils::createMask<12,24>()
 
static constexpr unsigned int ROW_MASK = MaskUtils::createMask<0,12>()
 
static constexpr unsigned int CHIP_SHIFT = 24
 
static constexpr unsigned int COL_SHIFT = 12
 
static constexpr unsigned int ROW_SHIFT = 0
 
static constexpr unsigned int N_COLS_PER_GROUP = 8
 
static constexpr unsigned int COL_MASK_FOR_GROUP = MaskUtils::createMask<12,3+12>()
 

Private Attributes

const InDetDD::PixelModuleDesignm_pixelModuleDesign =nullptr
 
unsigned short m_rows = 0
 
unsigned short m_columns = 0
 
unsigned short m_rowsPerCircuit = 0
 
unsigned short m_columnsPerCircuit = 0
 
unsigned char m_circuitsPerRow = 0
 
unsigned char m_circuitsPerColumn = 0
 
bool m_swapOfflineRowsColumns =false
 

Detailed Description

Helper class to convert between offline column, row and hardware chip, column, row coordinates.

Definition at line 33 of file PixelModuleHelper.h.

Constructor & Destructor Documentation

◆ PixelModuleHelper()

InDet::PixelModuleHelper::PixelModuleHelper ( const InDetDD::SiDetectorDesign design)
inline

Definition at line 50 of file PixelModuleHelper.h.

51  : m_pixelModuleDesign( dynamic_cast<const InDetDD::PixelModuleDesign *>(&design))
52  {
53  if (m_pixelModuleDesign->rowsPerCircuit()==400 /* @TODO find a better way to identify when to swap columns and rows*/ ) {
54  // the front-ends of ITk ring triplet modules are rotated differently
55  // wrt. the offline coordinate system compared to quads and
56  // barrel triplets. Once these modules are identified, the translation
57  // works in exactly the same way, but columns and rows need to be swapped,
65  }
66  else {
74  }
75 
76  }

Member Function Documentation

◆ circuitsPerColumn()

unsigned int InDet::PixelModuleHelper::circuitsPerColumn ( ) const
inline

Definition at line 83 of file PixelModuleHelper.h.

83 { return m_circuitsPerColumn; }

◆ circuitsPerRow()

unsigned int InDet::PixelModuleHelper::circuitsPerRow ( ) const
inline

Definition at line 84 of file PixelModuleHelper.h.

84 { return m_circuitsPerRow; }

◆ columnGroupDefect()

unsigned int InDet::PixelModuleHelper::columnGroupDefect ( unsigned int  row,
unsigned int  column 
) const
inline

Create a "column group" defect for the given offline coordinates.

Parameters
rowoffline row aka. phi index of a pixel of the column group
columnoffline column aka. eta index of a pixel of the column group
Returns
packed triplet chip, column, row of the first pixel in the column group and column group flag set Creates packed hardware coordinates for column group aka. ITk pixel core column which is the coordinate of the first pixel of that group and sets the column group flag.

Definition at line 127 of file PixelModuleHelper.h.

127  {
129  }

◆ columns()

unsigned int InDet::PixelModuleHelper::columns ( ) const
inline

Definition at line 79 of file PixelModuleHelper.h.

79 { return m_columns; }

◆ columnsPerCircuit()

unsigned int InDet::PixelModuleHelper::columnsPerCircuit ( ) const
inline

Definition at line 81 of file PixelModuleHelper.h.

81 { return m_columnsPerCircuit; }

◆ getChip()

static constexpr unsigned int InDet::PixelModuleHelper::getChip ( unsigned int  hardware_coordinates)
inlinestaticconstexpr

Definition at line 140 of file PixelModuleHelper.h.

140  {
141  return (hardware_coordinates & CHIP_MASK) >> CHIP_SHIFT;
142  }

◆ getColumn()

static constexpr unsigned int InDet::PixelModuleHelper::getColumn ( unsigned int  hardware_coordinates)
inlinestaticconstexpr

Definition at line 146 of file PixelModuleHelper.h.

146  {
147  return (hardware_coordinates & COL_MASK) >> COL_SHIFT;
148  }

◆ getRow()

static constexpr unsigned int InDet::PixelModuleHelper::getRow ( unsigned int  hardware_coordinates)
inlinestaticconstexpr

Definition at line 143 of file PixelModuleHelper.h.

143  {
144  return (hardware_coordinates & ROW_MASK) >> ROW_SHIFT;
145  }

◆ hardwareCoordinates()

unsigned int InDet::PixelModuleHelper::hardwareCoordinates ( unsigned int  row,
unsigned int  column 
) const
inline

compute "hardware" coordinates from offline coordinates.

Parameters
rowoffline row aka. phi index
columnoffline column aka. eta index
Returns
packed triplet of chip, column, row.

Definition at line 92 of file PixelModuleHelper.h.

92  {
93  unsigned int chip =0;
94  if (swapOfflineRowsColumns()) {
95  unsigned int tmp=row;
96  row=column;
97  column=tmp;
98  }
99  if (circuitsPerColumn()>1) {
100  assert( circuitsPerColumn() == 2);
101  chip += (row/rowsPerCircuit()) * circuitsPerRow();
102  row = row % rowsPerCircuit();
103  if (chip>0) {
104  row = rowsPerCircuit() - row -1;
105  column = columns() - column -1;
106  }
107  }
108  if (circuitsPerRow()>1) {
109  chip += column/columnsPerCircuit();
111  }
112  assert( (chip & (CHIP_MASK >> CHIP_SHIFT)) == chip);
113  assert( (column & (COL_MASK >> COL_SHIFT)) == column);
114  assert( (row & (ROW_MASK >> ROW_SHIFT)) == row);
115 
116  return (chip << CHIP_SHIFT) | (column << COL_SHIFT) | (row << ROW_SHIFT);
117  }

◆ inSameColumnGroup()

static constexpr bool InDet::PixelModuleHelper::inSameColumnGroup ( unsigned int  key_ref,
unsigned int  key_test 
)
inlinestaticconstexpr

Test whether the two packed hardware coorindates refer to the same column group.

Definition at line 158 of file PixelModuleHelper.h.

158  {
159  constexpr unsigned int mask_out_rows_and_cols_per_group = (CHIP_MASK|(COL_MASK & (~COL_MASK_FOR_GROUP)));
160  return (key_ref & mask_out_rows_and_cols_per_group)
161  == (key_test & mask_out_rows_and_cols_per_group);
162  }

◆ isColumnGroupDefect()

static constexpr bool InDet::PixelModuleHelper::isColumnGroupDefect ( unsigned int  key)
inlinestaticconstexpr

Test whether the column group flag is set in the packed hardware coordinate tripplet.

Definition at line 152 of file PixelModuleHelper.h.

152  {
153  return key & COLGROUP_DEFECT_BIT_MASK;
154  }

◆ isSameDefect()

constexpr static bool InDet::PixelModuleHelper::isSameDefect ( unsigned int  key_ref,
unsigned int  key_test 
)
inlinestaticconstexpr

Test whether the given packed hardware coordinates refer to the same pixel.

Definition at line 166 of file PixelModuleHelper.h.

166  {
167  return (key_ref & (CHIP_MASK | ROW_MASK | COL_MASK)) == key_test;
168  }

◆ isSameDefectWithGroups()

constexpr static bool InDet::PixelModuleHelper::isSameDefectWithGroups ( unsigned int  key_ref,
unsigned int  key_test 
)
inlinestaticconstexpr

Convenience function to test whether the given packed hardware coordinates refer to overlapping defects.

Parameters
key_refpacked hardware coordinates referring either to a single pixel defect or a column group defect
key_testpacked hardware coordinates referring to a single pixel defect
Returns
true if the defects overlap If key_ref refers to a single pixel defect and key_test refers to a column group defect the defects are only considered as overlapping if the pixel addressed by the two coordinates are identical, not if key_ref only is contained in the column group addressed by key_test. If key_ref and key test both could address exclusively a column group defect use : <verb> isSameDefect(key_ref, key_test) || ( (isColumnGroupDefect(key_ref)|| isColumnGroupDefect(key_test)) && inSameColumnGroup(key_ref, key_test)); </verb> instead.

Definition at line 184 of file PixelModuleHelper.h.

184  {
185  return isSameDefect(key_ref, key_test) || (isColumnGroupDefect(key_ref) && inSameColumnGroup(key_ref, key_test));
186  }

◆ nColumns()

unsigned int InDet::PixelModuleHelper::nColumns ( ) const
inline

Definition at line 134 of file PixelModuleHelper.h.

134  {
135  return m_pixelModuleDesign->columns();
136  }

◆ nPixels()

unsigned int InDet::PixelModuleHelper::nPixels ( ) const
inline

Definition at line 131 of file PixelModuleHelper.h.

131  {
133  }

◆ nRows()

unsigned int InDet::PixelModuleHelper::nRows ( ) const
inline

Definition at line 137 of file PixelModuleHelper.h.

137  {
138  return m_pixelModuleDesign->rows();
139  }

◆ offlineRange()

std::array<unsigned int,4> InDet::PixelModuleHelper::offlineRange ( unsigned int  key) const
inline

Convenience function to return oflline column and row ranges matching the defect-area of the given key.

Parameters
keypacked hardware coordinates addressing a single pixel or a column group defect
Returns
offline start column, end column, start row, end row, where the end is meant not to be inclusive i.e. [start, end)

Definition at line 192 of file PixelModuleHelper.h.

192  {
193  if (isColumnGroupDefect(key)) {
194  if (getRow(key) !=0) {
195  throw std::runtime_error("invalid key");
196  };
197 
198  unsigned int chip=getChip(key);
199  unsigned int row=getRow(key);
200  unsigned int row_end=row + rowsPerCircuit()-1;
201  unsigned int column=getColumn(key);
202  unsigned int column_end= column + N_COLS_PER_GROUP-1;
203 
204  unsigned int chip_row = chip / circuitsPerRow();
205  unsigned int chip_column = chip % circuitsPerRow();
206 
207  column += chip_column * columnsPerCircuit();
208  column_end += chip_column * columnsPerCircuit();
209  if (chip_row>=1) {
210  column = columns() - column -1;
211  column_end = columns() - column_end -1;
212 
213  row = rowsPerCircuit() - row -1 + chip_row * rowsPerCircuit();
214  row_end = rowsPerCircuit() - row_end -1 + chip_row * rowsPerCircuit();
215  }
216  if (swapOfflineRowsColumns()) {
217  return std::array<unsigned int,4>{ std::min(column, column_end), std::max(column,column_end)+1,
218  std::min(row, row_end), std::max(row, row_end)+1 };
219  }
220  else {
221  return std::array<unsigned int,4>{ std::min(row, row_end), std::max(row, row_end)+1,
222  std::min(column, column_end), std::max(column,column_end)+1 };
223  }
224  }
225  else {
226  unsigned int chip=getChip(key);
227  unsigned int row=getRow(key);
228  unsigned int column=getColumn(key);
229 
230  unsigned int chip_row = chip / circuitsPerRow();
231  unsigned int chip_column = chip % circuitsPerRow();
232 
233  column += chip_column * columnsPerCircuit();
234  if (chip_row>=1) {
235  column = columns() - column -1;
236 
237  row = rowsPerCircuit() - row -1 + chip_row * rowsPerCircuit();
238  }
239  if (swapOfflineRowsColumns()) {
240  return std::array<unsigned int,4 >{ column, column + 1,
241  row, row +1 };
242  }
243  else {
244  return std::array<unsigned int,4>{ row, row + 1,
245  column, column +1 };
246  }
247  }
248  }

◆ operator bool()

InDet::PixelModuleHelper::operator bool ( ) const
inline

Definition at line 77 of file PixelModuleHelper.h.

77 { return m_pixelModuleDesign != nullptr; }

◆ rows()

unsigned int InDet::PixelModuleHelper::rows ( ) const
inline

Definition at line 80 of file PixelModuleHelper.h.

80 { return m_rows; }

◆ rowsPerCircuit()

unsigned int InDet::PixelModuleHelper::rowsPerCircuit ( ) const
inline

Definition at line 82 of file PixelModuleHelper.h.

82 { return m_rowsPerCircuit; }

◆ swapOfflineRowsColumns()

bool InDet::PixelModuleHelper::swapOfflineRowsColumns ( ) const
inline

Definition at line 85 of file PixelModuleHelper.h.

85 { return m_swapOfflineRowsColumns; }

Member Data Documentation

◆ CHIP_MASK

constexpr unsigned int InDet::PixelModuleHelper::CHIP_MASK = MaskUtils::createMask<24,28>()
staticconstexpr

Definition at line 40 of file PixelModuleHelper.h.

◆ CHIP_SHIFT

constexpr unsigned int InDet::PixelModuleHelper::CHIP_SHIFT = 24
staticconstexpr

Definition at line 43 of file PixelModuleHelper.h.

◆ COL_MASK

constexpr unsigned int InDet::PixelModuleHelper::COL_MASK = MaskUtils::createMask<12,24>()
staticconstexpr

Definition at line 41 of file PixelModuleHelper.h.

◆ COL_MASK_FOR_GROUP

constexpr unsigned int InDet::PixelModuleHelper::COL_MASK_FOR_GROUP = MaskUtils::createMask<12,3+12>()
staticconstexpr

Definition at line 48 of file PixelModuleHelper.h.

◆ COL_SHIFT

constexpr unsigned int InDet::PixelModuleHelper::COL_SHIFT = 12
staticconstexpr

Definition at line 44 of file PixelModuleHelper.h.

◆ COLGROUP_DEFECT_BIT_MASK

constexpr unsigned int InDet::PixelModuleHelper::COLGROUP_DEFECT_BIT_MASK = (1u<<31)
staticconstexpr

Definition at line 39 of file PixelModuleHelper.h.

◆ m_circuitsPerColumn

unsigned char InDet::PixelModuleHelper::m_circuitsPerColumn = 0
private

Definition at line 257 of file PixelModuleHelper.h.

◆ m_circuitsPerRow

unsigned char InDet::PixelModuleHelper::m_circuitsPerRow = 0
private

Definition at line 256 of file PixelModuleHelper.h.

◆ m_columns

unsigned short InDet::PixelModuleHelper::m_columns = 0
private

Definition at line 253 of file PixelModuleHelper.h.

◆ m_columnsPerCircuit

unsigned short InDet::PixelModuleHelper::m_columnsPerCircuit = 0
private

Definition at line 255 of file PixelModuleHelper.h.

◆ m_pixelModuleDesign

const InDetDD::PixelModuleDesign* InDet::PixelModuleHelper::m_pixelModuleDesign =nullptr
private

Definition at line 251 of file PixelModuleHelper.h.

◆ m_rows

unsigned short InDet::PixelModuleHelper::m_rows = 0
private

Definition at line 252 of file PixelModuleHelper.h.

◆ m_rowsPerCircuit

unsigned short InDet::PixelModuleHelper::m_rowsPerCircuit = 0
private

Definition at line 254 of file PixelModuleHelper.h.

◆ m_swapOfflineRowsColumns

bool InDet::PixelModuleHelper::m_swapOfflineRowsColumns =false
private

Definition at line 258 of file PixelModuleHelper.h.

◆ N_COLS_PER_GROUP

constexpr unsigned int InDet::PixelModuleHelper::N_COLS_PER_GROUP = 8
staticconstexpr

Definition at line 47 of file PixelModuleHelper.h.

◆ ROW_MASK

constexpr unsigned int InDet::PixelModuleHelper::ROW_MASK = MaskUtils::createMask<0,12>()
staticconstexpr

Definition at line 42 of file PixelModuleHelper.h.

◆ ROW_SHIFT

constexpr unsigned int InDet::PixelModuleHelper::ROW_SHIFT = 0
staticconstexpr

Definition at line 45 of file PixelModuleHelper.h.


The documentation for this class was generated from the following file:
InDet::PixelModuleHelper::inSameColumnGroup
static constexpr bool inSameColumnGroup(unsigned int key_ref, unsigned int key_test)
Test whether the two packed hardware coorindates refer to the same column group.
Definition: PixelModuleHelper.h:158
query_example.row
row
Definition: query_example.py:24
InDetDD::PixelModuleDesign
Definition: PixelModuleDesign.h:48
InDetDD::PixelModuleDesign::columns
int columns() const
Number of cell columns per module:
Definition: PixelModuleDesign.h:340
InDet::PixelModuleHelper::m_columnsPerCircuit
unsigned short m_columnsPerCircuit
Definition: PixelModuleHelper.h:255
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
InDet::PixelModuleHelper::COLGROUP_DEFECT_BIT_MASK
static constexpr unsigned int COLGROUP_DEFECT_BIT_MASK
Definition: PixelModuleHelper.h:39
InDetDD::PixelModuleDesign::rows
int rows() const
Number of cell rows per module:
Definition: PixelModuleDesign.h:345
DeMoUpdate.column
dictionary column
Definition: DeMoUpdate.py:1110
InDet::PixelModuleHelper::swapOfflineRowsColumns
bool swapOfflineRowsColumns() const
Definition: PixelModuleHelper.h:85
InDet::PixelModuleHelper::m_pixelModuleDesign
const InDetDD::PixelModuleDesign * m_pixelModuleDesign
Definition: PixelModuleHelper.h:251
InDet::PixelModuleHelper::ROW_MASK
static constexpr unsigned int ROW_MASK
Definition: PixelModuleHelper.h:42
InDet::PixelModuleHelper::getColumn
static constexpr unsigned int getColumn(unsigned int hardware_coordinates)
Definition: PixelModuleHelper.h:146
InDet::PixelModuleHelper::N_COLS_PER_GROUP
static constexpr unsigned int N_COLS_PER_GROUP
Definition: PixelModuleHelper.h:47
InDet::PixelModuleHelper::m_rowsPerCircuit
unsigned short m_rowsPerCircuit
Definition: PixelModuleHelper.h:254
InDet::PixelModuleHelper::getRow
static constexpr unsigned int getRow(unsigned int hardware_coordinates)
Definition: PixelModuleHelper.h:143
InDet::PixelModuleHelper::m_circuitsPerRow
unsigned char m_circuitsPerRow
Definition: PixelModuleHelper.h:256
InDetDD::PixelModuleDesign::numberOfCircuitsPerColumn
int numberOfCircuitsPerColumn() const
Number of circuits per column:
Definition: PixelModuleDesign.h:320
InDet::PixelModuleHelper::ROW_SHIFT
static constexpr unsigned int ROW_SHIFT
Definition: PixelModuleHelper.h:45
InDet::PixelModuleHelper::CHIP_SHIFT
static constexpr unsigned int CHIP_SHIFT
Definition: PixelModuleHelper.h:43
InDet::PixelModuleHelper::m_circuitsPerColumn
unsigned char m_circuitsPerColumn
Definition: PixelModuleHelper.h:257
InDet::PixelModuleHelper::hardwareCoordinates
unsigned int hardwareCoordinates(unsigned int row, unsigned int column) const
compute "hardware" coordinates from offline coordinates.
Definition: PixelModuleHelper.h:92
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
InDet::PixelModuleHelper::getChip
static constexpr unsigned int getChip(unsigned int hardware_coordinates)
Definition: PixelModuleHelper.h:140
InDet::PixelModuleHelper::COL_MASK
static constexpr unsigned int COL_MASK
Definition: PixelModuleHelper.h:41
InDetDD::PixelModuleDesign::numberOfCircuitsPerRow
int numberOfCircuitsPerRow() const
Number of circuits per row:
Definition: PixelModuleDesign.h:325
InDet::PixelModuleHelper::isColumnGroupDefect
static constexpr bool isColumnGroupDefect(unsigned int key)
Test whether the column group flag is set in the packed hardware coordinate tripplet.
Definition: PixelModuleHelper.h:152
InDet::PixelModuleHelper::m_swapOfflineRowsColumns
bool m_swapOfflineRowsColumns
Definition: PixelModuleHelper.h:258
InDet::PixelModuleHelper::m_rows
unsigned short m_rows
Definition: PixelModuleHelper.h:252
InDet::PixelModuleHelper::m_columns
unsigned short m_columns
Definition: PixelModuleHelper.h:253
InDet::PixelModuleHelper::columnsPerCircuit
unsigned int columnsPerCircuit() const
Definition: PixelModuleHelper.h:81
InDet::PixelModuleHelper::CHIP_MASK
static constexpr unsigned int CHIP_MASK
Definition: PixelModuleHelper.h:40
InDetDD::PixelModuleDesign::rowsPerCircuit
int rowsPerCircuit() const
Number of cell rows per circuit:
Definition: PixelModuleDesign.h:335
InDet::PixelModuleHelper::rowsPerCircuit
unsigned int rowsPerCircuit() const
Definition: PixelModuleHelper.h:82
InDet::PixelModuleHelper::COL_MASK_FOR_GROUP
static constexpr unsigned int COL_MASK_FOR_GROUP
Definition: PixelModuleHelper.h:48
InDet::PixelModuleHelper::isSameDefect
constexpr static bool isSameDefect(unsigned int key_ref, unsigned int key_test)
Test whether the given packed hardware coordinates refer to the same pixel.
Definition: PixelModuleHelper.h:166
InDet::PixelModuleHelper::circuitsPerRow
unsigned int circuitsPerRow() const
Definition: PixelModuleHelper.h:84
InDet::PixelModuleHelper::circuitsPerColumn
unsigned int circuitsPerColumn() const
Definition: PixelModuleHelper.h:83
InDetDD::PixelModuleDesign::columnsPerCircuit
int columnsPerCircuit() const
Number of cell columns per circuit:
Definition: PixelModuleDesign.h:330
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
InDet::PixelModuleHelper::columns
unsigned int columns() const
Definition: PixelModuleHelper.h:79
InDet::PixelModuleHelper::COL_SHIFT
static constexpr unsigned int COL_SHIFT
Definition: PixelModuleHelper.h:44