25 desc.add<Int_t>(
"AMCSlots", 13);
29 descriptions.
add(
"GEMDAQStatusSource",
desc);
36 auto gemChMap = std::make_unique<GEMChMap>(chMap);
38 std::vector<unsigned int> listFEDId;
39 for (
auto const &[ec, dc] : gemChMap->chamberMap()) {
40 unsigned int fedId = ec.fedId;
41 uint8_t amcNum = ec.amcNum;
45 listFEDId.push_back(
fedId);
54 for (
auto fedId : listFEDId) {
60 auto gemChMap = std::make_unique<GEMChMap>();
63 for (
auto const &[ec, dc] : gemChMap->chamberMap()) {
64 unsigned int fedId = ec.fedId;
65 uint8_t amcNum = ec.amcNum;
76 if (h2Status ==
nullptr) {
80 unsigned int unBinPos = 1;
82 h2Status->
setBinLabel(unBinPos++,
"Invalid AMC", 2);
83 h2Status->
setBinLabel(unBinPos++,
"Invalid size", 2);
84 h2Status->
setBinLabel(unBinPos++,
"Fail trailer check", 2);
85 h2Status->
setBinLabel(unBinPos++,
"Fail fragment length", 2);
86 h2Status->
setBinLabel(unBinPos++,
"Fail trailer match", 2);
87 h2Status->
setBinLabel(unBinPos++,
"More trailer", 2);
88 h2Status->
setBinLabel(unBinPos++,
"CRC modified", 2);
89 h2Status->
setBinLabel(unBinPos++,
"S-link error", 2);
90 h2Status->
setBinLabel(unBinPos++,
"Wrong FED ID", 2);
95 h2Status->
setBinLabel(nPos, Form(
"GE%i1-%c", st, re), 1);
100 if (h2Status ==
nullptr) {
104 unsigned int unBinPos = 1;
106 h2Status->
setBinLabel(unBinPos++,
"Invalid OH", 2);
107 h2Status->
setBinLabel(unBinPos++,
"Back pressure", 2);
111 h2Status->
setBinLabel(unBinPos++,
"Bad run type", 2);
113 h2Status->
setBinLabel(unBinPos++,
"MMCM locked", 2);
114 h2Status->
setBinLabel(unBinPos++,
"DAQ clock locked", 2);
115 h2Status->
setBinLabel(unBinPos++,
"DAQ not ready", 2);
116 h2Status->
setBinLabel(unBinPos++,
"BC0 not locked", 2);
120 if (h2Status ==
nullptr) {
124 unsigned int unBinPos = 1;
126 h2Status->
setBinLabel(unBinPos++,
"Event FIFO near full", 2);
127 h2Status->
setBinLabel(unBinPos++,
"Input FIFO near full", 2);
128 h2Status->
setBinLabel(unBinPos++,
"L1A FIFO near full", 2);
129 h2Status->
setBinLabel(unBinPos++,
"Event size warn", 2);
130 h2Status->
setBinLabel(unBinPos++,
"Invalid VFAT", 2);
131 h2Status->
setBinLabel(unBinPos++,
"Event FIFO full", 2);
132 h2Status->
setBinLabel(unBinPos++,
"Input FIFO full", 2);
133 h2Status->
setBinLabel(unBinPos++,
"L1A FIFO full", 2);
134 h2Status->
setBinLabel(unBinPos++,
"Event size overflow", 2);
135 h2Status->
setBinLabel(unBinPos++,
"Invalid event", 2);
136 h2Status->
setBinLabel(unBinPos++,
"Out of Sync AMC vs VFAT", 2);
137 h2Status->
setBinLabel(unBinPos++,
"Out of Sync VFAT vs VFAT", 2);
138 h2Status->
setBinLabel(unBinPos++,
"BX mismatch AMC vs VFAT", 2);
139 h2Status->
setBinLabel(unBinPos++,
"BX mismatch VFAT vs VFAT", 2);
140 h2Status->
setBinLabel(unBinPos++,
"Input FIFO underflow", 2);
141 h2Status->
setBinLabel(unBinPos++,
"Bad VFAT count", 2);
145 if (h2Status ==
nullptr) {
149 unsigned int unBinPos = 1;
151 h2Status->
setBinLabel(unBinPos++,
"Basic overflow", 2);
152 h2Status->
setBinLabel(unBinPos++,
"Zero-sup overflow", 2);
153 h2Status->
setBinLabel(unBinPos++,
"VFAT CRC error", 2);
154 h2Status->
setBinLabel(unBinPos++,
"Invalid header", 2);
155 h2Status->
setBinLabel(unBinPos++,
"AMC EC mismatch", 2);
156 h2Status->
setBinLabel(unBinPos++,
"AMC BC mismatch", 2);
184 "amc13_status",
"AMC13 Status;AMC13;", nNumAMC13, 0.5, nNumAMC13 + 0.5,
nBitAMC13_, 0.5,
nBitAMC13_ + 0.5);
190 auto strName = Form(
"amc_status_GE%i1-%c", st, re);
191 auto strTitle = Form(
"AMC Status GE%i1-%c;AMC slot;", st, re);
204 this,
"vfat_statusWarnSum",
"VFAT reporting warnings", 36, 0.5, 36.5, 24, -0.5, 24 - 0.5,
"Chamber",
"VFAT");
206 this,
"vfat_statusErrSum",
"VFAT reporting errors", 36, 0.5, 36.5, 24, -0.5, 24 - 0.5,
"Chamber",
"VFAT");
305 event.getByToken(
tagVFAT_, gemVFAT);
306 event.getByToken(
tagOH_, gemOH);
307 event.getByToken(
tagAMC_, gemAMC);
318 std::map<ME4IdsKey, bool> mapChamberAll;
319 std::map<ME4IdsKey, bool> mapChamberWarning;
320 std::map<ME4IdsKey, bool> mapChamberError;
321 std::map<ME4IdsKey, bool> mapChamberVFATWarning;
322 std::map<ME4IdsKey, bool> mapChamberVFATError;
323 std::map<ME4IdsKey, bool> mapChamberOHWarning;
324 std::map<ME4IdsKey, bool> mapChamberOHError;
325 std::map<ME4IdsKey, bool> mapChamberAMCWarning;
326 std::map<ME4IdsKey, bool> mapChamberAMCError;
327 std::map<ME4IdsKey, bool> mapChamberAMC13Error;
329 for (
auto amc13It = gemAMC13->
begin(); amc13It != gemAMC13->
end(); ++amc13It) {
330 int fedId = (*amc13It).first;
336 const auto &
range = (*amc13It).second;
338 Bool_t bWarn =
false;
353 if (
errors.failTrailerCheck)
355 if (
errors.failFragmentLength)
357 if (
errors.failTrailerMatch)
370 if (!bWarn && !bErr) {
376 for (
auto gid : listChamber) {
377 ME4IdsKey key4Ch{gid.region(), gid.station(), gid.layer(), gid.chamber()};
379 mapChamberAMC13Error[key4Ch] =
false;
387 for (
auto amcIt = gemAMC->
begin(); amcIt != gemAMC->
end(); ++amcIt) {
388 int fedId = (*amcIt).first;
396 Bool_t bWarn =
false;
399 Int_t nAMCNum =
amc->amcNumber();
425 if (
errors.DAQclocklocked)
434 if (!bWarn && !bErr) {
436 h2AMCStatus->
Fill(nAMCNum, 1);
440 for (
auto gid : listChamber) {
441 ME4IdsKey key4Ch{gid.region(), gid.station(), gid.layer(), gid.chamber()};
443 mapChamberAMCError[key4Ch] =
false;
445 mapChamberAMCWarning[key4Ch] =
false;
451 for (
auto ohIt = gemOH->
begin(); ohIt != gemOH->
end(); ++ohIt) {
458 for (
auto OHStatus =
range.first; OHStatus !=
range.second; ++OHStatus) {
499 Bool_t bWarn =
warnings.wcodes != 0;
500 Bool_t bErr =
errors.codes != 0;
504 mapChamberOHWarning[key4Mod] =
false;
506 mapChamberOHError[key4Mod] =
false;
507 mapChamberAll[key4Mod] =
true;
511 for (
auto vfatIt = gemVFAT->begin(); vfatIt != gemVFAT->end(); ++vfatIt) {
515 MEStationInfo &stationInfo = mapStationInfo_[key3];
516 Int_t nNumVFATPerModule = stationInfo.nMaxVFAT_ / stationInfo.nNumModules_;
520 for (
auto vfatStat =
range.first; vfatStat !=
range.second; ++vfatStat) {
521 Int_t nIdxModule = getIdxModule(gid.
station(), vfatStat->chamberType());
522 Int_t nCh = (gid.
chamber() - 1) * stationInfo.nNumModules_ + nIdxModule;
525 Int_t nIdxVFAT = vfatStat->vfatPosition();
526 Int_t nIdxVFATMod = nIdxVFAT;
527 if (stationInfo.nNumModules_ > 1) {
528 nIdxVFATMod = nIdxVFAT + nNumVFATPerModule * (nIdxModule - 1);
533 mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFATMod, 2);
535 mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFATMod, 3);
539 mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFATMod, 4);
541 mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFATMod, 5);
543 mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFATMod, 6);
545 mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFATMod, 7);
547 Bool_t bWarn =
warnings.wcodes != 0;
548 Bool_t bErr =
errors.codes != 0;
550 mapStatusVFATPerCh_.Fill(key4Ch, nIdxVFATMod, 1);
552 mapChamberVFATWarning[key4Mod] =
false;
554 mapChamberVFATError[key4Mod] =
false;
556 mapStatusWarnVFATPerLayer_.Fill(key3, nCh, nIdxVFAT);
558 mapStatusErrVFATPerLayer_.Fill(key3, nCh, nIdxVFAT);
559 mapChamberAll[key4Mod] =
true;
563 if (nRunType_ == GEMDQM_RUNTYPE_ALLPLOTS || nRunType_ == GEMDQM_RUNTYPE_ONLINE) {
565 for (
auto const &[key4, bErr] : mapChamberAll) {
567 Int_t nChamber = keyToChamber(key4);
568 h2SummaryStatusAll->Fill(nChamber, mapStationToIdx_[key3]);
572 FillStatusSummaryPlot(mapChamberAll, h2SummaryStatusAll);
574 FillStatusSummaryPlot(mapChamberVFATWarning, h2SummaryStatusVFATWarning, &mapChamberWarning);
575 FillStatusSummaryPlot(mapChamberVFATError, h2SummaryStatusVFATError, &mapChamberError);
576 FillStatusSummaryPlot(mapChamberOHWarning, h2SummaryStatusOHWarning, &mapChamberWarning);
577 FillStatusSummaryPlot(mapChamberOHError, h2SummaryStatusOHError, &mapChamberError);
578 FillStatusSummaryPlot(mapChamberAMCWarning, h2SummaryStatusAMCWarning, &mapChamberWarning);
579 FillStatusSummaryPlot(mapChamberAMCError, h2SummaryStatusAMCError, &mapChamberError);
580 FillStatusSummaryPlot(mapChamberAMC13Error, h2SummaryStatusAMC13Error, &mapChamberError);
582 FillStatusSummaryPlot(mapChamberWarning, h2SummaryStatusWarning);
583 FillStatusSummaryPlot(mapChamberError, h2SummaryStatusError);
virtual void setTitle(const std::string &title)
set (ie. change) histogram/profile title
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
constexpr int station() const
MEMapInfT< MEMap4Ids, ME4IdsKey > MEMap4Inf
dqm::impl::MonitorElement * CreateSummaryHist(DQMStore::IBooker &ibooker, TString strName)
int ProcessWithMEMap3WithChamber(BookingHelper &bh, ME4IdsKey key) override
GEMDAQStatusSource(const edm::ParameterSet &cfg)
constexpr int region() const
int getIdxModule(const int, const int)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void FillWithRiseErr(MonitorElement *h, Int_t nX, Int_t nY, Bool_t &bErr)
virtual void setCurrentFolder(std::string const &fullpath)
edm::EDGetToken tagAMC13_
MonitorElement * h2SummaryStatusAMCWarning
MEMapInfT< MEMap3Ids, ME3IdsKey > MEMap3Inf
MonitorElement * h2AMC13Status_
std::string strFolderMain_
MonitorElement * h2SummaryStatusAMCError
int initGeometry(edm::EventSetup const &iSetup)
std::tuple< Int_t, Int_t, Int_t, Int_t > ME4IdsKey
std::map< UInt_t, int > mapFEDIdToRe_
int SetLabelForVFATs(K key, Int_t nNumEtaPartitions, Int_t nAxis, Int_t nNumBin=-1)
std::map< ME3IdsKey, MEStationInfo > mapStationInfo_
std::map< UInt_t, int > mapFEDIdToSt_
std::map< std::tuple< int, int >, std::vector< GEMDetId > > mapAMCToListChamber_
constexpr int layer() const
int Fill(K key, Double_t x)
std::string log_category_
constexpr int chamber() const
MonitorElement * h2SummaryStatusVFATError
const edm::ESGetToken< GEMChMap, GEMChMapRcd > gemChMapToken_
MEMap3Inf mapStatusWarnVFATPerLayer_
std::map< UInt_t, MonitorElement * > mapFEDIdToAMCStatus_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * h2SummaryStatusError
MEMap3Inf mapStatusErrVFATPerLayer_
int GenerateMEPerChamber(DQMStore::IBooker &ibooker)
void SetLabelAMCStatus(MonitorElement *h2Status)
void LoadROMap(edm::EventSetup const &iSetup)
std::map< UInt_t, int > mapFEDIdToPosition_
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
#define DEFINE_FWK_MODULE(type)
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
DigiRangeIterator begin() const
void SetLabelAMC13Status(MonitorElement *h2Status)
std::map< int, std::vector< GEMDetId > > mapAMC13ToListChamber_
MonitorElement * h2SummaryStatusVFATWarning
MonitorElement * h2SummaryStatusAll
const GEMGeometry * GEMGeometry_
void SetLabelVFATStatus(MonitorElement *h2Status)
std::pair< const_iterator, const_iterator > Range
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
void add(std::string const &label, ParameterSetDescription const &psetDescription)
DQMStore::IBooker * getBooker()
void SetLabelOHStatus(MonitorElement *h2Status)
std::string getNameDirLayer(ME3IdsKey key3)
int bookND(BookingHelper &bh, K key)
MonitorElement * h2SummaryStatusOHWarning
ME3IdsKey key4Tokey3(ME4IdsKey key)
MonitorElement * h2SummaryStatusAMC13Error
MEMap4Inf mapStatusVFATPerCh_
int ProcessWithMEMap3(BookingHelper &bh, ME3IdsKey key) override
std::tuple< Int_t, Int_t, Int_t > ME3IdsKey
void SetBinConfX(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
MonitorElement * h2SummaryStatusWarning
Log< level::Warning, false > LogWarning
MonitorElement * h2SummaryStatusOHError
void SetBinConfY(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
dqm::impl::MonitorElement * FindHist(K key)
DigiRangeIterator end() const
int SetLabelForChambers(K key, Int_t nAxis, Int_t nNumBin=-1, Int_t nIdxStart=1, Int_t nNumModules=1)