34 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") <<
"[DTDataIntegrityTask]: Constructor" << endl;
59 <<
" invalid! Must be Online, SM, Offline or HLT !" << endl;
64 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
65 <<
"[DTDataIntegrityTask]: Destructor. Analyzed " <<
neventsFED <<
" events" << endl;
66 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
67 <<
"[DTDataIntegrityTask]: postEndJob called!" << endl;
82 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") <<
"[DTDataIntegrityTask]: postBeginJob" << endl;
84 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
85 <<
"[DTDataIntegrityTask] Get DQMStore service" << endl;
89 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
104 for (
int uRos = 1; uRos <=
NuROS; ++uRos) {
110 for (
int ros = 1; ros <=
NuROS; ++ros) {
125 int nFED = (fedMax - fedMin) + 1;
127 hFEDEntry = ibooker.
book1D(
"FEDEntries",
"# entries per DT FED", nFED, fedMin, fedMax + 1);
128 hFEDFatal = ibooker.
book1D(
"FEDFatal",
"# fatal errors DT FED", nFED, fedMin, fedMax + 1);
133 string histoType =
"ROSSummary";
136 string histoName =
"ROSSummary_W" + wheel_s;
142 string histoTitle =
"Summary Wheel" + wheel_s +
" (FED " + fed_s +
")";
146 histo->setBinLabel(1,
"Error 1", 1);
147 histo->setBinLabel(2,
"Error 2", 1);
148 histo->setBinLabel(3,
"Error 3", 1);
149 histo->setBinLabel(4,
"Error 4", 1);
150 histo->setBinLabel(5,
"Not OKflag", 1);
152 histo->setBinLabel(6,
"TDC Fatal", 1);
153 histo->setBinLabel(7,
"TDC RO FIFO ov.", 1);
154 histo->setBinLabel(8,
"TDC L1 buf. ov.", 1);
155 histo->setBinLabel(9,
"TDC L1A FIFO ov.", 1);
156 histo->setBinLabel(10,
"TDC hit err.", 1);
157 histo->setBinLabel(11,
"TDC hit rej.", 1);
159 histo->setBinLabel(1,
"Sector1", 2);
160 histo->setBinLabel(2,
"Sector2", 2);
161 histo->setBinLabel(3,
"Sector3", 2);
162 histo->setBinLabel(4,
"Sector4", 2);
163 histo->setBinLabel(5,
"Sector5", 2);
164 histo->setBinLabel(6,
"Sector6", 2);
165 histo->setBinLabel(7,
"Sector7", 2);
166 histo->setBinLabel(8,
"Sector8", 2);
167 histo->setBinLabel(9,
"Sector9", 2);
168 histo->setBinLabel(10,
"Sector10", 2);
169 histo->setBinLabel(11,
"Sector11", 2);
170 histo->setBinLabel(12,
"Sector12", 2);
175 string wheel =
"ZERO";
181 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
182 <<
" Booking histos for FED: " << fed_s <<
" folder: " <<
folder << endl;
193 histoType =
"EventLength";
194 histoName =
"FED" + fed_s +
"_" + histoType;
195 histoTitle =
"Event Length (Bytes) FED " + fed_s;
201 histoType =
"uROSStatus";
202 histoName =
"FED" + fed_s +
"_" + histoType;
206 histo->setBinLabel(1,
"Error G 1", 1);
207 histo->setBinLabel(2,
"Error G 2", 1);
208 histo->setBinLabel(3,
"Error G 3", 1);
209 histo->setBinLabel(4,
"Error G 4", 1);
210 histo->setBinLabel(5,
"Error G 5", 1);
211 histo->setBinLabel(6,
"Error G 6", 1);
212 histo->setBinLabel(7,
"Error G 7", 1);
213 histo->setBinLabel(8,
"Error G 8", 1);
214 histo->setBinLabel(9,
"Error G 9", 1);
215 histo->setBinLabel(10,
"Error G 10", 1);
216 histo->setBinLabel(11,
"Error G 11", 1);
217 histo->setBinLabel(12,
"Error G 12", 1);
219 histo->setBinLabel(1,
"uROS 1", 2);
220 histo->setBinLabel(2,
"uROS 2", 2);
221 histo->setBinLabel(3,
"uROS 3", 2);
222 histo->setBinLabel(4,
"uROS 4", 2);
223 histo->setBinLabel(5,
"uROS 5", 2);
224 histo->setBinLabel(6,
"uROS 6", 2);
225 histo->setBinLabel(7,
"uROS 7", 2);
226 histo->setBinLabel(8,
"uROS 8", 2);
227 histo->setBinLabel(9,
"uROS 9", 2);
228 histo->setBinLabel(10,
"uROS 10", 2);
229 histo->setBinLabel(11,
"uROS 11", 2);
230 histo->setBinLabel(12,
"uROS 12", 2);
234 histoType =
"FEDAvgEvLengthvsLumi";
235 histoName =
"FED" + fed_s +
"_" + histoType;
236 histoTitle =
"Avg Event Length (Bytes) vs LumiSec FED " + fed_s;
252 histoType =
"uROSList";
253 histoName =
"FED" + fed_s +
"_" + histoType;
254 histoTitle =
"# of uROS in the FED payload (FED" + fed_s +
")";
259 histoTitle =
"Distrib. BX ID (FED" + fed_s +
")";
271 histoType =
"uROSSummary";
272 histoName =
"FED" + fed_s +
"_uROSSummary";
273 string histoTitle =
"Summary Wheel" +
wheel +
" (FED " + fed_s +
")";
279 histo->setBinLabel(1,
"Error G 1", 1);
280 histo->setBinLabel(2,
"Error G 2", 1);
281 histo->setBinLabel(3,
"Error G 3", 1);
282 histo->setBinLabel(4,
"Error G 4", 1);
283 histo->setBinLabel(5,
"Error G 5", 1);
284 histo->setBinLabel(6,
"Error G 6", 1);
285 histo->setBinLabel(7,
"Error G 7", 1);
286 histo->setBinLabel(8,
"Error G 8", 1);
287 histo->setBinLabel(9,
"Error G 9", 1);
288 histo->setBinLabel(10,
"Error G 10", 1);
289 histo->setBinLabel(11,
"Error G 11", 1);
290 histo->setBinLabel(12,
"Error G 12", 1);
292 histo->setBinLabel(1,
"uROS1", 2);
293 histo->setBinLabel(2,
"uROS2", 2);
294 histo->setBinLabel(3,
"uROS3", 2);
295 histo->setBinLabel(4,
"uROS4", 2);
296 histo->setBinLabel(5,
"uROS5", 2);
297 histo->setBinLabel(6,
"uROS6", 2);
298 histo->setBinLabel(7,
"uROS7", 2);
299 histo->setBinLabel(8,
"uROS8", 2);
300 histo->setBinLabel(9,
"uROS9", 2);
301 histo->setBinLabel(10,
"uROS10", 2);
302 histo->setBinLabel(11,
"uROS11", 2);
303 histo->setBinLabel(12,
"uROS12", 2);
312 string histoType =
"ROSError";
315 int linkUp = linkDown + 24;
317 string histoName =
"W" + wheel_s +
"_" +
"Sector" + ros_s +
"_" + histoType;
318 string histoTitle =
histoName +
" (Channel " + linkDown_s +
"-" + linkUp_s +
" error summary)";
328 histo->setBinLabel(1,
"Error 1", 1);
329 histo->setBinLabel(2,
"Error 2", 1);
330 histo->setBinLabel(3,
"Error 3", 1);
331 histo->setBinLabel(4,
"Error 4", 1);
332 histo->setBinLabel(5,
"Not OKFlag", 1);
335 histo->setBinLabel(6,
"TDC Fatal", 1);
336 histo->setBinLabel(7,
"TDC RO FIFO ov.", 1);
337 histo->setBinLabel(8,
"TDC L1 buf. ov.", 1);
338 histo->setBinLabel(9,
"TDC L1A FIFO ov.", 1);
339 histo->setBinLabel(10,
"TDC hit err.", 1);
340 histo->setBinLabel(11,
"TDC hit rej.", 1);
359 else if (
link == 22 ||
link == 23) {
366 if (ros == 9 && (
link == 22 ||
link == 23)) {
380 if (ros == 11 && (
link == 22 ||
link == 23)) {
388 histo->setBinLabel(
link + 1,
"S" + sector_s +
" MB" + st_s +
" ROB" + rob_s, 2);
392 string label25[12] = {
"S1 MB4 ROB5",
404 histo->setBinLabel(link25 + 1, label25[ros - 1], 2);
409 histoType =
"TDCError";
412 linkUp = linkDown + 24;
414 histoName =
"W" + wheel_s +
"_" +
"Sector" + ros_s +
"_" + histoType;
415 histoTitle =
histoName +
" (Channel " + linkDown_s +
"-" + linkUp_s +
" error summary)";
420 histo->setBinLabel(1,
"Fatal", 1);
421 histo->setBinLabel(2,
"RO FIFO ov.", 1);
422 histo->setBinLabel(3,
"L1 buf. ov.", 1);
423 histo->setBinLabel(4,
"L1A FIFO ov.", 1);
424 histo->setBinLabel(5,
"hit err.", 1);
425 histo->setBinLabel(6,
"hit rej.", 1);
426 histo->setBinLabel(7,
"Fatal", 1);
427 histo->setBinLabel(8,
"RO FIFO ov.", 1);
428 histo->setBinLabel(9,
"L1 buf. ov.", 1);
429 histo->setBinLabel(10,
"L1A FIFO ov.", 1);
430 histo->setBinLabel(11,
"hit err.", 1);
431 histo->setBinLabel(12,
"hit rej.", 1);
432 histo->setBinLabel(13,
"Fatal", 1);
433 histo->setBinLabel(14,
"RO FIFO ov.", 1);
434 histo->setBinLabel(15,
"L1 buf. ov.", 1);
435 histo->setBinLabel(16,
"L1A FIFO ov.", 1);
436 histo->setBinLabel(17,
"hit err.", 1);
437 histo->setBinLabel(18,
"hit rej.", 1);
438 histo->setBinLabel(19,
"Fatal", 1);
439 histo->setBinLabel(20,
"RO FIFO ov.", 1);
440 histo->setBinLabel(21,
"L1 buf. ov.", 1);
441 histo->setBinLabel(22,
"L1A FIFO ov.", 1);
442 histo->setBinLabel(23,
"hit err.", 1);
443 histo->setBinLabel(24,
"hit rej.", 1);
462 else if (
link == 22 ||
link == 23) {
469 if (ros == 9 && (
link == 22 ||
link == 23))
481 if (ros == 11 && (
link == 22 ||
link == 23)) {
489 histo->setBinLabel(
link + 1,
"S" + sector_s +
" MB" + st_s +
" ROB" + rob_s, 2);
493 histo->setBinLabel(link25 + 1, label25[ros - 1], 2);
505 string histoType =
"uROSEventLength";
506 string histoName =
"FED" + fed_s +
"_uROS" + uRos_s +
"_" +
"EventLength";
507 string histoTitle =
"Event Length (Bytes) FED " + fed_s +
" uROS" + uRos_s;
511 histoType =
"uROSAvgEventLengthvsLumi";
512 histoName =
"FED" + fed_s +
"_ROS" + uRos_s +
"AvgEventLengthvsLumi";
513 histoTitle =
"Event Length (Bytes) FED " + fed_s +
" ROS" + uRos_s;
517 histoType =
"TTSValues";
518 histoName =
"FED" + fed_s +
"_" +
"uROS" + uRos_s +
"_" + histoType;
522 histo->setBinLabel(1,
"Overflow Warning ", 1);
523 histo->setBinLabel(2,
"Busy", 1);
524 histo->setBinLabel(3,
"Ready", 1);
525 histo->setBinLabel(4,
"Unknown", 1);
531 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
532 <<
"[DTDataIntegrityTask]: " <<
neventsuROS <<
" events analyzed by processuROS" << endl;
540 unsigned int slotMap = (
data.getboardId()) & 0xF;
543 unsigned int ros =
theROS(slotMap, 0);
544 int ddu =
theDDU(fed, slotMap, 0,
false);
545 int wheel = (ddu - 770) % 5 - 2;
561 uROSStatus =
fedHistos[
"uROSStatus"][fed];
563 LogError(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
564 <<
"Trying to access non existing ME at FED " << fed << std::endl;
573 if ((!uROSError2) || (!uROSError1) || (!uROSError0)) {
574 LogError(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
575 <<
"Trying to access non existing ME at uROS " << uRos << std::endl;
594 }
else if (
link < 48) {
595 if ((
link == 46 ||
link == 57) && ros == 10)
600 if ((
link == 46 ||
link == 57) && ros == 10)
605 }
else if (
link < 72) {
623 int sector =
link + 1;
635 LogError(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
636 <<
"Trying to access non existing ME at uROS " << uRos << std::endl;
653 for (
unsigned int iros = ros - 1; iros < (ros + 2); ++iros) {
654 for (
unsigned int bin = 0;
bin < 5; ++
bin) {
671 for (
unsigned int icounter = 0; icounter <
data.geterrors().size(); ++icounter) {
672 int link =
data.geterrorROBID(icounter);
673 int tdc =
data.geterrorTDCID(icounter);
675 int tdcError_ROSSummary = 0;
676 int tdcError_ROSError = 0;
677 int tdcError_TDCHisto = 0;
679 if (
error & 0x4000) {
680 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
681 <<
" ROS " << uRos <<
" ROB " <<
link <<
" Internal fatal Error 4000 in TDC " <<
error << endl;
683 tdcError_ROSSummary = 5;
684 tdcError_ROSError = 5;
685 tdcError_TDCHisto = 0;
687 }
else if (
error & 0x0249) {
688 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
689 <<
" ROS " << uRos <<
" ROB " <<
link <<
" TDC FIFO overflow in TDC " <<
error << endl;
691 tdcError_ROSSummary = 6;
692 tdcError_ROSError = 6;
693 tdcError_TDCHisto = 1;
695 }
else if (
error & 0x0492) {
696 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
697 <<
" ROS " << uRos <<
" ROB " <<
link <<
" TDC L1 buffer overflow in TDC " <<
error << endl;
699 tdcError_ROSSummary = 7;
700 tdcError_ROSError = 7;
701 tdcError_TDCHisto = 2;
703 }
else if (
error & 0x2000) {
704 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
705 <<
" ROS " << uRos <<
" ROB " <<
link <<
" TDC L1A FIFO overflow in TDC " <<
error << endl;
707 tdcError_ROSSummary = 8;
708 tdcError_ROSError = 8;
709 tdcError_TDCHisto = 3;
711 }
else if (
error & 0x0924) {
712 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
713 <<
" uROS " << uRos <<
" ROB " <<
link <<
" TDC hit error in TDC " <<
error << endl;
715 tdcError_ROSSummary = 9;
716 tdcError_ROSError = 9;
717 tdcError_TDCHisto = 4;
719 }
else if (
error & 0x1000) {
720 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
721 <<
" uROS " << uRos <<
" ROB " <<
link <<
" TDC hit rejected in TDC " <<
error << endl;
723 tdcError_ROSSummary = 10;
724 tdcError_ROSError = 10;
725 tdcError_TDCHisto = 5;
728 LogWarning(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
729 <<
" TDC error code not known " <<
error << endl;
733 int sector =
link + 1;
734 if (tdcError_ROSSummary == 5)
739 ROSSummary->
Fill(tdcError_ROSSummary, sector - 1);
751 if (tdcError_ROSSummary == 5)
754 ROSSummary->
Fill(tdcError_ROSSummary, ros);
755 }
else if (
link < 48) {
756 if (tdcError_ROSSummary == 5) {
757 if ((
link == 46 ||
link == 57) && ros == 10)
763 if ((
link == 46 ||
link == 57) && ros == 10)
764 ROSSummary->
Fill(tdcError_ROSSummary, sector4);
766 ROSSummary->
Fill(tdcError_ROSSummary, ros + 1);
768 }
else if (
link < 72) {
769 if (tdcError_ROSSummary == 5)
772 ROSSummary->
Fill(tdcError_ROSSummary, ros + 2);
777 uROSError0->
Fill(tdcError_ROSError,
link);
779 if ((
link == 46 ||
link == 57) && ros == 10)
780 uROSError1->
Fill(tdcError_ROSError, sector4);
782 uROSError1->
Fill(tdcError_ROSError,
link - 24);
784 uROSError2->
Fill(tdcError_ROSError,
link - 48);
801 int ttsCodeValue = -1;
817 LogError(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
818 <<
"[DTDataIntegrityTask] FED User control: wrong TTS value " <<
value <<
" in FED " << fed <<
" uROS " 827 int uRosEventLength = (
data.gettrailer() & 0xFFFFF) * 8;
830 if (uRosEventLength > 5000)
831 uRosEventLength = 5000;
839 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
840 <<
"[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.);
938 folder =
"DT/00-DataIntegrity/";
946 return std::shared_ptr<dtdi::Void>();
950 int lumiBlock =
ls.id().luminosityBlock();
952 map<string, map<int, DTTimeEvolutionHisto*> >::iterator fedIt =
fedTimeHistos.begin();
953 map<string, map<int, DTTimeEvolutionHisto*> >::iterator fedEnd =
fedTimeHistos.end();
954 for (; fedIt != fedEnd; ++fedIt) {
955 map<int, DTTimeEvolutionHisto*>::iterator histoIt = fedIt->second.begin();
956 map<int, DTTimeEvolutionHisto*>::iterator histoEnd = fedIt->second.end();
957 for (; histoIt != histoEnd; ++histoIt) {
958 histoIt->second->updateTimeSlot(lumiBlock,
nEventsLS);
962 map<unsigned int, DTTimeEvolutionHisto*>::iterator urosIt =
urosTimeHistos.begin();
963 map<unsigned int, DTTimeEvolutionHisto*>::iterator urosEnd =
urosTimeHistos.end();
964 for (; urosIt != urosEnd; ++urosIt) {
965 urosIt->second->updateTimeSlot(lumiBlock,
nEventsLS);
977 LogTrace(
"DTRawToDigi|TDQM|DTMonitorModule|DTDataIntegrityTask") <<
"[DTDataIntegrityTask]: preProcessEvent" << endl;
986 for (
unsigned int j = 0;
j < fedCol->size(); ++
j) {
987 fedData = fedCol->at(
j);
988 int fed = fedData.
getfed();
990 LogError(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
991 <<
"[DTDataIntegrityTask]: analyze, FED ID " << fed <<
" not expected." << endl;
998 for (
int slot = 1; slot <=
DOCESLOTS; ++slot) {
999 urosData = fedData.
getuROS(slot);
1035 if (ros > 6 && tenDDU && ddu < 775)
1045 int ros = (
link / 24) + 3 * (slot % 6) - 2;
void bookHistosROS(DQMStore::IBooker &, const int wheel, const int ros)
T getParameter(std::string const &) const
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)
std::string to_string(const V &value)
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 const int DOCESLOTS
T getUntrackedParameter(std::string const &, T const &) const
std::shared_ptr< dtdi::Void > globalBeginLuminosityBlock(const edm::LuminosityBlock &ls, const edm::EventSetup &es) const override
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)
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