CMS 3D CMS Logo

DTDataIntegrityTask.cc
Go to the documentation of this file.
1 /*
2  * \file DTDataIntegrityTask.cc
3  *
4  * \author M. Zanetti (INFN Padova), S. Bolognesi (INFN Torino), G. Cerminara (INFN Torino)
5  *
6  */
7 
21 
22 #include <cmath>
23 #include <fstream>
24 #include <map>
25 #include <string>
26 #include <vector>
27 
28 using namespace std;
29 using namespace edm;
30 
32 
33  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
34  << "[DTDataIntegrityTask]: Constructor" <<endl;
35 
36  dduToken = consumes<DTDDUCollection>(ps.getParameter<InputTag>("dtDDULabel"));
37  ros25Token = consumes<DTROS25Collection>(ps.getParameter<InputTag>("dtROS25Label"));
38 
39  neventsDDU = 0;
40  neventsROS25 = 0;
41 
43  FEDIDMax = 774; // FEDNumbering::MAXDTFEDID; Monitoring only real used FEDs
44 
45 // If you want info VS time histos
46 // doTimeHisto = ps.getUntrackedParameter<bool>("doTimeHisto", false);
47 // Plot quantities about SC
48  getSCInfo = ps.getUntrackedParameter<bool>("getSCInfo", false);
49 
50  fedIntegrityFolder = ps.getUntrackedParameter<string>("fedIntegrityFolder","DT/FEDIntegrity");
51 
52  string processingMode = ps.getUntrackedParameter<string>("processingMode","Online");
53 
54  // processing mode flag to select plots to be produced and basedirs CB vedi se farlo meglio...
55  if (processingMode == "Online") {
56  mode = 0;
57  } else if(processingMode == "SM") {
58  mode = 1;
59  } else if (processingMode == "Offline") {
60  mode = 2;
61  } else if (processingMode == "HLT") {
62  mode = 3;
63  } else {
64  throw cms::Exception("MissingParameter")
65  << "[DTDataIntegrityTask]: processingMode :" << processingMode
66  << " invalid! Must be Online, SM, Offline or HLT !" << endl;
67  }
68 
69 }
70 
71 
73  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
74  <<"[DTDataIntegrityTask]: Destructor. Analyzed "<< neventsDDU <<" events"<<endl;
75  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
76  << "[DTDataIntegrityTask]: postEndJob called!" <<endl;
77 }
78 
79 /*
80  Folder Structure:
81  - One folder for each DDU, named FEDn
82  - Inside each DDU folder the DDU histos and the ROSn folder
83  - Inside each ROS folder the ROS histos and the ROBn folder
84  - Inside each ROB folder one occupancy plot and the TimeBoxes
85  with the chosen granularity (simply change the histo name)
86 */
87 
88 void DTDataIntegrityTask::bookHistograms(DQMStore::IBooker & ibooker, edm::Run const & iRun, edm::EventSetup const & iSetup) {
89 
90  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") << "[DTDataIntegrityTask]: postBeginJob" <<endl;
91 
92  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") << "[DTDataIntegrityTask] Get DQMStore service" << endl;
93 
94  // Loop over the DT FEDs
95 
96  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
97  << " FEDS: " << FEDIDmin << " to " << FEDIDMax << " in the RO" << endl;
98 
99  // book FED integrity histos
100  bookHistos(ibooker, FEDIDmin, FEDIDMax);
101 
102  if(mode == 0 || mode ==2){
103  // static booking of the histograms
104  for(int fed = FEDIDmin; fed <= FEDIDMax; ++fed) { // loop over the FEDs in the readout
105  DTROChainCoding code;
106  code.setDDU(fed);
107 
108  bookHistos(ibooker, string("ROS_S"), code);
109 
110  bookHistos(ibooker, string("DDU"), code);
111 
112  for(int ros = 1; ros <= 12; ++ros) {// loop over all ROS
113  code.setROS(ros);
114  bookHistosROS25(ibooker, code);
115  }
116  }
117  } //Not in HLT or SM mode
118 }
119 
120 void DTDataIntegrityTask::bookHistos(DQMStore::IBooker & ibooker, const int fedMin, const int fedMax) {
121 
122  ibooker.setCurrentFolder("DT/EventInfo/Counters");
123  nEventMonitor = ibooker.bookFloat("nProcessedEventsDataIntegrity");
124 
125  // Standard FED integrity histos
126  ibooker.setCurrentFolder(topFolder(true));
127 
128  int nFED = (fedMax - fedMin)+1;
129 
130  hFEDEntry = ibooker.book1D("FEDEntries","# entries per DT FED",nFED,fedMin,fedMax+1);
131  hFEDFatal = ibooker.book1D("FEDFatal","# fatal errors DT FED",nFED,fedMin,fedMax+1);
132  hFEDNonFatal = ibooker.book1D("FEDNonFatal","# NON fatal errors DT FED",nFED,fedMin,fedMax+1);
133 
134  if(mode == 3 || mode ==1) return; //Avoid duplication of Info in FEDIntegrity_EvF
135 
136  ibooker.setCurrentFolder(topFolder(false));
137  hTTSSummary = ibooker.book2D("TTSSummary","Summary Status TTS",nFED,fedMin,fedMax+1,9,1,10);
138  hTTSSummary->setAxisTitle("FED",1);
139  hTTSSummary->setBinLabel(1,"ROS PAF",2);
140  hTTSSummary->setBinLabel(2,"DDU PAF",2);
141  hTTSSummary->setBinLabel(3,"ROS PAF",2);
142  hTTSSummary->setBinLabel(4,"DDU PAF",2);
143  hTTSSummary->setBinLabel(5,"DDU Full",2);
144  hTTSSummary->setBinLabel(6,"L1A Mism.",2);
145  hTTSSummary->setBinLabel(7,"ROS Error",2);
146  hTTSSummary->setBinLabel(8,"BX Mism.",2);
147  hTTSSummary->setBinLabel(9,"DDU Logic Err.",2);
148 
149  // bookkeeping of the
150 
151  hCorruptionSummary = ibooker.book2D("DataCorruptionSummary", "Data Corruption Sources",
152  nFED,fedMin,fedMax+1, 8, 1, 9);
154  hCorruptionSummary->setBinLabel(1,"Miss Ch.",2);
155  hCorruptionSummary->setBinLabel(2,"ROS BX mism",2);
156  hCorruptionSummary->setBinLabel(3,"DDU BX mism",2);
157  hCorruptionSummary->setBinLabel(4,"ROS L1A mism",2);
158  hCorruptionSummary->setBinLabel(5,"Miss Payload",2);
159  hCorruptionSummary->setBinLabel(6,"FCRC bit",2);
160  hCorruptionSummary->setBinLabel(7,"Header check",2);
161  hCorruptionSummary->setBinLabel(8,"Triler Check",2);
162 
163 }
164 
165 
166 
168 
169  stringstream dduID_s; dduID_s << code.getDDU();
170  stringstream rosID_s; rosID_s << code.getROS();
171  stringstream robID_s; robID_s << code.getROB();
172  int wheel = (code.getDDUID() - 770)%5 - 2;
173  stringstream wheel_s; wheel_s << wheel;
174 
175  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
176  << " Booking histos for FED: " << code.getDDU() << " ROS: " << code.getROS()
177  << " ROB: " << code.getROB() << " folder: " << folder << endl;
178 
179  string histoType;
180  string histoName;
181  string histoTitle;
182  MonitorElement* histo = nullptr;
183 
184  // DDU Histograms
185  if (folder == "DDU") {
186 
187  ibooker.setCurrentFolder(topFolder(false) + "FED" + dduID_s.str());
188 
189  histoType = "EventLenght";
190  histoName = "FED" + dduID_s.str() + "_" + histoType;
191  histoTitle = "Event Lenght (Bytes) FED " + dduID_s.str();
192  (dduHistos[histoType])[code.getDDUID()] = ibooker.book1D(histoName,histoTitle,501,0,16032);
193 
194  if(mode == 3 || mode ==1) return; //Avoid duplication of Info in FEDIntegrity_EvF
195 
196  histoType = "ROSStatus";
197  histoName = "FED" + dduID_s.str() + "_" + histoType;
198  (dduHistos[histoType])[code.getDDUID()] = ibooker.book2D(histoName,histoName,12,0,12,12,0,12);
199  histo = (dduHistos[histoType])[code.getDDUID()];
200  histo->setBinLabel(1,"ch.enabled",1);
201  histo->setBinLabel(2,"timeout",1);
202  histo->setBinLabel(3,"ev.trailer lost",1);
203  histo->setBinLabel(4,"opt.fiber lost",1);
204  histo->setBinLabel(5,"tlk.prop.error",1);
205  histo->setBinLabel(6,"tlk.pattern error",1);
206  histo->setBinLabel(7,"tlk.sign.lost",1);
207  histo->setBinLabel(8,"error from ROS",1);
208  histo->setBinLabel(9,"if ROS in events",1);
209  histo->setBinLabel(10,"Miss. Evt.",1);
210  histo->setBinLabel(11,"Evt. ID Mismatch",1);
211  histo->setBinLabel(12,"BX Mismatch",1);
212 
213  histo->setBinLabel(1,"ROS 1",2);
214  histo->setBinLabel(2,"ROS 2",2);
215  histo->setBinLabel(3,"ROS 3",2);
216  histo->setBinLabel(4,"ROS 4",2);
217  histo->setBinLabel(5,"ROS 5",2);
218  histo->setBinLabel(6,"ROS 6",2);
219  histo->setBinLabel(7,"ROS 7",2);
220  histo->setBinLabel(8,"ROS 8",2);
221  histo->setBinLabel(9,"ROS 9",2);
222  histo->setBinLabel(10,"ROS 10",2);
223  histo->setBinLabel(11,"ROS 11",2);
224  histo->setBinLabel(12,"ROS 12",2);
225 
226  if(mode > 0) return; //Info for Online only
227 
228  histoType = "FEDAvgEvLenghtvsLumi";
229  histoName = "FED" + dduID_s.str() + "_" + histoType;
230  histoTitle = "Avg Event Lenght (Bytes) vs LumiSec FED " + dduID_s.str();
231  dduTimeHistos[histoType][code.getDDUID()] = new DTTimeEvolutionHisto(ibooker,histoName,histoTitle,200,10,true,0);
232 
233  histoType = "TTSValues";
234  histoName = "FED" + dduID_s.str() + "_" + histoType;
235  (dduHistos[histoType])[code.getDDUID()] = ibooker.book1D(histoName,histoName,8,0,8);
236  histo = (dduHistos[histoType])[code.getDDUID()];
237  histo->setBinLabel(1,"disconnected",1);
238  histo->setBinLabel(2,"warning overflow",1);
239  histo->setBinLabel(3,"out of synch",1);
240  histo->setBinLabel(4,"busy",1);
241  histo->setBinLabel(5,"ready",1);
242  histo->setBinLabel(6,"error",1);
243  histo->setBinLabel(7,"disconnected",1);
244  histo->setBinLabel(8,"unknown",1);
245 
246  histoType = "EventType";
247  histoName = "FED" + dduID_s.str() + "_" + histoType;
248  (dduHistos[histoType])[code.getDDUID()] = ibooker.book1D(histoName,histoName,2,1,3);
249  histo = (dduHistos[histoType])[code.getDDUID()];
250  histo->setBinLabel(1,"physics",1);
251  histo->setBinLabel(2,"calibration",1);
252 
253  histoType = "ROSList";
254  histoName = "FED" + dduID_s.str() + "_" + histoType;
255  histoTitle = "# of ROS in the FED payload (FED" + dduID_s.str() + ")";
256  (dduHistos[histoType])[code.getDDUID()] = ibooker.book1D(histoName,histoTitle,13,0,13);
257 
258  histoType = "FIFOStatus";
259  histoName = "FED" + dduID_s.str() + "_" + histoType;
260  (dduHistos[histoType])[code.getDDUID()] = ibooker.book2D(histoName,histoName,7,0,7,3,0,3);
261  histo = (dduHistos[histoType])[code.getDDUID()];
262  histo->setBinLabel(1,"Input ch1-4",1);
263  histo->setBinLabel(2,"Input ch5-8",1);
264  histo->setBinLabel(3,"Input ch9-12",1);
265  histo->setBinLabel(4,"Error/L1A ch1-4",1);
266  histo->setBinLabel(5,"Error/L1A ch5-8",1);
267  histo->setBinLabel(6,"Error/L1A ch9-12",1);
268  histo->setBinLabel(7,"Output",1);
269  histo->setBinLabel(1,"Full",2);
270  histo->setBinLabel(2,"Almost Full",2);
271  histo->setBinLabel(3,"Not Full",2);
272 
273  histoType = "BXID";
274  histoName = "FED" + dduID_s.str() + "_BXID";
275  histoTitle = "Distrib. BX ID (FED" + dduID_s.str() + ")";
276  (dduHistos[histoType])[code.getDDUID()] = ibooker.book1D(histoName,histoTitle,3600,0,3600);
277 
278  }
279 
280  // ROS Histograms
281  if ( folder == "ROS_S" ) { // The summary of the error of the ROS on the same FED
282  ibooker.setCurrentFolder(topFolder(false));
283 
284  if(mode == 3 || mode ==1) return; //Avoid duplication of Info in FEDIntegrity_EvF
285 
286  histoType = "ROSSummary";
287  histoName = "FED" + dduID_s.str() + "_ROSSummary";
288  string histoTitle = "Summary Wheel" + wheel_s.str() + " (FED " + dduID_s.str() + ")";
289 
290  ((rosSHistos[histoType])[code.getDDUID()]) = ibooker.book2D(histoName,histoTitle,20,0,20,12,1,13);
291  MonitorElement *histo = ((rosSHistos[histoType])[code.getDDUID()]);
292  // ROS error bins
293  histo ->setBinLabel(1,"Link TimeOut",1);
294  histo ->setBinLabel(2,"Ev.Id.Mis.",1);
295  histo ->setBinLabel(3,"FIFO almost full",1);
296  histo ->setBinLabel(4,"FIFO full",1);
297  histo ->setBinLabel(5,"CEROS timeout",1);
298  histo ->setBinLabel(6,"Max. wds",1);
299  histo ->setBinLabel(7,"WO L1A FIFO",1);
300  histo ->setBinLabel(8,"TDC parity err.",1);
301  histo ->setBinLabel(9,"BX ID Mis.",1);
302  histo ->setBinLabel(10,"TXP",1);
303  histo ->setBinLabel(11,"L1A almost full",1);
304  histo ->setBinLabel(12,"Ch. blocked",1);
305  histo ->setBinLabel(13,"Ev. Id. Mis.",1);
306  histo ->setBinLabel(14,"CEROS blocked",1);
307  // TDC error bins
308  histo ->setBinLabel(15,"TDC Fatal",1);
309  histo ->setBinLabel(16,"TDC RO FIFO ov.",1);
310  histo ->setBinLabel(17,"TDC L1 buf. ov.",1);
311  histo ->setBinLabel(18,"TDC L1A FIFO ov.",1);
312  histo ->setBinLabel(19,"TDC hit err.",1);
313  histo ->setBinLabel(20,"TDC hit rej.",1);
314 
315  histo ->setBinLabel(1,"ROS1",2);
316  histo ->setBinLabel(2,"ROS2",2);
317  histo ->setBinLabel(3,"ROS3",2);
318  histo ->setBinLabel(4,"ROS4",2);
319  histo ->setBinLabel(5,"ROS5",2);
320  histo ->setBinLabel(6,"ROS6",2);
321  histo ->setBinLabel(7,"ROS7",2);
322  histo ->setBinLabel(8,"ROS8",2);
323  histo ->setBinLabel(9,"ROS9",2);
324  histo ->setBinLabel(10,"ROS10",2);
325  histo ->setBinLabel(11,"ROS11",2);
326  histo ->setBinLabel(12,"ROS12",2);
327  }
328 
329  if ( folder == "ROS" ) {
330  ibooker.setCurrentFolder(topFolder(false) + "FED" + dduID_s.str() + "/" + folder + rosID_s.str());
331 
332  if(mode == 3 || mode ==1) return; //Avoid duplication of Info in FEDIntegrity_EvF
333 
334  histoType = "ROSError";
335  histoName = "FED" + dduID_s.str() + "_" + folder + rosID_s.str() + "_ROSError";
336  histoTitle = histoName + " (ROBID error summary)";
337  if(mode < 1) //Online only
338  (rosHistos[histoType])[code.getROSID()] = ibooker.book2D(histoName,histoTitle,17,0,17,26,0,26);
339  else
340  (rosHistos[histoType])[code.getROSID()] = ibooker.book2D(histoName,histoTitle,11,0,11,26,0,26);
341 
342  MonitorElement* histo = (rosHistos[histoType])[code.getROSID()];
343  // ROS error bins
344  histo->setBinLabel(1,"Link TimeOut",1);
345  histo->setBinLabel(2,"Ev.Id.Mis.",1);
346  histo->setBinLabel(3,"FIFO almost full",1);
347  histo->setBinLabel(4,"FIFO full",1);
348  histo->setBinLabel(5,"CEROS timeout",1);
349  histo->setBinLabel(6,"Max. wds",1);
350  histo->setBinLabel(7,"TDC parity err.",1);
351  histo->setBinLabel(8,"BX ID Mis.",1);
352  histo->setBinLabel(9,"Ch. blocked",1);
353  histo->setBinLabel(10,"Ev. Id. Mis.",1);
354  histo->setBinLabel(11,"CEROS blocked",1);
355  if(mode < 1) { //Online only
356  // TDC error bins
357  histo->setBinLabel(12,"TDC Fatal",1);
358  histo->setBinLabel(13,"TDC RO FIFO ov.",1);
359  histo->setBinLabel(14,"TDC L1 buf. ov.",1);
360  histo->setBinLabel(15,"TDC L1A FIFO ov.",1);
361  histo->setBinLabel(16,"TDC hit err.",1);
362  histo->setBinLabel(17,"TDC hit rej.",1);
363  }
364  histo->setBinLabel(1,"ROB0",2);
365  histo->setBinLabel(2,"ROB1",2);
366  histo->setBinLabel(3,"ROB2",2);
367  histo->setBinLabel(4,"ROB3",2);
368  histo->setBinLabel(5,"ROB4",2);
369  histo->setBinLabel(6,"ROB5",2);
370  histo->setBinLabel(7,"ROB6",2);
371  histo->setBinLabel(8,"ROB7",2);
372  histo->setBinLabel(9,"ROB8",2);
373  histo->setBinLabel(10,"ROB9",2);
374  histo->setBinLabel(11,"ROB10",2);
375  histo->setBinLabel(12,"ROB11",2);
376  histo->setBinLabel(13,"ROB12",2);
377  histo->setBinLabel(14,"ROB13",2);
378  histo->setBinLabel(15,"ROB14",2);
379  histo->setBinLabel(16,"ROB15",2);
380  histo->setBinLabel(17,"ROB16",2);
381  histo->setBinLabel(18,"ROB17",2);
382  histo->setBinLabel(19,"ROB18",2);
383  histo->setBinLabel(20,"ROB19",2);
384  histo->setBinLabel(21,"ROB20",2);
385  histo->setBinLabel(22,"ROB21",2);
386  histo->setBinLabel(23,"ROB22",2);
387  histo->setBinLabel(24,"ROB23",2);
388  histo->setBinLabel(25,"ROB24",2);
389  histo->setBinLabel(26,"SC",2);
390 
391  if(mode > 1) return;
392 
393  histoType = "ROSEventLenght";
394  histoName = "FED" + dduID_s.str() + "_" + folder + rosID_s.str() + "_ROSEventLenght";
395  histoTitle = "Event Lenght (Bytes) FED " + dduID_s.str() + " ROS " + rosID_s.str();
396  (rosHistos[histoType])[code.getROSID()] = ibooker.book1D(histoName,histoTitle,101,0,1616);
397 
398  histoType = "ROSAvgEventLenghtvsLumi";
399  histoName = "FED" + dduID_s.str() + "_" + folder + rosID_s.str() + histoType;
400  histoTitle = "Event Lenght (Bytes) FED " + dduID_s.str() + " ROS " + rosID_s.str();
401  rosTimeHistos[histoType][code.getROSID()] = new DTTimeEvolutionHisto(ibooker,histoName,histoTitle,200,10,true,0);
402 
403  histoType = "TDCError";
404  histoName = "FED" + dduID_s.str() + "_" + folder + rosID_s.str() + "_TDCError";
405  histoTitle = histoName + " (ROBID error summary)";
406  (rosHistos[histoType])[code.getROSID()] = ibooker.book2D(histoName,histoTitle,24,0,24,25,0,25);
407  histo = (rosHistos[histoType])[code.getROSID()];
408  // TDC error bins
409  histo->setBinLabel(1,"Fatal",1);
410  histo->setBinLabel(2,"RO FIFO ov.",1);
411  histo->setBinLabel(3,"L1 buf. ov.",1);
412  histo->setBinLabel(4,"L1A FIFO ov.",1);
413  histo->setBinLabel(5,"hit err.",1);
414  histo->setBinLabel(6,"hit rej.",1);
415  histo->setBinLabel(7,"Fatal",1);
416  histo->setBinLabel(8,"RO FIFO ov.",1);
417  histo->setBinLabel(9,"L1 buf. ov.",1);
418  histo->setBinLabel(10,"L1A FIFO ov.",1);
419  histo->setBinLabel(11,"hit err.",1);
420  histo->setBinLabel(12,"hit rej.",1);
421  histo->setBinLabel(13,"Fatal",1);
422  histo->setBinLabel(14,"RO FIFO ov.",1);
423  histo->setBinLabel(15,"L1 buf. ov.",1);
424  histo->setBinLabel(16,"L1A FIFO ov.",1);
425  histo->setBinLabel(17,"hit err.",1);
426  histo->setBinLabel(18,"hit rej.",1);
427  histo->setBinLabel(19,"Fatal",1);
428  histo->setBinLabel(20,"RO FIFO ov.",1);
429  histo->setBinLabel(21,"L1 buf. ov.",1);
430  histo->setBinLabel(22,"L1A FIFO ov.",1);
431  histo->setBinLabel(23,"hit err.",1);
432  histo->setBinLabel(24,"hit rej.",1);
433 
434  histo->setBinLabel(1,"ROB0",2);
435  histo->setBinLabel(2,"ROB1",2);
436  histo->setBinLabel(3,"ROB2",2);
437  histo->setBinLabel(4,"ROB3",2);
438  histo->setBinLabel(5,"ROB4",2);
439  histo->setBinLabel(6,"ROB5",2);
440  histo->setBinLabel(7,"ROB6",2);
441  histo->setBinLabel(8,"ROB7",2);
442  histo->setBinLabel(9,"ROB8",2);
443  histo->setBinLabel(10,"ROB9",2);
444  histo->setBinLabel(11,"ROB10",2);
445  histo->setBinLabel(12,"ROB11",2);
446  histo->setBinLabel(13,"ROB12",2);
447  histo->setBinLabel(14,"ROB13",2);
448  histo->setBinLabel(15,"ROB14",2);
449  histo->setBinLabel(16,"ROB15",2);
450  histo->setBinLabel(17,"ROB16",2);
451  histo->setBinLabel(18,"ROB17",2);
452  histo->setBinLabel(19,"ROB18",2);
453  histo->setBinLabel(20,"ROB19",2);
454  histo->setBinLabel(21,"ROB20",2);
455  histo->setBinLabel(22,"ROB21",2);
456  histo->setBinLabel(23,"ROB22",2);
457  histo->setBinLabel(24,"ROB23",2);
458  histo->setBinLabel(25,"ROB24",2);
459 
460  histoType = "ROB_mean";
461  histoName = "FED" + dduID_s.str() + "_" + "ROS" + rosID_s.str() + "_ROB_mean";
462  string fullName = topFolder(false) + "FED" + dduID_s.str() + "/" + folder + rosID_s.str()+ "/" + histoName;
463  names.insert (pair<std::string,std::string> (histoType,string(fullName)));
464  (rosHistos[histoType])[code.getROSID()] = ibooker.book2D(histoName,histoName,25,0,25,100,0,100);
465  (rosHistos[histoType])[code.getROSID()]->setAxisTitle("ROB #",1);
466  (rosHistos[histoType])[code.getROSID()]->setAxisTitle("ROB wordcounts",2);
467 
468  }
469 
470  // SC Histograms
471  if ( folder == "SC" ) {
472  // The plots are per wheel
473  ibooker.setCurrentFolder(topFolder(false) + "FED" + dduID_s.str());
474  if(mode == 3 || mode ==1) return; //Avoid duplication of Info in FEDIntegrity_EvF
475  // SC data Size
476  histoType = "SCSizeVsROSSize";
477  histoName = "FED" + dduID_s.str() + "_SCSizeVsROSSize";
478  histoTitle = "SC size vs SC (FED " + dduID_s.str() + ")";
479  rosHistos[histoType][code.getSCID()] = ibooker.book2D(histoName,histoTitle,12,1,13,51,-1,50);
480  rosHistos[histoType][code.getSCID()]->setAxisTitle("SC",1);
481 
482  }
483 }
484 
485 
487  bookHistos(ibooker, string("ROS"), code);
488 
489  if(mode < 1)
490  if(getSCInfo)
491  bookHistos(ibooker, string("SC"), code);
492 }
493 
494 
496 
497  neventsROS25++; // FIXME: implement a counter which makes sense
498 
499  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
500  << "[DTDataIntegrityTask]: " << neventsROS25 << " events analyzed by processROS25" << endl;
501 
502  // The ID of the RO board (used to map the histos)
503  DTROChainCoding code;
504  code.setDDU(ddu);
505  code.setROS(ros);
506 
507  if(mode == 3 || mode ==1) return; //Avoid duplication of Info in FEDIntegrity_EvF
508 
509  MonitorElement* ROSSummary = rosSHistos["ROSSummary"][code.getDDUID()];
510 
511  // Summary of all ROB errors
512  MonitorElement* ROSError = nullptr;
513  if(mode <= 2) ROSError = rosHistos["ROSError"][code.getROSID()];
514 
515  if ( (mode<=2) && (!ROSError) ) {
516  LogError("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") <<
517  "Trying to access non existing ME at ROSID " << code.getROSID() <<
518  std::endl;
519  return;
520  }
521 
522  // L1A ids to be checked against FED one
523  rosL1AIdsPerFED[ddu].insert(data.getROSHeader().TTCEventCounter());
524 
525  // ROS errors
526 
527 
528  // check for TPX errors
529  if (data.getROSTrailer().TPX() != 0) {
530  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") << " TXP error en ROS "
531  << code.getROS() << endl;
532  ROSSummary->Fill(9,code.getROS());
533  }
534 
535  // L1 Buffer almost full (non-critical error!)
536  if(data.getROSTrailer().l1AFifoOccupancy() > 31) {
537  ROSSummary->Fill(10,code.getROS());
538  }
539 
540 
541  for (vector<DTROSErrorWord>::const_iterator error_it = data.getROSErrors().begin();
542  error_it != data.getROSErrors().end(); error_it++) { // Loop over ROS error words
543 
544  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") << " Error in ROS " << code.getROS()
545  << " ROB Id " << (*error_it).robID()
546  << " Error type " << (*error_it).errorType() << endl;
547 
548  // Fill the ROSSummary (1 per FED) histo
549  ROSSummary->Fill((*error_it).errorType(), code.getROS());
550  if((*error_it).errorType() <= 11) { // set error flag
551  eventErrorFlag = true;
552  }
553 
554  if(mode <= 2) {
555  // Fill the ROB Summary (1 per ROS) histo
556  if ((*error_it).robID() != 31) {
557  ROSError->Fill((*error_it).errorType(),(*error_it).robID());
558  }
559  else if ((*error_it).errorType() == 4) {
560  vector<int> channelBins;
561  channelsInROS((*error_it).cerosID(),channelBins);
562  vector<int>::const_iterator channelIt = channelBins.begin();
563  vector<int>::const_iterator channelEnd = channelBins.end();
564  for(;channelIt!=channelEnd;++channelIt) {
565  ROSError->Fill(4,(*channelIt));
566  }
567  }
568  }
569  }
570 
571 
572  int ROSDebug_BunchNumber = -1;
573 
574  for (vector<DTROSDebugWord>::const_iterator debug_it = data.getROSDebugs().begin();
575  debug_it != data.getROSDebugs().end(); debug_it++) { // Loop over ROS debug words
576 
577  int debugROSSummary = 0;
578  int debugROSError = 0;
579  vector<int> debugBins;
580  bool hasEvIdMis = false;
581  vector<int> evIdMisBins;
582 
583  if ((*debug_it).debugType() == 0 ) {
584  ROSDebug_BunchNumber = (*debug_it).debugMessage();
585  } else if ((*debug_it).debugType() == 1 ) {
586  // not used
587  // ROSDebug_BcntResCntLow = (*debug_it).debugMessage();
588  } else if ((*debug_it).debugType() == 2 ) {
589  // not used
590  // ROSDebug_BcntResCntHigh = (*debug_it).debugMessage();
591  } else if ((*debug_it).debugType() == 3) {
592  if ((*debug_it).dontRead()){
593  debugROSSummary = 11;
594  debugROSError = 8;
595  if (mode <= 2) channelsInCEROS((*debug_it).cerosIdCerosStatus(),(*debug_it).dontRead(),debugBins);
596  } if ((*debug_it).evIdMis()){
597  hasEvIdMis = true;
598  if (mode <= 2) channelsInCEROS((*debug_it).cerosIdCerosStatus(),(*debug_it).evIdMis(),evIdMisBins);
599  }
600  } else if ((*debug_it).debugType() == 4 &&
601  (*debug_it).cerosIdRosStatus()){
602  debugROSSummary = 13;
603  debugROSError = 10;
604  if (mode <= 2) channelsInROS((*debug_it).cerosIdRosStatus(),debugBins);
605  }
606 
607  if (debugROSSummary) {
608  ROSSummary->Fill(debugROSSummary,code.getROS());
609  if (mode <= 2) {
610  vector<int>::const_iterator channelIt = debugBins.begin();
611  vector<int>::const_iterator channelEnd = debugBins.end();
612  for (;channelIt!=channelEnd;++channelIt) {
613  ROSError->Fill(debugROSError,(*channelIt));
614  }
615  }
616  }
617 
618  if (hasEvIdMis) {
619  ROSSummary->Fill(12,code.getROS());
620  if (mode <= 2) {
621  vector<int>::const_iterator channelIt = evIdMisBins.begin();
622  vector<int>::const_iterator channelEnd = evIdMisBins.end();
623  for (;channelIt!=channelEnd;++channelIt) {
624  ROSError->Fill(9,(*channelIt));
625  }
626  }
627  }
628 
629  }
630 
631  // ROB Group Header
632  // Check the BX of the ROB headers against the BX of the ROS
633  for (vector<DTROBHeader>::const_iterator rob_it = data.getROBHeaders().begin();
634  rob_it != data.getROBHeaders().end(); rob_it++) { // loop over ROB headers
635 
636  code.setROB((*rob_it).first);
637  DTROBHeaderWord robheader = (*rob_it).second;
638 
639  rosBxIdsPerFED[ddu].insert(ROSDebug_BunchNumber);
640 
641  if (robheader.bunchID() != ROSDebug_BunchNumber) {
642  // fill ROS Summary plot
643  ROSSummary->Fill(8,code.getROS());
644  eventErrorFlag = true;
645 
646  // fill ROB Summary plot for that particular ROS
647  if(mode <= 2) ROSError->Fill(7,robheader.robID());
648  }
649  }
650 
651 
652  if(mode < 1) { // produce only when not in HLT or SM
653  // ROB Trailer
654  for (vector<DTROBTrailerWord>::const_iterator robt_it = data.getROBTrailers().begin();
655  robt_it != data.getROBTrailers().end(); robt_it++) { // loop over ROB trailers
656  float wCount = (*robt_it).wordCount()<100. ? (*robt_it).wordCount() : 99.9;
657  rosHistos["ROB_mean"][code.getROSID()]->Fill((*robt_it).robID(),wCount);
658  }
659 
660  // Plot the event lenght //NOHLT
661  int rosEventLenght = data.getROSTrailer().EventWordCount()*4;
662  rosTimeHistos["ROSAvgEventLenghtvsLumi"][code.getROSID()]->accumulateValueTimeSlot(rosEventLenght);
663 
664  if(rosEventLenght > 1600) rosEventLenght = 1600;
665  rosHistos["ROSEventLenght"][code.getROSID()]->Fill(rosEventLenght);
666  }
667 
668 
669  // TDC Data
670  for (vector<DTTDCData>::const_iterator tdc_it = data.getTDCData().begin();
671  tdc_it != data.getTDCData().end(); tdc_it++) { // loop over TDC data
672 
673  DTTDCMeasurementWord tdcDatum = (*tdc_it).second;
674 
675  if ( tdcDatum.PC() !=0) {
676  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
677  << " PC error in ROS " << code.getROS() << " TDC " << (*tdc_it).first << endl;
678  // fill ROS Summary plot
679  ROSSummary->Fill(7,code.getROS());
680 
681  eventErrorFlag = true;
682 
683  // fill ROB Summary plot for that particular ROS
684  if(mode <= 2) ROSError->Fill(6,(*tdc_it).first);
685  }
686  }
687 
688  // TDC Error
689  for (vector<DTTDCError>::const_iterator tdc_it = data.getTDCError().begin();
690  tdc_it != data.getTDCError().end(); tdc_it++) { // loop over TDC errors
691 
692  code.setROB((*tdc_it).first);
693 
694  int tdcError_ROSSummary = 0;
695  int tdcError_ROSError = 0;
696  int tdcError_TDCHisto = 0;
697 
698  if(((*tdc_it).second).tdcError() & 0x4000 ) {
699  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
700  << " ROS " << code.getROS() << " ROB " << code.getROB()
701  << " Internal fatal Error 4000 in TDC " << (*tdc_it).first << endl;
702 
703  tdcError_ROSSummary = 14;
704  tdcError_ROSError = 11;
705  tdcError_TDCHisto = 0;
706 
707  } else if ( ((*tdc_it).second).tdcError() & 0x0249 ) {
708  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
709  << " ROS " << code.getROS() << " ROB " << code.getROB()
710  << " TDC FIFO overflow in TDC " << (*tdc_it).first << endl;
711 
712  tdcError_ROSSummary = 15;
713  tdcError_ROSError = 12;
714  tdcError_TDCHisto = 1;
715 
716  } else if ( ((*tdc_it).second).tdcError() & 0x0492 ) {
717  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
718  << " ROS " << code.getROS() << " ROB " << code.getROB()
719  << " TDC L1 buffer overflow in TDC " << (*tdc_it).first << endl;
720 
721  tdcError_ROSSummary = 16;
722  tdcError_ROSError = 13;
723  tdcError_TDCHisto = 2;
724 
725  } else if ( ((*tdc_it).second).tdcError() & 0x2000 ) {
726  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
727  << " ROS " << code.getROS() << " ROB " << code.getROB()
728  << " TDC L1A FIFO overflow in TDC " << (*tdc_it).first << endl;
729 
730  tdcError_ROSSummary = 17;
731  tdcError_ROSError = 14;
732  tdcError_TDCHisto = 3;
733 
734  } else if ( ((*tdc_it).second).tdcError() & 0x0924 ) {
735  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
736  << " ROS " << code.getROS() << " ROB " << code.getROB()
737  << " TDC hit error in TDC " << (*tdc_it).first << endl;
738 
739  tdcError_ROSSummary = 18;
740  tdcError_ROSError = 15;
741  tdcError_TDCHisto = 4;
742 
743  } else if ( ((*tdc_it).second).tdcError() & 0x1000 ) {
744  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
745  << " ROS " << code.getROS() << " ROB " << code.getROB()
746  << " TDC hit rejected in TDC " << (*tdc_it).first << endl;
747 
748  tdcError_ROSSummary = 19;
749  tdcError_ROSError = 16;
750  tdcError_TDCHisto = 5;
751 
752  } else {
753  LogWarning("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
754  << " TDC error code not known " << ((*tdc_it).second).tdcError() << endl;
755  }
756 
757  ROSSummary->Fill(tdcError_ROSSummary,code.getROS());
758 
759  if(tdcError_ROSSummary <= 15) {
760  eventErrorFlag = true;
761  }
762 
763  if(mode <= 2) {
764  ROSError->Fill(tdcError_ROSError,(*tdc_it).first);
765  if(mode <= 1)
766  rosHistos["TDCError"][code.getROSID()]->Fill(tdcError_TDCHisto+6*((*tdc_it).second).tdcID(),(*tdc_it).first);
767  }
768  }
769 
770  // Read SC data
771  if (mode < 1 && getSCInfo) {
772  // NumberOf16bitWords counts the # of words + 1 subheader
773  // the SC includes the SC "private header" and the ROS header and trailer (= NumberOf16bitWords +3)
774  rosHistos["SCSizeVsROSSize"][code.getSCID()]->Fill(ros,data.getSCTrailer().wordCount());
775 
776  }
777 }
778 
779 void DTDataIntegrityTask::processFED(DTDDUData & data, const std::vector<DTROS25Data> & rosData, int ddu) {
780 
781  neventsDDU++;
782  if (neventsDDU%1000 == 0)
783  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
784  << "[DTDataIntegrityTask]: " << neventsDDU << " events analyzed by processFED" << endl;
785 
786 
787  DTROChainCoding code;
788  code.setDDU(ddu);
789  if(code.getDDUID() < FEDIDmin || code.getDDUID() > FEDIDMax) return;
790 
791  hFEDEntry->Fill(code.getDDUID());
792 
793  FEDTrailer trailer = data.getDDUTrailer();
794  FEDHeader header = data.getDDUHeader();
795 
796  // check consistency of header and trailer
797  if(!header.check()) {
798  // error code 7
799  hFEDFatal->Fill(code.getDDUID());
800  hCorruptionSummary->Fill(code.getDDUID(), 7);
801  }
802 
803  if(!trailer.check()) {
804  // error code 8
805  hFEDFatal->Fill(code.getDDUID());
806  hCorruptionSummary->Fill(code.getDDUID(), 8);
807  }
808 
809  // check CRC error bit set by DAQ before sending data on SLink
810  if(data.crcErrorBit()) {
811  // error code 6
812  hFEDFatal->Fill(code.getDDUID());
813  hCorruptionSummary->Fill(code.getDDUID(), 6);
814  }
815 
816  if(mode == 3 || mode ==1) return; //Avoid duplication of Info in FEDIntegrity_EvF
817 
818  const DTDDUSecondStatusWord& secondWord = data.getSecondStatusWord();
819 
820  // Fill the status summary of the TTS
821 
822  //1D HISTO WITH TTS VALUES form trailer (7 bins = 7 values)
823  int ttsCodeValue = -1;
824  int ttsSummaryBin = -1;
825 
826  switch(trailer.ttsBits()) {
827  case 0:{ //disconnected
828  ttsCodeValue = 0;
829  break;
830  }
831  case 1:{ //warning overflow
832  ttsCodeValue = 1;
833  if(secondWord.warningROSPAF()) { // ROS PAF
834  ttsSummaryBin = 1;
835  } else { // DDU PAF
836  ttsSummaryBin = 2;
837  }
838 
839  break;
840  }
841  case 2:{ //out of sinch
842  ttsCodeValue = 2;
843  bool knownOrigin = false;
844  if(secondWord.outOfSynchROSError()) {// ROS Error
845  ttsSummaryBin = 7;
846  knownOrigin = true;
847  }
848  if(secondWord.l1AIDError()) {// L1A Mism.
849  ttsSummaryBin = 6;
850  knownOrigin = true;
851  }
852  if(secondWord.bxIDError()) {// BX Mism.
853  ttsSummaryBin = 8;
854  knownOrigin = true;
855  }
856  if(secondWord.outputFifoFull() || secondWord.inputFifoFull() || secondWord.fifoFull()) { // DDU Full
857  ttsSummaryBin = 5;
858  knownOrigin = true;
859  }
860  if(!knownOrigin) ttsSummaryBin = 9; // Error in DDU logic
861 
862  break;
863  }
864  case 4:{ //busy
865  ttsCodeValue = 3;
866  bool knownOrigin = false;
867  if(secondWord.busyROSPAF()) { // ROS PAF
868  ttsSummaryBin = 3;
869  knownOrigin = true;
870  }
871  if(secondWord.outputFifoAlmostFull() || secondWord.inputFifoAlmostFull() || secondWord.fifoAlmostFull() ){ // DDU PAF
872  ttsSummaryBin = 4;
873  knownOrigin = true;
874  }
875  if(!knownOrigin) ttsSummaryBin = 9; // Error in DDU logic
876  break;
877  }
878  case 8:{ //ready
879  ttsCodeValue = 4;
880  break;
881  }
882  case 12:{ //error
883  ttsCodeValue = 5;
884  break;
885  }
886  case 16:{ //disconnected
887  ttsCodeValue = 6;
888  break;
889  }
890  default:{
891  LogError("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
892  <<"[DTDataIntegrityTask] DDU control: wrong TTS value "<<trailer.ttsBits()<<endl;
893  ttsCodeValue = 7;
894  }
895  }
896  if(mode < 1) dduHistos["TTSValues"][code.getDDUID()]->Fill(ttsCodeValue);
897  if(ttsSummaryBin != -1) {
898  hTTSSummary->Fill(ddu, ttsSummaryBin);
899  }
900 
901 
902 
903 
904 
905 
906  //2D HISTO: ROS VS STATUS (8 BIT = 8 BIN) from 1st-2nd status words (9th BIN FROM LIST OF ROS in 2nd status word)
907  MonitorElement* hROSStatus = dduHistos["ROSStatus"][code.getDDUID()];
908  //1D HISTO: NUMBER OF ROS IN THE EVENTS from 2nd status word
909 
910  int rosList = secondWord.rosList();
911  set<int> rosPositions;
912  for(int i=0;i<12;i++) {
913  if(rosList & 0x1) {
914  rosPositions.insert(i);
915  //9th BIN FROM LIST OF ROS in 2nd status word
916  if(mode <= 2) hROSStatus->Fill(8,i,1);
917  }
918  rosList >>= 1;
919  }
920 
921  int channel=0;
922  for (vector<DTDDUFirstStatusWord>::const_iterator fsw_it = data.getFirstStatusWord().begin();
923  fsw_it != data.getFirstStatusWord().end(); fsw_it++) {
924  // assuming association one-to-one between DDU channel and ROS
925  if(mode <= 2) {
926  hROSStatus->Fill(0,channel,(*fsw_it).channelEnabled());
927  hROSStatus->Fill(1,channel,(*fsw_it).timeout());
928  hROSStatus->Fill(2,channel,(*fsw_it).eventTrailerLost());
929  hROSStatus->Fill(3,channel,(*fsw_it).opticalFiberSignalLost());
930  hROSStatus->Fill(4,channel,(*fsw_it).tlkPropagationError());
931  hROSStatus->Fill(5,channel,(*fsw_it).tlkPatternError());
932  hROSStatus->Fill(6,channel,(*fsw_it).tlkSignalLost());
933  hROSStatus->Fill(7,channel,(*fsw_it).errorFromROS());
934  }
935  // check that the enabled channel was also in the read-out
936  if((*fsw_it).channelEnabled() == 1 &&
937  rosPositions.find(channel) == rosPositions.end()) {
938  if(mode <= 2) hROSStatus->Fill(9,channel,1);
939  // error code 1
940  hFEDFatal->Fill(code.getDDUID());
941  hCorruptionSummary->Fill(code.getDDUID(), 1);
942  }
943  channel++;
944  }
945 
946 
947  // ---------------------------------------------------------------------
948  // cross checks between FED and ROS data
949  // check the BX ID against the ROSs
950  set<int> rosBXIds = rosBxIdsPerFED[ddu];
951  if((rosBXIds.size() > 1 || rosBXIds.find(header.bxID()) == rosBXIds.end()) && !rosBXIds.empty()) { // in this case look for faulty ROSs
952  for(vector<DTROS25Data>::const_iterator rosControlData = rosData.begin();
953  rosControlData != rosData.end(); ++rosControlData) { // loop over the ROS data
954  for (vector<DTROSDebugWord>::const_iterator debug_it = (*rosControlData).getROSDebugs().begin();
955  debug_it != (*rosControlData).getROSDebugs().end(); debug_it++) { // Loop over ROS debug words
956  if ((*debug_it).debugType() == 0 && (*debug_it).debugMessage() != header.bxID()) { // check the BX
957  int ros = (*rosControlData).getROSID();
958  // fill the error bin
959  if(mode <= 2) hROSStatus->Fill(11,ros-1);
960  // error code 2
961  hFEDFatal->Fill(code.getDDUID());
962  hCorruptionSummary->Fill(code.getDDUID(), 2);
963  }
964  }
965  }
966  }
967 
968  // check the BX ID against other FEDs
969  fedBXIds.insert(header.bxID());
970  if(fedBXIds.size() != 1) {
971  LogWarning("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
972  << "ERROR: FED " << ddu << " BX ID different from other feds: " << header.bxID() << endl;
973  // error code 3
974  hFEDFatal->Fill(code.getDDUID());
975  hCorruptionSummary->Fill(code.getDDUID(), 3);
976  }
977 
978 
979  // check the L1A ID against the ROSs
980  set<int> rosL1AIds = rosL1AIdsPerFED[ddu];
981  if((rosL1AIds.size() > 1 || rosL1AIds.find(header.lvl1ID()-1) == rosL1AIds.end()) && !rosL1AIds.empty()) { // in this case look for faulty ROSs
982  //If L1A_ID error identify which ROS has wrong L1A
983  for (vector<DTROS25Data>::const_iterator rosControlData = rosData.begin();
984  rosControlData != rosData.end(); rosControlData++) { // loop over the ROS data
985  int ROSHeader_TTCCount = ((*rosControlData).getROSHeader().TTCEventCounter() + 1) % 0x1000000; // fix comparison in case of last counting bin in ROS /first one in DDU
986  if( ROSHeader_TTCCount != header.lvl1ID() ) {
987  int ros = (*rosControlData).getROSID();
988  if(mode <= 2) hROSStatus->Fill(10,ros-1);
989  // error code 4
990  hFEDFatal->Fill(code.getDDUID());
991  hCorruptionSummary->Fill(code.getDDUID(), 4);
992  }
993  }
994  }
995 
996  //1D HISTOS: EVENT LENGHT from trailer
997  int fedEvtLenght = trailer.lenght()*8;
998  // if(fedEvtLenght > 16000) fedEvtLenght = 16000; // overflow bin
999  dduHistos["EventLenght"][code.getDDUID()]->Fill(fedEvtLenght);
1000 
1001  if(mode > 1) return;
1002 
1003  dduTimeHistos["FEDAvgEvLenghtvsLumi"][code.getDDUID()]->accumulateValueTimeSlot(fedEvtLenght);
1004 
1005  // size of the list of ROS in the Read-Out
1006  dduHistos["ROSList"][code.getDDUID()]->Fill(rosPositions.size());
1007 
1008 
1009  //2D HISTO: FIFO STATUS from 2nd status word
1010  MonitorElement *hFIFOStatus = dduHistos["FIFOStatus"][code.getDDUID()];
1011  int inputFifoFull = secondWord.inputFifoFull();
1012  int inputFifoAlmostFull = secondWord.inputFifoAlmostFull();
1013  int fifoFull = secondWord.fifoFull();
1014  int fifoAlmostFull = secondWord.fifoAlmostFull();
1015  int outputFifoFull = secondWord.outputFifoFull();
1016  int outputFifoAlmostFull = secondWord.outputFifoAlmostFull();
1017  for(int i=0;i<3;i++){
1018  if(inputFifoFull & 0x1){
1019  hFIFOStatus->Fill(i,0);
1020  }
1021  if(inputFifoAlmostFull & 0x1){
1022  hFIFOStatus->Fill(i,1);
1023  }
1024  if(fifoFull & 0x1){
1025  hFIFOStatus->Fill(3+i,0);
1026  }
1027  if(fifoAlmostFull & 0x1){
1028  hFIFOStatus->Fill(3+i,1);
1029  }
1030  if(!(inputFifoFull & 0x1) && !(inputFifoAlmostFull & 0x1)){
1031  hFIFOStatus->Fill(i,2);
1032  }
1033  if(!(fifoFull & 0x1) && !(fifoAlmostFull & 0x1)){
1034  hFIFOStatus->Fill(3+i,2);
1035  }
1036  inputFifoFull >>= 1;
1037  inputFifoAlmostFull >>= 1;
1038  fifoFull >>= 1;
1039  fifoAlmostFull >>= 1;
1040  }
1041 
1042  if(outputFifoFull){
1043  hFIFOStatus->Fill(6,0);
1044  }
1045  if(outputFifoAlmostFull){
1046  hFIFOStatus->Fill(6,1);
1047  }
1048  if(!outputFifoFull && !outputFifoAlmostFull){
1049  hFIFOStatus->Fill(6,2);
1050  }
1051 
1052 
1053 
1054 
1055 
1056 
1057 
1058  //1D HISTO: EVENT TYPE from header
1059  dduHistos["EventType"][code.getDDUID()]->Fill(header.triggerType());
1060 
1061  // fill the distribution of the BX ids
1062  dduHistos["BXID"][code.getDDUID()]->Fill(header.bxID());
1063 
1064 }
1065 
1067  return eventErrorFlag;
1068 }
1069 
1070 
1071 // log number of times the payload of each fed is unpacked
1073  hFEDEntry->Fill(dduID);
1074 }
1075 
1076 
1077 
1078 // log number of times the payload of each fed is skipped (no ROS inside)
1080  hFEDFatal->Fill(dduID);
1081 }
1082 
1083 
1084 
1085 // log number of times the payload of each fed is partially skipped (some ROS skipped)
1087  hFEDNonFatal->Fill(dduID);
1088 }
1089 
1090 std::string DTDataIntegrityTask::topFolder(bool isFEDIntegrity) const {
1091 
1092  string folder = isFEDIntegrity ? fedIntegrityFolder : "DT/00-DataIntegrity/";
1093 
1094  if (mode == 0 || mode == 2)
1095  folder = "DT/00-DataIntegrity/"; //Move everything from FEDIntegrity except for SM and HLT modes
1096 
1097  return folder;
1098 
1099 }
1100 
1101 void DTDataIntegrityTask::channelsInCEROS(int cerosId, int chMask, vector<int>& channels ){
1102  for (int iCh=0; iCh<6;++iCh) {
1103  if ((chMask >> iCh) & 0x1){
1104  channels.push_back(cerosId*6+iCh);
1105  }
1106  }
1107  return;
1108 }
1109 
1110 void DTDataIntegrityTask::channelsInROS(int cerosMask, vector<int>& channels){
1111  for (int iCeros=0; iCeros<5;++iCeros) {
1112  if ((cerosMask >> iCeros) & 0x1){
1113  for (int iCh=0; iCh<6;++iCh) {
1114  channels.push_back(iCeros*6+iCh);
1115  }
1116  }
1117  }
1118  return;
1119 }
1120 
1122 
1123  nEventsLS = 0;
1124 
1125 }
1126 
1128 
1129  int lumiBlock = ls.luminosityBlock();
1130 
1131  map<std::string, map<int, DTTimeEvolutionHisto*> >::iterator dduIt = dduTimeHistos.begin();
1132  map<std::string, map<int, DTTimeEvolutionHisto*> >::iterator dduEnd = dduTimeHistos.end();
1133  for(; dduIt!=dduEnd; ++dduIt) {
1134  map<int, DTTimeEvolutionHisto*>::iterator histoIt = dduIt->second.begin();
1135  map<int, DTTimeEvolutionHisto*>::iterator histoEnd = dduIt->second.end();
1136  for(; histoIt!=histoEnd; ++histoIt) {
1137  histoIt->second->updateTimeSlot(lumiBlock,nEventsLS);
1138  }
1139  }
1140 
1141  map<std::string, map<int, DTTimeEvolutionHisto*> >::iterator rosIt = rosTimeHistos.begin();
1142  map<std::string, map<int, DTTimeEvolutionHisto*> >::iterator rosEnd = rosTimeHistos.end();
1143  for(; rosIt!=rosEnd; ++rosIt) {
1144  map<int, DTTimeEvolutionHisto*>::iterator histoIt = rosIt->second.begin();
1145  map<int, DTTimeEvolutionHisto*>::iterator histoEnd = rosIt->second.end();
1146  for(; histoIt!=histoEnd; ++histoIt) {
1147  histoIt->second->updateTimeSlot(lumiBlock,nEventsLS);
1148  }
1149  }
1150 
1151 }
1152 
1154 {
1155  nevents++;
1157 
1158  nEventsLS++;
1159 
1160  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") << "[DTDataIntegrityTask]: preProcessEvent" <<endl;
1161  // clear the set of BXids from the ROSs
1162  for(map<int, set<int> >::iterator rosBxIds = rosBxIdsPerFED.begin(); rosBxIds != rosBxIdsPerFED.end(); ++rosBxIds) {
1163  (*rosBxIds).second.clear();
1164  }
1165 
1166  fedBXIds.clear();
1167 
1168  for(map<int, set<int> >::iterator rosL1AIds = rosL1AIdsPerFED.begin(); rosL1AIds != rosL1AIdsPerFED.end(); ++rosL1AIds) {
1169  (*rosL1AIds).second.clear();
1170  }
1171 
1172  // reset the error flag
1173  eventErrorFlag = false;
1174 
1175  // Digi collection
1176  edm::Handle<DTDDUCollection> dduProduct;
1177  e.getByToken(dduToken, dduProduct);
1178  edm::Handle<DTROS25Collection> ros25Product;
1179  e.getByToken(ros25Token, ros25Product);
1180 
1181  DTDDUData dduData;
1182  std::vector<DTROS25Data> ros25Data;
1183 
1184  if(dduProduct.isValid() && ros25Product.isValid()) {
1185  for(unsigned int i=0; i<dduProduct->size(); ++i)
1186  {
1187  dduData = dduProduct->at(i);
1188  ros25Data = ros25Product->at(i);
1189  // FIXME: passing id variable is not needed anymore - change processFED interface for next release!
1190  FEDHeader header = dduData.getDDUHeader();
1191  int id = header.sourceID();
1192  processFED(dduData, ros25Data, id);
1193  for(unsigned int j=0; j < ros25Data.size(); ++j) {
1194  int rosid = j+1;
1195  processROS25(ros25Data[j],id,rosid);
1196  }
1197  }
1198  }
1199 }
1200 
1201 // Local Variables:
1202 // show-trailing-whitespace: t
1203 // truncate-lines: t
1204 // End:
std::map< int, std::set< int > > rosBxIdsPerFED
std::multimap< std::string, std::string > names
std::map< int, std::set< int > > rosL1AIdsPerFED
int EventWordCount() const
Definition: DTDDUWords.h:272
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const std::vector< DTROBHeader > & getROBHeaders() const
Definition: DTControlData.h:58
std::map< std::string, std::map< int, MonitorElement * > > dduHistos
bool check()
Definition: FEDTrailer.cc:64
const std::vector< DTTDCData > & getTDCData() const
Definition: DTControlData.h:61
void processFED(DTDDUData &dduData, const std::vector< DTROS25Data > &rosData, int dduID)
int outputFifoFull() const
Definition: DTDDUWords.h:901
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
int PC() const
Definition: DTDDUWords.h:622
MonitorElement * hFEDNonFatal
int rosList() const
Definition: DTDDUWords.h:903
int l1AFifoOccupancy() const
Definition: DTDDUWords.h:271
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)
void bookHistos(DQMStore::IBooker &, const int fedMin, const int fedMax)
int getROS() const
int busyROSPAF() const
Definition: DTDDUWords.h:905
int l1AIDError() const
Definition: DTDDUWords.h:895
std::map< std::string, std::map< int, DTTimeEvolutionHisto * > > dduTimeHistos
void channelsInROS(int cerosMask, std::vector< int > &channels)
MonitorElement * hFEDFatal
void Fill(long long x)
LuminosityBlockNumber_t luminosityBlock() const
edm::EDGetTokenT< DTROS25Collection > ros25Token
const DTLocalTriggerTrailerWord & getSCTrailer() const
Definition: DTControlData.h:66
int sourceID()
Identifier of the FED.
Definition: FEDHeader.cc:28
int warningROSPAF() const
Definition: DTDDUWords.h:904
int getSCID() const
DTDataIntegrityTask(const edm::ParameterSet &ps)
int TTCEventCounter() const
Definition: DTDDUWords.h:225
void processROS25(DTROS25Data &data, int dduID, int ros)
const std::vector< DTROSDebugWord > & getROSDebugs() const
Definition: DTControlData.h:57
const std::vector< DTDDUFirstStatusWord > & getFirstStatusWord() const
const DTROSTrailerWord & getROSTrailer() const
Definition: DTControlData.h:54
const DTROSHeaderWord & getROSHeader() const
Definition: DTControlData.h:55
void beginLuminosityBlock(const edm::LuminosityBlock &ls, const edm::EventSetup &es) override
void analyze(const edm::Event &e, const edm::EventSetup &c) override
int TPX() const
Definition: DTDDUWords.h:270
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void endLuminosityBlock(const edm::LuminosityBlock &ls, const edm::EventSetup &es) override
int fifoFull() const
Definition: DTDDUWords.h:897
bool isValid() const
Definition: HandleBase.h:74
#define LogTrace(id)
bool crcErrorBit() const
std::map< std::string, std::map< int, MonitorElement * > > rosSHistos
int getDDUID() const
const FEDTrailer & getDDUTrailer() const
MonitorElement * nEventMonitor
int inputFifoAlmostFull() const
Definition: DTDDUWords.h:900
int ttsBits()
Current value of the Trigger Throttling System bitsAQ).
Definition: FEDTrailer.cc:32
int robID() const
Definition: DTDDUWords.h:421
def ls(path, rec=False)
Definition: eostools.py:348
int inputFifoFull() const
Definition: DTDDUWords.h:898
std::string topFolder(bool isFEDIntegrity) const
bool check()
Check that the header is OK.
Definition: FEDHeader.cc:64
const FEDHeader & getDDUHeader() const
Getters.
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * hFEDEntry
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
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.
Definition: FEDTrailer.cc:17
int bxID()
The bunch crossing number.
Definition: FEDHeader.cc:24
void setROS(const int &ID)
const std::vector< DTROBTrailerWord > & getROBTrailers() const
Definition: DTControlData.h:59
int getDDU() const
int bxIDError() const
Definition: DTDDUWords.h:896
void channelsInCEROS(int cerosId, int chMask, std::vector< int > &channels)
int getROB() const
int outputFifoAlmostFull() const
Definition: DTDDUWords.h:902
void setDDU(const int &ID)
need to reset the bits before setting
HLT enums.
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
void bookHistosROS25(DQMStore::IBooker &, DTROChainCoding code)
const std::vector< DTROSErrorWord > & getROSErrors() const
Definition: DTControlData.h:56
MonitorElement * hTTSSummary
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::map< std::string, std::map< int, DTTimeEvolutionHisto * > > rosTimeHistos
std::set< int > fedBXIds
MonitorElement * bookFloat(Args &&...args)
Definition: DQMStore.h:109
int lvl1ID()
Level-1 event number generated by the TTC system.
Definition: FEDHeader.cc:20
int fifoAlmostFull() const
Definition: DTDDUWords.h:899
int triggerType()
Event Trigger type identifier.
Definition: FEDHeader.cc:16
const std::vector< DTTDCError > & getTDCError() const
Definition: DTControlData.h:62
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
Definition: DTDDUWords.h:906
MonitorElement * hCorruptionSummary
int bunchID() const
Definition: DTDDUWords.h:423
edm::EDGetTokenT< DTDDUCollection > dduToken
Definition: Run.h:43
int getROSID() const