32 bool doesNotHaveNumbers(
const std::string& numberString) {
33 return (numberString.empty() or numberString.find_first_of(
"0123456789") == std::string::npos);
42 base_class(
type, name, parent)
50 if (detStore()->retrieve(
m_pHelper,
"SCT_ID").isFailure()) {
52 return StatusCode::FAILURE;
58 return StatusCode::SUCCESS;
65 return StatusCode::SUCCESS;
117 if (not condDataHandle.
isValid()) {
127 if (status.empty()) {
128 status.resize(
m_pHelper->wafer_hash_max(),
true);
130 for (
unsigned int hash=0; hash<status.size(); ++hash) {
135 if (chip_status.empty()) {
138 chip_status.resize(
m_pHelper->wafer_hash_max(),all_chips_set);
141 std::vector<std::vector<unsigned short> > &bad_strips = element_status.
getBadCells();
142 if (bad_strips.empty()) {
143 bad_strips.resize(status.size());
146 std::vector<std::pair<unsigned int, unsigned int> > tmp_bad_strips;
147 for (
unsigned int module_hash=0; module_hash<status.size(); ++module_hash) {
150 std::vector<unsigned short> &bad_module_strips_out = bad_strips.at(module_hash);
151 std::array<unsigned int, SCT::N_CHIPS_PER_SIDE> bad_strip_counts{};
153 const std::array<std::bitset<SCT_ConditionsData::STRIPS_PER_CHIP>,
157 unsigned int strip_i=0;
158 tmp_bad_strips.clear();
161 for (
const auto& chip_i : bad_module_strips_in) {
164 for (
unsigned int strip_per_chip_i=0; strip_per_chip_i<chip_i.size(); ++strip_per_chip_i) {
165 if (chip_i.test(strip_per_chip_i)) {
166 tmp_bad_strips.emplace_back(geoemtrical_chip_id,strip_i);
167 ++bad_strip_counts.at(geoemtrical_chip_id);
173 InDet::ChipFlags_t bad_chips=0;
174 for (
unsigned int the_chip=0; the_chip< bad_strip_counts.size(); ++the_chip) {
175 bad_chips |=
static_cast<InDet::ChipFlags_t
>((bad_strip_counts[the_chip]>=
m_nhits_noisychip) << the_chip);
177 chip_status[module_hash] &= ~bad_chips;
179 for (
const std::pair<unsigned int, unsigned int> &chip_and_strip : tmp_bad_strips) {
180 unsigned int strip_i=chip_and_strip.second;
181 std::vector<unsigned short>::const_iterator iter = std::lower_bound(bad_module_strips_out.begin(),bad_module_strips_out.end(),strip_i);
182 if (iter == bad_module_strips_out.end() || *iter != strip_i) {
183 bad_module_strips_out.insert( iter, strip_i);
197 for (; waferItr != waferEnd; ++waferItr) {
198 if (
m_pHelper->side(*waferItr) != 0)
continue;
210 std::string defectStr{
getList(moduleId, ctx)};
211 if (doesNotHaveNumbers(defectStr))
return;
214 std::set<int> defectList;
218 std::set<int>::const_iterator defectItr{defectList.begin()}, defectEnd{defectList.end()};
219 for (; defectItr!=defectEnd; ++defectItr) {
229 ATH_MSG_DEBUG(
"Bad Strip: Strip number in DB = " << *defectItr<<
", side/offline strip number = " << side <<
"/" << stripNum<<
", Identifier = " << stripId);
231 strips.insert(stripId);
248 string currentDefectList{
""};
252 condData->
find(moduleHash, currentDefectList);
256 return currentDefectList;
265 std::string::size_type sepPos{rangeStr.find(
s_separator)};
267 if (sepPos != std::string::npos) {
269 std::string::size_type len1{sepPos++}, len2{rangeStr.size()-sepPos};
270 int min{std::stoi(rangeStr.substr(0,len1))};
271 int max{std::stoi(rangeStr.substr(sepPos,len2))};
273 while (
min != (
max+1)) rangeList.insert(
min++);
276 rangeList.insert(std::stoi(rangeStr));
287 if (doesNotHaveNumbers(defectStr))
return;
289 std::istringstream is{defectStr};
290 std::istream_iterator<std::string> defectItr{is};
291 std::istream_iterator<std::string> defectEnd;
294 for (; defectItr != defectEnd; ++defectItr)
expandRange(*defectItr, defectList);
#define ATH_CHECK
Evaluate an expression and check for errors.
header file containing the number of elements and enumerated type of parameters which may be retrieve...
This is an Identifier helper class for the SCT subdetector.
Header file for AthHistogramAlgorithm.
This is a "hash" representation of an Identifier.
const std::vector< bool > & getElementStatus() const
const std::vector< ChipFlags_t > & getElementChipStatus() const
const std::vector< std::vector< unsigned short > > & getBadCells() const
std::vector< Identifier >::const_iterator const_id_iterator
Class for data object used in SCT_MonitorCondAlg and SCT_MonitorConditionsTool.
std::size_t nBadStripsForModule(const IdentifierHash &moduleHash) const
Get the number of bad strips for a module.
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.
bool isBadStrip(const IdentifierHash &waferHash, const int strip) const
Check if a strip is bad.
const std::array< std::bitset< SCT_ConditionsData::STRIPS_PER_CHIP >, SCT_ConditionsData::CHIPS_PER_SIDE > & badStripsForModule(const IdentifierHash &waferHash) const
std::size_t nBadStripsForChip(const IdentifierHash &waferHash, const int strip) const
Get the number of bad strips for the chip, where a strip locates.
std::size_t nBadStripsForWafer(const IdentifierHash &waferHash) const
Get the number of bad strips for a wafer.
const_pointer_type retrieve()
const_pointer_type cptr()
void addDependency(const EventIDRange &range)
constexpr unsigned int N_CHIPS_PER_SIDE
constexpr unsigned int getGeometricalChipID(unsigned int strip)
Get the geometrical chip ID for the given strip.
constexpr unsigned int N_SIDES