ATLAS Offline Software
Loading...
Searching...
No Matches
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
25
26//----------------------------------------------------------------------
27// Set a bad strip identifier
28void SCT_ConfigurationCondData::setBadStripId(const Identifier& badStripId, const IdentifierHash& hash, const int strip) {
29 m_badStripIds.insert(badStripId);
30 m_badStripArray[hash].set(strip);
31}
32
33//----------------------------------------------------------------------
34// Get all bad strip identifiers
35const 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
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
60const std::set<Identifier>* SCT_ConfigurationCondData::getBadWaferIds() const {
61 return &m_badWaferIds;
62}
63
64//----------------------------------------------------------------------
65// Clear all bad wafer identifiers
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
84const std::set<Identifier>* SCT_ConfigurationCondData::getBadModuleIds() const {
85 return &m_badModuleIds;
86}
87
88//----------------------------------------------------------------------
89// Clear all bad module identifiers
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
102void 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
117const 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
130std::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
137void 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
143unsigned 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
150const std::map<Identifier, unsigned int>* SCT_ConfigurationCondData::getBadChips() const {
151 return &m_badChips;
152}
153
154//----------------------------------------------------------------------
155// Clear all bad chips
159
160//----------------------------------------------------------------------
161// Clear all bad information
header file for data object for SCT_ConfigurationCondAlg and SCT_ConfigurationConditionsTool.
This is a "hash" representation of an Identifier.
std::array< std::bitset< N_STRIPS >, N_MODULES *N_SIDES > m_badStripArray
std::pair< bool, bool > areBadLinks(const IdentifierHash &hash) const
Check if a module has bad links.
void setBadChips(const Identifier &moduleId, const unsigned int chipStatus)
Set bad chips for a module.
const std::map< Identifier, unsigned int > * getBadChips() const
Get all bad chips.
void clearBadStripIds()
Clear all bad strip identifiers.
bool isBadWaferId(const Identifier &waferId) const
Check if a wafer identifier is bad one.
void clearBadWaferIds()
Clear all bad wafer identifiers.
std::set< Identifier > m_badModuleIds
const std::map< IdentifierHash, std::pair< bool, bool > > * getBadLinks() const
Get all bad links.
void clearBadModuleIds()
Clear all bad module identifiers.
void setBadWaferId(const Identifier &badWaferId)
Set a bad wafer identifier.
std::array< std::pair< bool, bool >, N_MODULES > m_badLinksArray
bool isBadModuleId(const Identifier &moduleId) const
Check if a module identifier is bad one.
void setBadLinks(const IdentifierHash &hash, const bool isBadLink0, const bool isBadLink1)
Set bad links for a module.
std::map< IdentifierHash, std::pair< bool, bool > > m_badLinks
bool isBadStrip(const IdentifierHash &hash, const int strip) const
Check if a strip identifier is bad one.
void clearBadLinks()
Clear all bad links.
const std::set< Identifier > * getBadModuleIds() const
Get all bad module identifiers.
std::map< Identifier, unsigned int > m_badChips
void setBadStripId(const Identifier &badStripId, const IdentifierHash &hash, const int strip)
Set a bad strip identifier.
void clear()
Clear all bad information.
const std::set< Identifier > * getBadStripIds() const
Get all bad strip identifiers.
const std::set< Identifier > * getBadWaferIds() const
Get all bad wafer identifiers.
void setBadModuleId(const Identifier &badModuleId)
Set a bad module identifier.
std::set< Identifier > m_badStripIds
std::set< Identifier > m_badWaferIds
void clearBadChips()
Clear all bad chips.