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

Class for data object used in SCT_MonitorCondAlg and SCT_MonitorConditionsTool. More...

#include <SCT_MonitorCondData.h>

Collaboration diagram for SCT_MonitorCondData:

Public Member Functions

 SCT_MonitorCondData ()
 Constructor. More...
 
virtual ~SCT_MonitorCondData ()=default
 Destructor. More...
 
bool find (const IdentifierHash &hash, std::string &defectList) const
 Check if a module has a defect (a list of bad strips). If it does not have defect return false. More...
 
void insert (const IdentifierHash &hash, const std::string &defectList)
 Insert a new defect (a list of bad strips) for a module. More...
 
void clear ()
 Clear m_defectListArray. More...
 
std::size_t nBadStripsForModule (const IdentifierHash &moduleHash) const
 Get the number of bad strips for a module. More...
 
std::size_t nBadStripsForWafer (const IdentifierHash &waferHash) const
 Get the number of bad strips for a wafer. More...
 
std::size_t nBadStripsForChip (const IdentifierHash &waferHash, const int strip) const
 Get the number of bad strips for the chip, where a strip locates. More...
 
bool isBadStrip (const IdentifierHash &waferHash, const int strip) const
 Check if a strip is bad. More...
 
const std::array< std::bitset< SCT_ConditionsData::STRIPS_PER_CHIP >, SCT_ConditionsData::CHIPS_PER_SIDE > & badStripsForModule (const IdentifierHash &waferHash) const
 
const std::array< std::array< std::array< std::bitset< SCT_ConditionsData::STRIPS_PER_CHIP >, SCT_ConditionsData::CHIPS_PER_SIDE >, SCT_ConditionsData::SIDES_PER_MODULE >, SCT_ConditionsData::NUMBER_OF_MODULES > & badStrips () const
 

Private Member Functions

void clearModule (const std::size_t moduleIndex)
 
void fillBadStrip (const std::size_t moduleIndex, const int strip)
 

Private Attributes

std::array< std::string, SCT_ConditionsData::NUMBER_OF_MODULESm_defectListArray
 Store the relation between modules and defects (lists of bad strips). More...
 
std::array< std::array< std::array< std::bitset< SCT_ConditionsData::STRIPS_PER_CHIP >, SCT_ConditionsData::CHIPS_PER_SIDE >, SCT_ConditionsData::SIDES_PER_MODULE >, SCT_ConditionsData::NUMBER_OF_MODULESm_badStripArray
 
std::array< std::array< std::array< std::size_t, SCT_ConditionsData::CHIPS_PER_SIDE >, SCT_ConditionsData::SIDES_PER_MODULE >, SCT_ConditionsData::NUMBER_OF_MODULESm_badChipArray {}
 
std::array< std::array< std::size_t, SCT_ConditionsData::SIDES_PER_MODULE >, SCT_ConditionsData::NUMBER_OF_MODULESm_badWaferArray {}
 
std::array< std::size_t, SCT_ConditionsData::NUMBER_OF_MODULESm_badModuleArray {}
 

Static Private Attributes

static const std::string s_separator {"-"}
 

Detailed Description

Class for data object used in SCT_MonitorCondAlg and SCT_MonitorConditionsTool.

Definition at line 29 of file SCT_MonitorCondData.h.

Constructor & Destructor Documentation

◆ SCT_MonitorCondData()

SCT_MonitorCondData::SCT_MonitorCondData ( )

Constructor.

Definition at line 22 of file SCT_MonitorCondData.cxx.

23 {
24  clear();
25 }

◆ ~SCT_MonitorCondData()

virtual SCT_MonitorCondData::~SCT_MonitorCondData ( )
virtualdefault

Destructor.

Member Function Documentation

◆ badStrips()

const std::array<std::array<std::array<std::bitset<SCT_ConditionsData::STRIPS_PER_CHIP>, SCT_ConditionsData::CHIPS_PER_SIDE>, SCT_ConditionsData::SIDES_PER_MODULE>, SCT_ConditionsData::NUMBER_OF_MODULES>& SCT_MonitorCondData::badStrips ( ) const
inline

Definition at line 67 of file SCT_MonitorCondData.h.

67  {
68  return m_badStripArray;
69  }

◆ badStripsForModule()

const std::array<std::bitset<SCT_ConditionsData::STRIPS_PER_CHIP>, SCT_ConditionsData::CHIPS_PER_SIDE>& SCT_MonitorCondData::badStripsForModule ( const IdentifierHash waferHash) const
inline

Definition at line 58 of file SCT_MonitorCondData.h.

58  {
59  std::size_t moduleIndex{static_cast<std::size_t>(waferHash/SCT_ConditionsData::SIDES_PER_MODULE)};
60  // 0 to 1
61  std::size_t waferIndex{static_cast<std::size_t>(waferHash%SCT_ConditionsData::SIDES_PER_MODULE)};
62  return m_badStripArray[moduleIndex][waferIndex];
63  }

◆ clear()

void SCT_MonitorCondData::clear ( )

Clear m_defectListArray.

Definition at line 83 of file SCT_MonitorCondData.cxx.

84 {
85  m_defectListArray.fill("");
86 
87  for (std::size_t moduleIndex{0}; moduleIndex<SCT_ConditionsData::NUMBER_OF_MODULES; moduleIndex++) {
88  clearModule(moduleIndex);
89  }
90 }

◆ clearModule()

void SCT_MonitorCondData::clearModule ( const std::size_t  moduleIndex)
private

Definition at line 139 of file SCT_MonitorCondData.cxx.

139  {
140  // std::array is not automatically initialized.
141  for (std::size_t waferIndex{0}; waferIndex<SCT_ConditionsData::SIDES_PER_MODULE; waferIndex++) {
142  for (std::size_t chipIndex{0}; chipIndex<SCT_ConditionsData::CHIPS_PER_SIDE; chipIndex++) {
143  m_badStripArray[moduleIndex][waferIndex][chipIndex].reset();
144  m_badChipArray[moduleIndex][waferIndex][chipIndex] = 0;
145  }
146  m_badWaferArray[moduleIndex][waferIndex] = 0;
147  }
148  m_badModuleArray[moduleIndex] = 0;
149 }

◆ fillBadStrip()

void SCT_MonitorCondData::fillBadStrip ( const std::size_t  moduleIndex,
const int  strip 
)
private

Definition at line 151 of file SCT_MonitorCondData.cxx.

151  {
152  // 0 <= strip < 1536
153  if (strip<0) return;
155 
156  // 0 or 1
157  std::size_t waferIndex{static_cast<std::size_t>(strip/SCT_ConditionsData::STRIPS_PER_WAFER)};
158  // 0 to 5
159  std::size_t chipIndex{static_cast<std::size_t>(strip/SCT_ConditionsData::STRIPS_PER_CHIP)%SCT_ConditionsData::CHIPS_PER_SIDE};
160  // 0 to 127
161  std::size_t stripIndex{static_cast<std::size_t>(strip%SCT_ConditionsData::STRIPS_PER_CHIP)};
162  // Set the strip as bad
163  m_badStripArray[moduleIndex][waferIndex][chipIndex].set(stripIndex);
164 }

◆ find()

bool SCT_MonitorCondData::find ( const IdentifierHash hash,
std::string &  defectList 
) const

Check if a module has a defect (a list of bad strips). If it does not have defect return false.

Definition at line 29 of file SCT_MonitorCondData.cxx.

30 {
31  std::size_t moduleIndex{static_cast<std::size_t>(hash/SCT_ConditionsData::SIDES_PER_MODULE)};
32  std::string result{m_defectListArray[moduleIndex]};
33  if (result.empty()) return false;
34  defectList = result;
35  return true;
36 }

◆ insert()

void SCT_MonitorCondData::insert ( const IdentifierHash hash,
const std::string &  defectList 
)

Insert a new defect (a list of bad strips) for a module.

Definition at line 40 of file SCT_MonitorCondData.cxx.

41 {
42  std::size_t moduleIndex{static_cast<std::size_t>(hash/SCT_ConditionsData::SIDES_PER_MODULE)};
43  m_defectListArray[moduleIndex] = defectList;
44 
45  // Set all strips, chips, wafers and module itself of this module good.
46  clearModule(moduleIndex);
47 
48  if (doesNotHaveNumbers(defectList)) return;
49 
50  // Fill bad strips
51  std::istringstream is{defectList};
52  std::istream_iterator<std::string> readString{is};
53  std::istream_iterator<std::string> endOfString; //relies on default constructor to produce eof
54  for (; readString != endOfString; ++readString) {
55  const std::string& stringRange{*readString};
56  std::string::size_type p{stringRange.find(s_separator)};
57  if (p!=std::string::npos) { //its a range
58  std::string::size_type len1{p++};
59  std::string::size_type len2{stringRange.size()-p};
60  int min{std::stoi(stringRange.substr(0, len1))};
61  int max{std::stoi(stringRange.substr(p, len2))};
62  for (int strip{min}; strip<=max; strip++) {
63  fillBadStrip(moduleIndex, strip);
64  }
65  } else { //assume its a single number
66  int strip{std::stoi(*readString)};
67  fillBadStrip(moduleIndex, strip);
68  }
69  }
70 
71  // Fill the number of defects in chips, wafers, module
72  for (std::size_t waferIndex{0}; waferIndex<SCT_ConditionsData::SIDES_PER_MODULE; waferIndex++) {
73  for (std::size_t chipIndex{0}; chipIndex<SCT_ConditionsData::CHIPS_PER_SIDE; chipIndex++) {
74  m_badChipArray[moduleIndex][waferIndex][chipIndex] = m_badStripArray[moduleIndex][waferIndex][chipIndex].count();
75  m_badWaferArray[moduleIndex][waferIndex] += m_badChipArray[moduleIndex][waferIndex][chipIndex];
76  }
77  m_badModuleArray[moduleIndex] += m_badWaferArray[moduleIndex][waferIndex];
78  }
79 }

◆ isBadStrip()

bool SCT_MonitorCondData::isBadStrip ( const IdentifierHash waferHash,
const int  strip 
) const

Check if a strip is bad.

Definition at line 121 of file SCT_MonitorCondData.cxx.

122 {
123  // 0 <= strip < 768
124  if (strip<0) return false;
125  if (strip>=SCT_ConditionsData::STRIPS_PER_WAFER) return false;
126 
127  // 0 to 4087
128  std::size_t moduleIndex{static_cast<std::size_t>(waferHash/SCT_ConditionsData::SIDES_PER_MODULE)};
129  // 0 to 1
130  std::size_t waferIndex{static_cast<std::size_t>(waferHash%SCT_ConditionsData::SIDES_PER_MODULE)};
131  // 0 to 5
132  std::size_t chipIndex{static_cast<std::size_t>(strip/SCT_ConditionsData::STRIPS_PER_CHIP)};
133  // 0 to 127
134  std::size_t stripIndex{static_cast<std::size_t>(strip%SCT_ConditionsData::STRIPS_PER_CHIP)};
135 
136  return m_badStripArray[moduleIndex][waferIndex][chipIndex].test(stripIndex);
137 }

◆ nBadStripsForChip()

std::size_t SCT_MonitorCondData::nBadStripsForChip ( const IdentifierHash waferHash,
const int  strip 
) const

Get the number of bad strips for the chip, where a strip locates.

Definition at line 105 of file SCT_MonitorCondData.cxx.

106 {
107  // 0 <= strip < 768
108  if (strip<0) return false;
109  if (strip>=SCT_ConditionsData::STRIPS_PER_WAFER) return false;
110 
111  // 0 to 4087
112  std::size_t moduleIndex{static_cast<std::size_t>(waferHash/SCT_ConditionsData::SIDES_PER_MODULE)};
113  // 0 to 1
114  std::size_t waferIndex{static_cast<std::size_t>(waferHash%SCT_ConditionsData::SIDES_PER_MODULE)};
115  // 0 to 5
116  std::size_t chipIndex{static_cast<std::size_t>(strip/SCT_ConditionsData::STRIPS_PER_CHIP)};
117 
118  return m_badChipArray[moduleIndex][waferIndex][chipIndex];
119 }

◆ nBadStripsForModule()

std::size_t SCT_MonitorCondData::nBadStripsForModule ( const IdentifierHash moduleHash) const

Get the number of bad strips for a module.

Definition at line 92 of file SCT_MonitorCondData.cxx.

93 {
94  std::size_t moduleIndex{static_cast<std::size_t>(moduleHash/SCT_ConditionsData::SIDES_PER_MODULE)};
95  return m_badModuleArray[moduleIndex];
96 }

◆ nBadStripsForWafer()

std::size_t SCT_MonitorCondData::nBadStripsForWafer ( const IdentifierHash waferHash) const

Get the number of bad strips for a wafer.

Definition at line 98 of file SCT_MonitorCondData.cxx.

99 {
100  std::size_t moduleIndex{static_cast<std::size_t>(waferHash/SCT_ConditionsData::SIDES_PER_MODULE)};
101  std::size_t waferIndex{static_cast<std::size_t>(waferHash%SCT_ConditionsData::SIDES_PER_MODULE)};
102  return m_badWaferArray[moduleIndex][waferIndex];
103 }

Member Data Documentation

◆ m_badChipArray

std::array<std::array<std::array<std::size_t, SCT_ConditionsData::CHIPS_PER_SIDE>, SCT_ConditionsData::SIDES_PER_MODULE>, SCT_ConditionsData::NUMBER_OF_MODULES> SCT_MonitorCondData::m_badChipArray {}
private

Definition at line 84 of file SCT_MonitorCondData.h.

◆ m_badModuleArray

std::array<std::size_t, SCT_ConditionsData::NUMBER_OF_MODULES> SCT_MonitorCondData::m_badModuleArray {}
private

Definition at line 89 of file SCT_MonitorCondData.h.

◆ m_badStripArray

std::array<std::array<std::array<std::bitset<SCT_ConditionsData::STRIPS_PER_CHIP>, SCT_ConditionsData::CHIPS_PER_SIDE>, SCT_ConditionsData::SIDES_PER_MODULE>, SCT_ConditionsData::NUMBER_OF_MODULES> SCT_MonitorCondData::m_badStripArray
private

Definition at line 80 of file SCT_MonitorCondData.h.

◆ m_badWaferArray

std::array<std::array<std::size_t, SCT_ConditionsData::SIDES_PER_MODULE>, SCT_ConditionsData::NUMBER_OF_MODULES> SCT_MonitorCondData::m_badWaferArray {}
private

Definition at line 87 of file SCT_MonitorCondData.h.

◆ m_defectListArray

std::array<std::string, SCT_ConditionsData::NUMBER_OF_MODULES> SCT_MonitorCondData::m_defectListArray
private

Store the relation between modules and defects (lists of bad strips).

Definition at line 76 of file SCT_MonitorCondData.h.

◆ s_separator

const std::string SCT_MonitorCondData::s_separator {"-"}
staticprivate

Definition at line 91 of file SCT_MonitorCondData.h.


The documentation for this class was generated from the following files:
get_generator_info.result
result
Definition: get_generator_info.py:21
SiliconTech::strip
@ strip
SCT_MonitorCondData::m_badModuleArray
std::array< std::size_t, SCT_ConditionsData::NUMBER_OF_MODULES > m_badModuleArray
Definition: SCT_MonitorCondData.h:89
SCT_ConditionsData::NUMBER_OF_MODULES
@ NUMBER_OF_MODULES
Definition: SCT_ConditionsParameters.h:19
SCT_ConditionsData::CHIPS_PER_SIDE
@ CHIPS_PER_SIDE
Definition: SCT_ConditionsParameters.h:20
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
SCT_ConditionsData::SIDES_PER_MODULE
@ SIDES_PER_MODULE
Definition: SCT_ConditionsParameters.h:18
SCT_ConditionsData::STRIPS_PER_WAFER
@ STRIPS_PER_WAFER
Definition: SCT_ConditionsParameters.h:21
SCT_MonitorCondData::s_separator
static const std::string s_separator
Definition: SCT_MonitorCondData.h:91
SCT_MonitorCondData::m_defectListArray
std::array< std::string, SCT_ConditionsData::NUMBER_OF_MODULES > m_defectListArray
Store the relation between modules and defects (lists of bad strips).
Definition: SCT_MonitorCondData.h:76
SCT_MonitorCondData::clearModule
void clearModule(const std::size_t moduleIndex)
Definition: SCT_MonitorCondData.cxx:139
SCT_ConditionsData::STRIPS_PER_CHIP
@ STRIPS_PER_CHIP
Definition: SCT_ConditionsParameters.h:21
SCT_MonitorCondData::m_badStripArray
std::array< std::array< std::array< std::bitset< SCT_ConditionsData::STRIPS_PER_CHIP >, SCT_ConditionsData::CHIPS_PER_SIDE >, SCT_ConditionsData::SIDES_PER_MODULE >, SCT_ConditionsData::NUMBER_OF_MODULES > m_badStripArray
Definition: SCT_MonitorCondData.h:80
SCT_MonitorCondData::fillBadStrip
void fillBadStrip(const std::size_t moduleIndex, const int strip)
Definition: SCT_MonitorCondData.cxx:151
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
SCT_MonitorCondData::m_badChipArray
std::array< std::array< std::array< std::size_t, SCT_ConditionsData::CHIPS_PER_SIDE >, SCT_ConditionsData::SIDES_PER_MODULE >, SCT_ConditionsData::NUMBER_OF_MODULES > m_badChipArray
Definition: SCT_MonitorCondData.h:84
SCT_MonitorCondData::m_badWaferArray
std::array< std::array< std::size_t, SCT_ConditionsData::SIDES_PER_MODULE >, SCT_ConditionsData::NUMBER_OF_MODULES > m_badWaferArray
Definition: SCT_MonitorCondData.h:87
SCT_MonitorCondData::clear
void clear()
Clear m_defectListArray.
Definition: SCT_MonitorCondData.cxx:83
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109