17 m_nMaskedLinks[reg] = 0;
34 m_geo.resize(maxHash, moduleGeo);
37 for (
unsigned int i{0};
i<maxHash;
i++) {
38 IdentifierHash
hash{
i};
41 moduleGeo.first.first, moduleGeo.first.second,
42 moduleGeo.second.first, moduleGeo.second.second,
52 if (not pEvent.isValid()) {
54 return StatusCode::SUCCESS;
66 fill(
"SCTErrMonitor", lumiBlockAcc, is1DAcc, sctFlagAcc);
69 std::array<int, N_REGIONS_INC_GENERAL> flaggedWafersIndices
71 std::array<int, N_REGIONS_INC_GENERAL> nFlaggedWafers{};
72 nFlaggedWafers.fill(0);
74 for (
unsigned int iHash{0}; iHash<wafer_hash_max; iHash++) {
75 const IdentifierHash
hash{iHash};
79 nFlaggedWafers[barrel_ec]++;
85 fill(
"SCTErrMonitor", flaggedWwafersIndicesAcc, nFlaggedWafersAcc);
88 return StatusCode::SUCCESS;
93 std::lock_guard<std::mutex> glock{
m_mutex};
108 for (; waferIterator not_eq waferEnd; ++waferIterator) {
127 fill(
"SCTErrMonitor", mEtaAcc, mPhiAcc, mOutAcc);
133 fill(
"SCTErrMonitor", moduleOutBinAcc, moduleOutAcc);
136 return StatusCode::SUCCESS;
145 fill(
"SCTErrMonitor", maskedLinksBinAcc, maskedLinksAcc);
147 return StatusCode::SUCCESS;
153 unsigned int nBadMods{
static_cast<unsigned int>(
m_configurationTool->badModules()->size())};
154 const std::map<IdentifierHash, std::pair<bool, bool>>* badLinks{
m_configurationTool->badLinks(ctx)};
155 unsigned int nBadLink0{0}, nBadLink1{0}, nBadLinkBoth{0};
156 for (
const std::pair<
const IdentifierHash, std::pair<bool, bool>>& link: *badLinks) {
157 std::pair<bool, bool>
status{link.second};
158 if ((
status.first ==
false) and (
status.second ==
true)) {
161 if ((
status.first ==
true) and (
status.second ==
false)) {
164 if ((
status.first ==
false) and (
status.second ==
false)) {
170 unsigned int nBadChips{0};
171 for (
const std::pair<const Identifier, unsigned int>& chip : *badChips) {
172 unsigned int status{chip.second};
174 nBadChips += ((
status & (1 <<
i)) == 0 ? 0 : 1);
178 std::set<Identifier> badStripsAll;
180 unsigned int nBadStrips{
static_cast<unsigned int>(badStripsAll.size())};
182 std::set<Identifier> badStripsExclusive;
184 int nBadStripsExclusive{
static_cast<int>(badStripsExclusive.size())};
185 int nBadStripsExclusiveBEC[
N_REGIONS] = {
188 for (
const Identifier& strip: badStripsExclusive) {
197 vDetailedConfBin[
i] =
i;
198 if (
i==0) vNBad[
i] = nBadMods;
199 else if (
i==1) vNBad[
i] = nBadLink0;
200 else if (
i==2) vNBad[
i] = nBadLink1;
201 else if (
i==3) vNBad[
i] = nBadChips;
202 else if (
i==4) vNBad[
i] =
static_cast<double>(nBadStripsExclusive) / 100.;
206 fill(
"SCTErrMonitor", detailedConfBinAcc, nBadAcc);
208 ATH_MSG_DEBUG(
"-----------------------------------------------------------------------");
215 ATH_MSG_DEBUG(
"Number of bad strips exclusive = " << nBadStripsExclusive);
216 ATH_MSG_DEBUG(
"Number of bad strips exclusive (ECC, B, ECA) = "
220 ATH_MSG_DEBUG(
"-----------------------------------------------------------------------");
222 return StatusCode::SUCCESS;
228 if (not pEvent.isValid()) {
230 return StatusCode::SUCCESS;
240 auto nBSErrorsAcc{
Monitored::Scalar<int>(
"n_"+SCT_ByteStreamErrors::ErrorTypeDescription[errType], nBSErrors)};
241 fill(
"SCTErrMonitor", lumiBlockAcc, nBSErrorsAcc);
245 std::array<int, N_REGIONS_INC_GENERAL> nMaskedLinks{};
246 nMaskedLinks.fill(0);
251 m_nMaskedLinks[reg] = nMaskedLinks[reg];
254 std::vector<int> vEta;
255 std::vector<int> vPhi;
256 std::vector<bool> vHasError;
260 categoryErrorMap.
count(errCate))};
261 fill(
"SCTErrMonitor", lumiBlockAcc, nCategoryErrorsAcc);
263 for (
int iReg{0}; iReg<
N_REGIONS; iReg++) {
269 const size_t size{
static_cast<size_t>((lastEta-firstEta+1)*(lastPhi-firstPhi+1))};
270 for (
int iLay{0}; iLay<maxLayer; iLay++) {
273 vHasError.resize(
size);
274 for (
int eta{firstEta}; eta<=lastEta; eta++) {
275 const int iEta{eta-firstEta};
276 for (
int phi{firstPhi}; phi<=lastPhi; phi++) {
277 const int iPhi{phi-firstPhi};
278 size_t index{
static_cast<size_t>(
iEta*(lastPhi-firstPhi+1)+
iPhi)};
281 vHasError[
index] = categoryErrorMap[errCate][iReg][iLay][
iEta][
iPhi];
288 fill(
"SCTErrMonitor", etaAcc, phiAcc, hasErrorAcc);
290 if (
m_doOnline and CategoryErrorsNames[errCate] ==
"Errors"){
292 fill(
"SCTErrMonitor", etaAcc, phiAcc, hasErrorRecentAcc);
299 bool doCoverage =
false;
301 std::lock_guard<std::mutex> lock(
m_mutex);
303 m_procLB.insert(pEvent->lumiBlock());
314 "SCT_MapOfDisabledLinks",
315 "SCT_MapOfLinksWithBadLinkLevelErrors",
316 "SCT_MapOfLinksWithBadRODLevelErrors",
317 "SCT_MapOfLinksWithBadErrors",
318 "SCT_MapOfLinksWithPSTrip",
319 "SCT_MapOfLinksWithAnyProbelm"
323 "Map of Disabled Links",
324 "Map of Links with bad LinkLevelErrors",
325 "Map of Links with Bad RODLevelErrors",
326 "Map of Links with Bad Errors",
327 "Map of Links Affected by PS Trip",
328 "Map of Links with Any Bad Problem"
331 std::lock_guard<std::mutex> lock{
m_mutex};
333 if (ent->m_evt!=ctx.evt()) {
334 if (ent->m_mapSCT.empty()) {
336 ent->
m_mapSCT.emplace_back(
names[iProblem].c_str(), titles[iProblem].c_str(),
338 ent->m_mapSCT[iProblem].GetXaxis()->SetTitle(
"#eta");
339 ent->m_mapSCT[iProblem].GetYaxis()->SetTitle(
"#phi");
343 ent->m_mapSCT[iProblem].Reset();
346 ent->m_evt = ctx.evt();
353 float psTripModules{0.};
362 for (
const IdentifierHash&
hash: sctHash[iProblem]) {
372 fill(
"SCTErrMonitor", lumiBlockAcc, detectorCoverageAcc);
379 fill(
"SCTErrMonitor", lumiBlockAcc, psTripModulesAcc);
382 return StatusCode::SUCCESS;
389 std::array<int, N_REGIONS_INC_GENERAL>& nMaskedLinks)
const {
391 std::array<bool, CategoryErrors::N_ERRCATEGORY> b_category{};
392 b_category.fill(
false);
396 (err_type == SCT_ByteStreamErrors::MaskedLink) or (err_type == SCT_ByteStreamErrors::MaskedROD);
402 if (err_type == tmpBadError) {
410 if (err_type == linkLevelError) {
418 if (err_type == rodLevelError) {
425 (err_type == SCT_ByteStreamErrors::TempMaskedChip0) or (err_type == SCT_ByteStreamErrors::TempMaskedChip1) or
426 (err_type == SCT_ByteStreamErrors::TempMaskedChip2) or (err_type == SCT_ByteStreamErrors::TempMaskedChip3) or
427 (err_type == SCT_ByteStreamErrors::TempMaskedChip4) or (err_type == SCT_ByteStreamErrors::TempMaskedChip5);
466 std::vector<int> numErrorsPerLumi[
N_REGIONS];
469 const int nLayers{n_layers[reg]*2};
470 numErrorsPerLumi[reg].resize(nLayers, 0);
478 if (not
hash.is_valid())
continue;
502 nMaskedLinks[regionIndex]++;
510 categoryErrorMap[errCate][regionIndex][
layer][ieta][iphi] =
true;
517 std::vector<int> vErrorType;
518 std::vector<int> vLayerSide;
519 std::vector<float> vErrorFraction;
520 std::vector<bool> vIsEC;
521 std::vector<bool> vIsB;
522 std::vector<bool> vIsEA;
523 vErrorType.reserve(
size);
524 vLayerSide.reserve(
size);
525 vErrorFraction.reserve(
size);
530 const int nLayers{n_layers[reg]*
N_SIDES};
531 for (
int layerSide{0}; layerSide<nLayers; layerSide++) {
533 if (num_modules==0.)
continue;
534 vErrorType.push_back(err_type);
535 vLayerSide.push_back(layerSide);
536 vErrorFraction.push_back(
static_cast<float>(numErrorsPerLumi[reg][layerSide])/num_modules);
549 fill(
"SCTErrMonitor", errorTypeAcc, layerSideAcc, errorFractionAcc, isECAcc, isBAcc, isEAAcc);
559 if (
fit.is_valid()) {
567 sctHashDisabled.clear();
570 for (
const Identifier& badModule: *badModules) {
573 IdentifierHash hashSide1;
575 sctHashDisabled.insert(hashSide0);
576 sctHashDisabled.insert(hashSide1);
582 std::set<IdentifierHash>& sctHashBadRODError,
583 std::set<IdentifierHash>& sctHashBadError)
const {
584 sctHashBadLinkError.clear();
585 sctHashBadRODError.clear();
586 sctHashBadError.clear();
587 const EventContext& ctx{Gaudi::Hive::currentContext()};
590 const std::set<IdentifierHash> sctErrors{
m_byteStreamErrTool->getErrorSet( linkLevelBadErrors, ctx )};
591 for (
const IdentifierHash& waferHash : sctErrors) {
592 sctHashBadLinkError.insert(waferHash);
598 const std::set<IdentifierHash> sctErrors{
m_byteStreamErrTool->getErrorSet( RodLevelBadErrors, ctx )};
599 for (
const IdentifierHash& waferHash : sctErrors) {
600 sctHashBadRODError.insert(waferHash);
606 const std::set<IdentifierHash> sctErrors{
m_byteStreamErrTool->getErrorSet( tmpBadError, ctx )};
607 for (
const IdentifierHash& waferHash : sctErrors) {
608 sctHashBadError.insert(waferHash);
618 sctHashSummary.clear();
620 const EventContext& ctx{Gaudi::Hive::currentContext()};
623 for (
unsigned int i{0};
i<maxHash;
i++) {
624 IdentifierHash
hash{
i};
625 sctHashAll.insert(
hash);
627 sctHashSummary.insert(
hash);
636 sctHashPSTripDCS.clear();
640 for (
unsigned int i{0};
i<maxHash;
i++) {
641 IdentifierHash
hash{
i};
645 sctHashPSTripDCS.insert(
hash);
648 psTripModules = npsw/2.;
654 double phiMin{
module.second.first}, phiMax{
module.second.second};
655 unsigned int nRep{1};
662 for (
unsigned int iRep{0}; iRep<nRep; iRep++) {
664 phiMin =
module.second.first;
669 const int iyMin{
static_cast<int>((phiMin/
M_PI+1.)*
s_nBinsPhi/2)+1};
673 const double yMin{(
static_cast<double>(iyMin)/
s_nBinsPhi*2-1.)*
M_PI};
674 const double yMax{(
static_cast<double>(iyMax)/
s_nBinsPhi*2-1.)*
M_PI};
681 for (
int ix{ixMin}; ix<=ixMax+1; ix++) {
683 if (ixMin==ixMax+1) weightx = wxOne;
684 else if (ix==ixMin) weightx = wxMin;
685 else if (ix==ixMax+1) weightx = wxMax;
686 for (
int iy{iyMin}; iy<=iyMax+1; iy++) {
688 if (iyMin==iyMax+1)
weight *= wyOne;
689 else if (iy==iyMin)
weight *= wyMin;
690 else if (iy==iyMax+1)
weight *= wyMax;
699 double occupancy{0.};
702 for (
unsigned int j{0}; j <
s_nBinsPhi; j++) {
703 double waferCell{histoAll.GetBinContent(
i+1, j+1) -
histo.GetBinContent(
i+1, j+1)};
715 double detector_coverage{100. * occupancy / (
static_cast<double>(
s_nBinsEta ) *
static_cast<double>(
s_nBinsPhi ) )};
716 return detector_coverage;