26 #include <TDirectoryFile.h>
52 void bookHistogramsChamberPart(DQMStore::IBooker &,
GEMDetId &);
53 void bookHistogramsStationPart(DQMStore::IBooker &,
GEMDetId &);
54 void bookHistogramsAMCPart(DQMStore::IBooker &);
55 void bookHistogramsTimeRecordPart(DQMStore::IBooker &);
57 int SetInfoChambers();
58 int SetConfigTimeRecord();
61 Int_t seekIdx(std::vector<GEMDetId> &listLayers, UInt_t unId);
62 void seekIdxSummary(
GEMDetId gid, Int_t &nIdxLayer, Int_t &nIdxChamber);
87 int amcStatusBit_ = 6;
135 const Int_t m_nIdxSummaryFill = 1, m_nIdxSummaryErr = 2;
157 GEMGeometry_ = &*hGeom;
159 edm::LogError(
"MuonGEMBaseValidation") <<
"+++ Error : GEM geometry is unavailable on event loop. +++\n";
169 tagVFAT_ = consumes<GEMVfatStatusDigiCollection>(
cfg.getParameter<
edm::InputTag>(
"VFATInputLabel"));
170 tagGEB_ = consumes<GEMGEBdataCollection>(
cfg.getParameter<
edm::InputTag>(
"GEBInputLabel"));
171 tagAMC_ = consumes<GEMAMCdataCollection>(
cfg.getParameter<
edm::InputTag>(
"AMCInputLabel"));
172 tagDigi_ = consumes<GEMDigiCollection>(
cfg.getParameter<
edm::InputTag>(
"digisInputLabel"));
174 listAMCSlots_ =
cfg.getParameter<std::vector<int>>(
"AMCSlots");
176 strFmtSummaryLabel_ =
cfg.getParameter<
std::string>(
"summaryLabelFmt");
177 bFlipSummary_ =
cfg.getParameter<
bool>(
"flipSummary");
178 bPerSuperchamber_ =
cfg.getParameter<
bool>(
"perSuperchamber");
180 strPathPrevDQMRoot_ =
cfg.getParameter<
std::string>(
"pathOfPrevDQMRoot");
181 nNEvtPerSec_ =
cfg.getParameter<
int>(
"numOfEvtPerSec");
182 nNSecPerBin_ =
cfg.getParameter<
int>(
"secOfEvtPerBin");
183 nNTimeBinPrimitive_ =
cfg.getParameter<
int>(
"totalTimeInterval");
185 nIdxFirstStrip_ =
cfg.getParameter<
int>(
"idxFirstStrip");
187 nNBxRange_ =
cfg.getParameter<
int>(
"bxRange");
188 nNBxBin_ =
cfg.getParameter<
int>(
"bxBin");
198 std::vector<int> listAMCSlotsDef = {0, 1, 2, 3, 4, 5, 6, 7};
199 desc.
add<std::vector<int>>(
"AMCSlots", listAMCSlotsDef);
201 desc.
add<
std::string>(
"summaryLabelFmt",
"GE%(station_signed)+i/%(layer)i");
202 desc.
add<
bool>(
"flipSummary",
false);
203 desc.
add<
bool>(
"perSuperchamber",
true);
206 desc.
add<
int>(
"numOfEvtPerSec", 100);
207 desc.
add<
int>(
"secOfEvtPerBin", 10);
208 desc.
add<
int>(
"totalTimeInterval", 50000);
210 desc.
add<
int>(
"idxFirstStrip", 0);
212 desc.
add<
int>(
"bxRange", 10);
213 desc.
add<
int>(
"bxBin", 20);
215 descriptions.
add(
"GEMDQMStatusDigi", desc);
219 return "Gemini_" + to_string(
id.
chamber()) +
"_GE" + (
id.region() > 0 ?
"p" :
"m") + to_string(
id.
station()) +
"_" +
220 to_string(
id.layer());
224 return std::string(
"st_") + (
id.region() >= 0 ?
"p" :
"m") + std::to_string(
id.
station()) +
225 (bPerSuperchamber_ ?
"_la_" + std::to_string(
id.layer()) :
"");
229 const std::vector<const GEMSuperChamber *> &superChambers_ = GEMGeometry_->superChambers();
230 for (
auto sch : superChambers_) {
231 int nLayer = sch->nChambers();
232 for (
int l = 0;
l < nLayer;
l++) {
233 Bool_t bExist =
false;
234 for (
auto ch : gemChambers_)
235 if (ch.id() == sch->chamber(
l + 1)->id())
240 gemChambers_.push_back(*sch->chamber(
l + 1));
248 m_listLayers.clear();
251 for (
auto ch : gemChambers_) {
257 for (
auto lid : m_listLayers) {
258 if (lid == layerID) {
265 m_listLayers.push_back(layerID);
270 for (
auto cid : m_listChambers) {
283 Int_t nFlipSign = (this->bFlipSummary_ ? -1 : 1);
284 Int_t nA = nFlipSign *
a.region() * (20 *
a.station() +
a.layer());
285 Int_t nB = nFlipSign *
b.region() * (20 *
b.station() +
b.layer());
290 Int_t nA = 20 *
a.chamber() +
a.layer();
291 Int_t nB = 20 *
b.chamber() +
b.layer();
296 std::sort(m_listLayers.begin(), m_listLayers.end(), lambdaLayer);
297 std::sort(m_listChambers.begin(), m_listChambers.end(), lambdaChamber);
299 nNCh_ = (
int)m_listChambers.size();
314 newTimeStore.
strName = strCommonName +
"status_AMCslots";
315 newTimeStore.
strTitle =
"Status of AMC slots per time";
317 newTimeStore.
nNbinY = listAMCSlots_.size();
318 listTimeStore_[0] = newTimeStore;
320 for (
auto layerId : m_listLayers) {
322 (layerId.region() > 0 ?
"p" :
"m") + std::to_string(layerId.station()) +
"_" + std::to_string(layerId.layer());
324 newTimeStore.
strName = strCommonName +
"status_GEB_" + suffixLayer(layerId);
328 newTimeStore.
nNbinY = nNCh_;
329 listTimeStore_[layerId] = newTimeStore;
332 for (
auto ch : gemChambers_) {
334 GEMDetId chIdStatus(chId.region(), chId.ring(), chId.station(), chId.layer(), chId.chamber(), 1);
335 GEMDetId chIdDigi(chId.region(), chId.ring(), chId.station(), chId.layer(), chId.chamber(), 2);
336 GEMDetId chIdBx(chId.region(), chId.ring(), chId.station(), chId.layer(), chId.chamber(), 3);
341 if (chId.station() == 1)
343 if (chId.station() == 2)
346 newTimeStore.
strName = strCommonName +
"status_chamber_" + strSuffix;
350 newTimeStore.
nNbinY = nVFAT;
351 listTimeStore_[chIdStatus] = newTimeStore;
353 newTimeStore.
strName = strCommonName +
"digi_chamber_" + strSuffix;
357 newTimeStore.
nNbinY = nVFAT;
358 listTimeStore_[chIdDigi] = newTimeStore;
360 newTimeStore.
strName = strCommonName +
"bx_chamber_" + strSuffix;
362 newTimeStore.
strAxisX =
"Bunch crossing";
364 newTimeStore.
nNbinY = nNBxBin_;
365 newTimeStore.
nNbinMin = -nNBxRange_;
368 listTimeStore_[chIdBx] = newTimeStore;
383 if (strPathPrevDQMRoot_.empty())
386 std::ifstream fExist(strPathPrevDQMRoot_.c_str());
391 fPrev =
new TFile(strPathPrevDQMRoot_.c_str());
392 if (fPrev ==
nullptr)
395 std::cout << strPathPrevDQMRoot_ <<
" is being loaded" << std::endl;
396 std::string strRunnum = ((TDirectoryFile *)fPrev->Get(
"DQMData"))->GetListOfKeys()->At(0)->GetName();
402 for (
auto &itStore : listTimeStore_) {
403 std::string strNameStore =
"DQMData/" + strRunnum +
"/GEM/Run summary/StatusDigi/" + itStore.second.strName;
404 TH2F *h2Prev = (TH2F *)fPrev->Get(strNameStore.c_str());
406 Int_t nNBinX = h2Prev->GetNbinsX();
407 Int_t nNBinY = h2Prev->GetNbinsY();
411 for (Int_t
i = 0;
i <= nNBinX + 1;
i++) {
413 nStackedEvt_ += h2Prev->GetBinContent(
i, 0);
414 for (Int_t
j = 0;
j <= nNBinY + 1;
j++) {
415 itStore.second.h2Histo->setBinContent(
i,
j, h2Prev->GetBinContent(
i,
j));
419 Int_t nStackedBinCurr = nStackedEvt_ / (nNSecPerBin_ * nNEvtPerSec_);
420 Int_t nStackedEvtCurr = nStackedEvt_ % (nNSecPerBin_ * nNEvtPerSec_);
422 if (nStackedBin_ < 0) {
423 nStackedBin_ = nStackedBinCurr;
424 nStackedEvt_ = nStackedEvtCurr;
426 bSync = (nStackedBin_ == nStackedBinCurr && nStackedEvt_ == nStackedEvtCurr);
431 std::cerr <<
"WARNING: No sync on time histograms" << std::endl;
446 to_string(gid.
station()) +
"/" + to_string(gid.
layer());
454 hName =
"vfatStatus_QualityFlag_" + strIdxName;
455 hTitle =
"VFAT quality " + strIdxTitle;
457 listVFATQualityFlag_[gid] = ibooker.book2D(hName, hTitle, nVFAT, 0, nVFAT, 9, 0, 9);
459 hName =
"vfatStatus_BC_" + strIdxName;
460 hTitle =
"VFAT bunch crossing " + strIdxTitle;
461 hTitle +=
";Bunch crossing;VFAT";
462 listVFATBC_[gid] = ibooker.book2D(hName, hTitle, nNBxBin_, -nNBxRange_, nNBxRange_, nVFAT, 0, nVFAT);
464 hName =
"vfatStatus_EC_" + strIdxName;
465 hTitle =
"VFAT event counter " + strIdxTitle;
466 hTitle +=
";Event counter;VFAT";
467 listVFATEC_[gid] = ibooker.book2D(hName, hTitle, 256, 0, 256, nVFAT, 0, nVFAT);
470 listVFATQualityFlag_[gid]->setBinLabel(unBinPos++,
"Good", 2);
471 listVFATQualityFlag_[gid]->setBinLabel(unBinPos++,
"CRC fail", 2);
472 listVFATQualityFlag_[gid]->setBinLabel(unBinPos++,
"b1010 fail", 2);
473 listVFATQualityFlag_[gid]->setBinLabel(unBinPos++,
"b1100 fail", 2);
474 listVFATQualityFlag_[gid]->setBinLabel(unBinPos++,
"b1110 fail", 2);
475 listVFATQualityFlag_[gid]->setBinLabel(unBinPos++,
"Hamming error", 2);
476 listVFATQualityFlag_[gid]->setBinLabel(unBinPos++,
"AFULL", 2);
477 listVFATQualityFlag_[gid]->setBinLabel(unBinPos++,
"SEUlogic", 2);
478 listVFATQualityFlag_[gid]->setBinLabel(unBinPos++,
"SUEI2C", 2);
480 m_mapStatusFill[gid] =
false;
481 m_mapStatusErr[gid] =
false;
489 UInt_t la = lid.
layer();
491 auto newbookGEB = [
this](DQMStore::IBooker &ibooker,
502 strName = strName +
"_" + suffixLayer(lid);
503 strTitle = strTitle +
", station: " + (re >= 0 ?
"+" :
"-") + std::to_string(nStation);
505 if (bPerSuperchamber_) {
506 strTitle +=
", layer: " + std::to_string(nLayer);
509 strTitle +=
";Chamber;" + strAxis;
511 auto hNew = ibooker.book2D(strName, strTitle, this->nNCh_, 0, this->nNCh_,
nBin, fMin, fMax);
513 for (Int_t
i = 0;
i < this->nNCh_;
i++) {
514 auto &gid = this->m_listChambers[
i];
515 Int_t nCh = gid.chamber() + (this->bPerSuperchamber_ ? 0 : gid.layer() - 1);
516 hNew->setBinLabel(
i + 1, std::to_string(nCh), 1);
522 listGEBInputStatus_[lid] =
523 newbookGEB(ibooker,
"geb_input_status",
"inputStatus",
"", lid, la, st, re, eBit_, 0, eBit_);
524 listGEBInputID_[lid] = newbookGEB(ibooker,
"geb_input_ID",
"inputID",
"Input ID", lid, la, st, re, 32, 0, 32);
525 listGEBVFATWordCnt_[lid] =
526 newbookGEB(ibooker,
"geb_no_vfats",
"nvfats in header",
"Number of VFATs in header", lid, la, st, re, 25, 0, 25);
527 listGEBVFATWordCntT_[lid] = newbookGEB(
528 ibooker,
"geb_no_vfatsT",
"nvfats in trailer",
"Number of VFATs in trailer", lid, la, st, re, 25, 0, 25);
529 listGEBZeroSupWordsCnt_[lid] = newbookGEB(
530 ibooker,
"geb_zeroSupWordsCnt",
"zeroSupWordsCnt",
"Zero sup. words count", lid, la, st, re, 10, 0, 10);
533 newbookGEB(ibooker,
"geb_bcOH",
"OH bunch crossing",
"OH bunch crossing", lid, la, st, re, 3600, 0, 3600);
535 newbookGEB(ibooker,
"geb_ecOH",
"OH event coounter",
"OH event counter", lid, la, st, re, 256, 0, 256);
537 newbookGEB(ibooker,
"geb_OHCRC",
"CRC of OH data",
"CRC of OH data", lid, la, st, re, 65536, 0, 65536);
540 listGEBInputStatus_[lid]->setBinLabel(unBinPos++,
"BX mismatch GLIB OH", 2);
541 listGEBInputStatus_[lid]->setBinLabel(unBinPos++,
"BX mismatch GLIB VFAT", 2);
542 listGEBInputStatus_[lid]->setBinLabel(unBinPos++,
"OOS GLIB OH", 2);
543 listGEBInputStatus_[lid]->setBinLabel(unBinPos++,
"OOS GLIB VFAT", 2);
544 listGEBInputStatus_[lid]->setBinLabel(unBinPos++,
"No VFAT marker", 2);
545 listGEBInputStatus_[lid]->setBinLabel(unBinPos++,
"Event size warn", 2);
546 listGEBInputStatus_[lid]->setBinLabel(unBinPos++,
"L1AFIFO near full", 2);
547 listGEBInputStatus_[lid]->setBinLabel(unBinPos++,
"InFIFO near full", 2);
548 listGEBInputStatus_[lid]->setBinLabel(unBinPos++,
"EvtFIFO near full", 2);
549 listGEBInputStatus_[lid]->setBinLabel(unBinPos++,
"Event size overflow", 2);
550 listGEBInputStatus_[lid]->setBinLabel(unBinPos++,
"L1AFIFO full", 2);
551 listGEBInputStatus_[lid]->setBinLabel(unBinPos++,
"InFIFO full", 2);
552 listGEBInputStatus_[lid]->setBinLabel(unBinPos++,
"EvtFIFO full", 2);
553 listGEBInputStatus_[lid]->setBinLabel(unBinPos++,
"Input FIFO underflow", 2);
554 listGEBInputStatus_[lid]->setBinLabel(unBinPos++,
"Stuck data", 2);
555 listGEBInputStatus_[lid]->setBinLabel(unBinPos++,
"Event FIFO underflow", 2);
559 h2AMCStatus_ = ibooker.book2D(
"amc_statusflag",
560 "Status of AMC slots;AMC slot;",
561 listAMCSlots_.size(),
563 listAMCSlots_.size(),
568 uint32_t unBinPos = 1;
569 h2AMCStatus_->setBinLabel(unBinPos++,
"BC0 not locked", 2);
570 h2AMCStatus_->setBinLabel(unBinPos++,
"DAQ not ready", 2);
571 h2AMCStatus_->setBinLabel(unBinPos++,
"DAQ clock not locked", 2);
572 h2AMCStatus_->setBinLabel(unBinPos++,
"MMCM not locked", 2);
573 h2AMCStatus_->setBinLabel(unBinPos++,
"Back pressure", 2);
574 h2AMCStatus_->setBinLabel(unBinPos++,
"GLIB out-of-sync", 2);
578 for (
auto &itStore : listTimeStore_) {
579 auto &infoCurr = itStore.second;
581 Float_t fMin = -0.5, fMax = infoCurr.nNbinY - 0.5;
583 if (infoCurr.nNbinMin < infoCurr.nNbinMax) {
584 fMin = infoCurr.nNbinMin;
585 fMax = infoCurr.nNbinMax;
588 infoCurr.h2Histo = ibooker.book2D(
590 infoCurr.strTitle +
";Per " + std::to_string(nNSecPerBin_ * nNEvtPerSec_) +
" events;" + infoCurr.strAxisX,
598 if (seekIdx(m_listLayers, itStore.first) >= 0) {
599 for (Int_t
i = 0;
i < nNCh_;
i++) {
600 auto &gid = m_listChambers[
i];
601 Int_t nCh = gid.chamber() + (bPerSuperchamber_ ? 0 : gid.layer() - 1);
602 infoCurr.h2Histo->setBinLabel(
i + 1, std::to_string(nCh), 2);
612 size_t unPos, unPosEnd;
614 for (unPos = strRes.find(
'%'); unPos != std::string::npos; unPos = strRes.find(
'%', unPos + 1)) {
615 unPosEnd = strRes.find(
')', unPos);
616 if (strRes[unPos + 1] !=
'(' || unPosEnd == std::string::npos)
620 std::string strKey = strRes.substr(unPos + 2, unPosEnd - (unPos + 2));
627 for (;; unPosEnd++) {
628 if (!(
'0' <= strRes[unPosEnd] && strRes[unPosEnd] <=
'9') && strRes[unPosEnd] !=
'+')
630 strOptNum += strRes[unPosEnd];
633 if (strRes[unPosEnd] !=
'i' && strRes[unPosEnd] !=
'd')
635 strOptNum += strRes[unPosEnd];
638 sprintf(szOutFmt, strOptNum.c_str(), mapArg[strKey]);
639 strRes = strRes.substr(0, unPos) + szOutFmt + strRes.substr(unPosEnd);
642 if (unPos != std::string::npos) {
643 std::cerr <<
"ERROR: Syntax error on printfWithMap(); " << std::endl;
653 GEMGeometry_ = initGeometry(iSetup);
654 if (GEMGeometry_ ==
nullptr)
664 ibooker.setCurrentFolder(
"GEM/StatusDigi");
666 for (
auto ch : gemChambers_) {
668 bookHistogramsChamberPart(ibooker, gid);
671 for (
auto lid : m_listLayers) {
672 bookHistogramsStationPart(ibooker, lid);
675 bookHistogramsAMCPart(ibooker);
678 SetConfigTimeRecord();
679 bookHistogramsTimeRecordPart(ibooker);
682 h1_vfat_qualityflag_ = ibooker.book1D(
"vfat_quality_flag",
"quality and flag", 9, 0, 9);
683 h2_vfat_qualityflag_ = ibooker.book2D(
"vfat_quality_flag_per_geb",
"quality and flag", nNCh_, 0, nNCh_, 9, 0, 9);
685 h1_amc_ttsState_ = ibooker.book1D(
"amc_ttsState",
"ttsState", 10, 0, 10);
686 h1_amc_davCnt_ = ibooker.book1D(
"amc_davCnt",
"davCnt", 10, 0, 10);
687 h1_amc_buffState_ = ibooker.book1D(
"amc_buffState",
"buffState", 10, 0, 10);
688 h1_amc_oosGlib_ = ibooker.book1D(
"amc_oosGlib",
"oosGlib", 10, 0, 10);
689 h1_amc_chTimeOut_ = ibooker.book1D(
"amc_chTimeOut",
"chTimeOut", 10, 0, 10);
692 ibooker.setCurrentFolder(
"GEM/EventInfo");
694 h3SummaryStatusPre_ = ibooker.book3D(
695 "reportSummaryMapPreliminary",
";Chamber;", nNCh_, 0, nNCh_, m_listLayers.size(), 0, m_listLayers.size(), 2, 0, 1);
697 for (Int_t
i = 0;
i < nNCh_;
i++) {
698 auto &gid = this->m_listChambers[
i];
699 Int_t nCh = gid.chamber() + (bPerSuperchamber_ ? 0 : gid.layer() - 1);
700 h3SummaryStatusPre_->setBinLabel(
i + 1, std::to_string(nCh), 1);
704 std::unordered_map<std::string, Int_t> mapArg;
708 for (
auto lid : m_listLayers) {
709 mapArg[
"station_signed"] = lid.region() * lid.station();
710 mapArg[
"region"] = lid.region();
711 mapArg[
"station"] = lid.station();
712 mapArg[
"layer"] = lid.layer();
713 mapArg[
"chamber"] = lid.chamber();
715 h3SummaryStatusPre_->setBinLabel(nIdxLayer + 1,
printfWithMap(strFmtSummaryLabel_, mapArg), 2);
727 for (;
i < nNumBits;
i++, unFlag <<= 1) {
728 if ((unVal & unFlag) != 0) {
743 for (;
i < nNumBits;
i++, unFlag <<= 1) {
744 if ((unVal & unFlag) != 0) {
757 for (Int_t nIdx = 0; nIdx < (Int_t)listLayers.size(); nIdx++)
758 if (
id == listLayers[nIdx])
764 Int_t nLayer = (bPerSuperchamber_ ? gid.
layer() : 0);
768 nIdxLayer = seekIdx(m_listLayers, layerId) + 1;
769 nIdxChamber = seekIdx(m_listChambers, chamberId) + 1;
773 Bool_t bIsNotEmpty =
true;
780 event.getByToken(tagVFAT_, gemVFAT);
781 event.getByToken(tagGEB_, gemGEB);
782 event.getByToken(tagAMC_, gemAMC);
783 event.getByToken(tagDigi_, gemDigis);
785 auto fillTimeHisto = [](
TimeStoreItem &listCurr,
int nStackedBin,
int nIdx,
bool bFill) ->
void {
786 Int_t nX = nStackedBin + 1;
799 int nIdx = seekIdx(m_listChambers, gemOnlychId);
800 int nRoll = gemid.
roll();
804 if (listTimeStore_.find((UInt_t)chIdStatus) == listTimeStore_.end()) {
805 edm::LogError(
"BadGeometry") <<
"Wrong detId which is not in the current geometry (VFAT status): " << gemchId
810 auto &listCurr = listTimeStore_[chIdStatus];
812 for (
auto vfatStat =
range.first; vfatStat !=
range.second; ++vfatStat) {
815 uint64_t unQFVFAT = vfatStat->quality() ;
816 if ((unQFVFAT & ~0
x1) == 0) {
819 Int_t nIdxLayer, nIdxChamber;
820 seekIdxSummary(gemchId, nIdxLayer, nIdxChamber);
821 h3SummaryStatusPre_->setBinContent(nIdxChamber, nIdxLayer, m_nIdxSummaryErr, 1.0);
824 FillBits(h1_vfat_qualityflag_, unQFVFAT, qVFATBit_ + fVFATBit_);
825 FillBits(h2_vfat_qualityflag_, unQFVFAT, qVFATBit_ + fVFATBit_, nIdx);
828 bIsNotEmpty = FillBits(listVFATQualityFlag_[gemchId], unQFVFAT, qVFATBit_ + fVFATBit_, nVFAT);
831 edm::LogError(
"BadGeometry") <<
"Wrong detId which is not in the current geometry (VFAT status): " << gemchId
836 listVFATEC_[gemchId]->Fill(vfatStat->ec(), nVFAT);
838 fillTimeHisto(listCurr, nStackedBin_, nVFAT, (unQFVFAT & ~0
x1) != 0);
847 Int_t nCh = seekIdx(m_listChambers, chid);
849 if (listTimeStore_.find((UInt_t)lid) == listTimeStore_.end()) {
850 edm::LogError(
"BadGeometry") <<
"Wrong detId which is not in the current geometry (GEB status): " << lid
855 auto &listCurr = listTimeStore_[lid];
858 for (
auto GEBStatus =
range.first; GEBStatus !=
range.second; ++GEBStatus) {
864 unStatus |= (GEBStatus->bxmVvV() << unBit++);
865 unStatus |= (GEBStatus->bxmAvV() << unBit++);
866 unStatus |= (GEBStatus->oOScVvV() << unBit++);
867 unStatus |= (GEBStatus->oOScAvV() << unBit++);
868 unStatus |= (GEBStatus->noVFAT() << unBit++);
869 unStatus |= (GEBStatus->evtSzW() << unBit++);
870 unStatus |= (GEBStatus->l1aNF() << unBit++);
871 unStatus |= (GEBStatus->inNF() << unBit++);
872 unStatus |= (GEBStatus->evtNF() << unBit++);
873 unStatus |= (GEBStatus->evtSzOFW() << unBit++);
874 unStatus |= (GEBStatus->l1aF() << unBit++);
875 unStatus |= (GEBStatus->inF() << unBit++);
876 unStatus |= (GEBStatus->evtF() << unBit++);
877 unStatus |= (GEBStatus->inUfw() << unBit++);
878 unStatus |= (GEBStatus->stuckData() << unBit++);
879 unStatus |= (GEBStatus->evUfw() << unBit++);
882 Int_t nIdxLayer, nIdxChamber;
883 seekIdxSummary(gemid, nIdxLayer, nIdxChamber);
884 h3SummaryStatusPre_->setBinContent(nIdxChamber, nIdxLayer, m_nIdxSummaryErr, 1.0);
887 bIsNotEmpty = FillBits(listGEBInputStatus_[lid], unStatus, eBit_, nCh);
890 edm::LogError(
"BadGeometry") <<
"Wrong detId which is not in the current geometry (GEB status): " << lid
895 listGEBInputID_[lid]->Fill(nCh, GEBStatus->inputID());
896 listGEBVFATWordCnt_[lid]->Fill(nCh, GEBStatus->vfatWordCnt() / 3);
897 listGEBVFATWordCntT_[lid]->Fill(nCh, GEBStatus->vfatWordCntT() / 3);
898 listGEBZeroSupWordsCnt_[lid]->Fill(nCh, GEBStatus->zeroSupWordsCnt());
900 listGEBbcOH_[lid]->Fill(nCh, GEBStatus->bcOH());
901 listGEBecOH_[lid]->Fill(nCh, GEBStatus->ecOH());
902 listGEBOHCRC_[lid]->Fill(nCh, GEBStatus->crc());
904 fillTimeHisto(listCurr, nStackedBin_, nCh, unStatus != 0);
908 auto findAMCIdx = [
this](Int_t nAMCnum) -> Int_t {
909 for (Int_t
i = 0;
i < (Int_t)listAMCSlots_.size();
i++)
910 if (listAMCSlots_[
i] == nAMCnum)
917 auto &listCurr = listTimeStore_[0];
919 Int_t nIdAMC = findAMCIdx(
amc->amcNum());
923 unStatus |= (!
amc->bc0locked() << unBit++);
924 unStatus |= (!
amc->daqReady() << unBit++);
925 unStatus |= (!
amc->daqClockLocked() << unBit++);
926 unStatus |= (!
amc->mmcmLocked() << unBit++);
927 unStatus |= (
amc->backPressure() << unBit++);
928 unStatus |= (
amc->oosGlib() << unBit++);
930 FillBits(h2AMCStatus_, unStatus, amcStatusBit_, nIdAMC);
932 h1_amc_ttsState_->Fill(
amc->ttsState());
933 h1_amc_davCnt_->Fill(
amc->davCnt());
934 h1_amc_buffState_->Fill(
amc->buffState());
935 h1_amc_oosGlib_->Fill(
amc->oosGlib());
936 h1_amc_chTimeOut_->Fill(
amc->linkTo());
938 fillTimeHisto(listCurr, nStackedBin_, nIdAMC, unStatus != 0);
942 auto findVFATByStrip = [](
GEMDetId gid, Int_t nIdxStrip, Int_t nNumStrips) -> Int_t {
948 return nNumEtaPart * ((Int_t)(nIdxStrip / (nNumStrips / nNumVFAT)) + 1) - gid.
roll();
949 }
else if (gid.
station() == 2) {
951 return nNumEtaPart * ((Int_t)(nIdxStrip / (nNumStrips / nNumVFAT)) + 1) - gid.
roll();
958 for (
auto ch : gemChambers_) {
960 Bool_t bIsHit =
false;
963 std::unordered_map<Int_t, Int_t> mapBXVFAT;
968 auto &listCurrDigi = listTimeStore_[chIdDigi];
969 auto &listCurrBx = listTimeStore_[chIdBx];
971 for (
auto roll : ch.etaPartitions()) {
973 const auto &digis_in_det = gemDigis->get(rId);
975 for (
auto d = digis_in_det.first;
d != digis_in_det.second; ++
d) {
976 Int_t nIdxStrip =
d->strip() - nIdxFirstStrip_;
977 Int_t nVFAT = findVFATByStrip(rId, nIdxStrip, roll->nstrips());
980 mapBXVFAT[nVFAT] =
d->bx();
981 fillTimeHisto(listCurrDigi, nStackedBin_, nVFAT,
true);
985 if (
d->bx() < listCurrBx.nNbinMin)
987 else if (
d->bx() >= listCurrBx.nNbinMax)
988 nIdxBx = listCurrBx.nNbinY - 1;
990 nIdxBx = (Int_t)(listCurrBx.nNbinY * 1.0 * (
d->bx() - listCurrBx.nNbinMin) /
991 (listCurrBx.nNbinMax - listCurrBx.nNbinMin));
993 fillTimeHisto(listCurrBx, nStackedBin_, nIdxBx,
true);
997 for (
auto bx : mapBXVFAT)
998 listVFATBC_[cId]->Fill(
bx.second,
bx.first);
1001 Int_t nIdxLayer, nIdxChamber;
1002 seekIdxSummary(cId, nIdxLayer, nIdxChamber);
1003 h3SummaryStatusPre_->setBinContent(nIdxChamber, nIdxLayer, m_nIdxSummaryFill, 1.0);
1009 if (nStackedEvt_ >= nNSecPerBin_ * nNEvtPerSec_) {