14 #include <type_traits>
33 return StatusCode::SUCCESS;
50 if (condData==
nullptr) {
51 ATH_MSG_ERROR(
"In isGood, SCT_ConfigurationCondData pointer cannot be retrieved");
62 result = (not condData->isBadModuleId(elementId));
64 result = (not condData->isBadWaferId(elementId));
75 if (not condDataHandle.isValid() ) {
83 const std::set<Identifier>* bad_wafers = condData->
getBadWaferIds();
91 constexpr
unsigned int N_SIDES = 2;
94 if (chip_status.empty()) {
95 chip_status.resize(
status.size(), all_flags_set);
97 for (
const Identifier &a_bad_wafer : *bad_wafers) {
102 const std::set<Identifier>* bad_modules = condData->getBadModuleIds();
104 for (
const Identifier &a_bad_module : *bad_modules) {
105 for (
unsigned int side_i=0; side_i<
N_SIDES; ++side_i) {
112 chip_status.at(
hash.value()) = 0;
117 if (condData->getBadChips()) {
118 std::array<unsigned int,N_SIDES> side_mask{0x3F, 0xFC0};
119 for (
const std::pair<const Identifier, unsigned int> &a_bad_module : *(condData->getBadChips()) ) {
120 for (
unsigned int side_i=0; side_i<
N_SIDES; ++side_i) {
121 if (a_bad_module.second & side_mask[side_i]) {
134 if (condData->getBadStripIds()) {
135 std::vector<std::vector<unsigned short> > &bad_strips = element_status.
getBadCells();
136 if (bad_strips.empty()) {
137 bad_strips.resize(
status.size());
139 for (
const Identifier &bad_strip : *(condData->getBadStripIds()) ) {
145 std::vector<unsigned short> &bad_module_strips_combined = bad_strips.at(
hash);
146 std::vector<unsigned short>::const_iterator iter = std::lower_bound(bad_module_strips_combined.begin(),bad_module_strips_combined.end(),strip_i);
147 if (iter == bad_module_strips_combined.end() || *iter != strip_i) {
148 bad_module_strips_combined.insert( iter, strip_i);
156 const EventContext& ctx{Gaudi::Hive::currentContext()};
158 return isGood(elementId, ctx,
h);
168 const EventContext& ctx{Gaudi::Hive::currentContext()};
169 return isGood(hashId, ctx);
177 if (not moduleId.is_valid()) {
178 ATH_MSG_WARNING(
"moduleId obtained from stripId " << stripId <<
" is invalid.");
183 const unsigned int v_badChips{
badChips(moduleId, ctx)};
191 if (v_badChips==0)
return true;
198 if ((
side==0 and (v_badChips & 0x3F)==0) or (
side==1 and (v_badChips & 0xFC0)==0))
return true;
200 int chip{
getChip(stripId, ctx)};
201 if (chip<0 or chip>=12) {
207 const bool badChip{
static_cast<bool>(v_badChips & (1<<chip))};
209 return (not badChip);
214 if (condData==
nullptr) {
215 ATH_MSG_ERROR(
"In isStripInBadModule, SCT_ConfigurationCondData pointer cannot be retrieved");
226 if (condData==
nullptr) {
227 ATH_MSG_ERROR(
"In isWaferInBadModule, SCT_ConfigurationCondData pointer cannot be retrieved");
232 return condData->isBadModuleId(moduleId);
240 if (pElement==
nullptr) {
241 ATH_MSG_FATAL(
"Element pointer is nullptr in 'badStrips' method");
248 const EventContext& ctx{Gaudi::Hive::currentContext()};
254 if (condData==
nullptr) {
255 ATH_MSG_ERROR(
"In badModules, SCT_ConfigurationCondData pointer cannot be retrieved");
259 return condData->getBadModuleIds();
263 const EventContext& ctx{Gaudi::Hive::currentContext()};
269 if (condData==
nullptr) {
270 ATH_MSG_ERROR(
"In badStrips, SCT_ConfigurationCondData pointer cannot be retrieved");
275 if (ignoreBadModules) {
277 if (condData->isBadModuleId(moduleId))
return;
280 for (
const Identifier& badStripId: *(condData->getBadStripIds())) {
281 if (ignoreBadChips) {
283 const int chip{
getChip(badStripId)};
285 unsigned int chipStatusWord{condData->getBadChips(moduleId)};
286 if ((chipStatusWord & (1 << chip)) != 0)
continue;
294 const EventContext& ctx{Gaudi::Hive::currentContext()};
295 return badStrips(moduleId, strips, ctx, ignoreBadModules, ignoreBadChips);
302 if (condData==
nullptr) {
303 ATH_MSG_ERROR(
"In badLinks, SCT_ConfigurationCondData pointer cannot be retrieved");
304 return std::pair<bool, bool>{
false,
false};
307 return condData->areBadLinks(
hash);
311 const EventContext& ctx{Gaudi::Hive::currentContext()};
317 if (condData==
nullptr) {
318 ATH_MSG_ERROR(
"In badLinks, SCT_ConfigurationCondData pointer cannot be retrieved");
322 return condData->getBadLinks();
326 const EventContext& ctx{Gaudi::Hive::currentContext()};
332 if (condData==
nullptr) {
333 ATH_MSG_ERROR(
"In badChips, SCT_ConfigurationCondData pointer cannot be retrieved");
337 return condData->getBadChips();
341 const EventContext& ctx{Gaudi::Hive::currentContext()};
348 if (condData==
nullptr) {
349 ATH_MSG_ERROR(
"In badChips, SCT_ConfigurationCondData pointer cannot be retrieved");
353 return condData->getBadChips(moduleId);
357 const EventContext& ctx{Gaudi::Hive::currentContext()};
363 if (condData==
nullptr) {
364 ATH_MSG_ERROR(
"In badStrips, SCT_ConfigurationCondData pointer cannot be retrieved");
368 if (!ignoreBadModules and !ignoreBadChips) {
369 const std::set<Identifier>& bad_strips = *condData->getBadStripIds();
370 std::copy(bad_strips.begin(), bad_strips.end(), std::inserter(strips,strips.begin()));
373 for (
const Identifier& badStripId: *(condData->getBadStripIds())) {
376 if (ignoreBadModules) {
377 if (condData->isBadModuleId(moduleId))
continue;
380 if (ignoreBadChips) {
381 const int chip{
getChip(badStripId)};
383 unsigned int chipStatusWord{condData->getBadChips(moduleId)};
384 if ((chipStatusWord & (1 << chip)) != 0)
continue;
387 strips.insert(badStripId);
393 const EventContext& ctx{Gaudi::Hive::currentContext()};
394 badStrips(strips, ctx, ignoreBadModules, ignoreBadChips);
400 return condData.retrieve();
405 if (not condData.isValid())
return nullptr;
406 return condData->getDetectorElement(waferHash);