File indexing completed on 2024-09-11 04:32:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include "CSCDQM_EventProcessor.h"
0020
0021 namespace cscdqm {
0022
0023
0024
0025
0026
0027 bool EventProcessor::processExaminer(const CSCDCCExaminer& binChecker, const CSCDCCFormatStatusDigi& digi) {
0028 bool eventAccepted = true;
0029 MonitorObject* mo = nullptr;
0030
0031 uint32_t binErrorStatus = digi.getDDUSummaryErrors();
0032
0033 if (getEMUHisto(h::EMU_ALL_DDUS_FORMAT_ERRORS, mo)) {
0034 const std::set<DDUIdType> DDUs = digi.getListOfDDUs();
0035 for (std::set<DDUIdType>::const_iterator ddu_itr = DDUs.begin(); ddu_itr != DDUs.end(); ++ddu_itr) {
0036 ExaminerStatusType errs = digi.getDDUErrors(*ddu_itr);
0037 int dduID = (*ddu_itr) & 0xFF;
0038 if (((*ddu_itr) >= FEDNumbering::MINCSCDDUFEDID) &&
0039 ((*ddu_itr) <=
0040 FEDNumbering::MAXCSCDDUFEDID))
0041 {
0042
0043 dduID = cscdqm::Utility::getRUIfromDDUId((*ddu_itr));
0044 if (dduID < 0) {
0045 LOG_WARN << "DDU source ID (" << (*ddu_itr) << ") is out of valid range. Remapping to DDU ID 1.";
0046 dduID = 1;
0047 }
0048 }
0049 if (errs != 0) {
0050 for (int i = 0; i < 29; i++) {
0051 if ((errs >> i) & 0x1) {
0052 mo->Fill(dduID, i + 1);
0053 }
0054 }
0055 } else {
0056 mo->Fill(dduID, 0);
0057 }
0058 }
0059 }
0060
0061
0062
0063 unsigned long dccBinCheckMask = 0x06080016;
0064
0065 if ((binErrorStatus & dccBinCheckMask) > 0) {
0066 eventAccepted = false;
0067 }
0068
0069 if (binErrorStatus != 0) {
0070 config->incNEventsBad();
0071 }
0072
0073
0074
0075 {
0076 uint32_t i = 0;
0077 CSCIdType chamberID = 0;
0078 while (digi.nextCSCWithPayload(i, chamberID)) {
0079 int crateID = (chamberID >> 4) & 0xFF;
0080 int dmbSlot = chamberID & 0xF;
0081
0082 if (crateID == 255) {
0083 continue;
0084 }
0085 if ((crateID > 60) || (dmbSlot > 10) || (crateID <= 0) || (dmbSlot <= 0)) {
0086 continue;
0087 }
0088
0089
0090 {
0091 CSCDetId cid;
0092 if (!config->fnGetCSCDetId(crateID, dmbSlot, cid)) {
0093 continue;
0094 }
0095 }
0096
0097
0098 config->incChamberCounter(DMB_EVENTS, crateID, dmbSlot);
0099 long DMBEvents = config->getChamberCounterValue(DMB_EVENTS, crateID, dmbSlot);
0100 config->copyChamberCounterValue(DMB_EVENTS, DMB_TRIGGERS, crateID, dmbSlot);
0101 cntDMBs++;
0102
0103 if (getEMUHisto(h::EMU_DMB_REPORTING, mo)) {
0104 mo->Fill(crateID, dmbSlot);
0105 }
0106
0107 unsigned int cscType = 0;
0108 unsigned int cscPosition = 0;
0109 if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition))
0110 continue;
0111
0112 if (cscPosition && getEMUHisto(h::EMU_CSC_REPORTING, mo)) {
0113 mo->Fill(cscPosition, cscType);
0114 }
0115
0116
0117 long payload = digi.getCSCPayload(chamberID);
0118 int cfeb_dav = (payload >> 7) & 0x7F;
0119 int cfeb_active = payload & 0x1F;
0120 cfeb_active |= ((payload >> 14) & 0x03) << 5;
0121 int alct_dav = (payload >> 5) & 0x1;
0122 int tmb_dav = (payload >> 6) & 0x1;
0123 int cfeb_dav_num = 0;
0124
0125 if (alct_dav == 0) {
0126 if (cscPosition && getEMUHisto(h::EMU_CSC_WO_ALCT, mo)) {
0127 mo->Fill(cscPosition, cscType);
0128 }
0129 if (getEMUHisto(h::EMU_DMB_WO_ALCT, mo)) {
0130 mo->Fill(crateID, dmbSlot);
0131 }
0132 }
0133
0134 if (tmb_dav == 0) {
0135 if (cscPosition && getEMUHisto(h::EMU_CSC_WO_CLCT, mo)) {
0136 mo->Fill(cscPosition, cscType);
0137 }
0138 if (getEMUHisto(h::EMU_DMB_WO_CLCT, mo)) {
0139 mo->Fill(crateID, dmbSlot);
0140 }
0141 }
0142
0143 if (cfeb_dav == 0) {
0144 if (cscPosition && getEMUHisto(h::EMU_CSC_WO_CFEB, mo)) {
0145 mo->Fill(cscPosition, cscType);
0146 }
0147 if (getEMUHisto(h::EMU_DMB_WO_CFEB, mo)) {
0148 mo->Fill(crateID, dmbSlot);
0149 }
0150 }
0151
0152
0153 for (int i = 0; i < 7; i++) {
0154 if ((cfeb_dav >> i) & 0x1)
0155 cntCFEBs++;
0156 }
0157
0158 if (alct_dav > 0) {
0159 cntALCTs++;
0160 }
0161
0162 if (tmb_dav > 0) {
0163 cntTMBs++;
0164 }
0165
0166 MonitorObject *mof = nullptr, *mo1 = nullptr, *mo2 = nullptr;
0167 if (getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_RATE, crateID, dmbSlot, mo) &&
0168 getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_FREQUENCY, crateID, dmbSlot, mof)) {
0169 if (getCSCHisto(h::CSC_DMB_CFEB_DAV_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mo1) &&
0170 getCSCHisto(h::CSC_DMB_CFEB_DAV, crateID, dmbSlot, mo2)) {
0171 for (int i = 1; i <= 7; i++) {
0172 double actual_dav_num = mo->GetBinContent(i);
0173 double unpacked_dav_num = mo2->GetBinContent(i);
0174 if (actual_dav_num) {
0175 mo1->SetBinContent(i, 1, 100. * (1 - unpacked_dav_num / actual_dav_num));
0176 }
0177 mo1->SetEntries((int)DMBEvents);
0178 }
0179 }
0180 for (int i = 0; i < 7; i++) {
0181 int cfeb_present = (cfeb_dav >> i) & 0x1;
0182 cfeb_dav_num += cfeb_present;
0183 if (cfeb_present) {
0184 mo->Fill(i);
0185 }
0186 float cfeb_entries = mo->GetBinContent(i + 1);
0187 mof->SetBinContent(i + 1, ((float)cfeb_entries / (float)(DMBEvents) * 100.0));
0188 }
0189 mof->SetEntries((int)DMBEvents);
0190 }
0191
0192 if (getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_MULTIPLICITY_RATE, crateID, dmbSlot, mo) &&
0193 getCSCHisto(h::CSC_ACTUAL_DMB_CFEB_DAV_MULTIPLICITY_FREQUENCY, crateID, dmbSlot, mof)) {
0194 for (unsigned short i = 1; i < 7; i++) {
0195 float cfeb_entries = mo->GetBinContent(i);
0196 mof->SetBinContent(i, ((float)cfeb_entries / (float)(DMBEvents) * 100.0));
0197 }
0198 mof->SetEntries((int)DMBEvents);
0199
0200 if (getCSCHisto(h::CSC_DMB_CFEB_DAV_MULTIPLICITY_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mo1) &&
0201 getCSCHisto(h::CSC_DMB_CFEB_DAV_MULTIPLICITY, crateID, dmbSlot, mo2)) {
0202 for (unsigned short i = 1; i < 9; i++) {
0203 float actual_dav_num = mo->GetBinContent(i);
0204 float unpacked_dav_num = mo2->GetBinContent(i);
0205 if (actual_dav_num) {
0206 mo1->SetBinContent(i, 1, 100. * (1 - unpacked_dav_num / actual_dav_num));
0207 }
0208 mo1->SetEntries((int)DMBEvents);
0209 }
0210 }
0211 mo->Fill(cfeb_dav_num);
0212 }
0213
0214 if (getCSCHisto(h::CSC_DMB_CFEB_ACTIVE_VS_DAV, crateID, dmbSlot, mo))
0215 mo->Fill(cfeb_dav, cfeb_active);
0216
0217
0218 if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_DAV_RATE, crateID, dmbSlot, mo)) {
0219 if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_DAV_FREQUENCY, crateID, dmbSlot, mo1)) {
0220 for (int i = 1; i < 4; i++) {
0221 float dav_num = mo->GetBinContent(i);
0222 mo1->SetBinContent(i, ((float)dav_num / (float)(DMBEvents) * 100.0));
0223 }
0224 mo1->SetEntries((int)DMBEvents);
0225
0226 if (getCSCHisto(h::CSC_DMB_FEB_DAV_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mof) &&
0227 getCSCHisto(h::CSC_DMB_FEB_DAV_RATE, crateID, dmbSlot, mo2)) {
0228 for (int i = 1; i < 4; i++) {
0229 float actual_dav_num = mo->GetBinContent(i);
0230 float unpacked_dav_num = mo2->GetBinContent(i);
0231 if (actual_dav_num) {
0232 mof->SetBinContent(i, 1, 100. * (1 - unpacked_dav_num / actual_dav_num));
0233 }
0234 mof->SetEntries((int)DMBEvents);
0235 mof->SetMaximum(100.0);
0236 }
0237 }
0238 }
0239
0240 if (alct_dav > 0) {
0241 mo->Fill(0.0);
0242 }
0243 if (tmb_dav > 0) {
0244 mo->Fill(1.0);
0245 }
0246 if (cfeb_dav > 0) {
0247 mo->Fill(2.0);
0248 }
0249 }
0250
0251 float feb_combination_dav = -1.0;
0252
0253 if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_COMBINATIONS_DAV_RATE, crateID, dmbSlot, mo)) {
0254 if (alct_dav == 0 && tmb_dav == 0 && cfeb_dav == 0)
0255 feb_combination_dav = 0.0;
0256 if (alct_dav > 0 && tmb_dav == 0 && cfeb_dav == 0)
0257 feb_combination_dav = 1.0;
0258 if (alct_dav == 0 && tmb_dav > 0 && cfeb_dav == 0)
0259 feb_combination_dav = 2.0;
0260 if (alct_dav == 0 && tmb_dav == 0 && cfeb_dav > 0)
0261 feb_combination_dav = 3.0;
0262 if (alct_dav == 0 && tmb_dav > 0 && cfeb_dav > 0)
0263 feb_combination_dav = 4.0;
0264 if (alct_dav > 0 && tmb_dav > 0 && cfeb_dav == 0)
0265 feb_combination_dav = 5.0;
0266 if (alct_dav > 0 && tmb_dav == 0 && cfeb_dav > 0)
0267 feb_combination_dav = 6.0;
0268 if (alct_dav > 0 && tmb_dav > 0 && cfeb_dav > 0)
0269 feb_combination_dav = 7.0;
0270
0271
0272 if (getCSCHisto(h::CSC_ACTUAL_DMB_FEB_COMBINATIONS_DAV_FREQUENCY, crateID, dmbSlot, mo1)) {
0273 for (int i = 1; i < 9; i++) {
0274 float feb_combination_dav_number = mo->GetBinContent(i);
0275 mo1->SetBinContent(i, ((float)feb_combination_dav_number / (float)(DMBEvents) * 100.0));
0276 }
0277 mo1->SetEntries(DMBEvents);
0278
0279 if (getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_UNPACKING_INEFFICIENCY, crateID, dmbSlot, mof) &&
0280 getCSCHisto(h::CSC_DMB_FEB_COMBINATIONS_DAV_RATE, crateID, dmbSlot, mo2)) {
0281 for (int i = 1; i < 9; i++) {
0282 float actual_dav_num = mo->GetBinContent(i);
0283 float unpacked_dav_num = mo2->GetBinContent(i);
0284 if (actual_dav_num) {
0285 mof->SetBinContent(i, 1, 100. * (1 - unpacked_dav_num / actual_dav_num));
0286 }
0287 mof->SetEntries((int)DMBEvents);
0288 mof->SetMaximum(100.0);
0289 }
0290 }
0291 }
0292 mo->Fill(feb_combination_dav);
0293 }
0294 }
0295 }
0296
0297
0298
0299 {
0300 uint32_t i = 0;
0301 CSCIdType chamberID = 0;
0302 while (digi.nextCSCWithStatus(i, chamberID)) {
0303 unsigned int crateID = (chamberID >> 4) & 0xFF;
0304 unsigned int dmbSlot = chamberID & 0xF;
0305 ExaminerStatusType chStatus = digi.getCSCStatus(chamberID);
0306
0307 if (crateID == 255) {
0308 continue;
0309 }
0310 if ((crateID > 60) || (dmbSlot > 10) || (crateID <= 0) || (dmbSlot <= 0)) {
0311 continue;
0312 }
0313
0314
0315 {
0316 CSCDetId cid;
0317 if (!config->fnGetCSCDetId(crateID, dmbSlot, cid)) {
0318 continue;
0319 }
0320 }
0321
0322 unsigned int cscType = 0;
0323 unsigned int cscPosition = 0;
0324 if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition))
0325 continue;
0326
0327 if (getCSCHisto(h::CSC_BINCHECK_DATAFLOW_PROBLEMS_TABLE, crateID, dmbSlot, mo)) {
0328 for (int bit = 0; bit < binChecker.nSTATUSES; bit++) {
0329 if (chStatus & (1 << bit)) {
0330 mo->Fill(0., bit);
0331 }
0332 }
0333 mo->SetEntries(config->getChamberCounterValue(DMB_EVENTS, crateID, dmbSlot));
0334 }
0335
0336 int anyInputFull = chStatus & 0x3F;
0337 if (anyInputFull) {
0338 if (cscPosition && getEMUHisto(h::EMU_CSC_DMB_INPUT_FIFO_FULL, mo)) {
0339 mo->Fill(cscPosition, cscType);
0340 }
0341 if (getEMUHisto(h::EMU_DMB_INPUT_FIFO_FULL, mo)) {
0342 mo->Fill(crateID, dmbSlot);
0343 }
0344 }
0345
0346 int anyInputTO = (chStatus >> 7) & 0x3FFF;
0347 if (anyInputTO) {
0348 if (cscPosition && getEMUHisto(h::EMU_CSC_DMB_INPUT_TIMEOUT, mo)) {
0349 mo->Fill(cscPosition, cscType);
0350 }
0351 if (getEMUHisto(h::EMU_DMB_INPUT_TIMEOUT, mo)) {
0352 mo->Fill(crateID, dmbSlot);
0353 }
0354 }
0355
0356 if (digi.getCSCStatus(chamberID) & (1 << 22)) {
0357 if (getEMUHisto(h::EMU_DMB_FORMAT_WARNINGS, mo)) {
0358 mo->Fill(crateID, dmbSlot);
0359 }
0360
0361 if (cscPosition && getEMUHisto(h::EMU_CSC_FORMAT_WARNINGS, mo)) {
0362 mo->Fill(cscPosition, cscType);
0363 }
0364 }
0365 }
0366 }
0367
0368
0369
0370 {
0371 uint32_t i = 0;
0372 CSCIdType chamberID = 0;
0373 while (digi.nextCSCWithError(i, chamberID)) {
0374 const unsigned int crateID = (chamberID >> 4) & 0xFF;
0375 const unsigned int dmbSlot = chamberID & 0xF;
0376 const ExaminerStatusType chErr = digi.getCSCErrors(chamberID);
0377
0378 if ((crateID == 255) || (chErr & 0x80)) {
0379 continue;
0380 }
0381 if ((crateID > 60) || (dmbSlot > 10) || (crateID <= 0) || (dmbSlot <= 0)) {
0382 continue;
0383 }
0384
0385
0386 {
0387 CSCDetId cid;
0388 if (!config->fnGetCSCDetId(crateID, dmbSlot, cid)) {
0389 continue;
0390 }
0391 }
0392
0393 if ((chErr & config->getBINCHECK_MASK()) != 0) {
0394 config->incChamberCounter(BAD_EVENTS, crateID, dmbSlot);
0395 }
0396
0397 bool isCSCError = false;
0398 bool fillBC = getCSCHisto(h::CSC_BINCHECK_ERRORSTAT_TABLE, crateID, dmbSlot, mo);
0399
0400 for (int bit = 5; bit < 24; bit++) {
0401 if (chErr & (1 << bit)) {
0402 isCSCError = true;
0403 if (fillBC) {
0404 mo->Fill(0., bit - 5);
0405 } else {
0406 break;
0407 }
0408 }
0409
0410 if (fillBC) {
0411 mo->SetEntries(config->getChamberCounterValue(DMB_EVENTS, crateID, dmbSlot));
0412 }
0413 }
0414
0415 if (isCSCError) {
0416 if (getEMUHisto(h::EMU_DMB_FORMAT_ERRORS, mo)) {
0417 mo->Fill(crateID, dmbSlot);
0418 }
0419
0420 if (eventAccepted && getEMUHisto(h::EMU_DMB_UNPACKED_WITH_ERRORS, mo)) {
0421 mo->Fill(crateID, dmbSlot);
0422 }
0423
0424 unsigned int cscType = 0;
0425 unsigned int cscPosition = 0;
0426 if (!getCSCFromMap(crateID, dmbSlot, cscType, cscPosition))
0427 continue;
0428
0429 if (cscPosition && getEMUHisto(h::EMU_CSC_FORMAT_ERRORS, mo)) {
0430 mo->Fill(cscPosition, cscType);
0431 }
0432
0433 if (eventAccepted && cscPosition && getEMUHisto(h::EMU_CSC_UNPACKED_WITH_ERRORS, mo)) {
0434 mo->Fill(cscPosition, cscType);
0435 }
0436 }
0437 }
0438 }
0439
0440 return eventAccepted;
0441 }
0442
0443 }