34 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") <<
"[DTDataIntegrityTask]: Constructor" << endl;
49 if (processingMode ==
"Online") {
51 }
else if (processingMode ==
"SM") {
53 }
else if (processingMode ==
"Offline") {
55 }
else if (processingMode ==
"HLT") {
58 throw cms::Exception(
"MissingParameter") <<
"[DTDataIntegrityTask]: processingMode :" << processingMode
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) {
109 for (
int wheel = -2; wheel < 3; ++wheel) {
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";
134 for (
int wheel = -2; wheel < 3; ++wheel) {
135 string wheel_s = to_string(wheel);
136 string histoName =
"ROSSummary_W" + wheel_s;
137 string fed_s = to_string(
FEDIDmin + 1);
142 string histoTitle =
"Summary Wheel" + wheel_s +
" (FED " + fed_s +
")";
144 ((
summaryHistos[histoType])[wheel]) = ibooker.
book2D(histoName, histoTitle, 11, 0, 11, 12, 1, 13);
175 string wheel =
"ZERO";
180 string fed_s = to_string(fed);
181 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
182 <<
" Booking histos for FED: " << fed_s <<
" folder: " << folder << endl;
190 if (folder ==
"CRATE") {
193 histoType =
"EventLength";
194 histoName =
"FED" + fed_s +
"_" + histoType;
195 histoTitle =
"Event Length (Bytes) FED " + fed_s;
196 (
fedHistos[histoType])[fed] = ibooker.
book1D(histoName, histoTitle, 501, 0, 30000);
201 histoType =
"uROSStatus";
202 histoName =
"FED" + fed_s +
"_" + histoType;
203 (
fedHistos[histoType])[fed] = ibooker.
book2D(histoName, histoName, 12, 0, 12, 12, 1, 13);
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 +
")";
255 (
fedHistos[histoType])[fed] = ibooker.
book1D(histoName, histoTitle, 13, 0, 13);
258 histoName =
"FED" + fed_s +
"_BXID";
259 histoTitle =
"Distrib. BX ID (FED" + fed_s +
")";
260 (
fedHistos[histoType])[fed] = ibooker.
book1D(histoName, histoTitle, 3600, 0, 3600);
265 if (folder ==
"FED") {
271 histoType =
"uROSSummary";
272 histoName =
"FED" + fed_s +
"_uROSSummary";
273 string histoTitle =
"Summary Wheel" + wheel +
" (FED " + fed_s +
")";
275 ((
summaryHistos[histoType])[fed]) = ibooker.
book2D(histoName, histoTitle, 12, 0, 12, 12, 1, 13);
308 string wheel_s = to_string(wheel);
309 string ros_s = to_string(ros);
312 string histoType =
"ROSError";
314 string linkDown_s = to_string(linkDown);
315 int linkUp = linkDown + 24;
316 string linkUp_s = to_string(linkUp);
317 string histoName =
"W" + wheel_s +
"_" +
"Sector" + ros_s +
"_" + histoType;
318 string histoTitle = histoName +
" (Channel " + linkDown_s +
"-" + linkUp_s +
" error summary)";
359 else if (
link == 22 ||
link == 23) {
366 if (ros == 9 && (
link == 22 ||
link == 23)) {
380 if (ros == 11 && (
link == 22 ||
link == 23)) {
385 string sector_s = to_string(sector);
386 string st_s = to_string(station);
387 string rob_s = to_string(rob);
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";
411 linkDown_s = to_string(linkDown);
412 linkUp = linkDown + 24;
413 linkUp_s = to_string(linkUp);
414 histoName =
"W" + wheel_s +
"_" +
"Sector" + ros_s +
"_" + histoType;
415 histoTitle = histoName +
" (Channel " + linkDown_s +
"-" + linkUp_s +
" error summary)";
416 keyHisto = (
TDCError)*1000 + (wheel + 2) * 100 + (ros - 1);
462 else if (
link == 22 ||
link == 23) {
469 if (ros == 9 && (
link == 22 ||
link == 23))
481 if (ros == 11 && (
link == 22 ||
link == 23)) {
486 string sector_s = to_string(sector);
487 string st_s = to_string(station);
488 string rob_s = to_string(rob);
489 histo->
setBinLabel(
link + 1,
"S" + sector_s +
" MB" + st_s +
" ROB" + rob_s, 2);
493 histo->
setBinLabel(link25 + 1, label25[ros - 1], 2);
498 string fed_s = to_string(fed);
499 string uRos_s = to_string(uRos);
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;
514 keyHisto = (fed -
FEDIDmin) * 100 + (uRos - 1);
517 histoType =
"TTSValues";
518 histoName =
"FED" + fed_s +
"_" +
"uROS" + uRos_s +
"_" + histoType;
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;
582 for (
unsigned int flag = 0; flag < 5; ++flag) {
591 errorX[value - 1][ros - 1][wheel + 2] += 1;
594 }
else if (
link < 48) {
595 if ((
link == 46 ||
link == 57) && ros == 10)
596 errorX[value - 1][sector4][wheel + 2] += 1;
598 errorX[value - 1][ros][wheel + 2] += 1;
600 if ((
link == 46 ||
link == 57) && ros == 10)
601 uROSErrorS4->
Fill(value - 1,
link - 24);
603 uROSError1->
Fill(value - 1,
link - 24);
605 }
else if (
link < 72) {
606 errorX[value - 1][ros + 1][wheel + 2] += 1;
608 uROSError2->
Fill(value - 1,
link - 48);
619 for (
unsigned int flag = 0; flag < 5; ++flag) {
623 int sector =
link + 1;
635 LogError(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
636 <<
"Trying to access non existing ME at uROS " << uRos << std::endl;
640 errorX[value - 1][sector - 1][wheel + 2] += 1;
642 uROSError0->
Fill(value - 1, ch25);
653 for (
unsigned int iros = ros - 1; iros < (ros + 2); ++iros) {
654 for (
unsigned int bin = 0;
bin < 5; ++
bin) {
662 for (
unsigned int flag = 4; flag < 16; ++flag) {
664 uROSSummary->
Fill(flag - 4, uRos);
665 uROSStatus->
Fill(flag - 4, uRos);
671 for (
unsigned int icounter = 0; icounter < data.
geterrors().size(); ++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;
738 ROSSummary->
Fill(tdcError_ROSSummary, sector - 1);
750 errorX[5][ros - 1][wheel + 2] += 1;
752 ROSSummary->
Fill(tdcError_ROSSummary, ros);
753 }
else if (link < 48) {
754 if ((link == 46 || link == 57) && ros == 10)
755 errorX[5][sector4][wheel + 2] += 1;
757 errorX[5][ros][wheel + 2] += 1;
759 if ((link == 46 || link == 57) && ros == 10)
760 ROSSummary->
Fill(tdcError_ROSSummary, sector4);
762 ROSSummary->
Fill(tdcError_ROSSummary, ros + 1);
764 }
else if (link < 72) {
765 errorX[5][ros + 1][wheel + 2] += 1;
767 ROSSummary->
Fill(tdcError_ROSSummary, ros + 2);
772 uROSError0->
Fill(tdcError_ROSError, link);
774 if ((link == 46 || link == 57) && ros == 10)
775 uROSError1->
Fill(tdcError_ROSError, sector4);
777 uROSError1->
Fill(tdcError_ROSError, link - 24);
779 uROSError2->
Fill(tdcError_ROSError, link - 48);
787 urosHistos[(
TDCError)*1000 + (wheel + 2) * 100 + (ros + 1)]->
Fill(tdcError_TDCHisto + 6 * tdc, link - 48);
796 int ttsCodeValue = -1;
812 LogError(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
813 <<
"[DTDataIntegrityTask] FED User control: wrong TTS value " << value <<
" in FED " << fed <<
" uROS "
822 int uRosEventLength = (data.
gettrailer() & 0xFFFFF) * 8;
825 if (uRosEventLength > 5000)
826 uRosEventLength = 5000;
834 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
835 <<
"[DTDataIntegrityTask]: " <<
neventsFED <<
" events analyzed by processFED" << endl;
837 if (fed < FEDIDmin || fed >
FEDIDmax)
849 fedHistos[
"EventLength"][fed]->Fill(fedEvtLength);
852 fedTimeHistos[
"FEDAvgEvLengthvsLumi"][fed]->accumulateValueTimeSlot(fedEvtLength);
905 else if (fed == FEDIDmax)
908 float sumTDC = 0., sumNotOKFlag = 0.;
909 for (
int ros = 0; ros < 12; ros++) {
910 sumNotOKFlag +=
errorX[4][ros][wheel + 2];
911 sumTDC +=
errorX[5][ros][wheel + 2];
916 for (
int ros = 0; ros < 12; ros++) {
917 sumNotOKFlag +=
errorX[4][ros][wheel + 2];
918 sumTDC +=
errorX[5][ros][wheel + 2];
923 sumNotOKFlag = sumNotOKFlag / ((wheel != 0) ? 2. : 1.);
924 sumTDC = sumTDC / ((wheel != 0) ? 2. : 1.);
934 folder =
"DT/00-DataIntegrity/";
942 return std::shared_ptr<dtdi::Void>();
948 map<string, map<int, DTTimeEvolutionHisto*> >::iterator fedIt =
fedTimeHistos.begin();
949 map<string, map<int, DTTimeEvolutionHisto*> >::iterator fedEnd =
fedTimeHistos.end();
950 for (; fedIt != fedEnd; ++fedIt) {
951 map<int, DTTimeEvolutionHisto*>::iterator histoIt = fedIt->second.begin();
952 map<int, DTTimeEvolutionHisto*>::iterator histoEnd = fedIt->second.end();
953 for (; histoIt != histoEnd; ++histoIt) {
954 histoIt->second->updateTimeSlot(lumiBlock,
nEventsLS);
958 map<unsigned int, DTTimeEvolutionHisto*>::iterator urosIt =
urosTimeHistos.begin();
959 map<unsigned int, DTTimeEvolutionHisto*>::iterator urosEnd =
urosTimeHistos.end();
960 for (; urosIt != urosEnd; ++urosIt) {
961 urosIt->second->updateTimeSlot(lumiBlock,
nEventsLS);
973 LogTrace(
"DTRawToDigi|TDQM|DTMonitorModule|DTDataIntegrityTask") <<
"[DTDataIntegrityTask]: preProcessEvent" << endl;
982 for (
unsigned int j = 0;
j < fedCol->size(); ++
j) {
983 fedData = fedCol->at(
j);
984 int fed = fedData.
getfed();
986 LogError(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
987 <<
"[DTDataIntegrityTask]: analyze, FED ID " << fed <<
" not expected." << endl;
994 for (
int slot = 1; slot <=
DOCESLOTS; ++slot) {
995 urosData = fedData.
getuROS(slot);
1007 int ros =
theROS(slot, link);
1031 if (ros > 6 && tenDDU && ddu < 775)
1041 int ros = (link / 24) + 3 * (slot % 6) - 2;
void bookHistosROS(DQMStore::IBooker &, const int wheel, const int ros)
LuminosityBlockID id() const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< int > geterrors() const
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
const edm::EventSetup & c
virtual void setCurrentFolder(std::string const &fullpath)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::string fedIntegrityFolder
int geterrorTDCID(int i) const
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 const int DOCESLOTS
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
DTuROSROSData getuROS(int slot) const
Abs< T >::type abs(const T &t)
int getokxflag(int i) const
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::map< std::string, std::map< int, MonitorElement * > > fedHistos
MonitorElement * nEventMonitor
std::string topFolder(bool isFEDIntegrity) const
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
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())
T getParameter(std::string const &) const
LuminosityBlockNumber_t luminosityBlock() const
int geterror(int i) const
int geterrorROBID(int i) const
void processFED(DTuROSFEDData &data, int fed)
char data[epos_bytes_allocation]
int getslotsize(int slot) const
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 theDDU(int crate, int slot, int link, bool tenDDU)