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);
142 int wheel = (code.
getDDUID() - 770) % 5 - 2;
145 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
146 <<
" Booking histos for FED: " << code.
getDDU() <<
" ROS: " << code.
getROS() <<
" ROB: " << code.
getROB()
147 <<
" folder: " << folder << endl;
155 if (folder ==
"DDU") {
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;
195 if (folder ==
"ROS_S") {
198 histoType =
"ROSSummary";
199 histoName =
"FED" + dduID_s +
"_ROSSummary";
200 string histoTitle =
"Summary Wheel" + wheel_s +
" (FED " + dduID_s +
")";
241 if (folder ==
"ROS") {
244 histoType =
"ROSError";
245 histoName =
"FED" + dduID_s +
"_" + folder + rosID_s +
"_ROSError";
246 histoTitle = histoName +
" (ROBID error summary)";
292 if (folder ==
"SC") {
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;
339 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityROSOffline")
340 <<
" TXP error en ROS " << code.
getROS() << endl;
349 for (vector<DTROSErrorWord>::const_iterator error_it = data.
getROSErrors().begin();
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();
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));
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;
560 if (!header.
check()) {
566 if (!trailer.
check()) {
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();
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) & 0x1) {
696 channels.push_back(cerosId * 6 + iCh);
703 for (
int iCeros = 0; iCeros < 5; ++iCeros) {
704 if ((cerosMask >> iCeros) & 0x1) {
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);
754 for (
unsigned int j = 0;
j < ros25Data.size(); ++
j) {
T getUntrackedParameter(std::string const &, T const &) const
const std::vector< DTROBHeader > & getROBHeaders() const
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
const edm::EventSetup & c
void bookHistosROS25(DQMStore::IBooker &, DTROChainCoding code)
const std::vector< DTTDCData > & getTDCData() const
virtual void setCurrentFolder(std::string const &fullpath)
void analyze(const edm::Event &e, const edm::EventSetup &c) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::map< std::string, std::map< int, MonitorElement * > > summaryHistos
int l1AFifoOccupancy() const
void processFED(DTDDUData &dduData, const std::vector< DTROS25Data > &rosData, int dduID)
std::string to_string(const V &value)
bool check() const
Check that the trailer is OK.
Log< level::Error, false > LogError
uint32_t fragmentLength() const
The length of the event fragment counted in 64-bit words including header and trailer.
void fedNonFatal(int dduID)
edm::EDGetTokenT< DTROS25Collection > ros25Token
const std::vector< DTROSDebugWord > & getROSDebugs() const
edm::EDGetTokenT< DTDDUCollection > dduToken
const std::vector< DTDDUFirstStatusWord > & getFirstStatusWord() const
std::map< int, std::set< int > > rosL1AIdsPerFED
const DTROSTrailerWord & getROSTrailer() const
const DTROSHeaderWord & getROSHeader() const
~DTDataIntegrityROSOffline() override
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)
std::string topFolder(bool isFEDIntegrity) const
const FEDTrailer & getDDUTrailer() const
MonitorElement * hTTSSummary
MonitorElement * hFEDNonFatal
const FEDHeader & getDDUHeader() const
Getters.
void setROB(const int &ID)
void bookHistos(DQMStore::IBooker &, const int fedMin, const int fedMax)
std::string fedIntegrityFolder
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
void setROS(const int &ID)
MonitorElement * nEventMonitor
std::map< std::string, std::map< int, MonitorElement * > > fedHistos
DTDataIntegrityROSOffline(const edm::ParameterSet &ps)
void setDDU(const int &ID)
need to reset the bits before setting
char data[epos_bytes_allocation]
const std::vector< DTROSErrorWord > & getROSErrors() const
std::map< std::string, std::map< int, MonitorElement * > > rosHistos
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
void channelsInCEROS(int cerosId, int chMask, std::vector< int > &channels)
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
std::map< int, std::set< int > > rosBxIdsPerFED
const std::vector< DTTDCError > & getTDCError() const
const DTDDUSecondStatusWord & getSecondStatusWord() const
MonitorElement * hFEDFatal
void processROS25(DTROS25Data &data, int dduID, int ros)
void channelsInROS(int cerosMask, std::vector< int > &channels)
MonitorElement * hFEDEntry
MonitorElement * hCorruptionSummary
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)