26 desc.add<Int_t>(
"AMCSlots", 13);
29 desc.add<
bool>(
"useDBEMap",
true);
31 descriptions.
add(
"GEMDAQStatusSource",
desc);
37 auto gemChMap = std::make_unique<GEMChMap>(chMap);
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;
46 listFEDId.push_back(
fedId);
55 for (
auto fedId : listFEDId) {
61 auto gemChMap = std::make_unique<GEMChMap>();
64 for (
auto const &[ec, dc] : gemChMap->chamberMap()) {
65 unsigned int fedId = ec.fedId;
66 uint8_t amcNum = ec.amcNum;
77 if (h2Status ==
nullptr) {
81 unsigned int unBinPos = 1;
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);
96 h2Status->
setBinLabel(nPos, Form(
"GE%i1-%c", st, re), 1);
101 if (h2Status ==
nullptr) {
105 unsigned int unBinPos = 1;
107 h2Status->
setBinLabel(unBinPos++,
"Invalid OH", 2);
108 h2Status->
setBinLabel(unBinPos++,
"Back pressure", 2);
112 h2Status->
setBinLabel(unBinPos++,
"Bad run type", 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);
121 if (h2Status ==
nullptr) {
125 unsigned int unBinPos = 1;
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);
147 if (h2Status ==
nullptr) {
151 unsigned int unBinPos = 1;
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);
187 "amc13_status",
"AMC13 Status;AMC13;", nNumAMC13, 0.5, nNumAMC13 + 0.5,
nBitAMC13_, 0.5,
nBitAMC13_ + 0.5);
193 auto strName = Form(
"amc_status_GE%i1-%c", st, re);
194 auto strTitle = Form(
"AMC Status GE%i1-%c;AMC slot;", st, re);
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");
310 event.getByToken(
tagVFAT_, gemVFAT);
311 event.getByToken(
tagOH_, gemOH);
312 event.getByToken(
tagAMC_, gemAMC);
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;
334 for (
auto amc13It = gemAMC13->
begin(); amc13It != gemAMC13->
end(); ++amc13It) {
335 int fedId = (*amc13It).first;
341 const auto &
range = (*amc13It).second;
343 Bool_t bWarn =
false;
358 if (
errors.failTrailerCheck)
360 if (
errors.failFragmentLength)
362 if (
errors.failTrailerMatch)
375 if (!bWarn && !bErr) {
381 for (
auto gid : listChamber) {
382 ME3IdsKey key3{gid.region(), gid.station(), gid.layer()};
384 for (
int nIdxModule = 1; nIdxModule <= stationInfo.
nNumModules_; nIdxModule++) {
385 ME5IdsKey key5Ch{gid.region(), gid.station(), gid.layer(), nIdxModule, gid.chamber()};
387 mapChamberAMC13Error[key5Ch] =
false;
396 for (
auto amcIt = gemAMC->
begin(); amcIt != gemAMC->
end(); ++amcIt) {
397 int fedId = (*amcIt).first;
405 Bool_t bWarn =
false;
408 Int_t nAMCNum =
amc->amcNumber();
434 if (
errors.DAQclocklocked)
443 if (!bWarn && !bErr) {
445 h2AMCStatus->
Fill(nAMCNum, 1);
449 for (
auto gid : listChamber) {
450 ME3IdsKey key3{gid.region(), gid.station(), gid.layer()};
452 for (
int nIdxModule = 1; nIdxModule <= stationInfo.
nNumModules_; nIdxModule++) {
453 ME5IdsKey key5Ch{gid.region(), gid.station(), gid.layer(), nIdxModule, gid.chamber()};
455 mapChamberAMCError[key5Ch] =
false;
457 mapChamberAMCWarning[key5Ch] =
false;
464 std::map<ME5IdsKey, uint32_t> map_missingVFATs;
465 std::map<ME5IdsKey, uint32_t> map_vfatMask;
467 for (
auto ohIt = gemOH->
begin(); ohIt != gemOH->
end(); ++ohIt) {
475 for (
auto OHStatus =
range.first; OHStatus !=
range.second; ++OHStatus) {
482 auto vfatMask = OHStatus->vfatMask();
483 map_missingVFATs[key5Mod] = OHStatus->missingVFATs();
486 for (Int_t
i = 0;
i < nNumVFATPerModule;
i++) {
531 Bool_t bWarn =
warnings.wcodes != 0;
532 Bool_t bErr =
errors.codes != 0;
536 mapChamberOHWarning[key5Mod] =
false;
538 mapChamberOHError[key5Mod] =
false;
539 mapChamberAll[key5Mod] =
true;
543 for (
auto vfatIt = gemVFAT->
begin(); vfatIt != gemVFAT->
end(); ++vfatIt) {
549 for (
auto vfatStat =
range.first; vfatStat !=
range.second; ++vfatStat) {
556 Int_t nIdxVFAT = vfatStat->vfatPosition();
557 Int_t nIdxVFATMod = nIdxVFAT;
559 auto missingVFATs = map_missingVFATs[key5Mod] & (1 << nIdxVFAT);
560 auto vfatMask = map_vfatMask[key5Mod] & (1 << nIdxVFAT);
586 Bool_t bWarn =
warnings.wcodes != 0;
587 Bool_t bErr =
errors.codes != 0 || bErr_masked;
591 mapChamberVFATWarning[key5Mod] =
false;
593 mapChamberVFATError[key5Mod] =
false;
598 mapChamberAll[key5Mod] =
true;
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
MEMapInfT< MEMap4Ids, ME4IdsKey > MEMap4Inf
dqm::impl::MonitorElement * CreateSummaryHist(DQMStore::IBooker &ibooker, TString strName)
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)
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)
edm::EDGetToken tagAMC13_
int SetLabelForChambers(K key, Int_t nAxis, Int_t nNumBin=-1, Int_t nIdxStart=1)
MonitorElement * h2SummaryStatusAMCWarning
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_
int ProcessWithMEMap5WithChamber(BookingHelper &bh, ME5IdsKey key) override
constexpr int layer() const
int Fill(K key, Double_t x)
std::string log_category_
constexpr int chamber() const
MEMap4Inf mapStatusErrVFATPerLayer_
MonitorElement * h2SummaryStatusVFATError
const edm::ESGetToken< GEMChMap, GEMChMapRcd > gemChMapToken_
std::map< UInt_t, MonitorElement * > mapFEDIdToAMCStatus_
int ProcessWithMEMap4(BookingHelper &bh, ME4IdsKey key) override
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * h2SummaryStatusError
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
MEMap5Inf mapStatusVFATPerCh_
#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
MEMapInfT< MEMap5Ids, ME5IdsKey > MEMap5Inf
std::tuple< Int_t, Int_t, Int_t > ME3IdsKey
void SetBinConfX(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
MEMap4Inf mapStatusWarnVFATPerLayer_
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
ME4IdsKey key5Tokey4(ME5IdsKey key)