13 gemEMapToken_ = esConsumes<GEMeMap, GEMeMapRcd, edm::Transition::BeginRun>();
23 desc.
add<Int_t>(
"AMCSlots", 13);
26 descriptions.
add(
"GEMDAQStatusSource", desc);
30 auto gemROMap = std::make_shared<GEMROMapping>();
34 auto gemEMap = std::make_unique<GEMeMap>(eMap);
35 gemEMap->convert(*gemROMap);
37 for (
auto imap : gemEMap->theChamberMap_) {
38 int nNumChamber = (int)imap.fedId.size();
39 for (
int i = 0;
i < nNumChamber;
i++) {
40 unsigned int fedId = imap.fedId[
i];
41 uint8_t amcNum = imap.amcNum[
i];
42 uint8_t gebId = imap.gebId[
i];
57 auto gemEMap = std::make_unique<GEMeMap>();
58 gemEMap->convertDummy(*gemROMap);
64 unsigned int unBinPos = 1;
66 h2Status->
setBinLabel(unBinPos++,
"Invalid AMC", 2);
67 h2Status->
setBinLabel(unBinPos++,
"Invalid size", 2);
68 h2Status->
setBinLabel(unBinPos++,
"Fail trailer check", 2);
69 h2Status->
setBinLabel(unBinPos++,
"Fail fragment length", 2);
70 h2Status->
setBinLabel(unBinPos++,
"Fail trailer match", 2);
71 h2Status->
setBinLabel(unBinPos++,
"More trailer", 2);
72 h2Status->
setBinLabel(unBinPos++,
"CRC modified", 2);
73 h2Status->
setBinLabel(unBinPos++,
"S-link error", 2);
74 h2Status->
setBinLabel(unBinPos++,
"Wrong FED ID", 2);
81 unsigned int unBinPos = 1;
84 h2Status->
setBinLabel(unBinPos++,
"Back pressure", 2);
88 h2Status->
setBinLabel(unBinPos++,
"Bad run type", 2);
90 h2Status->
setBinLabel(unBinPos++,
"MMCM locked", 2);
91 h2Status->
setBinLabel(unBinPos++,
"DAQ clock locked", 2);
92 h2Status->
setBinLabel(unBinPos++,
"DAQ not ready", 2);
93 h2Status->
setBinLabel(unBinPos++,
"BC0 not locked", 2);
97 unsigned int unBinPos = 1;
99 h2Status->
setBinLabel(unBinPos++,
"Event FIFO near full", 2);
100 h2Status->
setBinLabel(unBinPos++,
"Input FIFO near full", 2);
101 h2Status->
setBinLabel(unBinPos++,
"L1A FIFO near full", 2);
102 h2Status->
setBinLabel(unBinPos++,
"Event size warn", 2);
103 h2Status->
setBinLabel(unBinPos++,
"Invalid VFAT", 2);
104 h2Status->
setBinLabel(unBinPos++,
"Event FIFO full", 2);
105 h2Status->
setBinLabel(unBinPos++,
"Input FIFO full", 2);
106 h2Status->
setBinLabel(unBinPos++,
"L1A FIFO full", 2);
107 h2Status->
setBinLabel(unBinPos++,
"Event size overflow", 2);
108 h2Status->
setBinLabel(unBinPos++,
"Invalid event", 2);
109 h2Status->
setBinLabel(unBinPos++,
"Out of Sync AMC vs VFAT", 2);
110 h2Status->
setBinLabel(unBinPos++,
"Out of Sync VFAT vs VFAT", 2);
111 h2Status->
setBinLabel(unBinPos++,
"BX mismatch AMC vs VFAT", 2);
112 h2Status->
setBinLabel(unBinPos++,
"BX mismatch VFAT vs VFAT", 2);
113 h2Status->
setBinLabel(unBinPos++,
"Input FIFO underflow", 2);
114 h2Status->
setBinLabel(unBinPos++,
"Bad VFAT count", 2);
118 unsigned int unBinPos = 1;
120 h2Status->
setBinLabel(unBinPos++,
"Basic overflow", 2);
121 h2Status->
setBinLabel(unBinPos++,
"Zero-sup overflow", 2);
122 h2Status->
setBinLabel(unBinPos++,
"VFAT CRC error", 2);
123 h2Status->
setBinLabel(unBinPos++,
"Invalid header", 2);
124 h2Status->
setBinLabel(unBinPos++,
"AMC EC mismatch", 2);
125 h2Status->
setBinLabel(unBinPos++,
"AMC BC mismatch", 2);
149 "AMC Status GE11-M;AMC slot;",
157 "AMC Status GE11-P;AMC slot;",
175 this,
"vfat_statusWarnSum",
"VFAT reporting warnings", 36, 0.5, 36.5, 24, -0.5, 24 - 0.5,
"Chamber",
"VFAT");
177 this,
"vfat_statusErrSum",
"VFAT reporting errors", 36, 0.5, 36.5, 24, -0.5, 24 - 0.5,
"Chamber",
"VFAT");
254 event.getByToken(
tagVFAT_, gemVFAT);
255 event.getByToken(
tagOH_, gemOH);
256 event.getByToken(
tagAMC_, gemAMC);
259 std::map<ME4IdsKey, bool> mapChamberAll;
260 std::map<ME4IdsKey, bool> mapChamberWarning;
261 std::map<ME4IdsKey, bool> mapChamberError;
262 std::map<ME4IdsKey, bool> mapChamberVFATWarning;
263 std::map<ME4IdsKey, bool> mapChamberVFATError;
264 std::map<ME4IdsKey, bool> mapChamberOHWarning;
265 std::map<ME4IdsKey, bool> mapChamberOHError;
266 std::map<ME4IdsKey, bool> mapChamberAMCWarning;
267 std::map<ME4IdsKey, bool> mapChamberAMCError;
268 std::map<ME4IdsKey, bool> mapChamberAMC13Error;
270 for (
auto amc13It = gemAMC13->begin(); amc13It != gemAMC13->end(); ++amc13It) {
271 int fedId = (*amc13It).first;
284 const auto &
range = (*amc13It).second;
285 for (
auto amc13 =
range.first; amc13 !=
range.second; ++amc13) {
286 Bool_t bWarn =
false;
290 if (warnings.InValidAMC)
294 if (errors.InValidSize)
296 if (errors.failTrailerCheck)
298 if (errors.failFragmentLength)
300 if (errors.failTrailerMatch)
302 if (errors.moreTrailers)
304 if (errors.crcModified)
306 if (errors.slinkError)
308 if (errors.wrongFedId)
311 if (!bWarn && !bErr) {
315 for (
auto gid : listChamber) {
316 ME4IdsKey key4Ch{gid.region(), gid.station(), gid.layer(), gid.chamber()};
318 mapChamberAMC13Error[key4Ch] =
false;
326 for (
auto amcIt = gemAMC->begin(); amcIt != gemAMC->end(); ++amcIt) {
327 int fedId = (*amcIt).first;
340 for (
auto amc = range.first;
amc != range.second; ++
amc) {
341 Bool_t bWarn =
false;
344 Int_t nAMCNum =
amc->amcNumber();
347 if (warnings.InValidOH)
349 if (warnings.backPressure)
359 if (errors.badRunType)
363 if (errors.MMCMlocked)
365 if (errors.DAQclocklocked)
367 if (errors.DAQnotReday)
369 if (errors.BC0locked)
372 if (!bWarn && !bErr) {
373 h2AMCStatus->
Fill(nAMCNum, 1);
376 for (
auto gid : listChamber) {
377 ME4IdsKey key4Ch{gid.region(), gid.station(), gid.layer(), gid.chamber()};
379 mapChamberAMCError[key4Ch] =
false;
381 mapChamberAMCWarning[key4Ch] =
false;
387 for (
auto ohIt = gemOH->begin(); ohIt != gemOH->end(); ++ohIt) {
393 for (
auto OHStatus = range.first; OHStatus != range.second; ++OHStatus) {
403 if (warnings.InValidVFAT)
427 if (errors.badVFatCount)
430 Bool_t bWarn = warnings.wcodes != 0;
431 Bool_t bErr = errors.codes != 0;
435 mapChamberOHWarning[key4] =
false;
437 mapChamberOHError[key4] =
false;
438 mapChamberAll[key4] =
true;
442 for (
auto vfatIt = gemVFAT->begin(); vfatIt != gemVFAT->end(); ++vfatIt) {
448 for (
auto vfatStat = range.first; vfatStat != range.second; ++vfatStat) {
452 if (warnings.basicOFW)
454 if (warnings.zeroSupOFW)
456 if (warnings.basicOFW)
458 if (warnings.zeroSupOFW)
464 if (errors.InValidHeader)
472 if (errors.InValidHeader)
479 Bool_t bWarn = warnings.wcodes != 0;
480 Bool_t bErr = errors.codes != 0;
486 mapChamberVFATWarning[key4Ch] =
false;
488 mapChamberVFATError[key4Ch] =
false;
493 mapChamberAll[key4Ch] =
true;
498 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_
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)
int keyToChamber(ME4IdsKey key)
void SetLabelOHStatus(MonitorElement *h2Status)
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_