31 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") <<
"[DTDataIntegrityTask]: Constructor" << endl;
56 <<
" invalid! Must be Online, SM, Offline or HLT !" << endl;
62 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
63 <<
"[DTDataIntegrityTask]: Destructor. Analyzed " << neventsFED <<
" events" << endl;
64 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
65 <<
"[DTDataIntegrityTask]: postEndJob called!" << endl;
81 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") <<
"[DTDataIntegrityTask]: postBeginJob" << endl;
83 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
84 <<
"[DTDataIntegrityTask] Get DQMStore service" << endl;
88 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
103 for (
int uRos = 1; uRos <=
NuROS; ++uRos) {
109 for (
int ros = 1; ros <=
NuROS; ++ros) {
124 int nFED = (fedMax - fedMin) + 1;
126 hFEDEntry = ibooker.
book1D(
"FEDEntries",
"# entries per DT FED", nFED, fedMin, fedMax + 1);
127 hFEDFatal = ibooker.
book1D(
"FEDFatal",
"# fatal errors DT FED", nFED, fedMin, fedMax + 1);
132 string histoType =
"ROSSummary";
135 string histoName =
"ROSSummary_W" + wheel_s;
141 string histoTitle =
"Summary Wheel" + wheel_s +
" (FED " + fed_s +
")";
145 histo->setBinLabel(1,
"Error 1", 1);
146 histo->setBinLabel(2,
"Error 2", 1);
147 histo->setBinLabel(3,
"Error 3", 1);
148 histo->setBinLabel(4,
"Error 4", 1);
149 histo->setBinLabel(5,
"Not OKflag", 1);
151 histo->setBinLabel(6,
"TDC Fatal", 1);
152 histo->setBinLabel(7,
"TDC RO FIFO ov.", 1);
153 histo->setBinLabel(8,
"TDC L1 buf. ov.", 1);
154 histo->setBinLabel(9,
"TDC L1A FIFO ov.", 1);
155 histo->setBinLabel(10,
"TDC hit err.", 1);
156 histo->setBinLabel(11,
"TDC hit rej.", 1);
158 histo->setBinLabel(1,
"Sector1", 2);
159 histo->setBinLabel(2,
"Sector2", 2);
160 histo->setBinLabel(3,
"Sector3", 2);
161 histo->setBinLabel(4,
"Sector4", 2);
162 histo->setBinLabel(5,
"Sector5", 2);
163 histo->setBinLabel(6,
"Sector6", 2);
164 histo->setBinLabel(7,
"Sector7", 2);
165 histo->setBinLabel(8,
"Sector8", 2);
166 histo->setBinLabel(9,
"Sector9", 2);
167 histo->setBinLabel(10,
"Sector10", 2);
168 histo->setBinLabel(11,
"Sector11", 2);
169 histo->setBinLabel(12,
"Sector12", 2);
174 string wheel =
"ZERO";
180 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
181 <<
" Booking histos for FED: " << fed_s <<
" folder: " <<
folder << endl;
192 histoType =
"EventLength";
193 histoName =
"FED" + fed_s +
"_" + histoType;
194 histoTitle =
"Event Length (Bytes) FED " + fed_s;
200 histoType =
"uROSStatus";
201 histoName =
"FED" + fed_s +
"_" + histoType;
205 histo->setBinLabel(1,
"Error G 1", 1);
206 histo->setBinLabel(2,
"Error G 2", 1);
207 histo->setBinLabel(3,
"Error G 3", 1);
208 histo->setBinLabel(4,
"Error G 4", 1);
209 histo->setBinLabel(5,
"Error G 5", 1);
210 histo->setBinLabel(6,
"Error G 6", 1);
211 histo->setBinLabel(7,
"Error G 7", 1);
212 histo->setBinLabel(8,
"Error G 8", 1);
213 histo->setBinLabel(9,
"Error G 9", 1);
214 histo->setBinLabel(10,
"Error G 10", 1);
215 histo->setBinLabel(11,
"Error G 11", 1);
216 histo->setBinLabel(12,
"Error G 12", 1);
218 histo->setBinLabel(1,
"uROS 1", 2);
219 histo->setBinLabel(2,
"uROS 2", 2);
220 histo->setBinLabel(3,
"uROS 3", 2);
221 histo->setBinLabel(4,
"uROS 4", 2);
222 histo->setBinLabel(5,
"uROS 5", 2);
223 histo->setBinLabel(6,
"uROS 6", 2);
224 histo->setBinLabel(7,
"uROS 7", 2);
225 histo->setBinLabel(8,
"uROS 8", 2);
226 histo->setBinLabel(9,
"uROS 9", 2);
227 histo->setBinLabel(10,
"uROS 10", 2);
228 histo->setBinLabel(11,
"uROS 11", 2);
229 histo->setBinLabel(12,
"uROS 12", 2);
233 histoType =
"FEDAvgEvLengthvsLumi";
234 histoName =
"FED" + fed_s +
"_" + histoType;
235 histoTitle =
"Avg Event Length (Bytes) vs LumiSec FED " + fed_s;
251 histoType =
"uROSList";
252 histoName =
"FED" + fed_s +
"_" + histoType;
253 histoTitle =
"# of uROS in the FED payload (FED" + fed_s +
")";
258 histoTitle =
"Distrib. BX ID (FED" + fed_s +
")";
270 histoType =
"uROSSummary";
271 histoName =
"FED" + fed_s +
"_uROSSummary";
272 string histoTitle =
"Summary Wheel" +
wheel +
" (FED " + fed_s +
")";
278 histo->setBinLabel(1,
"Error G 1", 1);
279 histo->setBinLabel(2,
"Error G 2", 1);
280 histo->setBinLabel(3,
"Error G 3", 1);
281 histo->setBinLabel(4,
"Error G 4", 1);
282 histo->setBinLabel(5,
"Error G 5", 1);
283 histo->setBinLabel(6,
"Error G 6", 1);
284 histo->setBinLabel(7,
"Error G 7", 1);
285 histo->setBinLabel(8,
"Error G 8", 1);
286 histo->setBinLabel(9,
"Error G 9", 1);
287 histo->setBinLabel(10,
"Error G 10", 1);
288 histo->setBinLabel(11,
"Error G 11", 1);
289 histo->setBinLabel(12,
"Error G 12", 1);
291 histo->setBinLabel(1,
"uROS1", 2);
292 histo->setBinLabel(2,
"uROS2", 2);
293 histo->setBinLabel(3,
"uROS3", 2);
294 histo->setBinLabel(4,
"uROS4", 2);
295 histo->setBinLabel(5,
"uROS5", 2);
296 histo->setBinLabel(6,
"uROS6", 2);
297 histo->setBinLabel(7,
"uROS7", 2);
298 histo->setBinLabel(8,
"uROS8", 2);
299 histo->setBinLabel(9,
"uROS9", 2);
300 histo->setBinLabel(10,
"uROS10", 2);
301 histo->setBinLabel(11,
"uROS11", 2);
302 histo->setBinLabel(12,
"uROS12", 2);
311 string histoType =
"ROSError";
314 int linkUp = linkDown + 24;
316 string histoName =
"W" + wheel_s +
"_" +
"Sector" + ros_s +
"_" + histoType;
317 string histoTitle =
histoName +
" (Channel " + linkDown_s +
"-" + linkUp_s +
" error summary)";
327 histo->setBinLabel(1,
"Error 1", 1);
328 histo->setBinLabel(2,
"Error 2", 1);
329 histo->setBinLabel(3,
"Error 3", 1);
330 histo->setBinLabel(4,
"Error 4", 1);
331 histo->setBinLabel(5,
"Not OKFlag", 1);
334 histo->setBinLabel(6,
"TDC Fatal", 1);
335 histo->setBinLabel(7,
"TDC RO FIFO ov.", 1);
336 histo->setBinLabel(8,
"TDC L1 buf. ov.", 1);
337 histo->setBinLabel(9,
"TDC L1A FIFO ov.", 1);
338 histo->setBinLabel(10,
"TDC hit err.", 1);
339 histo->setBinLabel(11,
"TDC hit rej.", 1);
341 for (
int link = linkDown; link < linkUp; ++link) {
356 if (link > 18 && link < 22)
358 else if (link == 22 || link == 23) {
365 if (ros == 9 && (link == 22 || link == 23)) {
372 if (link > 18 && link < 22)
374 else if (link == 22 || link == 23)
379 if (ros == 11 && (link == 22 || link == 23)) {
387 histo->setBinLabel(link + 1,
"S" + sector_s +
" MB" + st_s +
" ROB" + rob_s, 2);
391 string label25[12] = {
"S1 MB4 ROB5",
403 histo->setBinLabel(link25 + 1, label25[ros - 1], 2);
408 histoType =
"TDCError";
411 linkUp = linkDown + 24;
413 histoName =
"W" + wheel_s +
"_" +
"Sector" + ros_s +
"_" + histoType;
414 histoTitle =
histoName +
" (Channel " + linkDown_s +
"-" + linkUp_s +
" error summary)";
419 histo->setBinLabel(1,
"Fatal", 1);
420 histo->setBinLabel(2,
"RO FIFO ov.", 1);
421 histo->setBinLabel(3,
"L1 buf. ov.", 1);
422 histo->setBinLabel(4,
"L1A FIFO ov.", 1);
423 histo->setBinLabel(5,
"hit err.", 1);
424 histo->setBinLabel(6,
"hit rej.", 1);
425 histo->setBinLabel(7,
"Fatal", 1);
426 histo->setBinLabel(8,
"RO FIFO ov.", 1);
427 histo->setBinLabel(9,
"L1 buf. ov.", 1);
428 histo->setBinLabel(10,
"L1A FIFO ov.", 1);
429 histo->setBinLabel(11,
"hit err.", 1);
430 histo->setBinLabel(12,
"hit rej.", 1);
431 histo->setBinLabel(13,
"Fatal", 1);
432 histo->setBinLabel(14,
"RO FIFO ov.", 1);
433 histo->setBinLabel(15,
"L1 buf. ov.", 1);
434 histo->setBinLabel(16,
"L1A FIFO ov.", 1);
435 histo->setBinLabel(17,
"hit err.", 1);
436 histo->setBinLabel(18,
"hit rej.", 1);
437 histo->setBinLabel(19,
"Fatal", 1);
438 histo->setBinLabel(20,
"RO FIFO ov.", 1);
439 histo->setBinLabel(21,
"L1 buf. ov.", 1);
440 histo->setBinLabel(22,
"L1A FIFO ov.", 1);
441 histo->setBinLabel(23,
"hit err.", 1);
442 histo->setBinLabel(24,
"hit rej.", 1);
444 for (
int link = linkDown; link < linkUp; ++link) {
459 if (link > 18 && link < 22)
461 else if (link == 22 || link == 23) {
468 if (ros == 9 && (link == 22 || link == 23))
473 if (link > 18 && link < 22)
475 else if (link == 22 || link == 23)
480 if (ros == 11 && (link == 22 || link == 23)) {
488 histo->setBinLabel(link + 1,
"S" + sector_s +
" MB" + st_s +
" ROB" + rob_s, 2);
492 histo->setBinLabel(link25 + 1, label25[ros - 1], 2);
504 string histoType =
"uROSEventLength";
505 string histoName =
"FED" + fed_s +
"_uROS" + uRos_s +
"_" +
"EventLength";
506 string histoTitle =
"Event Length (Bytes) FED " + fed_s +
" uROS" + uRos_s;
510 histoType =
"uROSAvgEventLengthvsLumi";
511 histoName =
"FED" + fed_s +
"_ROS" + uRos_s +
"AvgEventLengthvsLumi";
512 histoTitle =
"Event Length (Bytes) FED " + fed_s +
" ROS" + uRos_s;
516 histoType =
"TTSValues";
517 histoName =
"FED" + fed_s +
"_" +
"uROS" + uRos_s +
"_" + histoType;
521 histo->setBinLabel(1,
"Overflow Warning ", 1);
522 histo->setBinLabel(2,
"Busy", 1);
523 histo->setBinLabel(3,
"Ready", 1);
524 histo->setBinLabel(4,
"Unknown", 1);
531 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
532 <<
"[DTDataIntegrityTask]: " << neventsuROS <<
" events analyzed by processuROS" << endl;
541 unsigned int slotMap = (
data.getboardId()) & 0xF;
544 unsigned int ros =
theROS(slotMap, 0);
545 int ddu =
theDDU(fed, slotMap, 0,
false);
546 int wheel = (ddu - 770) % 5 - 2;
562 uROSStatus =
fedHistos[
"uROSStatus"][fed];
564 LogError(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
565 <<
"Trying to access non existing ME at FED " << fed << std::endl;
574 if ((!uROSError2) || (!uROSError1) || (!uROSError0)) {
575 LogError(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
576 <<
"Trying to access non existing ME at uROS " << uRos << std::endl;
582 for (
unsigned int link = 0; link < 72; ++link) {
591 }
else if (link < 48) {
592 if ((link == 46 || link == 57) && ros == 10)
597 if ((link == 46 || link == 57) && ros == 10)
602 }
else if (link < 72) {
614 for (
unsigned int link = 0; link < 12; ++link) {
631 LogError(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
632 <<
"Trying to access non existing ME at uROS " << uRos << std::endl;
659 for (
unsigned int iros = ros - 1; iros < (ros + 2); ++iros) {
660 for (
unsigned int bin = 0;
bin < 5; ++
bin) {
669 for (
unsigned int icounter = 0; icounter <
data.geterrors().size(); ++icounter) {
670 int link =
data.geterrorROBID(icounter);
671 int tdc =
data.geterrorTDCID(icounter);
673 int tdcError_ROSSummary = 0;
674 int tdcError_ROSError = 0;
675 int tdcError_TDCHisto = 0;
677 if (
error & 0x4000) {
678 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
679 <<
" ROS " << uRos <<
" ROB " << link <<
" Internal fatal Error 4000 in TDC " <<
error << endl;
681 tdcError_ROSSummary = 5;
682 tdcError_ROSError = 5;
683 tdcError_TDCHisto = 0;
685 }
else if (
error & 0x0249) {
686 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
687 <<
" ROS " << uRos <<
" ROB " << link <<
" TDC FIFO overflow in TDC " <<
error << endl;
689 tdcError_ROSSummary = 6;
690 tdcError_ROSError = 6;
691 tdcError_TDCHisto = 1;
693 }
else if (
error & 0x0492) {
694 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
695 <<
" ROS " << uRos <<
" ROB " << link <<
" TDC L1 buffer overflow in TDC " <<
error << endl;
697 tdcError_ROSSummary = 7;
698 tdcError_ROSError = 7;
699 tdcError_TDCHisto = 2;
701 }
else if (
error & 0x2000) {
702 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
703 <<
" ROS " << uRos <<
" ROB " << link <<
" TDC L1A FIFO overflow in TDC " <<
error << endl;
705 tdcError_ROSSummary = 8;
706 tdcError_ROSError = 8;
707 tdcError_TDCHisto = 3;
709 }
else if (
error & 0x0924) {
710 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
711 <<
" uROS " << uRos <<
" ROB " << link <<
" TDC hit error in TDC " <<
error << endl;
713 tdcError_ROSSummary = 9;
714 tdcError_ROSError = 9;
715 tdcError_TDCHisto = 4;
717 }
else if (
error & 0x1000) {
718 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
719 <<
" uROS " << uRos <<
" ROB " << link <<
" TDC hit rejected in TDC " <<
error << endl;
721 tdcError_ROSSummary = 10;
722 tdcError_ROSError = 10;
723 tdcError_TDCHisto = 5;
726 LogWarning(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
727 <<
" TDC error code not known " <<
error << endl;
732 if (tdcError_ROSSummary == 5)
737 ROSSummary->
Fill(tdcError_ROSSummary,
sector - 1);
749 if (tdcError_ROSSummary == 5)
752 ROSSummary->
Fill(tdcError_ROSSummary, ros);
753 }
else if (link < 48) {
754 if (tdcError_ROSSummary == 5) {
755 if ((link == 46 || link == 57) && ros == 10)
761 if ((link == 46 || link == 57) && ros == 10)
762 ROSSummary->
Fill(tdcError_ROSSummary, sector4);
764 ROSSummary->
Fill(tdcError_ROSSummary, ros + 1);
766 }
else if (link < 72) {
767 if (tdcError_ROSSummary == 5)
770 ROSSummary->
Fill(tdcError_ROSSummary, ros + 2);
775 uROSError0->
Fill(tdcError_ROSError, link);
777 if ((link == 46 || link == 57) && ros == 10)
778 uROSError1->
Fill(tdcError_ROSError, sector4);
780 uROSError1->
Fill(tdcError_ROSError, link - 24);
782 uROSError2->
Fill(tdcError_ROSError, link - 48);
799 int ttsCodeValue = -1;
815 LogError(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
816 <<
"[DTDataIntegrityTask] FED User control: wrong TTS value " <<
value <<
" in FED " << fed <<
" uROS " 825 int uRosEventLength = (
data.gettrailer() & 0xFFFFF) * 8;
828 if (uRosEventLength > 5000)
829 uRosEventLength = 5000;
837 if (neventsFED % 1000 == 0)
838 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
839 <<
"[DTDataIntegrityTask]: " << neventsFED <<
" events analyzed by processFED" << endl;
842 if (fed < FEDIDmin || fed >
FEDIDmax)
852 int fedEvtLength =
data.getevtlgth() * 8;
854 fedHistos[
"EventLength"][fed]->Fill(fedEvtLength);
857 fedTimeHistos[
"FEDAvgEvLengthvsLumi"][fed]->accumulateValueTimeSlot(fedEvtLength);
913 float sumTDC = 0., sumNotOKFlag = 0.;
914 for (
int ros = 0; ros < 12; ros++) {
921 for (
int ros = 0; ros < 12; ros++) {
928 sumNotOKFlag = sumNotOKFlag / ((
wheel != 0) ? 2. : 1.);
929 sumTDC = sumTDC / ((
wheel != 0) ? 2. : 1.);
939 folder =
"DT/00-DataIntegrity/";
946 return std::make_shared<dtdi::LumiCache>();
950 int lumiBlock =
ls.id().luminosityBlock();
951 const auto nEventsLS = luminosityBlockCache(
ls.index())->nEventsLS;
953 map<string, map<int, DTTimeEvolutionHisto*> >::iterator fedIt =
fedTimeHistos.begin();
954 map<string, map<int, DTTimeEvolutionHisto*> >::iterator fedEnd =
fedTimeHistos.end();
955 for (; fedIt != fedEnd; ++fedIt) {
956 map<int, DTTimeEvolutionHisto*>::iterator histoIt = fedIt->second.begin();
957 map<int, DTTimeEvolutionHisto*>::iterator histoEnd = fedIt->second.end();
958 for (; histoIt != histoEnd; ++histoIt) {
959 histoIt->second->updateTimeSlot(lumiBlock, nEventsLS);
963 map<unsigned int, DTTimeEvolutionHisto*>::iterator urosIt =
urosTimeHistos.begin();
964 map<unsigned int, DTTimeEvolutionHisto*>::iterator urosEnd =
urosTimeHistos.end();
965 for (; urosIt != urosEnd; ++urosIt) {
966 urosIt->second->updateTimeSlot(lumiBlock, nEventsLS);
973 luminosityBlockCache(
e.getLuminosityBlock().index())->nEventsLS++;
978 LogTrace(
"DTRawToDigi|TDQM|DTMonitorModule|DTDataIntegrityTask") <<
"[DTDataIntegrityTask]: preProcessEvent" << endl;
987 for (
unsigned int j = 0;
j < fedCol->size(); ++
j) {
988 fedData = fedCol->at(
j);
989 int fed = fedData.
getfed();
991 LogError(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
992 <<
"[DTDataIntegrityTask]: analyze, FED ID " << fed <<
" not expected." << endl;
999 for (
int slot = 1; slot <=
DOCESLOTS; ++slot) {
1000 urosData = fedData.
getuROS(slot);
1012 int ros =
theROS(slot, link);
1036 if (ros > 6 && tenDDU && ddu < 775)
1046 int ros = (link / 24) + 3 * (slot % 6) - 2;
void bookHistosROS(DQMStore::IBooker &, const int wheel, const int ros)
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
virtual void setCurrentFolder(std::string const &fullpath)
DTuROSROSData getuROS(int slot) const
std::string fedIntegrityFolder
void bookHistosuROS(DQMStore::IBooker &, const int fed, const int uRos)
void bookHistos(DQMStore::IBooker &, const int fedMin, const int fedMax)
edm::EDGetTokenT< DTuROSFEDDataCollection > fedToken
void globalEndLuminosityBlock(const edm::LuminosityBlock &ls, const edm::EventSetup &es) override
Log< level::Error, false > LogError
void processuROS(DTuROSROSData &data, int fed, int uRos)
MonitorElement * hFEDFatal
static std::string to_string(const XMLCh *ch)
static const int DOCESLOTS
T getUntrackedParameter(std::string const &, T const &) const
DTDataIntegrityTask(const edm::ParameterSet &ps)
std::map< std::string, std::map< int, DTTimeEvolutionHisto * > > fedTimeHistos
std::map< std::string, std::map< int, MonitorElement * > > summaryHistos
int theROS(int slot, int link)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::map< unsigned int, MonitorElement * > urosHistos
void analyze(const edm::Event &e, const edm::EventSetup &c) override
~DTDataIntegrityTask() override
Abs< T >::type abs(const T &t)
std::map< std::string, std::map< int, MonitorElement * > > fedHistos
MonitorElement * nEventMonitor
MonitorElement * hFEDEntry
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
void processFED(DTuROSFEDData &data, int fed)
std::shared_ptr< dtdi::LumiCache > globalBeginLuminosityBlock(const edm::LuminosityBlock &ls, const edm::EventSetup &es) const override
char data[epos_bytes_allocation]
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
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< unsigned int, DTTimeEvolutionHisto * > urosTimeHistos
int getslotsize(int slot) const
int theDDU(int crate, int slot, int link, bool tenDDU)
std::string topFolder(bool isFEDIntegrity) const