45 #include "DQM/SiStripMonitorHardware/interface/FEDErrors.hh"
118 : rawDataTag_(iConfig.getParameter<
edm::
InputTag>(
"RawDataTag")),
119 dirName_(iConfig.getUntrackedParameter<
std::
string>(
"DirName",
"SiStrip/FEDIntegrity/")),
120 printDebug_(iConfig.getUntrackedParameter<
bool>(
"PrintDebugMessages",
false)),
121 doPLOTfedsPresent_(iConfig.getParameter<
bool>(
"doPLOTfedsPresent")),
122 doPLOTfedFatalErrors_(iConfig.getParameter<
bool>(
"doPLOTfedFatalErrors")),
123 doPLOTfedNonFatalErrors_(iConfig.getParameter<
bool>(
"doPLOTfedNonFatalErrors")),
124 doPLOTnFEDinVsLS_(iConfig.getParameter<
bool>(
"doPLOTnFEDinVsLS")),
125 doPLOTnFEDinWdataVsLS_(iConfig.getParameter<
bool>(
"doPLOTnFEDinWdataVsLS")),
126 fedsPresent_(nullptr),
127 fedFatalErrors_(nullptr),
128 fedNonFatalErrors_(nullptr),
129 nFEDinVsLS_(nullptr),
130 nFEDinWdataVsLS_(nullptr),
131 updateFrequency_(iConfig.getUntrackedParameter<unsigned
int>(
"HistogramUpdateFrequency", 0)),
132 fedsPresentBinContents_(
FEDNumbering::MAXSiStripFEDID + 1, 0),
133 fedFatalErrorBinContents_(
FEDNumbering::MAXSiStripFEDID + 1, 0),
134 fedNonFatalErrorBinContents_(
FEDNumbering::MAXSiStripFEDID + 1, 0),
136 doPayloadChecks_(iConfig.getUntrackedParameter<
bool>(
"DoPayloadChecks",
true)),
137 checkChannelLengths_(iConfig.getUntrackedParameter<
bool>(
"CheckChannelLengths",
true)),
138 checkPacketCodes_(iConfig.getUntrackedParameter<
bool>(
"CheckChannelPacketCodes",
true)),
139 checkFELengths_(iConfig.getUntrackedParameter<
bool>(
"CheckFELengths",
true)),
140 checkChannelStatusBits_(iConfig.getUntrackedParameter<
bool>(
"CheckChannelStatus",
true)),
141 verbose_(iConfig.getUntrackedParameter<
bool>(
"verbose",
false)),
145 std::stringstream
ss;
146 ss <<
"Payload checks are disabled but individual payload checks have been enabled. The following payload checks "
149 ss <<
"Channel length check, ";
151 ss <<
"Channel packet code check, ";
153 ss <<
"Cabled channel status bits checks, ";
155 ss <<
"FE Unit legnth check";
185 std::cout <<
"[SiStripFEDCheckPlugin::analyze] gotData ? " << (gotData ?
"YES" :
"NOPE") << std::endl;
193 FEDErrors lFedErrors;
197 size_t nFEDinWdata = 0;
206 if (!fedData.
size() || !fedData.
data()) {
215 std::cout <<
" fedData.data(): " << fedData.
data() << std::endl;
218 if (fedData.
size() && fedData.
data())
226 bool hasFatalErrors =
false;
227 float rateNonFatal = 0;
229 std::unique_ptr<const sistrip::FEDBuffer>
buffer;
231 if (!lFedErrors.fillFatalFEDErrors(fedData, 0)) {
232 hasFatalErrors =
true;
238 throw cms::Exception(
"FEDBuffer") << st_buffer <<
" (check debug output for more details)";
240 auto tmp_buffer = std::make_unique<sistrip::FEDBuffer>(fedData,
true);
241 tmp_buffer->findChannels();
247 if (!channelLengthsOK || !channelPacketCodesOK || !feLengthsOK) {
248 hasFatalErrors =
true;
252 rateNonFatal = lFedErrors.fillNonFatalFEDErrors(
buffer.get(),
cabling_);
256 if (hasFatalErrors) {
262 throw cms::Exception(
"FEDBuffer") << st_buffer <<
" (check debug output for more details)";
264 auto tmp_buffer = std::make_unique<sistrip::FEDBuffer>(fedData,
true);
265 tmp_buffer->findChannels();
268 edm::LogInfo(
"SiStripFEDCheck") <<
"Fatal error with FED ID " <<
fedId <<
". Check summary: " << std::endl
269 <<
buffer->checkSummary() << std::endl;
270 std::stringstream
ss;
282 throw cms::Exception(
"FEDBuffer") << st_buffer <<
" (check debug output for more details)";
284 auto tmp_buffer = std::make_unique<sistrip::FEDBuffer>(fedData,
true);
285 tmp_buffer->findChannels();
288 edm::LogInfo(
"SiStripFEDCheck") <<
"Non-fatal error with FED ID " <<
fedId <<
" for " << rateNonFatal
289 <<
" of the channels. Check summary: " << std::endl
290 <<
buffer->checkSummary() << std::endl;
291 std::stringstream
ss;
298 std::cout <<
"nFEDin: " << nFEDin <<
" nFEDinWdata: " << nFEDinWdata << std::endl;
321 ibooker.
book1D(
"FEDEntries",
"Number of times FED buffer is present in data", nFED, xFEDmin, xFEDmax);
326 fedFatalErrors_ = ibooker.
book1D(
"FEDFatal",
"Number of fatal errors in FED buffer", nFED, xFEDmin, xFEDmax);
332 ibooker.
book1D(
"FEDNonFatal",
"Number of non fatal errors in FED buffer", nFED, xFEDmin, xFEDmax);
349 "nFEDinWdataVsLS",
"number of FED in (with data) Vs LS",
LSBin,
LSMin,
LSMax, nFED, xFEDmin, xFEDmax);
391 if (nonFatalError > 0)
394 if (nonFatalError > 0)
411 unsigned int entriesFedsPresent = 0;
412 unsigned int entriesFatalErrors = 0;
413 unsigned int entriesNonFatalErrors = 0;
418 entriesFedsPresent += fedsPresentBin;
422 entriesFatalErrors += fedFatalErrorsBin;
426 entriesNonFatalErrors += fedNonFatalErrorsBin;
445 desc.addUntracked<
unsigned int>(
"HistogramUpdateFrequency", 1000);
447 desc.addUntracked<
bool>(
"PrintDebugMessages",
false);
448 desc.add<
bool>(
"doPLOTfedsPresent",
true);
449 desc.add<
bool>(
"doPLOTfedFatalErrors",
true);
450 desc.add<
bool>(
"doPLOTfedNonFatalErrors",
true);
451 desc.add<
bool>(
"doPLOTnFEDinVsLS",
false);
452 desc.add<
bool>(
"doPLOTnFEDinWdataVsLS",
false);
454 desc.addUntracked<
bool>(
"WriteDQMStore",
false);
456 desc.addUntracked<
bool>(
"DoPayloadChecks",
true);
458 desc.addUntracked<
bool>(
"CheckChannelLengths",
true);
460 desc.addUntracked<
bool>(
"CheckChannelPacketCodes",
true);
462 desc.addUntracked<
bool>(
"CheckFELengths",
true);
464 desc.addUntracked<
bool>(
"CheckChannelStatus",
true);
465 desc.add<
int>(
"LSBin", 5000);
466 desc.add<
double>(
"LSMin", 0.5);
467 desc.add<
double>(
"LSMax", 5000.5);