17 m_nMaskedLinks[reg] = 0;
35 m_geo.resize(maxHash, moduleGeo);
38 for (
unsigned int i{0};
i<maxHash;
i++) {
39 IdentifierHash
hash{
i};
42 moduleGeo.first.first, moduleGeo.first.second,
43 moduleGeo.second.first, moduleGeo.second.second,
53 if (not pEvent.isValid()) {
55 return StatusCode::SUCCESS;
67 fill(
"SCTErrMonitor", lumiBlockAcc, is1DAcc, sctFlagAcc);
70 std::array<int, N_REGIONS_INC_GENERAL> flaggedWafersIndices
72 std::array<int, N_REGIONS_INC_GENERAL> nFlaggedWafers{};
73 nFlaggedWafers.fill(0);
75 for (
unsigned int iHash{0}; iHash<wafer_hash_max; iHash++) {
76 const IdentifierHash
hash{iHash};
80 nFlaggedWafers[barrel_ec]++;
86 fill(
"SCTErrMonitor", flaggedWwafersIndicesAcc, nFlaggedWafersAcc);
89 return StatusCode::SUCCESS;
94 std::lock_guard<std::mutex> glock{
m_mutex};
109 for (; waferIterator not_eq waferEnd; ++waferIterator) {
128 fill(
"SCTErrMonitor", mEtaAcc, mPhiAcc, mOutAcc);
134 fill(
"SCTErrMonitor", moduleOutBinAcc, moduleOutAcc);
137 return StatusCode::SUCCESS;
146 fill(
"SCTErrMonitor", maskedLinksBinAcc, maskedLinksAcc);
148 return StatusCode::SUCCESS;
154 unsigned int nBadMods{
static_cast<unsigned int>(
m_configurationTool->badModules()->size())};
155 const std::map<IdentifierHash, std::pair<bool, bool>>* badLinks{
m_configurationTool->badLinks(ctx)};
156 unsigned int nBadLink0{0}, nBadLink1{0}, nBadLinkBoth{0};
157 for (
const std::pair<
const IdentifierHash, std::pair<bool, bool>>& link: *badLinks) {
158 std::pair<bool, bool>
status{link.second};
159 if ((
status.first ==
false) and (
status.second ==
true)) {
162 if ((
status.first ==
true) and (
status.second ==
false)) {
165 if ((
status.first ==
false) and (
status.second ==
false)) {
171 unsigned int nBadChips{0};
172 for (
const std::pair<const Identifier, unsigned int>& chip : *badChips) {
173 unsigned int status{chip.second};
175 nBadChips += ((
status & (1 <<
i)) == 0 ? 0 : 1);
179 std::set<Identifier> badStripsAll;
181 unsigned int nBadStrips{
static_cast<unsigned int>(badStripsAll.size())};
183 std::set<Identifier> badStripsExclusive;
185 int nBadStripsExclusive{
static_cast<int>(badStripsExclusive.size())};
186 int nBadStripsExclusiveBEC[
N_REGIONS] = {
189 for (
const Identifier& strip: badStripsExclusive) {
198 vDetailedConfBin[
i] =
i;
199 if (
i==0) vNBad[
i] = nBadMods;
200 else if (
i==1) vNBad[
i] = nBadLink0;
201 else if (
i==2) vNBad[
i] = nBadLink1;
202 else if (
i==3) vNBad[
i] = nBadChips;
203 else if (
i==4) vNBad[
i] =
static_cast<double>(nBadStripsExclusive) / 100.;
207 fill(
"SCTErrMonitor", detailedConfBinAcc, nBadAcc);
209 ATH_MSG_DEBUG(
"-----------------------------------------------------------------------");
216 ATH_MSG_DEBUG(
"Number of bad strips exclusive = " << nBadStripsExclusive);
217 ATH_MSG_DEBUG(
"Number of bad strips exclusive (ECC, B, ECA) = "
221 ATH_MSG_DEBUG(
"-----------------------------------------------------------------------");
223 return StatusCode::SUCCESS;
229 if (not pEvent.isValid()) {
231 return StatusCode::SUCCESS;
241 auto nBSErrorsAcc{
Monitored::Scalar<int>(
"n_"+SCT_ByteStreamErrors::ErrorTypeDescription[errType], nBSErrors)};
242 fill(
"SCTErrMonitor", lumiBlockAcc, nBSErrorsAcc);
246 std::array<int, N_REGIONS_INC_GENERAL> nMaskedLinks{};
247 nMaskedLinks.fill(0);
252 m_nMaskedLinks[reg] = nMaskedLinks[reg];
255 std::vector<int> vEta;
256 std::vector<int> vPhi;
257 std::vector<bool> vHasError;
261 categoryErrorMap.
count(errCate))};
262 fill(
"SCTErrMonitor", lumiBlockAcc, nCategoryErrorsAcc);
264 for (
int iReg{0}; iReg<
N_REGIONS; iReg++) {
270 const size_t size{
static_cast<size_t>((lastEta-firstEta+1)*(lastPhi-firstPhi+1))};
271 for (
int iLay{0}; iLay<maxLayer; iLay++) {
274 vHasError.resize(
size);
275 for (
int eta{firstEta}; eta<=lastEta; eta++) {
276 const int iEta{eta-firstEta};
277 for (
int phi{firstPhi}; phi<=lastPhi; phi++) {
278 const int iPhi{phi-firstPhi};
279 size_t index{
static_cast<size_t>(
iEta*(lastPhi-firstPhi+1)+
iPhi)};
282 vHasError[
index] = categoryErrorMap[errCate][iReg][iLay][
iEta][
iPhi];
289 fill(
"SCTErrMonitor", etaAcc, phiAcc, hasErrorAcc);
291 if (
m_doOnline and CategoryErrorsNames[errCate] ==
"Errors"){
293 fill(
"SCTErrMonitor", etaAcc, phiAcc, hasErrorRecentAcc);
300 bool doCoverage =
false;
304 m_procLB.insert(pEvent->lumiBlock());
315 "SCT_MapOfDisabledLinks",
316 "SCT_MapOfLinksWithBadLinkLevelErrors",
317 "SCT_MapOfLinksWithBadRODLevelErrors",
318 "SCT_MapOfLinksWithBadErrors",
319 "SCT_MapOfLinksWithPSTrip",
320 "SCT_MapOfLinksWithAnyProbelm"
324 "Map of Disabled Links",
325 "Map of Links with bad LinkLevelErrors",
326 "Map of Links with Bad RODLevelErrors",
327 "Map of Links with Bad Errors",
328 "Map of Links Affected by PS Trip",
329 "Map of Links with Any Bad Problem"
334 if (ent->m_evt!=ctx.evt()) {
335 if (ent->m_mapSCT.empty()) {
337 ent->
m_mapSCT.emplace_back(
names[iProblem].c_str(), titles[iProblem].c_str(),
339 ent->m_mapSCT[iProblem].GetXaxis()->SetTitle(
"#eta");
340 ent->m_mapSCT[iProblem].GetYaxis()->SetTitle(
"#phi");
344 ent->m_mapSCT[iProblem].Reset();
347 ent->m_evt = ctx.evt();
354 float psTripModules{0.};
363 for (
const IdentifierHash&
hash: sctHash[iProblem]) {
373 fill(
"SCTErrMonitor", lumiBlockAcc, detectorCoverageAcc);
376 auto detectorCoverageR4PAcc{
Monitored::Scalar<double>(
"detectorCoverage"+coverageVarNames[iProblem]+
"InR4P", detector_coverage)};
379 fill(
"SCTErrMonitor", lumiBlockAcc, detectorCoverageR4PAcc);
388 fill(
"SCTErrMonitor", lumiBlockAcc, psTripModulesAcc);
392 return StatusCode::SUCCESS;
399 std::array<int, N_REGIONS_INC_GENERAL>& nMaskedLinks)
const {
401 std::array<bool, CategoryErrors::N_ERRCATEGORY> b_category{};
402 b_category.fill(
false);
406 (err_type == SCT_ByteStreamErrors::MaskedLink) or (err_type == SCT_ByteStreamErrors::MaskedROD);
412 if (err_type == tmpBadError) {
420 if (err_type == linkLevelError) {
428 if (err_type == rodLevelError) {
435 (err_type == SCT_ByteStreamErrors::TempMaskedChip0) or (err_type == SCT_ByteStreamErrors::TempMaskedChip1) or
436 (err_type == SCT_ByteStreamErrors::TempMaskedChip2) or (err_type == SCT_ByteStreamErrors::TempMaskedChip3) or
437 (err_type == SCT_ByteStreamErrors::TempMaskedChip4) or (err_type == SCT_ByteStreamErrors::TempMaskedChip5);
476 std::vector<int> numErrorsPerLumi[
N_REGIONS];
479 const int nLayers{n_layers[reg]*2};
480 numErrorsPerLumi[reg].resize(nLayers, 0);
488 if (not
hash.is_valid())
continue;
512 nMaskedLinks[regionIndex]++;
520 categoryErrorMap[errCate][regionIndex][
layer][ieta][iphi] =
true;
527 std::vector<int> vErrorType;
528 std::vector<int> vLayerSide;
529 std::vector<float> vErrorFraction;
530 std::vector<bool> vIsEC;
531 std::vector<bool> vIsB;
532 std::vector<bool> vIsEA;
533 vErrorType.reserve(
size);
534 vLayerSide.reserve(
size);
535 vErrorFraction.reserve(
size);
540 const int nLayers{n_layers[reg]*
N_SIDES};
541 for (
int layerSide{0}; layerSide<nLayers; layerSide++) {
543 if (num_modules==0.)
continue;
544 vErrorType.push_back(err_type);
545 vLayerSide.push_back(layerSide);
546 vErrorFraction.push_back(
static_cast<float>(numErrorsPerLumi[reg][layerSide])/num_modules);
559 fill(
"SCTErrMonitor", errorTypeAcc, layerSideAcc, errorFractionAcc, isECAcc, isBAcc, isEAAcc);
569 if (
fit.is_valid()) {
577 sctHashDisabled.clear();
580 for (
const Identifier& badModule: *badModules) {
583 IdentifierHash hashSide1;
585 sctHashDisabled.insert(hashSide0);
586 sctHashDisabled.insert(hashSide1);
592 std::set<IdentifierHash>& sctHashBadRODError,
593 std::set<IdentifierHash>& sctHashBadError)
const {
594 sctHashBadLinkError.clear();
595 sctHashBadRODError.clear();
596 sctHashBadError.clear();
597 const EventContext& ctx{Gaudi::Hive::currentContext()};
600 const std::set<IdentifierHash> sctErrors{
m_byteStreamErrTool->getErrorSet( linkLevelBadErrors, ctx )};
601 for (
const IdentifierHash& waferHash : sctErrors) {
602 sctHashBadLinkError.insert(waferHash);
608 const std::set<IdentifierHash> sctErrors{
m_byteStreamErrTool->getErrorSet( RodLevelBadErrors, ctx )};
609 for (
const IdentifierHash& waferHash : sctErrors) {
610 sctHashBadRODError.insert(waferHash);
616 const std::set<IdentifierHash> sctErrors{
m_byteStreamErrTool->getErrorSet( tmpBadError, ctx )};
617 for (
const IdentifierHash& waferHash : sctErrors) {
618 sctHashBadError.insert(waferHash);
628 sctHashSummary.clear();
630 const EventContext& ctx{Gaudi::Hive::currentContext()};
633 for (
unsigned int i{0};
i<maxHash;
i++) {
634 IdentifierHash
hash{
i};
635 sctHashAll.insert(
hash);
637 sctHashSummary.insert(
hash);
646 sctHashPSTripDCS.clear();
650 for (
unsigned int i{0};
i<maxHash;
i++) {
651 IdentifierHash
hash{
i};
655 sctHashPSTripDCS.insert(
hash);
658 psTripModules = npsw/2.;
664 double phiMin{
module.second.first}, phiMax{
module.second.second};
665 unsigned int nRep{1};
672 for (
unsigned int iRep{0}; iRep<nRep; iRep++) {
674 phiMin =
module.second.first;
679 const int iyMin{
static_cast<int>((phiMin/
M_PI+1.)*
s_nBinsPhi/2)+1};
683 const double yMin{(
static_cast<double>(iyMin)/
s_nBinsPhi*2-1.)*
M_PI};
684 const double yMax{(
static_cast<double>(iyMax)/
s_nBinsPhi*2-1.)*
M_PI};
691 for (
int ix{ixMin}; ix<=ixMax+1; ix++) {
693 if (ixMin==ixMax+1) weightx = wxOne;
694 else if (ix==ixMin) weightx = wxMin;
695 else if (ix==ixMax+1) weightx = wxMax;
696 for (
int iy{iyMin}; iy<=iyMax+1; iy++) {
698 if (iyMin==iyMax+1)
weight *= wyOne;
699 else if (iy==iyMin)
weight *= wyMin;
700 else if (iy==iyMax+1)
weight *= wyMax;
709 double occupancy{0.};
712 for (
unsigned int j{0}; j <
s_nBinsPhi; j++) {
713 double waferCell{histoAll.GetBinContent(
i+1, j+1) -
histo.GetBinContent(
i+1, j+1)};
725 double detector_coverage{100. * occupancy / (
static_cast<double>(
s_nBinsEta ) *
static_cast<double>(
s_nBinsPhi ) )};
726 return detector_coverage;