13 gemEMapToken_ = esConsumes<GEMeMap, GEMeMapRcd, edm::Transition::BeginRun>();
23 desc.
add<Int_t>(
"AMCSlots", 13);
27 descriptions.
add(
"GEMDAQStatusSource", desc);
31 auto gemROMap = std::make_shared<GEMROMapping>();
35 auto gemEMap = std::make_unique<GEMeMap>(eMap);
36 gemEMap->convert(*gemROMap);
38 for (
auto imap : gemEMap->theChamberMap_) {
39 int nNumChamber = (int)imap.fedId.size();
40 for (
int i = 0;
i < nNumChamber;
i++) {
41 unsigned int fedId = imap.fedId[
i];
42 uint8_t amcNum = imap.amcNum[
i];
43 uint8_t gebId = imap.gebId[
i];
58 auto gemEMap = std::make_unique<GEMeMap>();
59 gemEMap->convertDummy(*gemROMap);
65 if (h2Status ==
nullptr) {
69 unsigned int unBinPos = 1;
71 h2Status->
setBinLabel(unBinPos++,
"Invalid AMC", 2);
72 h2Status->
setBinLabel(unBinPos++,
"Invalid size", 2);
73 h2Status->
setBinLabel(unBinPos++,
"Fail trailer check", 2);
74 h2Status->
setBinLabel(unBinPos++,
"Fail fragment length", 2);
75 h2Status->
setBinLabel(unBinPos++,
"Fail trailer match", 2);
76 h2Status->
setBinLabel(unBinPos++,
"More trailer", 2);
77 h2Status->
setBinLabel(unBinPos++,
"CRC modified", 2);
78 h2Status->
setBinLabel(unBinPos++,
"S-link error", 2);
79 h2Status->
setBinLabel(unBinPos++,
"Wrong FED ID", 2);
86 if (h2Status ==
nullptr) {
90 unsigned int unBinPos = 1;
93 h2Status->
setBinLabel(unBinPos++,
"Back pressure", 2);
97 h2Status->
setBinLabel(unBinPos++,
"Bad run type", 2);
99 h2Status->
setBinLabel(unBinPos++,
"MMCM locked", 2);
100 h2Status->
setBinLabel(unBinPos++,
"DAQ clock locked", 2);
101 h2Status->
setBinLabel(unBinPos++,
"DAQ not ready", 2);
102 h2Status->
setBinLabel(unBinPos++,
"BC0 not locked", 2);
106 if (h2Status ==
nullptr) {
110 unsigned int unBinPos = 1;
112 h2Status->
setBinLabel(unBinPos++,
"Event FIFO near full", 2);
113 h2Status->
setBinLabel(unBinPos++,
"Input FIFO near full", 2);
114 h2Status->
setBinLabel(unBinPos++,
"L1A FIFO near full", 2);
115 h2Status->
setBinLabel(unBinPos++,
"Event size warn", 2);
116 h2Status->
setBinLabel(unBinPos++,
"Invalid VFAT", 2);
117 h2Status->
setBinLabel(unBinPos++,
"Event FIFO full", 2);
118 h2Status->
setBinLabel(unBinPos++,
"Input FIFO full", 2);
119 h2Status->
setBinLabel(unBinPos++,
"L1A FIFO full", 2);
120 h2Status->
setBinLabel(unBinPos++,
"Event size overflow", 2);
121 h2Status->
setBinLabel(unBinPos++,
"Invalid event", 2);
122 h2Status->
setBinLabel(unBinPos++,
"Out of Sync AMC vs VFAT", 2);
123 h2Status->
setBinLabel(unBinPos++,
"Out of Sync VFAT vs VFAT", 2);
124 h2Status->
setBinLabel(unBinPos++,
"BX mismatch AMC vs VFAT", 2);
125 h2Status->
setBinLabel(unBinPos++,
"BX mismatch VFAT vs VFAT", 2);
126 h2Status->
setBinLabel(unBinPos++,
"Input FIFO underflow", 2);
127 h2Status->
setBinLabel(unBinPos++,
"Bad VFAT count", 2);
131 if (h2Status ==
nullptr) {
135 unsigned int unBinPos = 1;
137 h2Status->
setBinLabel(unBinPos++,
"Basic overflow", 2);
138 h2Status->
setBinLabel(unBinPos++,
"Zero-sup overflow", 2);
139 h2Status->
setBinLabel(unBinPos++,
"VFAT CRC error", 2);
140 h2Status->
setBinLabel(unBinPos++,
"Invalid header", 2);
141 h2Status->
setBinLabel(unBinPos++,
"AMC EC mismatch", 2);
142 h2Status->
setBinLabel(unBinPos++,
"AMC BC mismatch", 2);
173 "AMC Status GE11-M;AMC slot;",
181 "AMC Status GE11-P;AMC slot;",
198 this,
"vfat_statusWarnSum",
"VFAT reporting warnings", 36, 0.5, 36.5, 24, -0.5, 24 - 0.5,
"Chamber",
"VFAT");
200 this,
"vfat_statusErrSum",
"VFAT reporting errors", 36, 0.5, 36.5, 24, -0.5, 24 - 0.5,
"Chamber",
"VFAT");
292 event.getByToken(
tagVFAT_, gemVFAT);
293 event.getByToken(
tagOH_, gemOH);
294 event.getByToken(
tagAMC_, gemAMC);
297 std::map<ME4IdsKey, bool> mapChamberAll;
298 std::map<ME4IdsKey, bool> mapChamberWarning;
299 std::map<ME4IdsKey, bool> mapChamberError;
300 std::map<ME4IdsKey, bool> mapChamberVFATWarning;
301 std::map<ME4IdsKey, bool> mapChamberVFATError;
302 std::map<ME4IdsKey, bool> mapChamberOHWarning;
303 std::map<ME4IdsKey, bool> mapChamberOHError;
304 std::map<ME4IdsKey, bool> mapChamberAMCWarning;
305 std::map<ME4IdsKey, bool> mapChamberAMCError;
306 std::map<ME4IdsKey, bool> mapChamberAMC13Error;
308 for (
auto amc13It = gemAMC13->begin(); amc13It != gemAMC13->end(); ++amc13It) {
309 int fedId = (*amc13It).first;
322 const auto &
range = (*amc13It).second;
323 for (
auto amc13 =
range.first; amc13 !=
range.second; ++amc13) {
324 Bool_t bWarn =
false;
329 if (warnings.InValidAMC)
335 if (errors.InValidSize)
337 if (errors.failTrailerCheck)
339 if (errors.failFragmentLength)
341 if (errors.failTrailerMatch)
343 if (errors.moreTrailers)
345 if (errors.crcModified)
347 if (errors.slinkError)
349 if (errors.wrongFedId)
353 if (!bWarn && !bErr) {
359 for (
auto gid : listChamber) {
360 ME4IdsKey key4Ch{gid.region(), gid.station(), gid.layer(), gid.chamber()};
362 mapChamberAMC13Error[key4Ch] =
false;
370 for (
auto amcIt = gemAMC->begin(); amcIt != gemAMC->end(); ++amcIt) {
371 int fedId = (*amcIt).first;
384 for (
auto amc = range.first;
amc != range.second; ++
amc) {
385 Bool_t bWarn =
false;
388 Int_t nAMCNum =
amc->amcNumber();
392 if (warnings.InValidOH)
394 if (warnings.backPressure)
406 if (errors.badRunType)
410 if (errors.MMCMlocked)
412 if (errors.DAQclocklocked)
414 if (errors.DAQnotReday)
416 if (errors.BC0locked)
420 if (!bWarn && !bErr) {
422 h2AMCStatus->
Fill(nAMCNum, 1);
426 for (
auto gid : listChamber) {
427 ME4IdsKey key4Ch{gid.region(), gid.station(), gid.layer(), gid.chamber()};
429 mapChamberAMCError[key4Ch] =
false;
431 mapChamberAMCWarning[key4Ch] =
false;
437 for (
auto ohIt = gemOH->begin(); ohIt != gemOH->end(); ++ohIt) {
443 for (
auto OHStatus = range.first; OHStatus != range.second; ++OHStatus) {
453 if (warnings.InValidVFAT)
477 if (errors.badVFatCount)
480 Bool_t bWarn = warnings.wcodes != 0;
481 Bool_t bErr = errors.codes != 0;
485 mapChamberOHWarning[key4] =
false;
487 mapChamberOHError[key4] =
false;
488 mapChamberAll[key4] =
true;
492 for (
auto vfatIt = gemVFAT->begin(); vfatIt != gemVFAT->end(); ++vfatIt) {
498 for (
auto vfatStat = range.first; vfatStat != range.second; ++vfatStat) {
502 if (warnings.basicOFW)
504 if (warnings.zeroSupOFW)
509 if (errors.InValidHeader)
516 Bool_t bWarn = warnings.wcodes != 0;
517 Bool_t bErr = errors.codes != 0;
521 mapChamberVFATWarning[key4Ch] =
false;
523 mapChamberVFATError[key4Ch] =
false;
528 mapChamberAll[key4Ch] =
true;
534 for (
auto const &[key4, bErr] : mapChamberAll) {
virtual void setTitle(const std::string &title)
set (ie. change) histogram/profile title
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
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)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void FillWithRiseErr(MonitorElement *h, Int_t nX, Int_t nY, Bool_t &bErr)
virtual void setCurrentFolder(std::string const &fullpath)
edm::EDGetToken tagAMC13_
int getVFATNumber(const int, const int, const int)
MonitorElement * h2SummaryStatusAMCWarning
MonitorElement * h2AMCStatusNeg_
MEMapInfT< MEMap3Ids, ME3IdsKey > MEMap3Inf
#define DEFINE_FWK_MODULE(type)
MonitorElement * h2AMC13Status_
std::string strFolderMain_
int SetLabelForChambers(K key, Int_t nAxis, Int_t nNumBin=-1)
MonitorElement * h2SummaryStatusAMCError
int initGeometry(edm::EventSetup const &iSetup)
std::tuple< Int_t, Int_t, Int_t, Int_t > ME4IdsKey
edm::ESGetToken< GEMeMap, GEMeMapRcd > gemEMapToken_
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< std::tuple< int, int >, std::vector< GEMDetId > > mapAMCToListChamber_
std::map< ME3IdsKey, int > mapStationToIdx_
Log< level::Error, false > LogError
int Fill(K key, Double_t x)
std::string log_category_
constexpr int ieta() const
MonitorElement * h2SummaryStatusVFATError
const uint16_t range(const Frame &aFrame)
bool getData(T &iHolder) const
MEMap3Inf mapStatusWarnVFATPerLayer_
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)
constexpr int region() const
tuple key
prepare the HTCondor submission files and eventually submit them
void analyze(edm::Event const &e, edm::EventSetup const &eSetup) override
ParameterDescriptionBase * add(U const &iLabel, T const &value)
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)
void SetLabelAMC13Status(MonitorElement *h2Status)
std::map< int, std::vector< GEMDetId > > mapAMC13ToListChamber_
MonitorElement * h2SummaryStatusVFATWarning
MonitorElement * h2SummaryStatusAll
const GEMGeometry * GEMGeometry_
void SetLabelVFATStatus(MonitorElement *h2Status)
constexpr int chamber() const
constexpr int layer() const
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())
T getParameter(std::string const &) const
constexpr int station() const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
DQMStore::IBooker * getBooker()
int keyToChamber(ME4IdsKey key)
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
void FillStatusSummaryPlot(std::map< ME4IdsKey, bool > &mapChamber, MonitorElement *h2Plot, std::map< ME4IdsKey, bool > *pmapSummary=nullptr)
MonitorElement * h2SummaryStatusOHError
void SetBinConfY(Int_t nBins, Double_t dL=0.5, Double_t dH=-1048576.0)
dqm::impl::MonitorElement * FindHist(K key)
MonitorElement * h2AMCStatusPos_