CMS 3D CMS Logo

DTDataIntegrityTask.cc
Go to the documentation of this file.
1 /*
2  * \file DTDataIntegrityTask.cc
3  *
4  * Class for DT Data Integrity
5  * at Online DQM (Single Thread)
6  * expected to monitor uROS
7  * Class with MEs vs Time/LS
8  *
9  * \author Javier Fernandez (Uni. Oviedo)
10  *
11  */
12 
23 
24 #include <cmath>
25 #include <fstream>
26 #include <map>
27 #include <string>
28 #include <vector>
29 
30 using namespace std;
31 using namespace edm;
32 
34  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") << "[DTDataIntegrityTask]: Constructor" << endl;
35 
36  fedToken = consumes<DTuROSFEDDataCollection>(ps.getParameter<InputTag>("dtFEDlabel"));
39 
40  neventsFED = 0;
41  neventsuROS = 0;
42 
43  fedIntegrityFolder = ps.getUntrackedParameter<string>("fedIntegrityFolder", "DT/FEDIntegrity");
44 
45  string processingMode = ps.getUntrackedParameter<string>("processingMode", "Online");
46 
47  // processing mode flag to select plots to be produced and basedirs CB vedi se farlo meglio...
48  if (processingMode == "Online") {
49  mode = 0;
50  } else if (processingMode == "SM") {
51  mode = 1;
52  } else if (processingMode == "Offline") {
53  throw cms::Exception("WrongParameter") << "[DTDataIntegrityTask]: processingMode :" << processingMode
54  << " invalid! Must be Online, SM or HLT !" << endl
55  << " Offline mode is covered on DTDataIntegrityuROSOffline" << endl;
56  } else if (processingMode == "HLT") {
57  mode = 3;
58  } else {
59  throw cms::Exception("MissingParameter") << "[DTDataIntegrityTask]: processingMode :" << processingMode
60  << " invalid! Must be Online, SM, Offline or HLT !" << endl;
61  }
62 }
63 
65  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
66  << "[DTDataIntegrityTask]: Destructor. Analyzed " << neventsFED << " events" << endl;
67  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
68  << "[DTDataIntegrityTask]: postEndJob called!" << endl;
69 }
70 
71 /*
72  Folder Structure uROS:
73  - 3 uROS Summary plots: Wheel-1/-2 (FED1369), Wheel0 (FED1370), Wheel+1/+2 (FED1371)
74  - One folder for each FED
75  - Inside each FED folder the uROSStatus histos, FED histos
76  - One folder for each wheel and the corresponding ROSn folders
77  - Inside each ROS folder the TDC and ROS errors histos, 24 Links/plot
78 */
79 
80 void DTDataIntegrityTask::bookHistograms(DQMStore::IBooker& ibooker,
81  edm::Run const& iRun,
82  edm::EventSetup const& iSetup) {
83  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask") << "[DTDataIntegrityTask]: postBeginJob" << endl;
84 
85  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
86  << "[DTDataIntegrityTask] Get DQMStore service" << endl;
87 
88  // Loop over the DT FEDs
89 
90  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
91  << " FEDS: " << FEDIDmin << " to " << FEDIDmax << " in the RO" << endl;
92 
93  // book FED integrity histos
94  bookHistos(ibooker, FEDIDmin, FEDIDmax);
95 
96  // static booking of the histograms
97 
98  if (mode == 0) {
99  for (int fed = FEDIDmin; fed <= FEDIDmax; ++fed) { // loop over the FEDs in the readout
100 
101  bookHistos(ibooker, string("FED"), fed);
102 
103  bookHistos(ibooker, string("CRATE"), fed);
104 
105  for (int uRos = 1; uRos <= NuROS; ++uRos) { // loop over all ROS
106  bookHistosuROS(ibooker, fed, uRos);
107  }
108  }
109 
110  for (int wheel = -2; wheel < 3; ++wheel) {
111  for (int ros = 1; ros <= NuROS; ++ros) { // loop over all ROS
112  bookHistosROS(ibooker, wheel, ros);
113  }
114  }
115 
116  } //Not in HLT or SM mode
117 }
118 
119 void DTDataIntegrityTask::bookHistos(DQMStore::IBooker& ibooker, const int fedMin, const int fedMax) {
120  ibooker.setCurrentFolder("DT/EventInfo/Counters");
121  nEventMonitor = ibooker.bookFloat("nProcessedEventsDataIntegrity");
122 
123  // Standard FED integrity histos
124  ibooker.setCurrentFolder(topFolder(true));
125 
126  int nFED = (fedMax - fedMin) + 1;
127 
128  hFEDEntry = ibooker.book1D("FEDEntries", "# entries per DT FED", nFED, fedMin, fedMax + 1);
129 
130  string histoType = "ROSSummary";
131  for (int wheel = -2; wheel < 3; ++wheel) {
132  string wheel_s = to_string(wheel);
133  string histoName = "ROSSummary_W" + wheel_s;
134  string fed_s = to_string(FEDIDmin + 1); //3 FEDs from 2018 onwards
135  if (wheel < 0)
136  fed_s = to_string(FEDIDmin);
137  else if (wheel > 0)
138  fed_s = to_string(FEDIDmax);
139  string histoTitle = "Summary Wheel" + wheel_s + " (FED " + fed_s + ")";
140 
141  ((summaryHistos[histoType])[wheel]) = ibooker.book2D(histoName, histoTitle, 11, 0, 11, 12, 1, 13);
142  MonitorElement* histo = ((summaryHistos[histoType])[wheel]);
143  histo->setBinLabel(1, "Error 1", 1);
144  histo->setBinLabel(2, "Error 2", 1);
145  histo->setBinLabel(3, "Error 3", 1);
146  histo->setBinLabel(4, "Error 4", 1);
147  histo->setBinLabel(5, "Not OKflag", 1);
148  // TDC error bins
149  histo->setBinLabel(6, "TDC Fatal", 1);
150  histo->setBinLabel(7, "TDC RO FIFO ov.", 1);
151  histo->setBinLabel(8, "TDC L1 buf. ov.", 1);
152  histo->setBinLabel(9, "TDC L1A FIFO ov.", 1);
153  histo->setBinLabel(10, "TDC hit err.", 1);
154  histo->setBinLabel(11, "TDC hit rej.", 1);
155 
156  histo->setBinLabel(1, "ROS1", 2);
157  histo->setBinLabel(2, "ROS2", 2);
158  histo->setBinLabel(3, "ROS3", 2);
159  histo->setBinLabel(4, "ROS4", 2);
160  histo->setBinLabel(5, "ROS5", 2);
161  histo->setBinLabel(6, "ROS6", 2);
162  histo->setBinLabel(7, "ROS7", 2);
163  histo->setBinLabel(8, "ROS8", 2);
164  histo->setBinLabel(9, "ROS9", 2);
165  histo->setBinLabel(10, "ROS10", 2);
166  histo->setBinLabel(11, "ROS11", 2);
167  histo->setBinLabel(12, "ROS12", 2);
168  }
169 }
170 
171 void DTDataIntegrityTask::bookHistos(DQMStore::IBooker& ibooker, string folder, const int fed) {
172  string wheel = "ZERO";
173  if (fed == FEDIDmin)
174  wheel = "NEG";
175  else if (fed == FEDIDmax)
176  wheel = "POS";
177  string fed_s = to_string(fed);
178  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
179  << " Booking histos for FED: " << fed_s << " folder: " << folder << endl;
180 
181  string histoType;
182  string histoName;
183  string histoTitle;
184  MonitorElement* histo = nullptr;
185 
186  // Crate (old DDU) Histograms
187  if (folder == "CRATE") {
188  ibooker.setCurrentFolder(topFolder(false) + "FED" + fed_s);
189 
190  histoType = "EventLength";
191  histoName = "FED" + fed_s + "_" + histoType;
192  histoTitle = "Event Length (Bytes) FED " + fed_s;
193  (fedHistos[histoType])[fed] = ibooker.book1D(histoName, histoTitle, 501, 0, 30000);
194 
195  if (mode == 3 || mode == 1)
196  return; //Avoid duplication of Info in FEDIntegrity_EvF
197 
198  histoType = "uROSStatus";
199  histoName = "FED" + fed_s + "_" + histoType;
200  (fedHistos[histoType])[fed] = ibooker.book2D(histoName, histoName, 12, 0, 12, 12, 1, 13);
201  histo = (fedHistos[histoType])[fed];
202  // only placeholders for the moment
203  histo->setBinLabel(1, "Error G 1", 1);
204  histo->setBinLabel(2, "Error G 2", 1);
205  histo->setBinLabel(3, "Error G 3", 1);
206  histo->setBinLabel(4, "Error G 4", 1);
207  histo->setBinLabel(5, "Error G 5", 1);
208  histo->setBinLabel(6, "Error G 6", 1);
209  histo->setBinLabel(7, "Error G 7", 1);
210  histo->setBinLabel(8, "Error G 8", 1);
211  histo->setBinLabel(9, "Error G 9", 1);
212  histo->setBinLabel(10, "Error G 10", 1);
213  histo->setBinLabel(11, "Error G 11", 1);
214  histo->setBinLabel(12, "Error G 12", 1);
215 
216  histo->setBinLabel(1, "uROS 1", 2);
217  histo->setBinLabel(2, "uROS 2", 2);
218  histo->setBinLabel(3, "uROS 3", 2);
219  histo->setBinLabel(4, "uROS 4", 2);
220  histo->setBinLabel(5, "uROS 5", 2);
221  histo->setBinLabel(6, "uROS 6", 2);
222  histo->setBinLabel(7, "uROS 7", 2);
223  histo->setBinLabel(8, "uROS 8", 2);
224  histo->setBinLabel(9, "uROS 9", 2);
225  histo->setBinLabel(10, "uROS 10", 2);
226  histo->setBinLabel(11, "uROS 11", 2);
227  histo->setBinLabel(12, "uROS 12", 2);
228 
229  if (mode > 0)
230  return; //Info for Online only
231 
232  histoType = "FEDAvgEvLengthvsLumi";
233  histoName = "FED" + fed_s + "_" + histoType;
234  histoTitle = "Avg Event Length (Bytes) vs LumiSec FED " + fed_s;
235  (fedTimeHistos[histoType])[fed] = new DTTimeEvolutionHisto(ibooker, histoName, histoTitle, 200, 10, true, 0);
236 
237  histoType = "TTSValues";
238  histoName = "FED" + fed_s + "_" + histoType;
239  (fedHistos[histoType])[fed] = ibooker.book1D(histoName, histoName, 8, 0, 8);
240  histo = (fedHistos[histoType])[fed];
241  histo->setBinLabel(1, "Disconnected", 1);
242  histo->setBinLabel(2, "Overflow Warning ", 1);
243  histo->setBinLabel(3, "Out of synch", 1);
244  histo->setBinLabel(4, "Busy", 1);
245  histo->setBinLabel(5, "Ready", 1);
246  histo->setBinLabel(6, "Error", 1);
247  histo->setBinLabel(7, "Disconnected", 1);
248  histo->setBinLabel(8, "Unknown", 1);
249 
250  histoType = "uROSList";
251  histoName = "FED" + fed_s + "_" + histoType;
252  histoTitle = "# of uROS in the FED payload (FED" + fed_s + ")";
253  (fedHistos[histoType])[fed] = ibooker.book1D(histoName, histoTitle, 13, 0, 13);
254 
255  histoType = "BXID";
256  histoName = "FED" + fed_s + "_BXID";
257  histoTitle = "Distrib. BX ID (FED" + fed_s + ")";
258  (fedHistos[histoType])[fed] = ibooker.book1D(histoName, histoTitle, 3600, 0, 3600);
259  }
260 
261  // uROS Histograms
262  if (folder == "FED") { // The summary of the error of the ROS on the same FED
263  ibooker.setCurrentFolder(topFolder(false));
264 
265  if (mode == 3 || mode == 1)
266  return; //Avoid duplication of Info in FEDIntegrity_EvF
267 
268  histoType = "uROSSummary";
269  histoName = "FED" + fed_s + "_uROSSummary";
270  string histoTitle = "Summary Wheel" + wheel + " (FED " + fed_s + ")";
271 
272  ((summaryHistos[histoType])[fed]) = ibooker.book2D(histoName, histoTitle, 12, 0, 12, 12, 1, 13);
273  MonitorElement* histo = ((summaryHistos[histoType])[fed]);
274  // ROS error bins
275  // Placeholders for Global Errors for the moment
276  histo->setBinLabel(1, "Error G 1", 1);
277  histo->setBinLabel(2, "Error G 2", 1);
278  histo->setBinLabel(3, "Error G 3", 1);
279  histo->setBinLabel(4, "Error G 4", 1);
280  histo->setBinLabel(5, "Error G 5", 1);
281  histo->setBinLabel(6, "Error G 6", 1);
282  histo->setBinLabel(7, "Error G 7", 1);
283  histo->setBinLabel(8, "Error G 8", 1);
284  histo->setBinLabel(9, "Error G 9", 1);
285  histo->setBinLabel(10, "Error G 10", 1);
286  histo->setBinLabel(11, "Error G 11", 1);
287  histo->setBinLabel(12, "Error G 12", 1);
288 
289  histo->setBinLabel(1, "uROS1", 2);
290  histo->setBinLabel(2, "uROS2", 2);
291  histo->setBinLabel(3, "uROS3", 2);
292  histo->setBinLabel(4, "uROS4", 2);
293  histo->setBinLabel(5, "uROS5", 2);
294  histo->setBinLabel(6, "uROS6", 2);
295  histo->setBinLabel(7, "uROS7", 2);
296  histo->setBinLabel(8, "uROS8", 2);
297  histo->setBinLabel(9, "uROS9", 2);
298  histo->setBinLabel(10, "uROS10", 2);
299  histo->setBinLabel(11, "uROS11", 2);
300  histo->setBinLabel(12, "uROS12", 2);
301  }
302 }
303 
304 void DTDataIntegrityTask::bookHistosROS(DQMStore::IBooker& ibooker, const int wheel, const int ros) {
305  string wheel_s = to_string(wheel);
306  string ros_s = to_string(ros);
307  ibooker.setCurrentFolder(topFolder(false) + "Wheel" + wheel_s + "/ROS" + ros_s);
308 
309  string histoType = "ROSError";
310  int linkDown = 0;
311  string linkDown_s = to_string(linkDown);
312  int linkUp = linkDown + 24;
313  string linkUp_s = to_string(linkUp);
314  string histoName = "W" + wheel_s + "_" + "ROS" + ros_s + "_" + histoType;
315  string histoTitle = histoName + " (Link " + linkDown_s + "-" + linkUp_s + " error summary)";
316  unsigned int keyHisto = (uROSError)*1000 + (wheel + 2) * 100 + (ros - 1);
317  if (mode < 1) // Online only
318  urosHistos[keyHisto] = ibooker.book2D(histoName, histoTitle, 11, 0, 11, 25, 0, 25);
319  else
320  urosHistos[keyHisto] = ibooker.book2D(histoName, histoTitle, 5, 0, 5, 25, 0, 25);
321 
323  // uROS error bins
324  // Placeholders for the moment
325  histo->setBinLabel(1, "Error 1", 1);
326  histo->setBinLabel(2, "Error 2", 1);
327  histo->setBinLabel(3, "Error 3", 1);
328  histo->setBinLabel(4, "Error 4", 1);
329  histo->setBinLabel(5, "Not OKFlag", 1);
330  if (mode < 1) { //Online only
331  // TDC error bins
332  histo->setBinLabel(6, "TDC Fatal", 1);
333  histo->setBinLabel(7, "TDC RO FIFO ov.", 1);
334  histo->setBinLabel(8, "TDC L1 buf. ov.", 1);
335  histo->setBinLabel(9, "TDC L1A FIFO ov.", 1);
336  histo->setBinLabel(10, "TDC hit err.", 1);
337  histo->setBinLabel(11, "TDC hit rej.", 1);
338  }
339  for (int link = linkDown; link < (linkUp + 1); ++link) {
340  string link_s = to_string(link);
341  histo->setBinLabel(link + 1, "Link" + link_s, 2);
342  }
343 
344  if (mode > 1)
345  return;
346 
347  histoType = "TDCError";
348  linkDown = 0;
349  linkDown_s = to_string(linkDown);
350  linkUp = linkDown + 24;
351  linkUp_s = to_string(linkUp);
352  histoName = "W" + wheel_s + "_" + "ROS" + ros_s + "_" + histoType;
353  histoTitle = histoName + " (Link " + linkDown_s + "-" + linkUp_s + " error summary)";
354  keyHisto = (TDCError)*1000 + (wheel + 2) * 100 + (ros - 1);
355  urosHistos[keyHisto] = ibooker.book2D(histoName, histoTitle, 24, 0, 24, 25, 0, 25);
357  // TDC error bins
358  histo->setBinLabel(1, "Fatal", 1);
359  histo->setBinLabel(2, "RO FIFO ov.", 1);
360  histo->setBinLabel(3, "L1 buf. ov.", 1);
361  histo->setBinLabel(4, "L1A FIFO ov.", 1);
362  histo->setBinLabel(5, "hit err.", 1);
363  histo->setBinLabel(6, "hit rej.", 1);
364  histo->setBinLabel(7, "Fatal", 1);
365  histo->setBinLabel(8, "RO FIFO ov.", 1);
366  histo->setBinLabel(9, "L1 buf. ov.", 1);
367  histo->setBinLabel(10, "L1A FIFO ov.", 1);
368  histo->setBinLabel(11, "hit err.", 1);
369  histo->setBinLabel(12, "hit rej.", 1);
370  histo->setBinLabel(13, "Fatal", 1);
371  histo->setBinLabel(14, "RO FIFO ov.", 1);
372  histo->setBinLabel(15, "L1 buf. ov.", 1);
373  histo->setBinLabel(16, "L1A FIFO ov.", 1);
374  histo->setBinLabel(17, "hit err.", 1);
375  histo->setBinLabel(18, "hit rej.", 1);
376  histo->setBinLabel(19, "Fatal", 1);
377  histo->setBinLabel(20, "RO FIFO ov.", 1);
378  histo->setBinLabel(21, "L1 buf. ov.", 1);
379  histo->setBinLabel(22, "L1A FIFO ov.", 1);
380  histo->setBinLabel(23, "hit err.", 1);
381  histo->setBinLabel(24, "hit rej.", 1);
382 
383  for (int link = linkDown; link < (linkUp + 1); ++link) {
384  string link_s = to_string(link);
385  histo->setBinLabel(link + 1, "Link" + link_s, 2);
386  }
387 } //bookHistosROS
388 
389 void DTDataIntegrityTask::bookHistosuROS(DQMStore::IBooker& ibooker, const int fed, const int uRos) {
390  string fed_s = to_string(fed);
391  string uRos_s = to_string(uRos);
392  ibooker.setCurrentFolder(topFolder(false) + "FED" + fed_s + "/uROS" + uRos_s);
393 
394  if (mode > 1)
395  return;
396 
397  string histoType = "uROSEventLength";
398  string histoName = "FED" + fed_s + "_uROS" + uRos_s + "_" + "EventLength";
399  string histoTitle = "Event Length (Bytes) FED " + fed_s + " uROS" + uRos_s;
400  unsigned int keyHisto = (uROSEventLength)*1000 + (fed - FEDIDmin) * 100 + (uRos - 1);
401  urosHistos[keyHisto] = ibooker.book1D(histoName, histoTitle, 101, 0, 5000);
402 
403  histoType = "uROSAvgEventLengthvsLumi";
404  histoName = "FED" + fed_s + "_ROS" + uRos_s + "AvgEventLengthvsLumi";
405  histoTitle = "Event Length (Bytes) FED " + fed_s + " ROS" + uRos_s;
406  keyHisto = (fed - FEDIDmin) * 100 + (uRos - 1);
407  urosTimeHistos[keyHisto] = new DTTimeEvolutionHisto(ibooker, histoName, histoTitle, 200, 10, true, 0);
408 
409  histoType = "TTSValues";
410  histoName = "FED" + fed_s + "_" + "uROS" + uRos_s + "_" + histoType;
411  keyHisto = TTSValues * 1000 + (fed - FEDIDmin) * 100 + (uRos - 1);
412  urosHistos[keyHisto] = ibooker.book1D(histoName, histoName, 8, 0, 8);
414  histo->setBinLabel(1, "Disconnected", 1);
415  histo->setBinLabel(2, "Overflow Warning ", 1);
416  histo->setBinLabel(3, "Out of synch", 1);
417  histo->setBinLabel(4, "Busy", 1);
418  histo->setBinLabel(5, "Ready", 1);
419  histo->setBinLabel(6, "Error", 1);
420  histo->setBinLabel(7, "Disconnected", 1);
421  histo->setBinLabel(8, "Unknown", 1);
422 }
423 
425  neventsuROS++;
426 
427  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
428  << "[DTDataIntegrityTask]: " << neventsuROS << " events analyzed by processuROS" << endl;
429 
430  if (mode == 3 || mode == 1)
431  return; //Avoid duplication of Info in FEDIntegrity_EvF
432 
433  MonitorElement* uROSSummary = nullptr;
434  uROSSummary = summaryHistos["uROSSummary"][fed];
435 
436  MonitorElement* uROSStatus = nullptr;
437  uROSStatus = fedHistos["uROSStatus"][fed];
438 
439  if (!uROSSummary) {
440  LogError("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
441  << "Trying to access non existing ME at FED " << fed << std::endl;
442  return;
443  }
444 
445  unsigned int slotMap = (data.getboardId()) & 0xF;
446  if (slotMap == 0)
447  return; //prevention for Simulation empty uROS data
448  int ros = theROS(slotMap, 0); //first sector correspondign to link 0
449  int ddu = theDDU(fed, slotMap, 0, false);
450  int wheel = (ddu - 770) % 5 - 2;
451  MonitorElement* ROSSummary = nullptr;
452  ROSSummary = summaryHistos["ROSSummary"][wheel];
453 
454  // Summary of all Link errors
455  MonitorElement* uROSError0 = nullptr;
456  MonitorElement* uROSError1 = nullptr;
457  MonitorElement* uROSError2 = nullptr;
458 
459  int errorX[5][12] = {{0}}; //5th is notOK flag
460 
461  if (mode <= 2) {
462  if (uRos > 2) { //sectors 1-12
463 
464  uROSError0 = urosHistos[(uROSError)*1000 + (wheel + 2) * 100 + (ros - 1)]; //links 0-23
465  uROSError1 = urosHistos[(uROSError)*1000 + (wheel + 2) * 100 + (ros)]; //links 24-47
466  uROSError2 = urosHistos[(uROSError)*1000 + (wheel + 2) * 100 + (ros + 1)]; //links 48-71
467 
468  if ((!uROSError2) || (!uROSError1) || (!uROSError0)) {
469  LogError("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
470  << "Trying to access non existing ME at uROS " << uRos << std::endl;
471  return;
472  }
473 
474  // uROS errors
475  for (unsigned int link = 0; link < 72; ++link) {
476  for (unsigned int flag = 0; flag < 5; ++flag) {
477  if ((data.getokxflag(link) >> flag) & 0x1) { // Undefined Flag 1-4 64bits word for each MTP (12 channels)
478  int value = flag;
479  if (flag == 0)
480  value = 5; //move it to the 5th bin
481 
482  if (value > 0) {
483  if (link < 24) {
484  errorX[value - 1][ros - 1] += 1;
485  uROSError0->Fill(value - 1, link); //bins start at 0 despite labelin
486  } else if (link < 48) {
487  errorX[value - 1][ros] += 1;
488  uROSError1->Fill(value - 1, link - 23);
489  } else if (link < 72) {
490  errorX[value - 1][ros + 1] += 1;
491  uROSError2->Fill(value - 1, link - 47);
492  }
493  } //value>0
494  } //flag value
495  } //loop on flags
496  } //loop on links
497  } //uROS>2
498 
499  else { //uRos<3
500 
501  for (unsigned int link = 0; link < 12; ++link) {
502  for (unsigned int flag = 0; flag < 5; ++flag) {
503  if ((data.getokxflag(link) >> flag) & 0x1) { // Undefined Flag 1-4 64bits word for each MTP (12 channels)
504  int value = flag;
505  int sc = 24;
506  if (flag == 0)
507  value = 5; //move it to the 5th bin
508 
509  if (value > 0) {
510  unsigned int keyHisto = (uROSError)*1000 + (wheel + 2) * 100 + link; //ros -1 = link in this case
511  uROSError0 = urosHistos[keyHisto];
512  if (!uROSError0) {
513  LogError("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
514  << "Trying to access non existing ME at uROS " << uRos << std::endl;
515  return;
516  }
517  errorX[value - 1][link] += 1; // ros-1=link in this case
518  uROSError0->Fill(value - 1, sc); //bins start at 0 despite labeling, this is the old SC
519  }
520  } //flag values
521  } //loop on flags
522  } //loop on links
523  } //else uRos<3
524 
525  } //mode<=2
526 
527  // Fill the ROSSummary (1 per wheel) histo
528  for (unsigned int iros = 0; iros < 12; ++iros) {
529  for (unsigned int bin = 0; bin < 5; ++bin) {
530  if (errorX[bin][iros] != 0)
531  ROSSummary->Fill(bin, iros + 1); //bins start at 1
532  }
533  }
534 
535  // Global Errors for uROS
536  for (unsigned int flag = 4; flag < 16; ++flag) {
537  if ((data.getuserWord() >> flag) & 0x1) {
538  uROSSummary->Fill(flag - 4, uRos);
539  uROSStatus->Fill(flag - 4, uRos); //duplicated info?
540  }
541  }
542 
543  // ROS error
544  for (unsigned int icounter = 0; icounter < data.geterrors().size(); ++icounter) {
545  int link = data.geterrorROBID(icounter);
546  int tdc = data.geterrorTDCID(icounter);
547  int error = data.geterror(icounter);
548  int tdcError_ROSSummary = 0;
549  int tdcError_ROSError = 0;
550  int tdcError_TDCHisto = 0;
551 
552  if (error & 0x4000) {
553  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
554  << " ROS " << uRos << " ROB " << link << " Internal fatal Error 4000 in TDC " << error << endl;
555 
556  tdcError_ROSSummary = 5;
557  tdcError_ROSError = 5;
558  tdcError_TDCHisto = 0;
559 
560  } else if (error & 0x0249) {
561  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
562  << " ROS " << uRos << " ROB " << link << " TDC FIFO overflow in TDC " << error << endl;
563 
564  tdcError_ROSSummary = 6;
565  tdcError_ROSError = 6;
566  tdcError_TDCHisto = 1;
567 
568  } else if (error & 0x0492) {
569  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
570  << " ROS " << uRos << " ROB " << link << " TDC L1 buffer overflow in TDC " << error << endl;
571 
572  tdcError_ROSSummary = 7;
573  tdcError_ROSError = 7;
574  tdcError_TDCHisto = 2;
575 
576  } else if (error & 0x2000) {
577  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
578  << " ROS " << uRos << " ROB " << link << " TDC L1A FIFO overflow in TDC " << error << endl;
579 
580  tdcError_ROSSummary = 8;
581  tdcError_ROSError = 8;
582  tdcError_TDCHisto = 3;
583 
584  } else if (error & 0x0924) {
585  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
586  << " uROS " << uRos << " ROB " << link << " TDC hit error in TDC " << error << endl;
587 
588  tdcError_ROSSummary = 9;
589  tdcError_ROSError = 9;
590  tdcError_TDCHisto = 4;
591 
592  } else if (error & 0x1000) {
593  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
594  << " uROS " << uRos << " ROB " << link << " TDC hit rejected in TDC " << error << endl;
595 
596  tdcError_ROSSummary = 10;
597  tdcError_ROSError = 10;
598  tdcError_TDCHisto = 5;
599 
600  } else {
601  LogWarning("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
602  << " TDC error code not known " << error << endl;
603  }
604 
605  if (uRos < 3) {
606  ROSSummary->Fill(tdcError_ROSSummary, link + 1); //link 0 = ROS 1
607  int sc = 24;
608  if (mode <= 2) {
609  urosHistos[(uROSError)*1000 + (wheel + 2) * 100 + (link)]->Fill(tdcError_ROSError, sc);
610  if (mode <= 1)
611  urosHistos[(TDCError)*1000 + (wheel + 2) * 100 + (link)]->Fill(tdcError_TDCHisto + 6 * (tdc - 1),
612  sc); // ros-1=link in this case
613  } //mode<=2
614  } //uRos<3
615  else { //uRos>2
616  if (link < 24)
617  ROSSummary->Fill(tdcError_ROSSummary, ros);
618  else if (link < 48)
619  ROSSummary->Fill(tdcError_ROSSummary, ros + 1);
620  else if (link < 72)
621  ROSSummary->Fill(tdcError_ROSSummary, ros + 2);
622 
623  if (mode <= 2) {
624  if (link < 24)
625  uROSError0->Fill(tdcError_ROSError, link);
626  else if (link < 48)
627  uROSError1->Fill(tdcError_ROSError, link - 23);
628  else if (link < 72)
629  uROSError2->Fill(tdcError_ROSError, link - 47);
630 
631  if (mode <= 1) {
632  if (link < 24)
633  urosHistos[(TDCError)*1000 + (wheel + 2) * 100 + (ros - 1)]->Fill(tdcError_TDCHisto + 6 * (tdc - 1), link);
634  else if (link < 48)
635  urosHistos[(TDCError)*1000 + (wheel + 2) * 100 + (ros)]->Fill(tdcError_TDCHisto + 6 * (tdc - 1), link - 23);
636  else if (link < 72)
637  urosHistos[(TDCError)*1000 + (wheel + 2) * 100 + (ros + 1)]->Fill(tdcError_TDCHisto + 6 * (tdc - 1),
638  link - 47);
639 
640  } //mode<=1
641  } //mode<=2
642  } //uROS>2
643  } //loop on errors
644 
645  // 1D histograms for TTS values per uROS
646  int ttsCodeValue = -1;
647 
648  int value = (data.getuserWord() & 0xF);
649  switch (value) {
650  case 0: { //disconnected
651  ttsCodeValue = 0;
652  break;
653  }
654  case 1: { //warning overflow
655  ttsCodeValue = 1;
656  break;
657  }
658  case 2: { //out of sinch
659  ttsCodeValue = 2;
660  break;
661  }
662  case 4: { //busy
663  ttsCodeValue = 3;
664  break;
665  }
666  case 8: { //ready
667  ttsCodeValue = 4;
668  break;
669  }
670  case 12: { //error
671  ttsCodeValue = 5;
672  break;
673  }
674  case 15: { //disconnected
675  ttsCodeValue = 6;
676  break;
677  }
678  default: {
679  LogError("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
680  << "[DTDataIntegrityTask] FED User control: wrong TTS value " << value << " in FED " << fed << " uROS "
681  << uRos << endl;
682  ttsCodeValue = 7;
683  }
684  }
685  if (mode < 1) {
686  urosHistos[TTSValues * 1000 + (fed - FEDIDmin) * 100 + (uRos - 1)]->Fill(ttsCodeValue);
687 
688  // Plot the event length //NOHLT
689  int uRosEventLength = (data.gettrailer() & 0xFFFFF) * 8;
690  urosTimeHistos[(fed - FEDIDmin) * 100 + (uRos - 1)]->accumulateValueTimeSlot(uRosEventLength);
691 
692  if (uRosEventLength > 5000)
693  uRosEventLength = 5000;
694  urosHistos[uROSEventLength * 1000 + (fed - FEDIDmin) * 100 + (uRos - 1)]->Fill(uRosEventLength);
695  }
696 }
697 
699  neventsFED++;
700  if (neventsFED % 1000 == 0)
701  LogTrace("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
702  << "[DTDataIntegrityTask]: " << neventsFED << " events analyzed by processFED" << endl;
703 
704  if (fed < FEDIDmin || fed > FEDIDmax)
705  return;
706 
707  hFEDEntry->Fill(fed);
708 
709  if (mode == 3 || mode == 1)
710  return; //Avoid duplication of Info in FEDIntegrity_EvF
711 
712  //1D HISTOS: EVENT LENGHT from trailer
713  int fedEvtLength = data.getevtlgth() * 8; //1 word = 8 bytes
714  // if(fedEvtLength > 16000) fedEvtLength = 16000; // overflow bin
715  fedHistos["EventLength"][fed]->Fill(fedEvtLength);
716 
717  if (mode > 1)
718  return;
719 
720  fedTimeHistos["FEDAvgEvLengthvsLumi"][fed]->accumulateValueTimeSlot(fedEvtLength);
721 
722  // fill the distribution of the BX ids
723  fedHistos["BXID"][fed]->Fill(data.getBXId());
724 
725  // size of the list of ROS in the Read-Out
726  fedHistos["uROSList"][fed]->Fill(data.getnslots());
727 
728  // Fill the status summary of the TTS
729 
730  //1D HISTO WITH TTS VALUES form trailer (7 bins = 7 values)
731 
732  int ttsCodeValue = -1;
733  int value = data.getTTS();
734  switch (value) {
735  case 0: { //disconnected
736  ttsCodeValue = 0;
737  break;
738  }
739  case 1: { //warning overflow
740  ttsCodeValue = 1;
741  break;
742  }
743  case 2: { //out of sinch
744  ttsCodeValue = 2;
745  break;
746  }
747  case 4: { //busy
748  ttsCodeValue = 3;
749  break;
750  }
751  case 8: { //ready
752  ttsCodeValue = 4;
753  break;
754  }
755  case 12: { //error
756  ttsCodeValue = 5;
757  break;
758  }
759  case 15: { //disconnected
760  ttsCodeValue = 6;
761  break;
762  }
763  default: {
764  LogError("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
765  << "[DTDataIntegrityTask] FED TTS control: wrong TTS value " << value << " in FED " << fed << endl;
766  ttsCodeValue = 7;
767  }
768  }
769  if (mode < 1)
770  fedHistos["TTSValues"][fed]->Fill(ttsCodeValue);
771 }
772 
773 std::string DTDataIntegrityTask::topFolder(bool isFEDIntegrity) const {
774  string folder = isFEDIntegrity ? fedIntegrityFolder : "DT/00-DataIntegrity/";
775 
776  if (mode == 0)
777  folder = "DT/00-DataIntegrity/"; //Move everything from FEDIntegrity except for SM and HLT modes
778 
779  return folder;
780 }
781 
783  nEventsLS = 0;
784 }
785 
787  int lumiBlock = ls.luminosityBlock();
788 
789  map<string, map<int, DTTimeEvolutionHisto*> >::iterator fedIt = fedTimeHistos.begin();
790  map<string, map<int, DTTimeEvolutionHisto*> >::iterator fedEnd = fedTimeHistos.end();
791  for (; fedIt != fedEnd; ++fedIt) {
792  map<int, DTTimeEvolutionHisto*>::iterator histoIt = fedIt->second.begin();
793  map<int, DTTimeEvolutionHisto*>::iterator histoEnd = fedIt->second.end();
794  for (; histoIt != histoEnd; ++histoIt) {
795  histoIt->second->updateTimeSlot(lumiBlock, nEventsLS);
796  }
797  }
798 
799  map<unsigned int, DTTimeEvolutionHisto*>::iterator urosIt = urosTimeHistos.begin();
800  map<unsigned int, DTTimeEvolutionHisto*>::iterator urosEnd = urosTimeHistos.end();
801  for (; urosIt != urosEnd; ++urosIt) {
802  urosIt->second->updateTimeSlot(lumiBlock, nEventsLS);
803  }
804 }
805 
807  nevents++;
809 
810  nEventsLS++;
811 
812  LogTrace("DTRawToDigi|TDQM|DTMonitorModule|DTDataIntegrityTask") << "[DTDataIntegrityTask]: preProcessEvent" << endl;
813 
814  // Digi collection
816  e.getByToken(fedToken, fedCol);
817  DTuROSFEDData fedData;
818  DTuROSROSData urosData;
819 
820  if (fedCol.isValid()) {
821  for (unsigned int j = 0; j < fedCol->size(); ++j) {
822  fedData = fedCol->at(j);
823  int fed = fedData.getfed(); //argument should be void
824  if (fed > FEDIDmax || fed < FEDIDmin) {
825  LogError("DTRawToDigi|DTDQM|DTMonitorModule|DTDataIntegrityTask")
826  << "[DTDataIntegrityTask]: analyze, FED ID " << fed << " not expected." << endl;
827  continue;
828  }
829  processFED(fedData, fed);
830 
831  if (mode == 3 || mode == 1)
832  continue; //Not needed for FEDIntegrity_EvF
833 
834  for (int slot = 1; slot <= DOCESLOTS; ++slot) {
835  urosData = fedData.getuROS(slot);
836  if (fedData.getslotsize(slot) == 0 || urosData.getslot() == -1)
837  continue;
838  processuROS(urosData, fed, slot);
839  }
840  }
841  }
842 }
843 
844 // Conversions
845 int DTDataIntegrityTask::theDDU(int crate, int slot, int link, bool tenDDU) {
846  int ros = theROS(slot, link);
847 
848  int ddu = 772;
849  //if (crate == 1368) { ddu = 775; }
850  //Needed just in case this FED should be used due to fibers length
851 
852  if (crate == FEDNumbering::MINDTUROSFEDID) {
853  if (slot < 7)
854  ddu = 770;
855  else
856  ddu = 771;
857  }
858 
859  if (crate == (FEDNumbering::MINDTUROSFEDID + 1)) {
860  ddu = 772;
861  }
862 
863  if (crate == FEDNumbering::MAXDTUROSFEDID) {
864  if (slot < 7)
865  ddu = 773;
866  else
867  ddu = 774;
868  }
869 
870  if (ros > 6 && tenDDU && ddu < 775)
871  ddu += 5;
872 
873  return ddu;
874 }
875 
876 int DTDataIntegrityTask::theROS(int slot, int link) {
877  if (slot % 6 == 5)
878  return link + 1;
879 
880  int ros = (link / 24) + 3 * (slot % 6) - 2;
881  return ros;
882 }
883 
884 // Local Variables:
885 // show-trailing-whitespace: t
886 // truncate-lines: t
887 // End:
cmsHarvester.nevents
nevents
Definition: cmsHarvester.py:3177
DTuROSFEDData::getslotsize
int getslotsize(int slot) const
Definition: DTuROSControlData.h:142
FEDNumbering.h
eostools.ls
def ls(path, rec=False)
Definition: eostools.py:349
DTDataIntegrityTask::neventsFED
int neventsFED
Definition: DTDataIntegrityTask.h:95
dqm::impl::MonitorElement
Definition: MonitorElement.h:98
MessageLogger.h
DTDataIntegrityTask::nevents
int nevents
Definition: DTDataIntegrityTask.h:69
DTDataIntegrityTask::fedHistos
std::map< std::string, std::map< int, MonitorElement * > > fedHistos
Definition: DTDataIntegrityTask.h:74
DTuROSROSData::getslot
int getslot() const
Definition: DTuROSControlData.h:51
MainPageGenerator.link
link
Definition: MainPageGenerator.py:271
DTDataIntegrityTask::neventsuROS
int neventsuROS
Definition: DTDataIntegrityTask.h:96
DTDataIntegrityTask::fedTimeHistos
std::map< std::string, std::map< int, DTTimeEvolutionHisto * > > fedTimeHistos
Definition: DTDataIntegrityTask.h:88
DTDataIntegrityTask::DTDataIntegrityTask
DTDataIntegrityTask(const edm::ParameterSet &ps)
Definition: DTDataIntegrityTask.cc:33
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::Run
Definition: Run.h:45
DTDataIntegrityTask::NuROS
const int NuROS
Definition: DTDataIntegrityTask.h:102
printsummarytable.folder
folder
Definition: printsummarytable.py:7
edm
HLT enums.
Definition: AlignableModifier.h:19
DTDataIntegrityTask::~DTDataIntegrityTask
~DTDataIntegrityTask() override
Definition: DTDataIntegrityTask.cc:64
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:279
DTDataIntegrityTask::endLuminosityBlock
void endLuminosityBlock(const edm::LuminosityBlock &ls, const edm::EventSetup &es) override
Definition: DTDataIntegrityTask.cc:786
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
DTDataIntegrityTask::FEDIDmin
int FEDIDmin
Definition: DTDataIntegrityTask.h:98
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DTDataIntegrityTask::urosTimeHistos
std::map< unsigned int, DTTimeEvolutionHisto * > urosTimeHistos
Definition: DTDataIntegrityTask.h:90
DTDataIntegrityTask::uROSEventLength
Definition: DTDataIntegrityTask.h:82
edm::Handle
Definition: AssociativeIterator.h:50
relativeConstraints.error
error
Definition: relativeConstraints.py:53
FEDNumbering::MINDTUROSFEDID
Definition: FEDNumbering.h:111
DTDataIntegrityTask::processFED
void processFED(DTuROSFEDData &data, int fed)
Definition: DTDataIntegrityTask.cc:698
DTDataIntegrityTask::theDDU
int theDDU(int crate, int slot, int link, bool tenDDU)
Definition: DTDataIntegrityTask.cc:845
DTDataIntegrityTask::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: DTDataIntegrityTask.cc:80
DTDataIntegrityTask::bookHistosROS
void bookHistosROS(DQMStore::IBooker &, const int wheel, const int ros)
Definition: DTDataIntegrityTask.cc:304
DTDataIntegrityTask::summaryHistos
std::map< std::string, std::map< int, MonitorElement * > > summaryHistos
Definition: DTDataIntegrityTask.h:76
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
DTuROSFEDData::getfed
int getfed() const
Definition: DTuROSControlData.h:130
Service.h
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
DTDataIntegrityTask::FEDIDmax
int FEDIDmax
Definition: DTDataIntegrityTask.h:99
DTuROSFEDData::getuROS
DTuROSROSData getuROS(int slot) const
Definition: DTuROSControlData.h:148
DTDataIntegrityTask::fedIntegrityFolder
std::string fedIntegrityFolder
Definition: DTDataIntegrityTask.h:106
DTDataIntegrityTask::topFolder
std::string topFolder(bool isFEDIntegrity) const
Definition: DTDataIntegrityTask.cc:773
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
DTTimeEvolutionHisto.h
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
Event.h
DTDataIntegrityTask::nEventsLS
int nEventsLS
Definition: DTDataIntegrityTask.h:93
plotFactory.keyHisto
keyHisto
Definition: plotFactory.py:80
DTDataIntegrityTask::analyze
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Definition: DTDataIntegrityTask.cc:806
DOCESLOTS
static const int DOCESLOTS
Definition: DTuROSControlData.h:19
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
DTuROSROSData
Definition: DTuROSControlData.h:22
DTuROSFEDData
Definition: DTuROSControlData.h:103
value
Definition: value.py:1
edm::EventSetup
Definition: EventSetup.h:57
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
HcalObjRepresent::Fill
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
Definition: HcalObjRepresent.h:1053
DTDataIntegrityTask::bookHistosuROS
void bookHistosuROS(DQMStore::IBooker &, const int fed, const int uRos)
Definition: DTDataIntegrityTask.cc:389
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
DTDataIntegrityTask::bookHistos
void bookHistos(DQMStore::IBooker &, const int fedMin, const int fedMax)
Definition: DTDataIntegrityTask.cc:119
DTDataIntegrityTask::TDCError
Definition: DTDataIntegrityTask.h:82
std
Definition: JetResolutionObject.h:76
DTDataIntegrityTask::fedToken
edm::EDGetTokenT< DTuROSFEDDataCollection > fedToken
Definition: DTDataIntegrityTask.h:109
DTDataIntegrityTask::beginLuminosityBlock
void beginLuminosityBlock(const edm::LuminosityBlock &ls, const edm::EventSetup &es) override
Definition: DTDataIntegrityTask.cc:782
Frameworkfwd.h
DTDataIntegrityTask::urosHistos
std::map< unsigned int, MonitorElement * > urosHistos
Definition: DTDataIntegrityTask.h:78
DTTimeEvolutionHisto
Definition: DTTimeEvolutionHisto.h:15
Exception
Definition: hltDiff.cc:246
DTDataIntegrityTask::processuROS
void processuROS(DTuROSROSData &data, int fed, int uRos)
Definition: DTDataIntegrityTask.cc:424
HltBtagPostValidation_cff.histoName
histoName
Definition: HltBtagPostValidation_cff.py:17
Exception.h
DTDataIntegrityTask::TTSValues
Definition: DTDataIntegrityTask.h:82
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
DTDataIntegrityTask::mode
int mode
Definition: DTDataIntegrityTask.h:105
DTskim_cfg.processingMode
processingMode
Definition: DTskim_cfg.py:82
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
ParameterSet.h
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
FEDNumbering::MAXDTUROSFEDID
Definition: FEDNumbering.h:112
DTDataIntegrityTask::nEventMonitor
MonitorElement * nEventMonitor
Definition: DTDataIntegrityTask.h:72
DTDataIntegrityTask::theROS
int theROS(int slot, int link)
Definition: DTDataIntegrityTask.cc:876
edm::InputTag
Definition: InputTag.h:15
DTDataIntegrityTask::uROSError
Definition: DTDataIntegrityTask.h:82
DTDataIntegrityTask.h
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
DTDataIntegrityTask::hFEDEntry
MonitorElement * hFEDEntry
Definition: DTDataIntegrityTask.h:85
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37