ATLAS Offline Software
SCT_ConfigurationCondData.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //----------------------------------------------------------------------
6 // Implementation file for the data object class for SCT_ConfigurationSvc
7 //----------------------------------------------------------------------
8 
10 
11 #include <algorithm>
12 #include <iterator>
13 
14 //----------------------------------------------------------------------
15 // Constructor
17  m_badStripIds{},
18  m_badStripArray{},
19  m_badWaferIds{},
20  m_badModuleIds{},
21  m_badChips{}
22 {
23  clearBadLinks();
24 }
25 
26 //----------------------------------------------------------------------
27 // Set a bad strip identifier
28 void SCT_ConfigurationCondData::setBadStripId(const Identifier& badStripId, const IdentifierHash& hash, const int strip) {
29  m_badStripIds.insert(badStripId);
31 }
32 
33 //----------------------------------------------------------------------
34 // Get all bad strip identifiers
35 const std::set<Identifier>* SCT_ConfigurationCondData::getBadStripIds() const {
36  return &m_badStripIds;
37 }
38 
39 //----------------------------------------------------------------------
40 // Clear all bad strip identifiers
42  m_badStripIds.clear();
43  m_badStripArray.fill(std::bitset<N_STRIPS>());
44 }
45 
46 //----------------------------------------------------------------------
47 // Check if a strip identifier is bad one
48 bool SCT_ConfigurationCondData::isBadStrip(const IdentifierHash& hash, const int strip) const {
49  return m_badStripArray.at(hash.value()).test(strip);
50 }
51 
52 //----------------------------------------------------------------------
53 // Set a bad wafer identifier
55  m_badWaferIds.insert(badWaferId);
56 }
57 
58 //----------------------------------------------------------------------
59 // Get all bad wafer identifiers
60 const std::set<Identifier>* SCT_ConfigurationCondData::getBadWaferIds() const {
61  return &m_badWaferIds;
62 }
63 
64 //----------------------------------------------------------------------
65 // Clear all bad wafer identifiers
67  m_badWaferIds.clear();
68 }
69 
70 //----------------------------------------------------------------------
71 // Check if a wafer identifier is bad one
73  return (m_badWaferIds.find(waferId)!=m_badWaferIds.end());
74 }
75 
76 //----------------------------------------------------------------------
77 // Set a bad module identifier
79  m_badModuleIds.insert(badModuleId);
80 }
81 
82 //----------------------------------------------------------------------
83 // Get all bad module identifiers
84 const std::set<Identifier>* SCT_ConfigurationCondData::getBadModuleIds() const {
85  return &m_badModuleIds;
86 }
87 
88 //----------------------------------------------------------------------
89 // Clear all bad module identifiers
91  m_badModuleIds.clear();
92 }
93 
94 //----------------------------------------------------------------------
95 // Check if a module identifier is bad one
97  return (m_badModuleIds.find(moduleId)!=m_badModuleIds.end());
98 }
99 
100 //----------------------------------------------------------------------
101 // Set bad links for a module
102 void SCT_ConfigurationCondData::setBadLinks(const IdentifierHash& hash, const bool isBadLink0, const bool isBadLink1) {
103  unsigned int iHash{hash};
104  iHash = (iHash/2)*2; // Make iHash even
105  if (m_badLinks.count(iHash)==0) {
106  m_badLinks.insert(std::pair<IdentifierHash, std::pair<bool, bool>>(iHash, std::pair<bool, bool>(isBadLink0, isBadLink1)));
107  } else {
108  m_badLinks[iHash].first &= isBadLink0;
109  m_badLinks[iHash].second &= isBadLink1;
110  }
111  m_badLinksArray[iHash/2].first &= isBadLink0;
112  m_badLinksArray[iHash/2].second &= isBadLink1;
113 }
114 
115 //----------------------------------------------------------------------
116 // Get all bad links
117 const std::map<IdentifierHash, std::pair<bool, bool>>* SCT_ConfigurationCondData::getBadLinks() const {
118  return &m_badLinks;
119 }
120 
121 //----------------------------------------------------------------------
122 // Clear all bad links
124  m_badLinks.clear();
125  m_badLinksArray.fill(std::make_pair(true, true));
126 }
127 
128 //----------------------------------------------------------------------
129 // Check if a module has bad links
130 std::pair<bool, bool> SCT_ConfigurationCondData::areBadLinks(const IdentifierHash& hash) const {
131  // Bad convetion is used. true is for good link and false is for bad link...
132  return m_badLinksArray[hash/2];
133 }
134 
135 //----------------------------------------------------------------------
136 // Set bad chips for a module
137 void SCT_ConfigurationCondData::setBadChips(const Identifier& moduleId, const unsigned int chipStatus) {
138  if (chipStatus!=0) m_badChips[moduleId] = chipStatus;
139 }
140 
141 //----------------------------------------------------------------------
142 // bad chips for a module
143 unsigned int SCT_ConfigurationCondData::getBadChips(const Identifier& moduleId) const {
144  std::map<Identifier, unsigned int>::const_iterator it{m_badChips.find(moduleId)};
145  return (it!=m_badChips.end()) ? (*it).second : 0;
146 }
147 
148 //----------------------------------------------------------------------
149 // Get all bad chips
150 const std::map<Identifier, unsigned int>* SCT_ConfigurationCondData::getBadChips() const {
151  return &m_badChips;
152 }
153 
154 //----------------------------------------------------------------------
155 // Clear all bad chips
157  m_badChips.clear();
158 }
159 
160 //----------------------------------------------------------------------
161 // Clear all bad information
166  clearBadLinks();
167  clearBadChips();
168 }
SCT_ConfigurationCondData::setBadWaferId
void setBadWaferId(const Identifier &badWaferId)
Set a bad wafer identifier.
Definition: SCT_ConfigurationCondData.cxx:54
SiliconTech::strip
@ strip
SCT_ConfigurationCondData::m_badLinks
std::map< IdentifierHash, std::pair< bool, bool > > m_badLinks
Definition: SCT_ConfigurationCondData.h:96
SCT_ConfigurationCondData::m_badWaferIds
std::set< Identifier > m_badWaferIds
Definition: SCT_ConfigurationCondData.h:94
SCT_ConfigurationCondData::setBadLinks
void setBadLinks(const IdentifierHash &hash, const bool isBadLink0, const bool isBadLink1)
Set bad links for a module.
Definition: SCT_ConfigurationCondData.cxx:102
SCT_ConfigurationCondData::getBadStripIds
const std::set< Identifier > * getBadStripIds() const
Get all bad strip identifiers.
Definition: SCT_ConfigurationCondData.cxx:35
SCT_ConfigurationCondData::m_badModuleIds
std::set< Identifier > m_badModuleIds
Definition: SCT_ConfigurationCondData.h:95
SCT_ConfigurationCondData::clearBadLinks
void clearBadLinks()
Clear all bad links.
Definition: SCT_ConfigurationCondData.cxx:123
skel.it
it
Definition: skel.GENtoEVGEN.py:396
SCT_ConfigurationCondData::clearBadModuleIds
void clearBadModuleIds()
Clear all bad module identifiers.
Definition: SCT_ConfigurationCondData.cxx:90
SCT_ConfigurationCondData::isBadModuleId
bool isBadModuleId(const Identifier &moduleId) const
Check if a module identifier is bad one.
Definition: SCT_ConfigurationCondData.cxx:96
SCT_ConfigurationCondData.h
SCT_ConfigurationCondData::m_badStripArray
std::array< std::bitset< N_STRIPS >, N_MODULES *N_SIDES > m_badStripArray
Definition: SCT_ConfigurationCondData.h:93
SCT_ConfigurationCondData::m_badLinksArray
std::array< std::pair< bool, bool >, N_MODULES > m_badLinksArray
Definition: SCT_ConfigurationCondData.h:97
SCT_ConfigurationCondData::getBadLinks
const std::map< IdentifierHash, std::pair< bool, bool > > * getBadLinks() const
Get all bad links.
Definition: SCT_ConfigurationCondData.cxx:117
SCT_ConfigurationCondData::setBadStripId
void setBadStripId(const Identifier &badStripId, const IdentifierHash &hash, const int strip)
Set a bad strip identifier.
Definition: SCT_ConfigurationCondData.cxx:28
SCT_ConfigurationCondData::SCT_ConfigurationCondData
SCT_ConfigurationCondData()
Constructor.
Definition: SCT_ConfigurationCondData.cxx:16
SCT_ConfigurationCondData::m_badStripIds
std::set< Identifier > m_badStripIds
Definition: SCT_ConfigurationCondData.h:92
SCT_ConfigurationCondData::m_badChips
std::map< Identifier, unsigned int > m_badChips
Definition: SCT_ConfigurationCondData.h:98
SCT_ConfigurationCondData::clearBadWaferIds
void clearBadWaferIds()
Clear all bad wafer identifiers.
Definition: SCT_ConfigurationCondData.cxx:66
SCT_ConfigurationCondData::clearBadStripIds
void clearBadStripIds()
Clear all bad strip identifiers.
Definition: SCT_ConfigurationCondData.cxx:41
SCT_ConfigurationCondData::clear
void clear()
Clear all bad information.
Definition: SCT_ConfigurationCondData.cxx:162
SCT_ConfigurationCondData::areBadLinks
std::pair< bool, bool > areBadLinks(const IdentifierHash &hash) const
Check if a module has bad links.
Definition: SCT_ConfigurationCondData.cxx:130
SCT_ConfigurationCondData::isBadStrip
bool isBadStrip(const IdentifierHash &hash, const int strip) const
Check if a strip identifier is bad one.
Definition: SCT_ConfigurationCondData.cxx:48
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
SCT_ConfigurationCondData::clearBadChips
void clearBadChips()
Clear all bad chips.
Definition: SCT_ConfigurationCondData.cxx:156
SCT_ConfigurationCondData::setBadModuleId
void setBadModuleId(const Identifier &badModuleId)
Set a bad module identifier.
Definition: SCT_ConfigurationCondData.cxx:78
SCT_ConfigurationCondData::setBadChips
void setBadChips(const Identifier &moduleId, const unsigned int chipStatus)
Set bad chips for a module.
Definition: SCT_ConfigurationCondData.cxx:137
SCT_ConfigurationCondData::getBadModuleIds
const std::set< Identifier > * getBadModuleIds() const
Get all bad module identifiers.
Definition: SCT_ConfigurationCondData.cxx:84
SCT_ConfigurationCondData::getBadWaferIds
const std::set< Identifier > * getBadWaferIds() const
Get all bad wafer identifiers.
Definition: SCT_ConfigurationCondData.cxx:60
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
SCT_ConfigurationCondData::getBadChips
const std::map< Identifier, unsigned int > * getBadChips() const
Get all bad chips.
Definition: SCT_ConfigurationCondData.cxx:150
SCT_ConfigurationCondData::isBadWaferId
bool isBadWaferId(const Identifier &waferId) const
Check if a wafer identifier is bad one.
Definition: SCT_ConfigurationCondData.cxx:72
Identifier
Definition: IdentifierFieldParser.cxx:14