Helper class to create keys for defects described by chip, column and row indices, and a mask.
More...
template<typename T, unsigned int T_ROW_BITS, unsigned int T_COL_BITS, unsigned int T_CHIP_BITS, unsigned int T_MASK_SEL_BITS, unsigned int T_N_MASKS = 3>
struct InDet::ModuleKeyHelper< T, T_ROW_BITS, T_COL_BITS, T_CHIP_BITS, T_MASK_SEL_BITS, T_N_MASKS >
Helper class to create keys for defects described by chip, column and row indices, and a mask.
- Template Parameters
-
T_ROW_BITS | number of bits to store the row index of a defect. |
T_COL_BITS | number of bits to store the column index of a defect. |
T_CHIP_BITS | number of bits to store the chip index of a defect. |
T_MASK_SEL_BITS | number of bits to store the mask index of a group defect. |
T_N_MASKS | total number of masks supported by this helper; must be representable by the number of @T_MASK_SEL_BITS |
The key assumes a hierarchical ordering of the indices where the chip index ranks highest and the row index lowest. The mask is applied to the final key and can be used to represent a defect of adjacent pixels by a single key, provided it is possible to compute the first pixel of such a group from a key which addresses a single pixel by a simple mask i.e. single-pixel-key bit-wise-and mask = group-key where the group-key is the single pixel key of the first pixel in that group.
Definition at line 47 of file ModuleKeyHelper.h.
template<typename T , unsigned int T_ROW_BITS, unsigned int T_COL_BITS, unsigned int T_CHIP_BITS, unsigned int T_MASK_SEL_BITS, unsigned int T_N_MASKS = 3>
Construct this key helper.
- Parameters
-
masks | the possible masks available for this key helper. |
The first mask should have all bits set which specify the row, column and chip index i.e. a mask for keys addressing individual cells e.g. pixel or strip. The other masks may have the lowest n-bits set to zero. Masks are expected to be in ascending order i.e. the number of trailing zero value bits is increasing.
Definition at line 125 of file ModuleKeyHelper.h.
template<typename T , unsigned int T_ROW_BITS, unsigned int T_COL_BITS, unsigned int T_CHIP_BITS, unsigned int T_MASK_SEL_BITS, unsigned int T_N_MASKS = 3>
static constexpr T InDet::ModuleKeyHelper< T, T_ROW_BITS, T_COL_BITS, T_CHIP_BITS, T_MASK_SEL_BITS, T_N_MASKS >::getChip |
( |
T |
key | ) |
|
|
inlinestaticconstexpr |
template<typename T , unsigned int T_ROW_BITS, unsigned int T_COL_BITS, unsigned int T_CHIP_BITS, unsigned int T_MASK_SEL_BITS, unsigned int T_N_MASKS = 3>
static constexpr T InDet::ModuleKeyHelper< T, T_ROW_BITS, T_COL_BITS, T_CHIP_BITS, T_MASK_SEL_BITS, T_N_MASKS >::getColumn |
( |
T |
key | ) |
|
|
inlinestaticconstexpr |
template<typename T , unsigned int T_ROW_BITS, unsigned int T_COL_BITS, unsigned int T_CHIP_BITS, unsigned int T_MASK_SEL_BITS, unsigned int T_N_MASKS = 3>
T InDet::ModuleKeyHelper< T, T_ROW_BITS, T_COL_BITS, T_CHIP_BITS, T_MASK_SEL_BITS, T_N_MASKS >::getMask |
( |
T |
key | ) |
const |
|
inline |
Get the mask specified by the full key.
- Parameters
-
The mask index must be smaller than the total number of masks available in this helper. The result will be undefined otherwise.
Definition at line 134 of file ModuleKeyHelper.h.
147 return static_cast<T>(1
u);
template<typename T , unsigned int T_ROW_BITS, unsigned int T_COL_BITS, unsigned int T_CHIP_BITS, unsigned int T_MASK_SEL_BITS, unsigned int T_N_MASKS = 3>
static constexpr T InDet::ModuleKeyHelper< T, T_ROW_BITS, T_COL_BITS, T_CHIP_BITS, T_MASK_SEL_BITS, T_N_MASKS >::getRow |
( |
T |
key | ) |
|
|
inlinestaticconstexpr |
template<typename T , unsigned int T_ROW_BITS, unsigned int T_COL_BITS, unsigned int T_CHIP_BITS, unsigned int T_MASK_SEL_BITS, unsigned int T_N_MASKS = 3>
bool InDet::ModuleKeyHelper< T, T_ROW_BITS, T_COL_BITS, T_CHIP_BITS, T_MASK_SEL_BITS, T_N_MASKS >::isOverlapping |
( |
T |
key_ref, |
|
|
T |
key_test |
|
) |
| const |
|
inline |
Test whether a single cell (e.g.
pixel or strip) key is compatible with a defect key
- Parameters
-
key_ref | a defect key |
key_test | a single cell (e.g. pixel or strip) key. The defect key can be either the key of a single cell (e.g. pixel or strip) or the first cell (e.g. pixel or strip) of a group, which is fully identified by this key and the mask also specified by the key and which can be obtained by getMask. |
Definition at line 195 of file ModuleKeyHelper.h.
198 return (key_ref &
mask) == (key_test &
mask);
201 return key_ref == key_test;
template<typename T , unsigned int T_ROW_BITS, unsigned int T_COL_BITS, unsigned int T_CHIP_BITS, unsigned int T_MASK_SEL_BITS, unsigned int T_N_MASKS = 3>
static constexpr T InDet::ModuleKeyHelper< T, T_ROW_BITS, T_COL_BITS, T_CHIP_BITS, T_MASK_SEL_BITS, T_N_MASKS >::makeKey |
( |
unsigned int |
mask_sel, |
|
|
unsigned int |
chip, |
|
|
unsigned int |
col, |
|
|
unsigned int |
row = 0u |
|
) |
| |
|
inlinestaticconstexprprotected |
Create a key from mask, chip, column and row indices.
- Parameters
-
mask_sel | the index of a mask starting from zero |
chip | the index of a chip starting from zero |
col | the index of a column starting from zero |
row | the index of a row starting from zero |
The indices must be representable by the number of reserved bits.
Definition at line 89 of file ModuleKeyHelper.h.
90 return makeKeyPart<MASK_SEL_SHIFT,MASK_SEL_MASK>(mask_sel)
91 | makeKeyPart<CHIP_SHIFT,CHIP_MASK>(chip)
92 | makeKeyPart<COL_SHIFT,COL_MASK>(
col)
93 | makeKeyPart<ROW_SHIFT,ROW_MASK>(
row);
template<typename T , unsigned int T_ROW_BITS, unsigned int T_COL_BITS, unsigned int T_CHIP_BITS, unsigned int T_MASK_SEL_BITS, unsigned int T_N_MASKS = 3>
template<unsigned int SHIFT, T MASK>
static constexpr T InDet::ModuleKeyHelper< T, T_ROW_BITS, T_COL_BITS, T_CHIP_BITS, T_MASK_SEL_BITS, T_N_MASKS >::makeKeyPart |
( |
[[maybe_unused] ] T |
val | ) |
|
|
inlinestaticconstexprprotected |
Convenience method to create part of a key.
- Template Parameters
-
SHIFT | the given value will be shifted by this ammount |
MASK | the shifted value must not overflow this mask. |
- Parameters
-
val | the value to be stored in the key part |
Definition at line 71 of file ModuleKeyHelper.h.
72 if constexpr(
MASK==0) {
76 assert (((
val << SHIFT) &
MASK) == (
val << SHIFT));
77 return (
val << SHIFT);
template<typename T , unsigned int T_ROW_BITS, unsigned int T_COL_BITS, unsigned int T_CHIP_BITS, unsigned int T_MASK_SEL_BITS, unsigned int T_N_MASKS = 3>
unsigned int InDet::ModuleKeyHelper< T, T_ROW_BITS, T_COL_BITS, T_CHIP_BITS, T_MASK_SEL_BITS, T_N_MASKS >::maskedKey |
( |
[[maybe_unused] ] unsigned int |
mask_idx, |
|
|
unsigned int |
chip, |
|
|
unsigned int |
col, |
|
|
unsigned int |
row = 0u |
|
) |
| const |
|
inline |
Create a key for a group defect.
- Parameters
-
mask_idx | the index of mask associated to this group defect |
chip | the chip index of one cell (e.g. pixel or strip) of this group defect |
column | the column index of one cell (e.g. pixel or strip) of this group defect |
row | the row index of one cell (e.g. pixel or strip) of this group defect |
The resulting key will be the key of the first cell (e.g. pixel or strip) of this group defect, and the mask index will be set accordingly.
Definition at line 160 of file ModuleKeyHelper.h.
162 assert( mask_idx <
m_masks.size());
template<typename T , unsigned int T_ROW_BITS, unsigned int T_COL_BITS, unsigned int T_CHIP_BITS, unsigned int T_MASK_SEL_BITS, unsigned int T_N_MASKS = 3>
unsigned int InDet::ModuleKeyHelper< T, T_ROW_BITS, T_COL_BITS, T_CHIP_BITS, T_MASK_SEL_BITS, T_N_MASKS >::maskedKey |
( |
unsigned int |
mask_idx, |
|
|
unsigned int |
key |
|
) |
| const |
|
inline |
Turn a single cell (e.g.
pixel or strip) defect key into a group defect key.
- Parameters
-
mask_idx | the index of mask associated to this group defect |
key | single pixel key |
The resulting key will be the key of the first pixel of this group defect, and the mask index will be set accordingly.
Definition at line 177 of file ModuleKeyHelper.h.
179 assert( mask_idx <
m_masks.size());
template<typename T , unsigned int T_ROW_BITS, unsigned int T_COL_BITS, unsigned int T_CHIP_BITS, unsigned int T_MASK_SEL_BITS, unsigned int T_N_MASKS = 3>
static constexpr unsigned int InDet::ModuleKeyHelper< T, T_ROW_BITS, T_COL_BITS, T_CHIP_BITS, T_MASK_SEL_BITS, T_N_MASKS >::nMasks |
( |
| ) |
|
|
inlinestaticconstexpr |