30 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
31 <<
"[DTDataIntegrityROSOffline]: Constructor" << endl;
47 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
48 <<
"[DTDataIntegrityROSOffline]: Destructor. Analyzed " <<
neventsFED <<
" events" << endl;
49 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
50 <<
"[DTDataIntegrityROSOffline]: postEndJob called!" << endl;
65 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
66 <<
"[DTDataIntegrityROSOffline]: postBeginJob" << endl;
68 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
69 <<
"[DTDataIntegrityROSOffline] Get DQMStore service" << endl;
73 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
90 for (
int ros = 1; ros <=
nROS; ++ros) {
104 int nFED = (fedMax - fedMin) + 1;
106 hFEDEntry = ibooker.
book1D(
"FEDEntries",
"# entries per DT FED", nFED, fedMin, fedMax + 1);
108 hFEDFatal = ibooker.
book1D(
"FEDFatal",
"# fatal errors DT FED", nFED, fedMin, fedMax + 1);
109 hFEDNonFatal = ibooker.
book1D(
"FEDNonFatal",
"# NON fatal errors DT FED", nFED, fedMin, fedMax + 1);
112 hTTSSummary = ibooker.
book2D(
"TTSSummary",
"Summary Status TTS", nFED, fedMin, fedMax + 1, 9, 1, 10);
126 ibooker.
book2D(
"DataCorruptionSummary",
"Data Corruption Sources", nFED, fedMin, fedMax + 1, 8, 1, 9);
139 string dduID_s = to_string(code.
getDDU());
140 string rosID_s = to_string(code.
getROS());
141 string robID_s = to_string(code.
getROB());
143 string wheel_s = to_string(
wheel);
145 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
146 <<
" Booking histos for FED: " << code.
getDDU() <<
" ROS: " << code.
getROS() <<
" ROB: " << code.
getROB()
147 <<
" folder: " <<
folder << endl;
156 ibooker.setCurrentFolder(
topFolder(
false) +
"FED" + dduID_s);
158 histoType =
"EventLength";
159 histoName =
"FED" + dduID_s +
"_" + histoType;
160 histoTitle =
"Event Length (Bytes) FED " + dduID_s;
163 histoType =
"ROSStatus";
164 histoName =
"FED" + dduID_s +
"_" + histoType;
167 histo->setBinLabel(1,
"ch.enabled", 1);
168 histo->setBinLabel(2,
"timeout", 1);
169 histo->setBinLabel(3,
"ev.trailer lost", 1);
170 histo->setBinLabel(4,
"opt.fiber lost", 1);
171 histo->setBinLabel(5,
"tlk.prop.error", 1);
172 histo->setBinLabel(6,
"tlk.pattern error", 1);
173 histo->setBinLabel(7,
"tlk.sign.lost", 1);
174 histo->setBinLabel(8,
"error from ROS", 1);
175 histo->setBinLabel(9,
"if ROS in events", 1);
176 histo->setBinLabel(10,
"Miss. Evt.", 1);
177 histo->setBinLabel(11,
"Evt. ID Mismatch", 1);
178 histo->setBinLabel(12,
"BX Mismatch", 1);
180 histo->setBinLabel(1,
"ROS 1", 2);
181 histo->setBinLabel(2,
"ROS 2", 2);
182 histo->setBinLabel(3,
"ROS 3", 2);
183 histo->setBinLabel(4,
"ROS 4", 2);
184 histo->setBinLabel(5,
"ROS 5", 2);
185 histo->setBinLabel(6,
"ROS 6", 2);
186 histo->setBinLabel(7,
"ROS 7", 2);
187 histo->setBinLabel(8,
"ROS 8", 2);
188 histo->setBinLabel(9,
"ROS 9", 2);
189 histo->setBinLabel(10,
"ROS 10", 2);
190 histo->setBinLabel(11,
"ROS 11", 2);
191 histo->setBinLabel(12,
"ROS 12", 2);
196 ibooker.setCurrentFolder(
topFolder(
false));
198 histoType =
"ROSSummary";
199 histoName =
"FED" + dduID_s +
"_ROSSummary";
200 string histoTitle =
"Summary Wheel" + wheel_s +
" (FED " + dduID_s +
")";
205 histo->setBinLabel(1,
"Link TimeOut", 1);
206 histo->setBinLabel(2,
"Ev.Id.Mis.", 1);
207 histo->setBinLabel(3,
"FIFO almost full", 1);
208 histo->setBinLabel(4,
"FIFO full", 1);
209 histo->setBinLabel(5,
"CEROS timeout", 1);
210 histo->setBinLabel(6,
"Max. wds", 1);
211 histo->setBinLabel(7,
"WO L1A FIFO", 1);
212 histo->setBinLabel(8,
"TDC parity err.", 1);
213 histo->setBinLabel(9,
"BX ID Mis.", 1);
214 histo->setBinLabel(10,
"TXP", 1);
215 histo->setBinLabel(11,
"L1A almost full", 1);
216 histo->setBinLabel(12,
"Ch. blocked", 1);
217 histo->setBinLabel(13,
"Ev. Id. Mis.", 1);
218 histo->setBinLabel(14,
"CEROS blocked", 1);
220 histo->setBinLabel(15,
"TDC Fatal", 1);
221 histo->setBinLabel(16,
"TDC RO FIFO ov.", 1);
222 histo->setBinLabel(17,
"TDC L1 buf. ov.", 1);
223 histo->setBinLabel(18,
"TDC L1A FIFO ov.", 1);
224 histo->setBinLabel(19,
"TDC hit err.", 1);
225 histo->setBinLabel(20,
"TDC hit rej.", 1);
227 histo->setBinLabel(1,
"ROS1", 2);
228 histo->setBinLabel(2,
"ROS2", 2);
229 histo->setBinLabel(3,
"ROS3", 2);
230 histo->setBinLabel(4,
"ROS4", 2);
231 histo->setBinLabel(5,
"ROS5", 2);
232 histo->setBinLabel(6,
"ROS6", 2);
233 histo->setBinLabel(7,
"ROS7", 2);
234 histo->setBinLabel(8,
"ROS8", 2);
235 histo->setBinLabel(9,
"ROS9", 2);
236 histo->setBinLabel(10,
"ROS10", 2);
237 histo->setBinLabel(11,
"ROS11", 2);
238 histo->setBinLabel(12,
"ROS12", 2);
242 ibooker.setCurrentFolder(
topFolder(
false) +
"FED" + dduID_s +
"/" +
folder + rosID_s);
244 histoType =
"ROSError";
246 histoTitle =
histoName +
" (ROBID error summary)";
251 histo->setBinLabel(1,
"Link TimeOut", 1);
252 histo->setBinLabel(2,
"Ev.Id.Mis.", 1);
253 histo->setBinLabel(3,
"FIFO almost full", 1);
254 histo->setBinLabel(4,
"FIFO full", 1);
255 histo->setBinLabel(5,
"CEROS timeout", 1);
256 histo->setBinLabel(6,
"Max. wds", 1);
257 histo->setBinLabel(7,
"TDC parity err.", 1);
258 histo->setBinLabel(8,
"BX ID Mis.", 1);
259 histo->setBinLabel(9,
"Ch. blocked", 1);
260 histo->setBinLabel(10,
"Ev. Id. Mis.", 1);
261 histo->setBinLabel(11,
"CEROS blocked", 1);
263 histo->setBinLabel(1,
"ROB0", 2);
264 histo->setBinLabel(2,
"ROB1", 2);
265 histo->setBinLabel(3,
"ROB2", 2);
266 histo->setBinLabel(4,
"ROB3", 2);
267 histo->setBinLabel(5,
"ROB4", 2);
268 histo->setBinLabel(6,
"ROB5", 2);
269 histo->setBinLabel(7,
"ROB6", 2);
270 histo->setBinLabel(8,
"ROB7", 2);
271 histo->setBinLabel(9,
"ROB8", 2);
272 histo->setBinLabel(10,
"ROB9", 2);
273 histo->setBinLabel(11,
"ROB10", 2);
274 histo->setBinLabel(12,
"ROB11", 2);
275 histo->setBinLabel(13,
"ROB12", 2);
276 histo->setBinLabel(14,
"ROB13", 2);
277 histo->setBinLabel(15,
"ROB14", 2);
278 histo->setBinLabel(16,
"ROB15", 2);
279 histo->setBinLabel(17,
"ROB16", 2);
280 histo->setBinLabel(18,
"ROB17", 2);
281 histo->setBinLabel(19,
"ROB18", 2);
282 histo->setBinLabel(20,
"ROB19", 2);
283 histo->setBinLabel(21,
"ROB20", 2);
284 histo->setBinLabel(22,
"ROB21", 2);
285 histo->setBinLabel(23,
"ROB22", 2);
286 histo->setBinLabel(24,
"ROB23", 2);
287 histo->setBinLabel(25,
"ROB24", 2);
288 histo->setBinLabel(26,
"SC", 2);
294 ibooker.setCurrentFolder(
topFolder(
false) +
"FED" + dduID_s);
297 histoType =
"SCSizeVsROSSize";
298 histoName =
"FED" + dduID_s +
"_SCSizeVsROSSize";
299 histoTitle =
"SC size vs SC (FED " + dduID_s +
")";
312 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
313 <<
"[DTDataIntegrityROSOffline]: " <<
neventsROS <<
" events analyzed by processROS25" << endl;
327 LogError(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
328 <<
"Trying to access non existing ME at ROSID " << code.
getROSID() << std::endl;
338 if (
data.getROSTrailer().TPX() != 0) {
339 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
340 <<
" TXP error en ROS " << code.
getROS() << endl;
345 if (
data.getROSTrailer().l1AFifoOccupancy() > 31) {
349 for (vector<DTROSErrorWord>::const_iterator error_it =
data.getROSErrors().begin();
350 error_it !=
data.getROSErrors().end();
353 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
354 <<
" Error in ROS " << code.
getROS() <<
" ROB Id " << (*error_it).robID() <<
" Error type "
355 << (*error_it).errorType() << endl;
358 ROSSummary->
Fill((*error_it).errorType(), code.
getROS());
359 if ((*error_it).errorType() <= 11) {
364 if ((*error_it).robID() != 31) {
365 ROSError->
Fill((*error_it).errorType(), (*error_it).robID());
366 }
else if ((*error_it).errorType() == 4) {
367 vector<int> channelBins;
369 vector<int>::const_iterator channelIt = channelBins.begin();
370 vector<int>::const_iterator channelEnd = channelBins.end();
371 for (; channelIt != channelEnd; ++channelIt) {
372 ROSError->
Fill(4, (*channelIt));
377 int ROSDebug_BunchNumber = -1;
379 for (vector<DTROSDebugWord>::const_iterator debug_it =
data.getROSDebugs().begin();
380 debug_it !=
data.getROSDebugs().end();
383 int debugROSSummary = 0;
384 int debugROSError = 0;
385 vector<int> debugBins;
386 bool hasEvIdMis =
false;
387 vector<int> evIdMisBins;
389 if ((*debug_it).debugType() == 0) {
390 ROSDebug_BunchNumber = (*debug_it).debugMessage();
391 }
else if ((*debug_it).debugType() == 1) {
394 }
else if ((*debug_it).debugType() == 2) {
397 }
else if ((*debug_it).debugType() == 3) {
398 if ((*debug_it).dontRead()) {
399 debugROSSummary = 11;
401 channelsInCEROS((*debug_it).cerosIdCerosStatus(), (*debug_it).dontRead(), debugBins);
403 if ((*debug_it).evIdMis()) {
405 channelsInCEROS((*debug_it).cerosIdCerosStatus(), (*debug_it).evIdMis(), evIdMisBins);
407 }
else if ((*debug_it).debugType() == 4 && (*debug_it).cerosIdRosStatus()) {
408 debugROSSummary = 13;
413 if (debugROSSummary) {
414 ROSSummary->
Fill(debugROSSummary, code.
getROS());
415 vector<int>::const_iterator channelIt = debugBins.begin();
416 vector<int>::const_iterator channelEnd = debugBins.end();
417 for (; channelIt != channelEnd; ++channelIt) {
418 ROSError->
Fill(debugROSError, (*channelIt));
424 vector<int>::const_iterator channelIt = evIdMisBins.begin();
425 vector<int>::const_iterator channelEnd = evIdMisBins.end();
426 for (; channelIt != channelEnd; ++channelIt) {
427 ROSError->
Fill(9, (*channelIt));
434 for (vector<DTROBHeader>::const_iterator rob_it =
data.getROBHeaders().begin(); rob_it !=
data.getROBHeaders().end();
437 code.
setROB((*rob_it).first);
442 if (robheader.
bunchID() != ROSDebug_BunchNumber) {
453 for (vector<DTTDCData>::const_iterator tdc_it =
data.getTDCData().begin(); tdc_it !=
data.getTDCData().end();
458 if (tdcDatum.
PC() != 0) {
459 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
460 <<
" PC error in ROS " << code.
getROS() <<
" TDC " << (*tdc_it).first << endl;
467 ROSError->
Fill(6, (*tdc_it).first);
472 for (vector<DTTDCError>::const_iterator tdc_it =
data.getTDCError().begin(); tdc_it !=
data.getTDCError().end();
475 code.
setROB((*tdc_it).first);
477 int tdcError_ROSSummary = 0;
478 int tdcError_ROSError = 0;
480 if (((*tdc_it).second).tdcError() & 0x4000) {
481 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
482 <<
" ROS " << code.
getROS() <<
" ROB " << code.
getROB() <<
" Internal fatal Error 4000 in TDC "
483 << (*tdc_it).first << endl;
485 tdcError_ROSSummary = 14;
486 tdcError_ROSError = 11;
488 }
else if (((*tdc_it).second).tdcError() & 0x0249) {
489 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
490 <<
" ROS " << code.
getROS() <<
" ROB " << code.
getROB() <<
" TDC FIFO overflow in TDC " << (*tdc_it).first
493 tdcError_ROSSummary = 15;
494 tdcError_ROSError = 12;
496 }
else if (((*tdc_it).second).tdcError() & 0x0492) {
497 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
498 <<
" ROS " << code.
getROS() <<
" ROB " << code.
getROB() <<
" TDC L1 buffer overflow in TDC "
499 << (*tdc_it).first << endl;
501 tdcError_ROSSummary = 16;
502 tdcError_ROSError = 13;
504 }
else if (((*tdc_it).second).tdcError() & 0x2000) {
505 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
506 <<
" ROS " << code.
getROS() <<
" ROB " << code.
getROB() <<
" TDC L1A FIFO overflow in TDC " << (*tdc_it).first
509 tdcError_ROSSummary = 17;
510 tdcError_ROSError = 14;
512 }
else if (((*tdc_it).second).tdcError() & 0x0924) {
513 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
514 <<
" ROS " << code.
getROS() <<
" ROB " << code.
getROB() <<
" TDC hit error in TDC " << (*tdc_it).first
517 tdcError_ROSSummary = 18;
518 tdcError_ROSError = 15;
520 }
else if (((*tdc_it).second).tdcError() & 0x1000) {
521 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
522 <<
" ROS " << code.
getROS() <<
" ROB " << code.
getROB() <<
" TDC hit rejected in TDC " << (*tdc_it).first
525 tdcError_ROSSummary = 19;
526 tdcError_ROSError = 16;
529 LogWarning(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
530 <<
" TDC error code not known " << ((*tdc_it).second).tdcError() << endl;
533 ROSSummary->
Fill(tdcError_ROSSummary, code.
getROS());
535 if (tdcError_ROSSummary <= 15) {
539 ROSError->
Fill(tdcError_ROSError, (*tdc_it).first);
546 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
547 <<
"[DTDataIntegrityROSOffline]: " <<
neventsFED <<
" events analyzed by processFED" << endl;
566 if (!trailer.
check()) {
573 if (
data.crcErrorBit()) {
585 int rosList = secondWord.
rosList();
586 set<int> rosPositions;
587 for (
int i = 0;
i < 12;
i++) {
589 rosPositions.insert(
i);
591 hROSStatus->
Fill(8,
i, 1);
597 for (vector<DTDDUFirstStatusWord>::const_iterator fsw_it =
data.getFirstStatusWord().begin();
598 fsw_it !=
data.getFirstStatusWord().end();
601 hROSStatus->
Fill(0, channel, (*fsw_it).channelEnabled());
602 hROSStatus->
Fill(1, channel, (*fsw_it).timeout());
603 hROSStatus->
Fill(2, channel, (*fsw_it).eventTrailerLost());
604 hROSStatus->
Fill(3, channel, (*fsw_it).opticalFiberSignalLost());
605 hROSStatus->
Fill(4, channel, (*fsw_it).tlkPropagationError());
606 hROSStatus->
Fill(5, channel, (*fsw_it).tlkPatternError());
607 hROSStatus->
Fill(6, channel, (*fsw_it).tlkSignalLost());
608 hROSStatus->
Fill(7, channel, (*fsw_it).errorFromROS());
610 if ((*fsw_it).channelEnabled() == 1 && rosPositions.find(channel) == rosPositions.end()) {
611 hROSStatus->
Fill(9, channel, 1);
623 if ((rosBXIds.size() > 1 || rosBXIds.find(
header.bxID()) == rosBXIds.end()) &&
625 for (vector<DTROS25Data>::const_iterator rosControlData = rosData.begin(); rosControlData != rosData.end();
627 for (vector<DTROSDebugWord>::const_iterator debug_it = (*rosControlData).getROSDebugs().begin();
628 debug_it != (*rosControlData).getROSDebugs().end();
630 if ((*debug_it).debugType() == 0 && (*debug_it).debugMessage() !=
header.bxID()) {
631 int ros = (*rosControlData).getROSID();
633 hROSStatus->
Fill(11, ros - 1);
645 LogWarning(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
646 <<
"ERROR: FED " << ddu <<
" BX ID different from other feds: " <<
header.bxID() << endl;
654 if ((rosL1AIds.size() > 1 || rosL1AIds.find(
header.lvl1ID() - 1) == rosL1AIds.end()) &&
655 !rosL1AIds.empty()) {
657 for (vector<DTROS25Data>::const_iterator rosControlData = rosData.begin(); rosControlData != rosData.end();
659 unsigned int ROSHeader_TTCCount =
660 ((*rosControlData).getROSHeader().TTCEventCounter() + 1) %
662 if (ROSHeader_TTCCount !=
header.lvl1ID()) {
663 int ros = (*rosControlData).getROSID();
664 hROSStatus->
Fill(10, ros - 1);
688 string folder =
"DT/00-DataIntegrity/";
694 for (
int iCh = 0; iCh < 6; ++iCh) {
695 if ((chMask >> iCh) & 0
x1) {
696 channels.push_back(cerosId * 6 + iCh);
703 for (
int iCeros = 0; iCeros < 5; ++iCeros) {
704 if ((cerosMask >> iCeros) & 0
x1) {
705 for (
int iCh = 0; iCh < 6; ++iCh) {
706 channels.push_back(iCeros * 6 + iCh);
717 LogTrace(
"DTRawToDigi|TDQM|DTMonitorModule|DTDataIntegrityROSOffline")
718 <<
"[DTDataIntegrityROSOffline]: preProcessEvent" << endl;
723 (*rosBxIds).second.clear();
730 (*rosL1AIds).second.clear();
743 std::vector<DTROS25Data> ros25Data;
745 for (
unsigned int i = 0;
i < dduProduct->size(); ++
i) {
746 dduData = dduProduct->at(
i);
747 ros25Data = ros25Product->at(
i);
749 int id =
header.sourceID();
754 for (
unsigned int j = 0;
j < ros25Data.size(); ++
j) {