32 bool doesNotHaveNumbers(
const std::string& numberString) {
33 return (numberString.empty() or numberString.find_first_of(
"0123456789") == std::string::npos);
52 return StatusCode::FAILURE;
58 return StatusCode::SUCCESS;
65 return StatusCode::SUCCESS;
96 return not condData->isBadStrip(waferHash,
strip);
110 const EventContext& ctx{Gaudi::Hive::currentContext()};
112 return isGood(elementId, ctx,
h);
127 const EventContext& ctx{Gaudi::Hive::currentContext()};
129 return isGood(hashId, ctx);
136 if (not condDataHandle.isValid()) {
154 if (chip_status.empty()) {
160 std::vector<std::vector<unsigned short> > &bad_strips = element_status.
getBadCells();
161 if (bad_strips.empty()) {
162 bad_strips.resize(
status.size());
165 std::vector<std::pair<unsigned int, unsigned int> > tmp_bad_strips;
166 for (
unsigned int module_hash=0; module_hash<
status.size(); ++module_hash) {
169 std::vector<unsigned short> &bad_module_strips_out = bad_strips.at(module_hash);
170 std::array<unsigned int, SCT::N_CHIPS_PER_SIDE> bad_strip_counts{};
172 const std::array<std::bitset<SCT_ConditionsData::STRIPS_PER_CHIP>,
174 &bad_module_strips_in = condData->badStripsForModule(moduleHash);
176 unsigned int strip_i=0;
177 tmp_bad_strips.clear();
180 for (
const auto& chip_i : bad_module_strips_in) {
183 for (
unsigned int strip_per_chip_i=0; strip_per_chip_i<chip_i.size(); ++strip_per_chip_i) {
184 if (chip_i.test(strip_per_chip_i)) {
185 tmp_bad_strips.emplace_back(geoemtrical_chip_id,strip_i);
186 ++bad_strip_counts.at(geoemtrical_chip_id);
193 for (
unsigned int the_chip=0; the_chip< bad_strip_counts.size(); ++the_chip) {
196 chip_status[module_hash] &= ~bad_chips;
198 for (
const std::pair<unsigned int, unsigned int> &chip_and_strip : tmp_bad_strips) {
199 unsigned int strip_i=chip_and_strip.second;
200 std::vector<unsigned short>::const_iterator iter = std::lower_bound(bad_module_strips_out.begin(),bad_module_strips_out.end(),strip_i);
201 if (iter == bad_module_strips_out.end() || *iter != strip_i) {
202 bad_module_strips_out.insert( iter, strip_i);
216 for (; waferItr != waferEnd; ++waferItr) {
225 const EventContext& ctx{Gaudi::Hive::currentContext()};
235 std::string defectStr{
getList(moduleId, ctx)};
236 if (doesNotHaveNumbers(defectStr))
return;
239 std::set<int> defectList;
243 std::set<int>::const_iterator defectItr{defectList.begin()}, defectEnd{defectList.end()};
244 for (; defectItr!=defectEnd; ++defectItr) {
254 ATH_MSG_DEBUG(
"Bad Strip: Strip number in DB = " << *defectItr<<
", side/offline strip number = " <<
side <<
"/" << stripNum<<
", Identifier = " << stripId);
256 strips.insert(stripId);
262 const EventContext& ctx{Gaudi::Hive::currentContext()};
275 const EventContext& ctx{Gaudi::Hive::currentContext()};
285 string currentDefectList{
""};
289 condData->find(moduleHash, currentDefectList);
293 return currentDefectList;
302 std::string::size_type sepPos{rangeStr.find(
s_separator)};
304 if (sepPos != std::string::npos) {
306 std::string::size_type len1{sepPos++}, len2{rangeStr.size()-sepPos};
307 int min{std::stoi(rangeStr.substr(0,len1))};
308 int max{std::stoi(rangeStr.substr(sepPos,len2))};
310 while (
min != (
max+1)) rangeList.insert(
min++);
313 rangeList.insert(std::stoi(rangeStr));
324 if (doesNotHaveNumbers(defectStr))
return;
326 std::istringstream is{defectStr};
327 std::istream_iterator<std::string> defectItr{is};
328 std::istream_iterator<std::string> defectEnd;
331 for (; defectItr != defectEnd; ++defectItr)
expandRange(*defectItr, defectList);
339 return condData.retrieve();