CMS 3D CMS Logo

GEMDAQStatusSource.cc
Go to the documentation of this file.
2 
3 using namespace std;
4 using namespace edm;
5 
8  tagVFAT_ = consumes<GEMVFATStatusCollection>(cfg.getParameter<edm::InputTag>("VFATInputLabel"));
9  tagOH_ = consumes<GEMOHStatusCollection>(cfg.getParameter<edm::InputTag>("OHInputLabel"));
10  tagAMC_ = consumes<GEMAMCStatusCollection>(cfg.getParameter<edm::InputTag>("AMCInputLabel"));
11  tagAMC13_ = consumes<GEMAMC13StatusCollection>(cfg.getParameter<edm::InputTag>("AMC13InputLabel"));
12  useDBEMap_ = cfg.getParameter<bool>("useDBEMap");
13 
14  nAMCSlots_ = cfg.getParameter<Int_t>("AMCSlots");
15 
16  bWarnedNotFound_ = false;
17 }
18 
21  desc.add<edm::InputTag>("VFATInputLabel", edm::InputTag("muonGEMDigis", "VFATStatus"));
22  desc.add<edm::InputTag>("OHInputLabel", edm::InputTag("muonGEMDigis", "OHStatus"));
23  desc.add<edm::InputTag>("AMCInputLabel", edm::InputTag("muonGEMDigis", "AMCStatus"));
24  desc.add<edm::InputTag>("AMC13InputLabel", edm::InputTag("muonGEMDigis", "AMC13Status"));
25 
26  desc.add<Int_t>("AMCSlots", 13);
27  desc.addUntracked<std::string>("runType", "relval");
28  desc.addUntracked<std::string>("logCategory", "GEMDAQStatusSource");
29  desc.add<bool>("useDBEMap", true);
30 
31  descriptions.add("GEMDAQStatusSource", desc);
32 }
33 
35  if (useDBEMap_) {
36  const auto &chMap = iSetup.getData(gemChMapToken_);
37  auto gemChMap = std::make_unique<GEMChMap>(chMap);
38 
39  std::vector<unsigned int> listFEDId;
40  for (auto const &[ec, dc] : gemChMap->chamberMap()) {
41  unsigned int fedId = ec.fedId;
42  uint8_t amcNum = ec.amcNum;
43  GEMDetId gemChId(dc.detId);
44 
45  if (mapFEDIdToRe_.find(fedId) == mapFEDIdToRe_.end()) {
46  listFEDId.push_back(fedId);
47  }
48  mapFEDIdToRe_[fedId] = gemChId.region();
49  mapFEDIdToSt_[fedId] = gemChId.station();
50  mapAMC13ToListChamber_[fedId].push_back(gemChId);
51  mapAMCToListChamber_[{fedId, amcNum}].push_back(gemChId);
52  }
53 
54  Int_t nIdx = 1;
55  for (auto fedId : listFEDId) {
56  mapFEDIdToPosition_[fedId] = nIdx++;
57  }
58 
59  } else {
60  // no EMap in DB, using dummy
61  auto gemChMap = std::make_unique<GEMChMap>();
62  gemChMap->setDummy();
63 
64  for (auto const &[ec, dc] : gemChMap->chamberMap()) {
65  unsigned int fedId = ec.fedId;
66  uint8_t amcNum = ec.amcNum;
67  GEMDetId gemChId(dc.detId);
68 
69  mapFEDIdToRe_[fedId] = gemChId.region();
70  mapAMC13ToListChamber_[fedId].push_back(gemChId);
71  mapAMCToListChamber_[{fedId, amcNum}].push_back(gemChId);
72  }
73  }
74 }
75 
77  if (h2Status == nullptr) {
78  return;
79  }
80 
81  unsigned int unBinPos = 1;
82  h2Status->setBinLabel(unBinPos++, "Good", 2);
83  h2Status->setBinLabel(unBinPos++, "Invalid AMC", 2);
84  h2Status->setBinLabel(unBinPos++, "Invalid size", 2);
85  h2Status->setBinLabel(unBinPos++, "Fail trailer check", 2);
86  h2Status->setBinLabel(unBinPos++, "Fail fragment length", 2);
87  h2Status->setBinLabel(unBinPos++, "Fail trailer match", 2);
88  h2Status->setBinLabel(unBinPos++, "More trailer", 2);
89  h2Status->setBinLabel(unBinPos++, "CRC modified", 2);
90  h2Status->setBinLabel(unBinPos++, "S-link error", 2);
91  h2Status->setBinLabel(unBinPos++, "Wrong FED ID", 2);
92 
93  for (auto const &[fedId, nPos] : mapFEDIdToPosition_) {
94  auto st = mapFEDIdToSt_[fedId];
95  auto re = (mapFEDIdToRe_[fedId] > 0 ? 'P' : 'M');
96  h2Status->setBinLabel(nPos, Form("GE%i1-%c", st, re), 1);
97  }
98 }
99 
101  if (h2Status == nullptr) {
102  return;
103  }
104 
105  unsigned int unBinPos = 1;
106  h2Status->setBinLabel(unBinPos++, "Good", 2);
107  h2Status->setBinLabel(unBinPos++, "Invalid OH", 2);
108  h2Status->setBinLabel(unBinPos++, "Back pressure", 2);
109  h2Status->setBinLabel(unBinPos++, "Bad EC", 2);
110  h2Status->setBinLabel(unBinPos++, "Bad BC", 2);
111  h2Status->setBinLabel(unBinPos++, "Bad OC", 2);
112  h2Status->setBinLabel(unBinPos++, "Bad run type", 2);
113  h2Status->setBinLabel(unBinPos++, "Bad CRC", 2);
114  h2Status->setBinLabel(unBinPos++, "MMCM locked", 2);
115  h2Status->setBinLabel(unBinPos++, "DAQ clock locked", 2);
116  h2Status->setBinLabel(unBinPos++, "DAQ not ready", 2);
117  h2Status->setBinLabel(unBinPos++, "BC0 not locked", 2);
118 }
119 
121  if (h2Status == nullptr) {
122  return;
123  }
124 
125  unsigned int unBinPos = 1;
126  h2Status->setBinLabel(unBinPos++, "Good", 2);
127  h2Status->setBinLabel(unBinPos++, "Event FIFO near full", 2);
128  h2Status->setBinLabel(unBinPos++, "Input FIFO near full", 2);
129  h2Status->setBinLabel(unBinPos++, "L1A FIFO near full", 2);
130  h2Status->setBinLabel(unBinPos++, "Event size warn", 2);
131  h2Status->setBinLabel(unBinPos++, "Invalid VFAT", 2);
132  h2Status->setBinLabel(unBinPos++, "missing VFATs", 2);
133  h2Status->setBinLabel(unBinPos++, "Event FIFO full", 2);
134  h2Status->setBinLabel(unBinPos++, "Input FIFO full", 2);
135  h2Status->setBinLabel(unBinPos++, "L1A FIFO full", 2);
136  h2Status->setBinLabel(unBinPos++, "Event size overflow", 2);
137  h2Status->setBinLabel(unBinPos++, "Invalid event", 2);
138  h2Status->setBinLabel(unBinPos++, "Out of Sync AMC vs VFAT", 2);
139  h2Status->setBinLabel(unBinPos++, "Out of Sync VFAT vs VFAT", 2);
140  h2Status->setBinLabel(unBinPos++, "BX mismatch AMC vs VFAT", 2);
141  h2Status->setBinLabel(unBinPos++, "BX mismatch VFAT vs VFAT", 2);
142  h2Status->setBinLabel(unBinPos++, "Input FIFO underflow", 2);
143  h2Status->setBinLabel(unBinPos++, "Bad VFAT count", 2);
144 }
145 
147  if (h2Status == nullptr) {
148  return;
149  }
150 
151  unsigned int unBinPos = 1;
152  h2Status->setBinLabel(unBinPos++, "Good", 2);
153  h2Status->setBinLabel(unBinPos++, "Basic overflow", 2);
154  h2Status->setBinLabel(unBinPos++, "Zero-sup overflow", 2);
155  h2Status->setBinLabel(unBinPos++, "VFAT CRC error", 2);
156  h2Status->setBinLabel(unBinPos++, "Invalid header", 2);
157  h2Status->setBinLabel(unBinPos++, "AMC EC mismatch", 2);
158  h2Status->setBinLabel(unBinPos++, "AMC BC mismatch", 2);
159  h2Status->setBinLabel(unBinPos++, "missing VFAT", 2);
160 }
161 
163  LoadROMap(iSetup);
164  if (mapAMC13ToListChamber_.empty() || mapAMCToListChamber_.empty())
165  return;
166  initGeometry(iSetup);
167  if (GEMGeometry_ == nullptr)
168  return;
169  loadChambers();
170 
171  strFolderMain_ = "GEM/DAQStatus";
172 
173  nBXMin_ = -10;
174  nBXMax_ = 10;
175 
176  ibooker.cd();
178 
179  h2AMC13Status_ = nullptr;
180 
181  bFillAMC_ = false;
182 
183  //if (nRunType_ != GEMDQM_RUNTYPE_RELVAL)
185  Int_t nNumAMC13 = (Int_t)mapFEDIdToRe_.size();
186  h2AMC13Status_ = ibooker.book2D(
187  "amc13_status", "AMC13 Status;AMC13;", nNumAMC13, 0.5, nNumAMC13 + 0.5, nBitAMC13_, 0.5, nBitAMC13_ + 0.5);
189 
190  for (auto &[fedId, nIdx] : mapFEDIdToPosition_) {
191  auto st = mapFEDIdToSt_[fedId];
192  auto re = (mapFEDIdToRe_[fedId] > 0 ? 'P' : 'M');
193  auto strName = Form("amc_status_GE%i1-%c", st, re);
194  auto strTitle = Form("AMC Status GE%i1-%c;AMC slot;", st, re);
196  ibooker.book2D(strName, strTitle, nAMCSlots_, -0.5, nAMCSlots_ - 0.5, nBitAMC_, 0.5, nBitAMC_ + 0.5);
198  }
199 
200  bFillAMC_ = true;
201  }
202 
203  mapStatusOH_ =
204  MEMap4Inf(this, "oh_status", "OptoHybrid Status", 36, 0.5, 36.5, nBitOH_, 0.5, nBitOH_ + 0.5, "Chamber");
205 
207  this, "vfat_statusWarnSum", "VFAT reporting warnings", 36, 0.5, 36.5, 24, -0.5, 24 - 0.5, "Chamber", "VFAT");
209  this, "vfat_statusErrSum", "VFAT reporting errors", 36, 0.5, 36.5, 24, -0.5, 24 - 0.5, "Chamber", "VFAT");
211  MEMap5Inf(this, "vfat_status", "VFAT Status", 24, -0.5, 24 - 0.5, nBitVFAT_, 0.5, nBitVFAT_ + 0.5, "VFAT");
212 
218  }
219 
220  GenerateMEPerChamber(ibooker);
221 
223  h2SummaryStatusAll = CreateSummaryHist(ibooker, "chamberAllStatus");
224  h2SummaryStatusWarning = CreateSummaryHist(ibooker, "chamberWarnings");
225  h2SummaryStatusError = CreateSummaryHist(ibooker, "chamberErrors");
226  }
227 
229  h2SummaryStatusVFATWarning = CreateSummaryHist(ibooker, "chamberVFATWarnings");
230  h2SummaryStatusVFATError = CreateSummaryHist(ibooker, "chamberVFATErrors");
231  h2SummaryStatusOHWarning = CreateSummaryHist(ibooker, "chamberOHWarnings");
232  h2SummaryStatusOHError = CreateSummaryHist(ibooker, "chamberOHErrors");
233  h2SummaryStatusAMCWarning = CreateSummaryHist(ibooker, "chamberAMCWarnings");
234  h2SummaryStatusAMCError = CreateSummaryHist(ibooker, "chamberAMCErrors");
235  h2SummaryStatusAMC13Error = CreateSummaryHist(ibooker, "chamberAMC13Errors");
236 
237  h2SummaryStatusAll->setTitle("Summary of all number of OH or VFAT status of each chambers");
238  h2SummaryStatusWarning->setTitle("Summary of all warnings of each chambers");
239  h2SummaryStatusError->setTitle("Summary of all errors of each chambers");
240  h2SummaryStatusVFATWarning->setTitle("Summary of VFAT warnings of each chambers");
241  h2SummaryStatusVFATError->setTitle("Summary of VFAT errors of each chambers");
242  h2SummaryStatusOHWarning->setTitle("Summary of OH warnings of each chambers");
243  h2SummaryStatusOHError->setTitle("Summary of OH errors of each chambers");
244  h2SummaryStatusAMCWarning->setTitle("Summary of AMC warnings of each chambers");
245  h2SummaryStatusAMCError->setTitle("Summary of AMC errors of each chambers");
246  h2SummaryStatusAMC13Error->setTitle("Summary of AMC13 errors of each chambers");
247  }
248 }
249 
251  ME3IdsKey key3 = key4Tokey3(key);
252  MEStationInfo &stationInfo = mapStationInfo_[key3];
253 
254  Int_t nNewNumCh = stationInfo.nMaxIdxChamber_ - stationInfo.nMinIdxChamber_ + 1;
255  Int_t nNewMinIdxChamber = (stationInfo.nMinIdxChamber_ - 1) + 1;
256  Int_t nNewMaxIdxChamber = stationInfo.nMaxIdxChamber_;
257 
258  mapStatusOH_.SetBinConfX(nNewNumCh, nNewMinIdxChamber - 0.5, nNewMaxIdxChamber + 0.5);
259  mapStatusOH_.bookND(bh, key);
260  mapStatusOH_.SetLabelForChambers(key, 1, -1, nNewMinIdxChamber);
261 
262  if (mapStatusOH_.isOperating()) {
264  }
265 
266  Int_t nNumVFATPerModule = stationInfo.nMaxVFAT_ / stationInfo.nNumModules_;
267 
268  mapStatusWarnVFATPerLayer_.SetBinConfX(nNewNumCh, nNewMinIdxChamber - 0.5, nNewMaxIdxChamber + 0.5);
269  mapStatusWarnVFATPerLayer_.SetBinConfY(nNumVFATPerModule, -0.5);
271  mapStatusWarnVFATPerLayer_.SetLabelForChambers(key, 1, -1, nNewMinIdxChamber);
273 
274  mapStatusErrVFATPerLayer_.SetBinConfX(nNewNumCh, nNewMinIdxChamber - 0.5, nNewMaxIdxChamber + 0.5);
275  mapStatusErrVFATPerLayer_.SetBinConfY(nNumVFATPerModule, -0.5);
277  mapStatusErrVFATPerLayer_.SetLabelForChambers(key, 1, -1, nNewMinIdxChamber);
279 
280  return 0;
281 }
282 
284  ME4IdsKey key4 = key5Tokey4(key);
285  ME3IdsKey key3 = key4Tokey3(key4);
286  MEStationInfo &stationInfo = mapStationInfo_[key3];
287 
288  Int_t nNumVFATPerModule = stationInfo.nMaxVFAT_ / stationInfo.nNumModules_;
289 
290  bh.getBooker()->setCurrentFolder(strFolderMain_ + "/VFATStatus_" + getNameDirLayer(key4));
291 
292  mapStatusVFATPerCh_.SetBinConfX(nNumVFATPerModule, -0.5);
297  }
298 
300 
301  return 0;
302 }
303 
309 
310  event.getByToken(tagVFAT_, gemVFAT);
311  event.getByToken(tagOH_, gemOH);
312  event.getByToken(tagAMC_, gemAMC);
313  event.getByToken(tagAMC13_, gemAMC13);
314 
315  if (!(gemVFAT.isValid() && gemOH.isValid() && gemAMC.isValid() && gemAMC13.isValid())) {
316  if (!bWarnedNotFound_) {
317  edm::LogWarning(log_category_) << "DAQ sources from muonGEMDigis are not found";
318  bWarnedNotFound_ = true;
319  }
320  return;
321  }
322 
323  std::map<ME5IdsKey, bool> mapChamberAll;
324  std::map<ME5IdsKey, bool> mapChamberWarning;
325  std::map<ME5IdsKey, bool> mapChamberError;
326  std::map<ME5IdsKey, bool> mapChamberVFATWarning;
327  std::map<ME5IdsKey, bool> mapChamberVFATError;
328  std::map<ME5IdsKey, bool> mapChamberOHWarning;
329  std::map<ME5IdsKey, bool> mapChamberOHError;
330  std::map<ME5IdsKey, bool> mapChamberAMCWarning;
331  std::map<ME5IdsKey, bool> mapChamberAMCError;
332  std::map<ME5IdsKey, bool> mapChamberAMC13Error;
333 
334  for (auto amc13It = gemAMC13->begin(); amc13It != gemAMC13->end(); ++amc13It) {
335  int fedId = (*amc13It).first;
336  if (mapFEDIdToPosition_.find(fedId) == mapFEDIdToPosition_.end()) {
337  continue;
338  }
339  int nXBin = mapFEDIdToPosition_[fedId];
340 
341  const auto &range = (*amc13It).second;
342  for (auto amc13 = range.first; amc13 != range.second; ++amc13) {
343  Bool_t bWarn = false;
344  Bool_t bErr = false;
345 
348 
349  if (bFillAMC_) {
351  if (warnings.InValidAMC)
352  FillWithRiseErr(h2AMC13Status_, nXBin, 2, bWarn);
353  }
354 
356  if (errors.InValidSize)
357  FillWithRiseErr(h2AMC13Status_, nXBin, 3, bErr);
358  if (errors.failTrailerCheck)
359  FillWithRiseErr(h2AMC13Status_, nXBin, 4, bErr);
360  if (errors.failFragmentLength)
361  FillWithRiseErr(h2AMC13Status_, nXBin, 5, bErr);
362  if (errors.failTrailerMatch)
363  FillWithRiseErr(h2AMC13Status_, nXBin, 6, bErr);
364  if (errors.moreTrailers)
365  FillWithRiseErr(h2AMC13Status_, nXBin, 7, bErr);
366  if (errors.crcModified)
367  FillWithRiseErr(h2AMC13Status_, nXBin, 8, bErr);
368  if (errors.slinkError)
369  FillWithRiseErr(h2AMC13Status_, nXBin, 9, bErr);
370  if (errors.wrongFedId)
371  FillWithRiseErr(h2AMC13Status_, nXBin, 10, bErr);
372  }
373  }
374 
375  if (!bWarn && !bErr) {
377  h2AMC13Status_->Fill(nXBin, 1);
378  }
379  } else {
380  auto &listChamber = mapAMC13ToListChamber_[fedId];
381  for (auto gid : listChamber) {
382  ME3IdsKey key3{gid.region(), gid.station(), gid.layer()};
383  MEStationInfo &stationInfo = mapStationInfo_[key3];
384  for (int nIdxModule = 1; nIdxModule <= stationInfo.nNumModules_; nIdxModule++) {
385  ME5IdsKey key5Ch{gid.region(), gid.station(), gid.layer(), nIdxModule, gid.chamber()};
386  if (bErr)
387  mapChamberAMC13Error[key5Ch] = false;
388  }
389  }
390  }
391  }
392  }
393 
394  MonitorElement *h2AMCStatus = nullptr;
395 
396  for (auto amcIt = gemAMC->begin(); amcIt != gemAMC->end(); ++amcIt) {
397  int fedId = (*amcIt).first;
398  if (mapFEDIdToAMCStatus_.find(fedId) == mapFEDIdToAMCStatus_.end()) {
399  continue;
400  }
401  h2AMCStatus = mapFEDIdToAMCStatus_[fedId];
402 
403  const GEMAMCStatusCollection::Range &range = (*amcIt).second;
404  for (auto amc = range.first; amc != range.second; ++amc) {
405  Bool_t bWarn = false;
406  Bool_t bErr = false;
407 
408  Int_t nAMCNum = amc->amcNumber();
409 
410  GEMAMCStatus::Warnings warnings{amc->warnings()};
411  GEMAMCStatus::Errors errors{amc->errors()};
412 
413  if (bFillAMC_) {
415  if (warnings.InValidOH)
416  FillWithRiseErr(h2AMCStatus, nAMCNum, 2, bWarn);
417  if (warnings.backPressure)
418  FillWithRiseErr(h2AMCStatus, nAMCNum, 3, bWarn);
419  }
420 
422  if (errors.badEC)
423  FillWithRiseErr(h2AMCStatus, nAMCNum, 4, bErr);
424  if (errors.badBC)
425  FillWithRiseErr(h2AMCStatus, nAMCNum, 5, bErr);
426  if (errors.badOC)
427  FillWithRiseErr(h2AMCStatus, nAMCNum, 6, bErr);
428  if (errors.badRunType)
429  FillWithRiseErr(h2AMCStatus, nAMCNum, 7, bErr);
430  if (errors.badCRC)
431  FillWithRiseErr(h2AMCStatus, nAMCNum, 8, bErr);
432  if (errors.MMCMlocked)
433  FillWithRiseErr(h2AMCStatus, nAMCNum, 9, bErr);
434  if (errors.DAQclocklocked)
435  FillWithRiseErr(h2AMCStatus, nAMCNum, 10, bErr);
436  if (errors.DAQnotReday)
437  FillWithRiseErr(h2AMCStatus, nAMCNum, 11, bErr);
438  if (errors.BC0locked)
439  FillWithRiseErr(h2AMCStatus, nAMCNum, 12, bErr);
440  }
441  }
442 
443  if (!bWarn && !bErr) {
445  h2AMCStatus->Fill(nAMCNum, 1);
446  }
447  } else {
448  auto &listChamber = mapAMCToListChamber_[{fedId, nAMCNum}];
449  for (auto gid : listChamber) {
450  ME3IdsKey key3{gid.region(), gid.station(), gid.layer()};
451  MEStationInfo &stationInfo = mapStationInfo_[key3];
452  for (int nIdxModule = 1; nIdxModule <= stationInfo.nNumModules_; nIdxModule++) {
453  ME5IdsKey key5Ch{gid.region(), gid.station(), gid.layer(), nIdxModule, gid.chamber()};
454  if (bErr)
455  mapChamberAMCError[key5Ch] = false;
456  if (bWarn)
457  mapChamberAMCWarning[key5Ch] = false;
458  }
459  }
460  }
461  }
462  }
463 
464  std::map<ME5IdsKey, uint32_t> map_missingVFATs;
465  std::map<ME5IdsKey, uint32_t> map_vfatMask;
466 
467  for (auto ohIt = gemOH->begin(); ohIt != gemOH->end(); ++ohIt) {
468  GEMDetId gid = (*ohIt).first;
469  ME3IdsKey key3{gid.region(), gid.station(), gid.layer()};
470  MEStationInfo &stationInfo = mapStationInfo_[key3];
471 
472  Int_t nNumVFATPerModule = stationInfo.nMaxVFAT_ / stationInfo.nNumModules_;
473 
474  const GEMOHStatusCollection::Range &range = (*ohIt).second;
475  for (auto OHStatus = range.first; OHStatus != range.second; ++OHStatus) {
476  Int_t nIdxModule = getIdxModule(gid.station(), OHStatus->chamberType());
477  Int_t nCh = gid.chamber();
478  ME4IdsKey key4{gid.region(), gid.station(), gid.layer(), nIdxModule};
479  ME5IdsKey key5Mod{
480  gid.region(), gid.station(), gid.layer(), nIdxModule, nCh}; // WARNING: Chamber+Module, not iEta
481 
482  auto vfatMask = OHStatus->vfatMask();
483  map_missingVFATs[key5Mod] = OHStatus->missingVFATs();
484  map_vfatMask[key5Mod] = vfatMask;
485 
486  for (Int_t i = 0; i < nNumVFATPerModule; i++) {
487  if ((vfatMask & (1 << i)) == 0) {
488  // -16: A sufficient large number to avoid any effect from a buggy filling
489  mapStatusErrVFATPerLayer_.Fill(key4, nCh, i, -16);
490  }
491  }
492 
493  GEMOHStatus::Warnings warnings{OHStatus->warnings()};
494  if (warnings.EvtNF)
495  mapStatusOH_.Fill(key4, nCh, 2);
496  if (warnings.InNF)
497  mapStatusOH_.Fill(key4, nCh, 3);
498  if (warnings.L1aNF)
499  mapStatusOH_.Fill(key4, nCh, 4);
500  if (warnings.EvtSzW)
501  mapStatusOH_.Fill(key4, nCh, 5);
502  if (warnings.InValidVFAT)
503  mapStatusOH_.Fill(key4, nCh, 6);
504  if (warnings.missingVFAT)
505  mapStatusOH_.Fill(key4, nCh, 7);
506 
507  GEMOHStatus::Errors errors{OHStatus->errors()};
508  if (errors.EvtF)
509  mapStatusOH_.Fill(key4, nCh, 8);
510  if (errors.InF)
511  mapStatusOH_.Fill(key4, nCh, 9);
512  if (errors.L1aF)
513  mapStatusOH_.Fill(key4, nCh, 10);
514  if (errors.EvtSzOFW)
515  mapStatusOH_.Fill(key4, nCh, 11);
516  if (errors.Inv)
517  mapStatusOH_.Fill(key4, nCh, 12);
518  if (errors.OOScAvV)
519  mapStatusOH_.Fill(key4, nCh, 13);
520  if (errors.OOScVvV)
521  mapStatusOH_.Fill(key4, nCh, 14);
522  if (errors.BxmAvV)
523  mapStatusOH_.Fill(key4, nCh, 15);
524  if (errors.BxmVvV)
525  mapStatusOH_.Fill(key4, nCh, 16);
526  if (errors.InUfw)
527  mapStatusOH_.Fill(key4, nCh, 17);
528  if (errors.badVFatCount)
529  mapStatusOH_.Fill(key4, nCh, 18);
530 
531  Bool_t bWarn = warnings.wcodes != 0;
532  Bool_t bErr = errors.codes != 0;
533  if (!bWarn && !bErr)
534  mapStatusOH_.Fill(key4, nCh, 1);
535  if (bWarn)
536  mapChamberOHWarning[key5Mod] = false;
537  if (bErr)
538  mapChamberOHError[key5Mod] = false;
539  mapChamberAll[key5Mod] = true;
540  }
541  }
542 
543  for (auto vfatIt = gemVFAT->begin(); vfatIt != gemVFAT->end(); ++vfatIt) {
544  GEMDetId gid = (*vfatIt).first;
545  ME3IdsKey key3{gid.region(), gid.station(), gid.layer()};
546 
547  const GEMVFATStatusCollection::Range &range = (*vfatIt).second;
548 
549  for (auto vfatStat = range.first; vfatStat != range.second; ++vfatStat) {
550  Int_t nIdxModule = getIdxModule(gid.station(), vfatStat->chamberType());
551  Int_t nCh = gid.chamber();
552  ME4IdsKey key4{gid.region(), gid.station(), gid.layer(), nIdxModule};
553  ME5IdsKey key5Mod{
554  gid.region(), gid.station(), gid.layer(), nIdxModule, nCh}; // WARNING: Chamber+Module, not iEta
555 
556  Int_t nIdxVFAT = vfatStat->vfatPosition();
557  Int_t nIdxVFATMod = nIdxVFAT;
558 
559  auto missingVFATs = map_missingVFATs[key5Mod] & (1 << nIdxVFAT);
560  auto vfatMask = map_vfatMask[key5Mod] & (1 << nIdxVFAT);
561 
562  if (vfatMask == 0) {
563  continue;
564  }
565 
566  Bool_t bErr_masked = missingVFATs != 0;
567 
568  GEMVFATStatus::Warnings warnings{vfatStat->warnings()};
569  if (warnings.basicOFW)
570  mapStatusVFATPerCh_.Fill(key5Mod, nIdxVFATMod, 2);
571  if (warnings.zeroSupOFW)
572  mapStatusVFATPerCh_.Fill(key5Mod, nIdxVFATMod, 3);
573 
574  GEMVFATStatus::Errors errors{(uint8_t)vfatStat->errors()};
575  if (errors.vc)
576  mapStatusVFATPerCh_.Fill(key5Mod, nIdxVFATMod, 4);
577  if (errors.InValidHeader)
578  mapStatusVFATPerCh_.Fill(key5Mod, nIdxVFATMod, 5);
579  if (errors.EC)
580  mapStatusVFATPerCh_.Fill(key5Mod, nIdxVFATMod, 6);
581  if (errors.BC)
582  mapStatusVFATPerCh_.Fill(key5Mod, nIdxVFATMod, 7);
583  if (bErr_masked)
584  mapStatusVFATPerCh_.Fill(key5Mod, nIdxVFATMod, 8);
585 
586  Bool_t bWarn = warnings.wcodes != 0;
587  Bool_t bErr = errors.codes != 0 || bErr_masked;
588  if (!bWarn && !bErr)
589  mapStatusVFATPerCh_.Fill(key5Mod, nIdxVFATMod, 1);
590  if (bWarn)
591  mapChamberVFATWarning[key5Mod] = false;
592  if (bErr)
593  mapChamberVFATError[key5Mod] = false;
594  if (bWarn)
595  mapStatusWarnVFATPerLayer_.Fill(key4, nCh, nIdxVFAT);
596  if (bErr)
597  mapStatusErrVFATPerLayer_.Fill(key4, nCh, nIdxVFAT);
598  mapChamberAll[key5Mod] = true;
599  }
600  }
601 
603  // Summarizing all presence of status of each chamber
605  // Summarizing all the error and warning occupancy
606  FillStatusSummaryPlot(mapChamberVFATWarning, h2SummaryStatusVFATWarning, &mapChamberWarning);
607  FillStatusSummaryPlot(mapChamberVFATError, h2SummaryStatusVFATError, &mapChamberError);
608  FillStatusSummaryPlot(mapChamberOHWarning, h2SummaryStatusOHWarning, &mapChamberWarning);
609  FillStatusSummaryPlot(mapChamberOHError, h2SummaryStatusOHError, &mapChamberError);
610  FillStatusSummaryPlot(mapChamberAMCWarning, h2SummaryStatusAMCWarning, &mapChamberWarning);
611  FillStatusSummaryPlot(mapChamberAMCError, h2SummaryStatusAMCError, &mapChamberError);
612  FillStatusSummaryPlot(mapChamberAMC13Error, h2SummaryStatusAMC13Error, &mapChamberError);
613 
614  FillStatusSummaryPlot(mapChamberWarning, h2SummaryStatusWarning);
616  }
617 }
618 
void FillStatusSummaryPlot(std::map< ME5IdsKey, bool > &mapChamber, MonitorElement *h2Plot, std::map< ME5IdsKey, bool > *pmapSummary=nullptr)
virtual void setTitle(const std::string &title)
set (ie. change) histogram/profile title
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
constexpr int station() const
Definition: GEMDetId.h:179
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
MEMapInfT< MEMap4Ids, ME4IdsKey > MEMap4Inf
Definition: GEMDQMBase.h:475
dqm::impl::MonitorElement * CreateSummaryHist(DQMStore::IBooker &ibooker, TString strName)
Definition: GEMDQMBase.cc:150
GEMDAQStatusSource(const edm::ParameterSet &cfg)
constexpr int region() const
Definition: GEMDetId.h:171
Int_t nRunType_
Definition: GEMDQMBase.h:545
int getIdxModule(const int, const int)
Definition: GEMDQMBase.h:688
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::tuple< Int_t, Int_t, Int_t, Int_t, Int_t > ME5IdsKey
void FillWithRiseErr(MonitorElement *h, Int_t nX, Int_t nY, Bool_t &bErr)
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
edm::EDGetToken tagAMC13_
int SetLabelForChambers(K key, Int_t nAxis, Int_t nNumBin=-1, Int_t nIdxStart=1)
Definition: GEMDQMBase.h:337
MonitorElement * h2SummaryStatusAMCWarning
MonitorElement * h2AMC13Status_
MonitorElement * h2SummaryStatusAMCError
int initGeometry(edm::EventSetup const &iSetup)
Definition: GEMDQMBase.cc:27
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)
Definition: GEMDQMBase.h:359
std::map< ME3IdsKey, MEStationInfo > mapStationInfo_
Definition: GEMDQMBase.h:651
std::map< UInt_t, int > mapFEDIdToSt_
std::map< std::tuple< int, int >, std::vector< GEMDetId > > mapAMCToListChamber_
int loadChambers()
Definition: GEMDQMBase.cc:56
int ProcessWithMEMap5WithChamber(BookingHelper &bh, ME5IdsKey key) override
constexpr int layer() const
Definition: GEMDetId.h:190
int Fill(K key, Double_t x)
Definition: GEMDQMBase.h:395
std::string log_category_
Definition: GEMDQMBase.h:547
constexpr int chamber() const
Definition: GEMDetId.h:183
MEMap4Inf mapStatusErrVFATPerLayer_
edm::EDGetToken tagVFAT_
MonitorElement * h2SummaryStatusVFATError
const edm::ESGetToken< GEMChMap, GEMChMapRcd > gemChMapToken_
void Fill(long long x)
std::map< UInt_t, MonitorElement * > mapFEDIdToAMCStatus_
int ProcessWithMEMap4(BookingHelper &bh, ME4IdsKey key) override
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::EDGetToken tagOH_
MonitorElement * h2SummaryStatusError
int GenerateMEPerChamber(DQMStore::IBooker &ibooker)
Definition: GEMDQMBase.cc:197
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
Transition
Definition: Transition.h:12
key
prepare the HTCondor submission files and eventually submit them
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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_
Definition: GEMDQMBase.h:629
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())
Definition: DQMStore.h:221
void add(std::string const &label, ParameterSetDescription const &psetDescription)
DQMStore::IBooker * getBooker()
Definition: GEMDQMBase.h:94
void SetLabelOHStatus(MonitorElement *h2Status)
bool isValid() const
Definition: HandleBase.h:70
std::string getNameDirLayer(ME3IdsKey key3)
Definition: GEMDQMBase.h:746
int bookND(BookingHelper &bh, K key)
Definition: GEMDQMBase.h:307
MonitorElement * h2SummaryStatusOHWarning
ME3IdsKey key4Tokey3(ME4IdsKey key)
Definition: GEMDQMBase.h:596
MonitorElement * h2SummaryStatusAMC13Error
HLT enums.
MEMapInfT< MEMap5Ids, ME5IdsKey > MEMap5Inf
Definition: GEMDQMBase.h:476
std::tuple< Int_t, Int_t, Int_t > ME3IdsKey
void SetBinConfX(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
Definition: GEMDQMBase.h:281
Definition: errors.py:1
MEMap4Inf mapStatusWarnVFATPerLayer_
MonitorElement * h2SummaryStatusWarning
Log< level::Warning, false > LogWarning
Definition: AMCSpec.h:8
MonitorElement * h2SummaryStatusOHError
void SetBinConfY(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
Definition: GEMDQMBase.h:289
dqm::impl::MonitorElement * FindHist(K key)
Definition: GEMDQMBase.h:328
DigiRangeIterator end() const
Definition: event.py:1
Definition: Run.h:45
ME4IdsKey key5Tokey4(ME5IdsKey key)
Definition: GEMDQMBase.h:601
edm::EDGetToken tagAMC_