ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::EmulatedDefects< T_ModuleHelper > Class Template Reference

Data structure do mark e.g. More...

#include <EmulatedDefects.h>

Inheritance diagram for InDet::EmulatedDefects< T_ModuleHelper >:
Collaboration diagram for InDet::EmulatedDefects< T_ModuleHelper >:

Classes

class  greater
 Special greater operator which ignores the column group flag in the comparison. More...

Public Types

using KEY_TYPE = typename T_ModuleHelper::KEY_TYPE

Public Member Functions

 EmulatedDefects (const InDetDD::SiDetectorElementCollection &detector_elements)
std::pair< typename std::vector< KEY_TYPE >::const_iterator, typename std::vector< KEY_TYPE >::const_iteratorlower_bound (unsigned int id_hash, KEY_TYPE key) const
 Convenience method to find the preceding defect.
bool isDefect (const T_ModuleHelper &helper, unsigned int id_hash, KEY_TYPE key) const
 Test whether a pixel or strip on a certain module is marked as defect.
bool isDefect (const T_ModuleHelper &helper, unsigned int id_hash, unsigned int row_idx_aka_phi, unsigned int col_idx_aka_eta) const
 Test whether a pixel on a certain module is marked as defect.
bool isModuleDefect (unsigned int id_hash) const
 Return true if the module defined by the given ID hash is defect.
void setModuleDefect (unsigned int id_hash)
 Mark the specified module as defect.
const InDetDD::SiDetectorElementgetDetectorElement (unsigned int id_hash) const
 Return the detector element for the given ID hash.
const InDetDD::SiDetectorElementCollectiongetDetectorElementCollection () const
 Return the detector element collection.

Static Public Member Functions

static std::pair< typename std::vector< KEY_TYPE >::iterator, typename std::vector< KEY_TYPE >::iteratorlower_bound (std::vector< KEY_TYPE > &module_defects, KEY_TYPE key)
 Convenience method to find the preceding defect.
static std::pair< typename std::vector< KEY_TYPE >::const_iterator, typename std::vector< KEY_TYPE >::const_iteratorlower_bound (const std::vector< KEY_TYPE > &module_defects, KEY_TYPE key)
 Convenience method to find the preceding defect (read only).
static std::pair< KEY_TYPE, KEY_TYPEgetRange (typename std::vector< KEY_TYPE >::const_iterator key_iter)
 Convenience method to get a range of keys.

Public Attributes

elements
 STL member.

Static Public Attributes

static constexpr bool s_needMasking = T_ModuleHelper::RANGE_FLAG_MASK != 0
static constexpr unsigned int MASK_FOR_COMPARISON = T_ModuleHelper::CHIP_MASK | T_ModuleHelper::ROW_MASK | T_ModuleHelper::COL_MASK

Protected Member Functions

void resize (std::size_t n_modules)
 Resize data structures for this number of modules.

Protected Attributes

std::vector< bool > m_moduleIsDefect
const InDetDD::SiDetectorElementCollectionm_detectorElements

Detailed Description

template<class T_ModuleHelper>
class InDet::EmulatedDefects< T_ModuleHelper >

Data structure do mark e.g.

pixel defects for a list of modules. Contains a list of ordered hardware coordinates marking defect "pixels" for each module identified by an ID hash (consecutive integer). Defects can be either individual pixel defects or column group defects (group of 8 consecutive columns). The defects are expected to be ordered in descending order (excluding the column group flag), such that std::lower_bound together with the supplied greater comparator will yield the defect which is either identical, has a smaller column address or smaller row address. If the elements are in a different order the results will be undefined.

Definition at line 24 of file EmulatedDefects.h.

Member Typedef Documentation

◆ KEY_TYPE

template<class T_ModuleHelper>
using InDet::EmulatedDefects< T_ModuleHelper >::KEY_TYPE = typename T_ModuleHelper::KEY_TYPE

Definition at line 29 of file EmulatedDefects.h.

Constructor & Destructor Documentation

◆ EmulatedDefects()

template<class T_ModuleHelper>
InDet::EmulatedDefects< T_ModuleHelper >::EmulatedDefects ( const InDetDD::SiDetectorElementCollection & detector_elements)
inline

Definition at line 31 of file EmulatedDefects.h.

33 {
34 resize( m_detectorElements->size() );
35 }
Data structure do mark e.g.
const InDetDD::SiDetectorElementCollection * m_detectorElements
void resize(std::size_t n_modules)
Resize data structures for this number of modules.

Member Function Documentation

◆ getDetectorElement()

template<class T_ModuleHelper>
const InDetDD::SiDetectorElement & InDet::EmulatedDefects< T_ModuleHelper >::getDetectorElement ( unsigned int id_hash) const
inline

Return the detector element for the given ID hash.

will throw a range_error if the ID hash is invalid.

Definition at line 149 of file EmulatedDefects.h.

149 {
150 return *(m_detectorElements->at(id_hash));
151 }

◆ getDetectorElementCollection()

template<class T_ModuleHelper>
const InDetDD::SiDetectorElementCollection & InDet::EmulatedDefects< T_ModuleHelper >::getDetectorElementCollection ( ) const
inline

Return the detector element collection.

Definition at line 154 of file EmulatedDefects.h.

154 {
155 return *m_detectorElements;
156 }

◆ getRange()

template<class T_ModuleHelper>
std::pair< KEY_TYPE, KEY_TYPE > InDet::EmulatedDefects< T_ModuleHelper >::getRange ( typename std::vector< KEY_TYPE >::const_iterator key_iter)
inlinestatic

Convenience method to get a range of keys.

Parameters
key_itera valid iterator to defects
Returns
a range of defect keys or a pair of identical keys If the iterator is a range iterator return the start key and the key of the last element of this range otherwise the given key twice.

Definition at line 98 of file EmulatedDefects.h.

98 {
100 auto prev = key_iter;
101 --prev;
102 return std::make_pair(*key_iter,*prev);
103 }
104 else {
106 }
107 }

◆ isDefect() [1/2]

template<class T_ModuleHelper>
bool InDet::EmulatedDefects< T_ModuleHelper >::isDefect ( const T_ModuleHelper & helper,
unsigned int id_hash,
KEY_TYPE key ) const
inline

Test whether a pixel or strip on a certain module is marked as defect.

Parameters
helperutility matching this defect data to check whether a defect overlaps with pixel coordinates.
id_hasha valid ID hash
keypacked hardware coordinates of the pixel to be tested.
Returns
true if this data structure contains a defect for this module which overlaps with the given pixel coordinates. Will throw a range_error if the ID hash is invalid.

Definition at line 116 of file EmulatedDefects.h.

116 {
118 return (defect_iter != end_iter) && helper.isMatchingDefect(*defect_iter,key);
119 }
static std::pair< typename std::vector< KEY_TYPE >::iterator, typename std::vector< KEY_TYPE >::iterator > lower_bound(std::vector< KEY_TYPE > &module_defects, KEY_TYPE key)
Convenience method to find the preceding defect.

◆ isDefect() [2/2]

template<class T_ModuleHelper>
bool InDet::EmulatedDefects< T_ModuleHelper >::isDefect ( const T_ModuleHelper & helper,
unsigned int id_hash,
unsigned int row_idx_aka_phi,
unsigned int col_idx_aka_eta ) const
inline

Test whether a pixel on a certain module is marked as defect.

Parameters
helperutility matching this defect data to check whether a defect overlaps with pixel coordinates.
id_hasha valid ID hash
row_idx_aka_phithe offline row aka phi index of a pixel
col_idx_aka_etathe offline column aka eta index of a pixel
Returns
true if this data structure contains a defect for this module which overlaps with the given pixel coordinates Will throw a range_error if the ID hash is invalid.

Definition at line 129 of file EmulatedDefects.h.

129 {
130 return isDefect(helper, id_hash, helper.hardwareCoordinates(row_idx_aka_phi, col_idx_aka_eta) );
131 }
bool isDefect(const T_ModuleHelper &helper, unsigned int id_hash, KEY_TYPE key) const
Test whether a pixel or strip on a certain module is marked as defect.

◆ isModuleDefect()

template<class T_ModuleHelper>
bool InDet::EmulatedDefects< T_ModuleHelper >::isModuleDefect ( unsigned int id_hash) const
inline

Return true if the module defined by the given ID hash is defect.

Will throw a range_error if ID hash is invalid.

Definition at line 136 of file EmulatedDefects.h.

136 {
137 return m_moduleIsDefect.at(id_hash);
138 }
std::vector< bool > m_moduleIsDefect

◆ lower_bound() [1/3]

template<class T_ModuleHelper>
std::pair< typename std::vector< KEY_TYPE >::const_iterator, typename std::vector< KEY_TYPE >::const_iterator > InDet::EmulatedDefects< T_ModuleHelper >::lower_bound ( const std::vector< KEY_TYPE > & module_defects,
KEY_TYPE key )
inlinestatic

Convenience method to find the preceding defect (read only).

Parameters
module_defectsthe defect list of a particular module
keypacked hardware coordinates addressing a single pixel or column group defect.
Returns
pair of the iterator of the preceding element and the end iterator If there is no preceding defect then both returned iterators will be the end iterator

Definition at line 72 of file EmulatedDefects.h.

73 {
75 module_defects.end());
76 }
Special greater operator which ignores the column group flag in the comparison.

◆ lower_bound() [2/3]

template<class T_ModuleHelper>
std::pair< typename std::vector< KEY_TYPE >::iterator, typename std::vector< KEY_TYPE >::iterator > InDet::EmulatedDefects< T_ModuleHelper >::lower_bound ( std::vector< KEY_TYPE > & module_defects,
KEY_TYPE key )
inlinestatic

Convenience method to find the preceding defect.

Parameters
module_defectsthe defect list of a particular module
keypacked hardware coordinates addressing a single pixel or column group defect.
Returns
pair of the iterator of the preceding element and the end iterator If there is no preceding defect then both returned iterators will be the end iterator

Definition at line 59 of file EmulatedDefects.h.

60 {
62 module_defects.end());
63 }

◆ lower_bound() [3/3]

template<class T_ModuleHelper>
std::pair< typename std::vector< KEY_TYPE >::const_iterator, typename std::vector< KEY_TYPE >::const_iterator > InDet::EmulatedDefects< T_ModuleHelper >::lower_bound ( unsigned int id_hash,
KEY_TYPE key ) const
inline

Convenience method to find the preceding defect.

Parameters
id_hasha valid ID hash of a module.
keypacked hardware coordinates addressing a single pixel or column group defect.
Returns
pair of the iterator of the preceding element and the end iterator of the corresponding module If there is no preceding defect then both returned iterators will be the end iterator. Will throw a range_error if the ID hash is invalid.

Definition at line 86 of file EmulatedDefects.h.

86 {
89 module_defects.end());
90 }

◆ resize()

template<class T_ModuleHelper>
void InDet::EmulatedDefects< T_ModuleHelper >::resize ( std::size_t n_modules)
inlineprotected

Resize data structures for this number of modules.

Definition at line 160 of file EmulatedDefects.h.

◆ setModuleDefect()

template<class T_ModuleHelper>
void InDet::EmulatedDefects< T_ModuleHelper >::setModuleDefect ( unsigned int id_hash)
inline

Mark the specified module as defect.

Definition at line 142 of file EmulatedDefects.h.

142 {
143 m_moduleIsDefect.at(id_hash)=true;
144 }

Member Data Documentation

◆ elements

T std::vector< T >::elements
inherited

STL member.

◆ m_detectorElements

template<class T_ModuleHelper>
const InDetDD::SiDetectorElementCollection* InDet::EmulatedDefects< T_ModuleHelper >::m_detectorElements
protected

Definition at line 165 of file EmulatedDefects.h.

◆ m_moduleIsDefect

template<class T_ModuleHelper>
std::vector<bool> InDet::EmulatedDefects< T_ModuleHelper >::m_moduleIsDefect
protected

Definition at line 164 of file EmulatedDefects.h.

◆ MASK_FOR_COMPARISON

template<class T_ModuleHelper>
unsigned int InDet::EmulatedDefects< T_ModuleHelper >::MASK_FOR_COMPARISON = T_ModuleHelper::CHIP_MASK | T_ModuleHelper::ROW_MASK | T_ModuleHelper::COL_MASK
staticconstexpr

Definition at line 28 of file EmulatedDefects.h.

◆ s_needMasking

template<class T_ModuleHelper>
bool InDet::EmulatedDefects< T_ModuleHelper >::s_needMasking = T_ModuleHelper::RANGE_FLAG_MASK != 0
staticconstexpr

Definition at line 27 of file EmulatedDefects.h.


The documentation for this class was generated from the following file: