33 const unsigned long long max_bx = 59793997824ULL;
43 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
44 <<
"[DTDataIntegrityTask]: Constructor" <<endl;
59 if (processingMode ==
"Online") {
61 }
else if(processingMode ==
"SM") {
63 }
else if (processingMode ==
"Offline") {
65 }
else if (processingMode ==
"HLT") {
69 <<
"[DTDataIntegrityTask]: processingMode :" << processingMode
70 <<
" invalid! Must be Online, SM, Offline or HLT !" << endl;
78 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
79 <<
"[DTDataIntegrityTask]: Destructor. Analyzed "<<
neventsDDU <<
" events"<<endl;
94 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
95 <<
"[DTDataIntegrityTask]: postEndJob called!" <<endl;
106 int nFED = (fedMax - fedMin)+1;
129 nFED,fedMin,fedMax+1, 8, 1, 9);
147 stringstream dduID_s; dduID_s << code.
getDDU();
148 stringstream rosID_s; rosID_s << code.
getROS();
149 stringstream robID_s; robID_s << code.
getROB();
150 int wheel = (code.
getDDUID() - 770)%5 - 2;
151 stringstream wheel_s; wheel_s << wheel;
153 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
154 <<
" Booking histos for FED: " << code.
getDDU() <<
" ROS: " << code.
getROS()
155 <<
" ROB: " << code.
getROB() <<
" folder: " << folder << endl;
163 if (folder ==
"DDU") {
167 histoType =
"EventLenght";
168 histoName =
"FED" + dduID_s.str() +
"_" + histoType;
169 histoTitle =
"Event Lenght (Bytes) FED " + dduID_s.str();
174 histoType =
"ROSStatus";
175 histoName =
"FED" + dduID_s.str() +
"_" + histoType;
206 histoType =
"TTSValues";
207 histoName =
"FED" + dduID_s.str() +
"_" + histoType;
219 histoType =
"EventType";
220 histoName =
"FED" + dduID_s.str() +
"_" + histoType;
226 histoType =
"ROSList";
227 histoName =
"FED" + dduID_s.str() +
"_" + histoType;
228 histoTitle =
"# of ROS in the FED payload (FED" + dduID_s.str() +
")";
231 histoType =
"FIFOStatus";
232 histoName =
"FED" + dduID_s.str() +
"_" + histoType;
248 histoName =
"FED" + dduID_s.str() +
"_BXID";
249 histoTitle =
"Distrib. BX ID (FED" + dduID_s.str() +
")";
256 if ( folder ==
"ROS_S" ) {
259 histoType =
"ROSSummary";
260 histoName =
"FED" + dduID_s.str() +
"_ROSSummary";
261 string histoTitle =
"Summary Wheel" + wheel_s.str() +
" (FED " + dduID_s.str() +
")";
302 if ( folder ==
"ROS" ) {
306 histoType =
"ROSError";
307 histoName =
"FED" + dduID_s.str() +
"_" + folder + rosID_s.str() +
"_ROSError";
308 histoTitle = histoName +
" (ROBID error summary)";
365 histoType =
"ROSEventLenght";
366 histoName =
"FED" + dduID_s.str() +
"_" + folder + rosID_s.str() +
"_ROSEventLenght";
367 histoTitle =
"Event Lenght (Bytes) FED " + dduID_s.str() +
" ROS " + rosID_s.str();
371 histoType =
"TDCError";
372 histoName =
"FED" + dduID_s.str() +
"_" + folder + rosID_s.str() +
"_TDCError";
373 histoTitle = histoName +
" (ROBID error summary)";
428 histoType =
"ROB_mean";
429 histoName =
"FED" + dduID_s.str() +
"_" +
"ROS" + rosID_s.str() +
"_ROB_mean";
430 string fullName =
topFolder(
false) +
"FED" + dduID_s.str() +
"/" + folder + rosID_s.str()+
"/" + histoName;
431 names.insert (pair<std::string,std::string> (histoType,
string(fullName)));
466 if ( folder ==
"SC" ) {
471 histoType =
"SCSizeVsROSSize";
472 histoName =
"FED" + dduID_s.str() +
"_SCSizeVsROSSize";
473 histoTitle =
"SC size - ROS size vs SC (FED " + dduID_s.str() +
")";
482 if(histoType ==
"Event_word_vs_time"){
486 if ((*it).first==histoType){
490 int first_bin = -1, last_bin=-1;
494 if( first_bin == -1 ) { first_bin =
bin; }
500 if( first_bin > 1 ) { first_bin -= 1; }
501 if( last_bin < h1-> getNbinsX() ){ last_bin += 1; }
532 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
533 <<
"[DTDataIntegrityTask]: " <<
neventsROS25 <<
" events analyzed by processROS25" << endl;
554 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") <<
" TXP error en ROS "
569 for (vector<DTROSErrorWord>::const_iterator error_it = data.
getROSErrors().begin();
572 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") <<
" Error in ROS " << code.
getROS()
573 <<
" ROB Id " << (*error_it).robID()
574 <<
" Error type " << (*error_it).errorType() << endl;
577 ROSSummary->
Fill((*error_it).errorType(), code.
getROS());
578 if((*error_it).errorType() <= 11) {
584 if ((*error_it).robID() != 31) {
585 ROSError->
Fill((*error_it).errorType(),(*error_it).robID());
587 else if ((*error_it).errorType() == 4) {
588 vector<int> channelBins;
590 vector<int>::const_iterator channelIt = channelBins.begin();
591 vector<int>::const_iterator channelEnd = channelBins.end();
592 for(;channelIt!=channelEnd;++channelIt) {
593 ROSError->
Fill(4,(*channelIt));
600 int ROSDebug_BunchNumber = -1;
601 int ROSDebug_BcntResCntLow = 0;
602 int ROSDebug_BcntResCntHigh = 0;
603 int ROSDebug_BcntResCnt = 0;
605 for (vector<DTROSDebugWord>::const_iterator debug_it = data.
getROSDebugs().begin();
608 int debugROSSummary = 0;
609 int debugROSError = 0;
610 vector<int> debugBins;
611 bool hasEvIdMis =
false;
612 vector<int> evIdMisBins;
614 if ((*debug_it).debugType() == 0 ) {
615 ROSDebug_BunchNumber = (*debug_it).debugMessage();
616 }
else if ((*debug_it).debugType() == 1 ) {
617 ROSDebug_BcntResCntLow = (*debug_it).debugMessage();
618 }
else if ((*debug_it).debugType() == 2 ) {
619 ROSDebug_BcntResCntHigh = (*debug_it).debugMessage();
620 }
else if ((*debug_it).debugType() == 3) {
621 if ((*debug_it).dontRead()){
622 debugROSSummary = 11;
624 if (
mode <= 2)
channelsInCEROS((*debug_it).cerosIdCerosStatus(),(*debug_it).dontRead(),debugBins);
625 }
if ((*debug_it).evIdMis()){
627 if (
mode <= 2)
channelsInCEROS((*debug_it).cerosIdCerosStatus(),(*debug_it).evIdMis(),evIdMisBins);
629 }
else if ((*debug_it).debugType() == 4 &&
630 (*debug_it).cerosIdRosStatus()){
631 debugROSSummary = 13;
636 if (debugROSSummary) {
637 ROSSummary->
Fill(debugROSSummary,code.
getROS());
639 vector<int>::const_iterator channelIt = debugBins.begin();
640 vector<int>::const_iterator channelEnd = debugBins.end();
641 for (;channelIt!=channelEnd;++channelIt) {
642 ROSError->
Fill(debugROSError,(*channelIt));
650 vector<int>::const_iterator channelIt = evIdMisBins.begin();
651 vector<int>::const_iterator channelEnd = evIdMisBins.end();
652 for (;channelIt!=channelEnd;++channelIt) {
653 ROSError->
Fill(9,(*channelIt));
660 ROSDebug_BcntResCnt = (ROSDebug_BcntResCntHigh << 15) + ROSDebug_BcntResCntLow;
686 for (vector<DTROBHeader>::const_iterator rob_it = data.
getROBHeaders().begin();
689 code.
setROB((*rob_it).first);
694 if (robheader.
bunchID() != ROSDebug_BunchNumber) {
707 for (vector<DTROBTrailerWord>::const_iterator robt_it = data.
getROBTrailers().begin();
709 float wCount = (*robt_it).wordCount()<100. ? (*robt_it).wordCount() : 99.9;
721 if(rosEventLenght > 1600) rosEventLenght = 1600;
727 for (vector<DTTDCData>::const_iterator tdc_it = data.
getTDCData().begin();
728 tdc_it != data.
getTDCData().end(); tdc_it++) {
732 if ( tdcDatum.
PC() !=0) {
733 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
734 <<
" PC error in ROS " << code.
getROS() <<
" TDC " << (*tdc_it).first << endl;
741 if(
mode <= 2) ROSError->
Fill(6,(*tdc_it).first);
746 for (vector<DTTDCError>::const_iterator tdc_it = data.
getTDCError().begin();
749 code.
setROB((*tdc_it).first);
751 int tdcError_ROSSummary = 0;
752 int tdcError_ROSError = 0;
753 int tdcError_TDCHisto = 0;
755 if(((*tdc_it).second).tdcError() & 0x4000 ) {
756 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
758 <<
" Internal fatal Error 4000 in TDC " << (*tdc_it).first << endl;
760 tdcError_ROSSummary = 14;
761 tdcError_ROSError = 11;
762 tdcError_TDCHisto = 0;
764 }
else if ( ((*tdc_it).second).tdcError() & 0x0249 ) {
765 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
767 <<
" TDC FIFO overflow in TDC " << (*tdc_it).first << endl;
769 tdcError_ROSSummary = 15;
770 tdcError_ROSError = 12;
771 tdcError_TDCHisto = 1;
773 }
else if ( ((*tdc_it).second).tdcError() & 0x0492 ) {
774 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
776 <<
" TDC L1 buffer overflow in TDC " << (*tdc_it).first << endl;
778 tdcError_ROSSummary = 16;
779 tdcError_ROSError = 13;
780 tdcError_TDCHisto = 2;
782 }
else if ( ((*tdc_it).second).tdcError() & 0x2000 ) {
783 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
785 <<
" TDC L1A FIFO overflow in TDC " << (*tdc_it).first << endl;
787 tdcError_ROSSummary = 17;
788 tdcError_ROSError = 14;
789 tdcError_TDCHisto = 3;
791 }
else if ( ((*tdc_it).second).tdcError() & 0x0924 ) {
792 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
794 <<
" TDC hit error in TDC " << (*tdc_it).first << endl;
796 tdcError_ROSSummary = 18;
797 tdcError_ROSError = 15;
798 tdcError_TDCHisto = 4;
800 }
else if ( ((*tdc_it).second).tdcError() & 0x1000 ) {
801 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
803 <<
" TDC hit rejected in TDC " << (*tdc_it).first << endl;
805 tdcError_ROSSummary = 19;
806 tdcError_ROSError = 16;
807 tdcError_TDCHisto = 5;
810 LogWarning(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
811 <<
" TDC error code not known " << ((*tdc_it).second).tdcError() << endl;
814 ROSSummary->
Fill(tdcError_ROSSummary,code.
getROS());
816 if(tdcError_ROSSummary <= 15) {
821 ROSError->
Fill(tdcError_ROSError,(*tdc_it).first);
823 rosHistos[
"TDCError"][code.
getROSID()]->Fill(tdcError_TDCHisto+6*((*tdc_it).second).tdcID(),(*tdc_it).first);
846 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
847 <<
"[DTDataIntegrityTask]: " <<
neventsDDU <<
" events analyzed by processFED" << endl;
859 if(!header.
check()) {
865 if(!trailer.
check()) {
884 int ttsCodeValue = -1;
885 int ttsSummaryBin = -1;
904 bool knownOrigin =
false;
921 if(!knownOrigin) ttsSummaryBin = 9;
927 bool knownOrigin =
false;
936 if(!knownOrigin) ttsSummaryBin = 9;
952 LogError(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
953 <<
"[DTDataIntegrityTask] DDU control: wrong TTS value "<<trailer.
ttsBits()<<endl;
958 if(ttsSummaryBin != -1) {
971 int rosList = secondWord.
rosList();
972 set<int> rosPositions;
973 for(
int i=0;
i<12;
i++) {
975 rosPositions.insert(
i);
983 for (vector<DTDDUFirstStatusWord>::const_iterator fsw_it = data.
getFirstStatusWord().begin();
987 hROSStatus->
Fill(0,channel,(*fsw_it).channelEnabled());
988 hROSStatus->
Fill(1,channel,(*fsw_it).timeout());
989 hROSStatus->
Fill(2,channel,(*fsw_it).eventTrailerLost());
990 hROSStatus->
Fill(3,channel,(*fsw_it).opticalFiberSignalLost());
991 hROSStatus->
Fill(4,channel,(*fsw_it).tlkPropagationError());
992 hROSStatus->
Fill(5,channel,(*fsw_it).tlkPatternError());
993 hROSStatus->
Fill(6,channel,(*fsw_it).tlkSignalLost());
994 hROSStatus->
Fill(7,channel,(*fsw_it).errorFromROS());
997 if((*fsw_it).channelEnabled() == 1 &&
998 rosPositions.find(channel) == rosPositions.end()) {
999 if(
mode <= 2) hROSStatus->
Fill(9,channel,1);
1012 if((rosBXIds.size() > 1 || rosBXIds.find(header.
bxID()) == rosBXIds.end()) && rosBXIds.size() != 0) {
1013 for(vector<DTROS25Data>::const_iterator rosControlData = rosData.begin();
1014 rosControlData != rosData.end(); ++rosControlData) {
1015 for (vector<DTROSDebugWord>::const_iterator debug_it = (*rosControlData).getROSDebugs().begin();
1016 debug_it != (*rosControlData).getROSDebugs().end(); debug_it++) {
1017 if ((*debug_it).debugType() == 0 && (*debug_it).debugMessage() != header.
bxID()) {
1018 int ros = (*rosControlData).getROSID();
1020 if(
mode <= 2) hROSStatus->
Fill(11,ros-1);
1032 LogWarning(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
1033 <<
"ERROR: FED " << ddu <<
" BX ID different from other feds: " << header.
bxID() << endl;
1042 if((rosL1AIds.size() > 1 || rosL1AIds.find(header.
lvl1ID()-1) == rosL1AIds.end()) && rosL1AIds.size() != 0) {
1044 for (vector<DTROS25Data>::const_iterator rosControlData = rosData.begin();
1045 rosControlData != rosData.end(); rosControlData++) {
1046 int ROSHeader_TTCCount = ((*rosControlData).getROSHeader().TTCEventCounter() + 1) % 0x1000000;
1047 if( ROSHeader_TTCCount != header.
lvl1ID() ) {
1048 int ros = (*rosControlData).getROSID();
1049 if(
mode <= 2) hROSStatus->
Fill(10,ros-1);
1058 int fedEvtLenght = trailer.
lenght()*8;
1062 if(
mode > 1)
return;
1073 int fifoFull = secondWord.
fifoFull();
1077 for(
int i=0;
i<3;
i++){
1078 if(inputFifoFull & 0x1){
1079 hFIFOStatus->
Fill(
i,0);
1081 if(inputFifoAlmostFull & 0x1){
1082 hFIFOStatus->
Fill(
i,1);
1085 hFIFOStatus->
Fill(3+
i,0);
1087 if(fifoAlmostFull & 0x1){
1088 hFIFOStatus->
Fill(3+
i,1);
1090 if(!(inputFifoFull & 0x1) && !(inputFifoAlmostFull & 0x1)){
1091 hFIFOStatus->
Fill(
i,2);
1093 if(!(fifoFull & 0x1) && !(fifoAlmostFull & 0x1)){
1094 hFIFOStatus->
Fill(3+
i,2);
1096 inputFifoFull >>= 1;
1097 inputFifoAlmostFull >>= 1;
1099 fifoAlmostFull >>= 1;
1103 hFIFOStatus->
Fill(6,0);
1105 if(outputFifoAlmostFull){
1106 hFIFOStatus->
Fill(6,1);
1108 if(!outputFifoFull && !outputFifoAlmostFull){
1109 hFIFOStatus->
Fill(6,2);
1157 if (!isFEDIntegrity)
1158 folder += (
mode==1) ?
"_SM/" : (
mode==3) ?
"_EvF/" :
"/";
1165 for (
int iCh=0; iCh<6;++iCh) {
1166 if ((chMask >> iCh) & 0x1){
1167 channels.push_back(cerosId*6+iCh);
1174 for (
int iCeros=0; iCeros<5;++iCeros) {
1175 if ((cerosMask >> iCeros) & 0x1){
1176 for (
int iCh=0; iCh<6;++iCh) {
1177 channels.push_back(iCeros*6+iCh);
1185 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") <<
"[DTDataIntegrityTask]: preProcessEvent" <<endl;
1189 (*rosBxIds).second.clear();
1196 (*rosL1AIds).second.clear();
1208 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") <<
"[DTDataIntegrityTask]: postBeginJob" <<endl;
1211 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") <<
"[DTDataIntegrityTask] Get DQMStore service" << endl;
1219 LogTrace(
"DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
1220 <<
" FEDS: " << FEDIDmin <<
" to " << FEDIDMax <<
" in the RO" << endl;
1226 for(
int fed = FEDIDmin; fed <= FEDIDMax; ++fed) {
1234 for(
int ros = 1; ros <= 12; ++ros) {
std::map< int, std::set< int > > rosBxIdsPerFED
std::multimap< std::string, std::string > names
std::map< int, std::set< int > > rosL1AIdsPerFED
int EventWordCount() const
T getUntrackedParameter(std::string const &, T const &) const
const std::vector< DTROBHeader > & getROBHeaders() const
void preProcessEvent(const edm::EventID &iEvtid, const edm::Timestamp &iTime)
std::map< std::string, std::map< int, MonitorElement * > > dduHistos
const std::vector< DTTDCData > & getTDCData() const
std::multimap< std::string, std::string >::iterator it
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
void setAxisRange(double xmin, double xmax, int axis=1)
set x-, y- or z-axis range (axis=1, 2, 3 respectively)
void processFED(DTDDUData &dduData, const std::vector< DTROS25Data > &rosData, int dduID)
int outputFifoFull() const
std::string fedIntegrityFolder
MonitorElement * hFEDNonFatal
const DTLocalTriggerSectorCollectorHeaderWord & getSCPrivHeader() const
void ROSWords_t(double &ResetCount_unfolded, int ROS_number, int ROSDebug_BcntResCnt, int nevents)
void watchPreProcessEvent(PreProcessEvent::slot_type const &iSlot)
int l1AFifoOccupancy() const
bool eventHasErrors() const
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)
double ResetCount_unfolded
void channelsInROS(int cerosMask, std::vector< int > &channels)
MonitorElement * hFEDFatal
int getNbinsY(void) const
get # of bins in Y-axis
const DTLocalTriggerTrailerWord & getSCTrailer() const
int warningROSPAF() const
void processROS25(DTROS25Data &data, int dduID, int ros)
const std::vector< DTROSDebugWord > & getROSDebugs() const
const std::vector< DTDDUFirstStatusWord > & getFirstStatusWord() const
const DTROSTrailerWord & getROSTrailer() const
const DTROSHeaderWord & getROSHeader() const
void bookHistosROS25(DTROChainCoding code)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
std::map< std::string, std::map< int, MonitorElement * > > rosSHistos
void TimeHistos(std::string histoType)
const unsigned long long max_bx
const FEDTrailer & getDDUTrailer() const
int inputFifoAlmostFull() const
int ttsBits()
Current value of the Trigger Throttling System bitsAQ).
int inputFifoFull() const
std::string topFolder(bool isFEDIntegrity) const
const FEDHeader & getDDUHeader() const
Getters.
MonitorElement * hFEDEntry
void setROB(const int &ID)
std::map< std::string, std::map< int, MonitorElement * > > rosHistos
int lenght()
The length of the event fragment counted in 64-bit words including header and trailer.
void setROS(const int &ID)
void bookHistos(const int fedMin, const int fedMax)
const std::vector< DTROBTrailerWord > & getROBTrailers() const
DTDataIntegrityTask(const edm::ParameterSet &ps, edm::ActivityRegistry ®)
void channelsInCEROS(int cerosId, int chMask, std::vector< int > &channels)
double getBinContent(int binx) const
get content of bin (1-D)
int outputFifoAlmostFull() const
void setDDU(const int &ID)
need to reset the bits before setting
const std::vector< DTROSErrorWord > & getROSErrors() const
MonitorElement * hTTSSummary
int getNbinsX(void) const
get # of bins in X-axis
void fedNonFatal(int dduID)
int fifoAlmostFull() const
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
const std::vector< DTTDCError > & getTDCError() const
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
const DTDDUSecondStatusWord & getSecondStatusWord() const
int outOfSynchROSError() const
MonitorElement * hCorruptionSummary
virtual ~DTDataIntegrityTask()
void setCurrentFolder(const std::string &fullpath)
void watchPostBeginJob(PostBeginJob::slot_type const &iSlot)
convenience function for attaching to signal