ATLAS Offline Software
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
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 Member Functions

std::pair< std::vector< unsigned int >::const_iterator, std::vector< unsigned int >::const_iterator > lower_bound (unsigned int id_hash, unsigned int key) const
 Convenience method to find the preceding defect. More...
 
bool isDefect (const T_ModuleHelper &helper, unsigned int id_hash, unsigned int key) const
 Test whether a pixel on a certain module is marked as defect. More...
 
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. More...
 

Static Public Member Functions

static std::pair< std::vector< unsigned int >::iterator, std::vector< unsigned int >::iterator > lower_bound (std::vector< unsigned int > &module_defects, unsigned int key)
 Convenience method to find the preceding defect. More...
 

Public Attributes

const InDetDD::SiDetectorElementCollectionm_detectorElements = nullptr
 
elements
 STL member. More...
 

Static Public Attributes

static constexpr unsigned int MASK_FOR_COMPARISON = T_ModuleHelper::CHIP_MASK | T_ModuleHelper::ROW_MASK | T_ModuleHelper::COL_MASK
 

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 27 of file EmulatedDefects.h.

Member Function Documentation

◆ isDefect() [1/2]

template<class T_ModuleHelper >
bool InDet::EmulatedDefects< T_ModuleHelper >::isDefect ( const T_ModuleHelper &  helper,
unsigned int  id_hash,
unsigned int  key 
) 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
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 72 of file EmulatedDefects.h.

72  {
73  auto [defect_iter, end_iter] =lower_bound(id_hash, key);
74  return (defect_iter != end_iter && helper.isSameDefectWithGroups( *defect_iter, key) );
75  }

◆ 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 85 of file EmulatedDefects.h.

85  {
86  unsigned int key = helper.hardwareCoordinates(row_idx_aka_phi, col_idx_aka_eta);
87  return isDefect(helper, id_hash, key);
88  }

◆ lower_bound() [1/2]

template<class T_ModuleHelper >
static std::pair< std::vector<unsigned int>::iterator, std::vector<unsigned int>::iterator> InDet::EmulatedDefects< T_ModuleHelper >::lower_bound ( std::vector< unsigned int > &  module_defects,
unsigned int  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 46 of file EmulatedDefects.h.

47  {
48  return std::make_pair( std::lower_bound( module_defects.begin(),module_defects.end(), key, greater()),
49  module_defects.end());
50  }

◆ lower_bound() [2/2]

template<class T_ModuleHelper >
std::pair< std::vector<unsigned int>::const_iterator, std::vector<unsigned int>::const_iterator> InDet::EmulatedDefects< T_ModuleHelper >::lower_bound ( unsigned int  id_hash,
unsigned int  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 59 of file EmulatedDefects.h.

59  {
60  const std::vector<unsigned int> &module_defects = this->at(id_hash);
61  return std::make_pair( std::lower_bound( module_defects.begin(),module_defects.end(), key, greater()),
62  module_defects.end());
63  }

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 = nullptr

Definition at line 90 of file EmulatedDefects.h.

◆ MASK_FOR_COMPARISON

template<class T_ModuleHelper >
constexpr 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 30 of file EmulatedDefects.h.


The documentation for this class was generated from the following file:
InDet::EmulatedDefects::isDefect
bool isDefect(const T_ModuleHelper &helper, unsigned int id_hash, unsigned int key) const
Test whether a pixel on a certain module is marked as defect.
Definition: EmulatedDefects.h:72
CxxUtils::fpcompare::greater
bool greater(double a, double b)
Compare two FP numbers, working around x87 precision issues.
Definition: fpcompare.h:140
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:112
InDet::EmulatedDefects::lower_bound
static std::pair< std::vector< unsigned int >::iterator, std::vector< unsigned int >::iterator > lower_bound(std::vector< unsigned int > &module_defects, unsigned int key)
Convenience method to find the preceding defect.
Definition: EmulatedDefects.h:46
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37