CMS 3D CMS Logo

L1GtHwValidation.cc
Go to the documentation of this file.
1 
16 // this class header
18 
19 // system include files
20 #include <memory>
21 #include <iostream>
22 #include <iomanip>
23 
24 // user include files
28 
31 
35 
38 
42 
46 
47 #include "TH1.h"
48 #include "TH2.h"
49 #include "TTree.h"
50 
51 // constructor(s)
53  : //
54  // input tag for the L1 GT hardware DAQ record
55  m_l1GtDataDaqInputTag(paramSet.getParameter<edm::InputTag>("L1GtDataDaqInputTag")),
56  // input tag for the L1 GT hardware EVM record
57  m_l1GtDataEvmInputTag(paramSet.getParameter<edm::InputTag>("L1GtDataEvmInputTag")),
58  // input tag for the L1 GT emulator DAQ record
59  m_l1GtEmulDaqInputTag(paramSet.getParameter<edm::InputTag>("L1GtEmulDaqInputTag")),
60  // input tag for the L1 GT emulator EVM record
61  m_l1GtEmulEvmInputTag(paramSet.getParameter<edm::InputTag>("L1GtEmulEvmInputTag")),
62  // input tag for the L1 GCT hardware record
63  m_l1GctDataInputTag(paramSet.getParameter<edm::InputTag>("L1GctDataInputTag")),
64  //
65  m_dirName(paramSet.getUntrackedParameter("DirName", std::string("L1TEMU/GTexpert"))),
66  //
67  m_excludeCondCategTypeObject(
68  paramSet.getParameter<std::vector<edm::ParameterSet> >("ExcludeCondCategTypeObject")),
69  //
70  m_excludeAlgoTrigByName(paramSet.getParameter<std::vector<std::string> >("ExcludeAlgoTrigByName")),
71  //
72  m_excludeAlgoTrigByBit(paramSet.getParameter<std::vector<int> >("ExcludeAlgoTrigByBit")),
73  //
74  // initialize counters
75  m_nrDataEventError(0),
76  m_nrEmulEventError(0),
77  // cache
78  m_l1GtMenuCacheID(0ULL),
79  m_l1GtPfAlgoCacheID(0ULL),
80  m_l1GtPfTechCacheID(0ULL),
81  m_l1GtTmAlgoCacheID(0ULL),
82  m_l1GtTmTechCacheID(0ULL),
83  //
84  m_agree(true),
85  m_dataOnly(false),
86  m_emulOnly(false),
87  m_dataOnlyMask(false),
88  m_emulOnlyMask(false),
89  //
90  m_nrEvJob(0),
91  m_nrEvRun(0) {
92  for (std::vector<edm::ParameterSet>::const_iterator itExclud = m_excludeCondCategTypeObject.begin();
93  itExclud != m_excludeCondCategTypeObject.end();
94  ++itExclud) {
95  if (!(itExclud->getParameter<std::string>("ExcludedCondCategory")).empty()) {
96  m_excludedCondCategory.push_back(
97  l1GtConditionCategoryStringToEnum(itExclud->getParameter<std::string>("ExcludedCondCategory")));
98 
99  } else {
100  m_excludedCondCategory.push_back(CondNull);
101  }
102 
103  if (!(itExclud->getParameter<std::string>("ExcludedCondType")).empty()) {
104  m_excludedCondType.push_back(
105  l1GtConditionTypeStringToEnum(itExclud->getParameter<std::string>("ExcludedCondType")));
106 
107  } else {
108  m_excludedCondType.push_back(TypeNull);
109  }
110 
111  if (!(itExclud->getParameter<std::string>("ExcludedL1GtObject")).empty()) {
112  m_excludedL1GtObject.push_back(l1GtObjectStringToEnum(itExclud->getParameter<std::string>("ExcludedL1GtObject")));
113 
114  } else {
115  m_excludedL1GtObject.push_back(ObjNull);
116  }
117  }
118 
119  LogDebug("L1GtHwValidation") << "\nInput tag for the L1 GT DAQ hardware record: " << m_l1GtDataDaqInputTag
120  << "\nInput tag for the L1 GT EVM hardware record: " << m_l1GtDataEvmInputTag
121  << "\nInput tag for the L1 GT DAQ emulator records: " << m_l1GtEmulDaqInputTag
122  << "\nInput tag for the L1 GT EVM emulator records: " << m_l1GtEmulEvmInputTag
123  << "\nInput tag for the L1 GCT hardware record: " << m_l1GctDataInputTag
124  << std::endl;
125 
126  // FIXME print in debug mode ExcludeCondCategTypeObject, ExcludeAlgoTrigByName, etc
127 
128  //set Token(-s)
130  consumes<L1GlobalTriggerReadoutRecord>(paramSet.getParameter<edm::InputTag>("L1GtDataDaqInputTag"));
132  consumes<L1GlobalTriggerReadoutRecord>(paramSet.getParameter<edm::InputTag>("L1GtEmulDaqInputTag"));
134  consumes<L1GlobalTriggerEvmReadoutRecord>(paramSet.getParameter<edm::InputTag>("L1GtDataEvmInputTag"));
136  consumes<L1GlobalTriggerEvmReadoutRecord>(paramSet.getParameter<edm::InputTag>("L1GtEmulEvmInputTag"));
137 }
138 
139 // destructor
141  // empty
142 }
143 
144 // member functions
145 
146 void L1GtHwValidation::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& evSetup) {}
147 
149  const edm::Run& iRun,
150  const edm::EventSetup& evSetup) {
151  ibooker.setCurrentFolder(m_dirName);
152 
153  // histograms
154 
155  const unsigned int numberTechTriggers = L1GlobalTriggerReadoutSetup::NumberTechnicalTriggers;
156 
157  const unsigned int numberAlgoTriggers = L1GlobalTriggerReadoutSetup::NumberPhysTriggers;
158 
159  for (int iRec = 0; iRec < NumberOfGtRecords; ++iRec) {
160  std::string recString;
161  if (iRec == 0) {
162  recString = "Daq_";
163  ibooker.setCurrentFolder(m_dirName + "/DAQ/");
164 
165  } else {
166  recString = "Evm_";
167  ibooker.setCurrentFolder(m_dirName + "/EVM/");
168  }
169 
170  std::string hName;
171  const char* histName;
172 
173  hName = recString + "gtfeDataEmul";
174  histName = hName.c_str();
175 
176  // GTFE histograms
177  m_gtfeDataEmul[iRec] = ibooker.book1D(histName, "GTFE data vs emul mismatch", 8, 0., 7.);
178  m_gtfeDataEmul[iRec]->setBinLabel(1, "BoardId", 1);
179  m_gtfeDataEmul[iRec]->setBinLabel(2, "RecordLength1", 1);
180  m_gtfeDataEmul[iRec]->setBinLabel(3, "RecordLength0", 1);
181  m_gtfeDataEmul[iRec]->setBinLabel(4, "BxNr", 1);
182  m_gtfeDataEmul[iRec]->setBinLabel(5, "SetupVersion", 1);
183  m_gtfeDataEmul[iRec]->setBinLabel(6, "DaqActiveBoards", 1);
184  m_gtfeDataEmul[iRec]->setBinLabel(7, "AltNrBxBoard", 1);
185  m_gtfeDataEmul[iRec]->setBinLabel(8, "TotalTriggerNr", 1);
186 
187  // FDL histograms
188 
189  for (int iHist = 0; iHist < TotalBxInEvent; ++iHist) {
190  // convert [0, TotalBxInEvent] to [-X, +X] and add to histogram name
191  int iIndex = iHist - ((TotalBxInEvent + 1) / 2 - 1);
192  int hIndex = (iIndex + 16) % 16;
193 
194  std::stringstream ss;
196  ss << std::uppercase << std::hex << hIndex;
197  ss >> str;
198 
199  if (iRec == 0) {
200  ibooker.setCurrentFolder(m_dirName + "/DAQ/BxInEvent_" + str);
201 
202  } else {
203  ibooker.setCurrentFolder(m_dirName + "/EVM/BxInEvent_" + str);
204  }
205 
206  hName = recString + "FdlDataEmul_" + str;
207  histName = hName.c_str();
208 
209  std::string hTitle = "FDL data vs emul mismatch for BxInEvent = " + str;
210  const char* histTitle = hTitle.c_str();
211 
212  //
213 
214  m_fdlDataEmul[iHist][iRec] = ibooker.book1D(histName, histTitle, 13, 0., 13.);
215  m_fdlDataEmul[iHist][iRec]->setBinLabel(1, "BoardId", 1);
216  m_fdlDataEmul[iHist][iRec]->setBinLabel(2, "BxInEvent", 1);
217  m_fdlDataEmul[iHist][iRec]->setBinLabel(3, "BxNr", 1);
218  m_fdlDataEmul[iHist][iRec]->setBinLabel(4, "EventNr", 1);
219  m_fdlDataEmul[iHist][iRec]->setBinLabel(5, "TechTrigger", 1);
220  m_fdlDataEmul[iHist][iRec]->setBinLabel(6, "TechTriggerMask", 1);
221  m_fdlDataEmul[iHist][iRec]->setBinLabel(7, "AlgoTrigger", 1);
222  m_fdlDataEmul[iHist][iRec]->setBinLabel(8, "AlgoTriggerMask", 1);
223  m_fdlDataEmul[iHist][iRec]->setBinLabel(9, "AlgoExtend", 1);
224  m_fdlDataEmul[iHist][iRec]->setBinLabel(10, "NoAlgo", 1);
225  m_fdlDataEmul[iHist][iRec]->setBinLabel(11, "FinalORAllParts", 1);
226  m_fdlDataEmul[iHist][iRec]->setBinLabel(12, "FinalORPhysPart", 1);
227  m_fdlDataEmul[iHist][iRec]->setBinLabel(13, "LocalBxNr", 1);
228 
229  // algorithm decision
230  // data
231  hName = recString + "Data_AlgoDecision_" + str;
232  histName = hName.c_str();
233 
234  hTitle = "Data: algorithm decision word for BxInEvent = " + str;
235  histTitle = hTitle.c_str();
236 
237  m_fdlDataAlgoDecision[iHist][iRec] =
238  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
239 
240  // emul
241  hName = recString + "Emul_AlgoDecision_" + str;
242  histName = hName.c_str();
243 
244  hTitle = "Emul: algorithm decision word for BxInEvent = " + str;
245  histTitle = hTitle.c_str();
246 
247  m_fdlEmulAlgoDecision[iHist][iRec] =
248  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
249 
250  // algorithm decision for prescaled algorithms
251  // data
252  hName = recString + "Data_AlgoDecision_Prescaled_" + str;
253  histName = hName.c_str();
254 
255  hTitle = "Data: prescaled algorithms: algorithm decision for BxInEvent = " + str;
256  histTitle = hTitle.c_str();
257 
258  m_fdlDataAlgoDecisionPrescaled[iHist][iRec] =
259  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
260 
261  // emul
262  hName = recString + "Emul_AlgoDecision_Prescaled_" + str;
263  histName = hName.c_str();
264 
265  hTitle = "Emul: prescaled algorithms: algorithm decision for BxInEvent = " + str;
266  histTitle = hTitle.c_str();
267 
268  m_fdlEmulAlgoDecisionPrescaled[iHist][iRec] =
269  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
270 
271  // algorithm decision for unprescaled algorithms
272  // data
273  hName = recString + "Data_AlgoDecision_Unprescaled_" + str;
274  histName = hName.c_str();
275 
276  hTitle = "Data: unprescaled algorithms: algorithm decision for BxInEvent = " + str;
277  histTitle = hTitle.c_str();
278 
279  m_fdlDataAlgoDecisionUnprescaled[iHist][iRec] =
280  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
281 
282  // emul
283  hName = recString + "Emul_AlgoDecision_Unprescaled_" + str;
284  histName = hName.c_str();
285 
286  hTitle = "Emul: unprescaled algorithms: algorithm decision for BxInEvent = " + str;
287  histTitle = hTitle.c_str();
288 
289  m_fdlEmulAlgoDecisionUnprescaled[iHist][iRec] =
290  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
291 
292  // algorithm decision after masking (partition physics)
293  // data
294  hName = recString + "Data_AlgoDecisionAfterMask_" + str;
295  histName = hName.c_str();
296 
297  hTitle = "Data, physics partition: algorithm decision word after mask for BxInEvent = " + str;
298  histTitle = hTitle.c_str();
299 
300  m_fdlDataAlgoDecisionMask[iHist][iRec] =
301  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
302 
303  // emul
304  hName = recString + "Emul_AlgoDecisionAfterMask_" + str;
305  histName = hName.c_str();
306 
307  hTitle = "Emul, physics partition: algorithm decision word after mask for BxInEvent = " + str;
308  histTitle = hTitle.c_str();
309 
310  m_fdlEmulAlgoDecisionMask[iHist][iRec] =
311  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
312 
313  //
314  hName = recString + "DataEmul_AlgoDecision_" + str;
315  histName = hName.c_str();
316 
317  hTitle = "Data vs emul: non-matching algorithm decision word for BxInEvent = " + str;
318  histTitle = hTitle.c_str();
319 
320  m_fdlDataEmulAlgoDecision[iHist][iRec] =
321  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
322 
323  //
324  hName = recString + "DataEmul_AlgoDecision_Prescaled_" + str;
325  histName = hName.c_str();
326 
327  hTitle = "Data vs emul: prescaled algorithms with non-matching decision for BxInEvent = " + str;
328  histTitle = hTitle.c_str();
329 
331  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
332 
333  //
334  hName = recString + "DataEmul_AlgoDecision_Unprescaled_" + str;
335  histName = hName.c_str();
336 
337  hTitle = "Data vs emul: unprescaled algorithms with non-matching decision for BxInEvent = " + str;
338  histTitle = hTitle.c_str();
339 
341  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
342 
343  //
344  hName = recString + "DataEmul_AlgoDecision_Unprescaled_Allowed_" + str;
345  histName = hName.c_str();
346 
347  hTitle = "Data vs emul: unprescaled algorithms not excluded with non-matching decision for BxInEvent = " + str;
348  histTitle = hTitle.c_str();
349 
351  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
352 
353  //
354  hName = recString + "Data_AlgoDecision_NoMatch_" + str;
355  histName = hName.c_str();
356 
357  hTitle = "Data: algorithm decision for non-matching cases for BxInEvent = " + str;
358  histTitle = hTitle.c_str();
359 
360  m_fdlDataAlgoDecision_NoMatch[iHist][iRec] =
361  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
362 
363  //
364  hName = recString + "Emul_AlgoDecision_NoMatch_" + str;
365  histName = hName.c_str();
366 
367  hTitle = "Emul: algorithm decision for non-matching cases for BxInEvent = " + str;
368  histTitle = hTitle.c_str();
369 
370  m_fdlEmulAlgoDecision_NoMatch[iHist][iRec] =
371  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
372 
373  // prescaled algorithms
374  hName = recString + "Data_AlgoDecision_Prescaled_NoMatch_" + str;
375  histName = hName.c_str();
376 
377  hTitle = "Data: prescaled algorithms: non-matching algorithm decision for BxInEvent = " + str;
378  histTitle = hTitle.c_str();
379 
381  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
382 
383  //
384  hName = recString + "Emul_AlgoDecision_Prescaled_NoMatch_" + str;
385  histName = hName.c_str();
386 
387  hTitle = "Emul: prescaled algorithms: non-matching algorithm decision for BxInEvent = " + str;
388  histTitle = hTitle.c_str();
389 
391  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
392 
393  // unprescaled algorithms - non-matching
394  hName = recString + "Data_AlgoDecision_Unprescaled_NoMatch_" + str;
395  histName = hName.c_str();
396 
397  hTitle = "Data: unprescaled algorithms: non-matching algorithm decision for BxInEvent = " + str;
398  histTitle = hTitle.c_str();
399 
401  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
402 
403  //
404  hName = recString + "Emul_AlgoDecision_Unprescaled_NoMatch_" + str;
405  histName = hName.c_str();
406 
407  hTitle = "Emul: unprescaled algorithms: non-matching algorithm decision for BxInEvent = " + str;
408  histTitle = hTitle.c_str();
409 
411  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
412 
413  //
414  hName = recString + "Data_AlgoDecisionMask_NoMatch_" + str;
415  histName = hName.c_str();
416 
417  hTitle = "Data: algorithm decision for non-matching cases after mask for BxInEvent = " + str;
418  histTitle = hTitle.c_str();
419 
420  m_fdlDataAlgoDecisionMask_NoMatch[iHist][iRec] =
421  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
422 
423  //
424  hName = recString + "Emul_AlgoDecisionMask_NoMatch_" + str;
425  histName = hName.c_str();
426 
427  hTitle = "Emul: algorithm decision for non-matching cases after mask for BxInEvent = " + str;
428  histTitle = hTitle.c_str();
429 
430  m_fdlEmulAlgoDecisionMask_NoMatch[iHist][iRec] =
431  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
432 
433  // prescaled algorithms
434  hName = recString + "Data_AlgoDecisionMask_Prescaled_NoMatch_" + str;
435  histName = hName.c_str();
436 
437  hTitle = "Data: prescaled algorithms: non-matching algorithm decision after mask for BxInEvent = " + str;
438  histTitle = hTitle.c_str();
439 
441  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
442 
443  //
444  hName = recString + "Emul_AlgoDecision_PrescaledMask_NoMatch_" + str;
445  histName = hName.c_str();
446 
447  hTitle = "Emul: prescaled algorithms: non-matching algorithm decision after mask for BxInEvent = " + str;
448  histTitle = hTitle.c_str();
449 
451  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
452 
453  // unprescaled algorithms - non-matching
454  hName = recString + "Data_AlgoDecision_UnprescaledMask_NoMatch_" + str;
455  histName = hName.c_str();
456 
457  hTitle = "Data: unprescaled algorithms: non-matching algorithm decision after mask for BxInEvent = " + str;
458  histTitle = hTitle.c_str();
459 
461  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
462 
463  //
464  hName = recString + "Emul_AlgoDecision_UnprescaledMask_NoMatch_" + str;
465  histName = hName.c_str();
466 
467  hTitle = "Emul: unprescaled algorithms: non-matching algorithm decision after mask for BxInEvent = " + str;
468  histTitle = hTitle.c_str();
469 
471  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
472 
473  //
474  hName = recString + "DataEmul_AlgoDecisionAfterMask_" + str;
475  histName = hName.c_str();
476 
477  hTitle =
478  "Data vs emul, physics partition: non-matching algorithm decision word after mask for BxInEvent = " + str;
479  histTitle = hTitle.c_str();
480 
481  m_fdlDataEmulAlgoDecisionMask[iHist][iRec] =
482  ibooker.book1D(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
483 
484  // technical trigger decision
485  // data
486  hName = recString + "Data_TechDecision_" + str;
487  histName = hName.c_str();
488 
489  hTitle = "Data technical trigger decision word for BxInEvent = " + str;
490  histTitle = hTitle.c_str();
491 
492  m_fdlDataTechDecision[iHist][iRec] =
493  ibooker.book1D(histName, histTitle, numberTechTriggers, 0., numberTechTriggers);
494 
495  // emul
496  hName = recString + "Emul_TechDecision_" + str;
497  histName = hName.c_str();
498 
499  hTitle = "Emul: technical trigger decision word for BxInEvent = " + str;
500  histTitle = hTitle.c_str();
501 
502  m_fdlEmulTechDecision[iHist][iRec] =
503  ibooker.book1D(histName, histTitle, numberTechTriggers, 0., numberTechTriggers);
504 
505  // technical trigger decision after masking (partition physics)
506  hName = recString + "Data_TechDecisionAfterMask_" + str;
507  histName = hName.c_str();
508 
509  hTitle = "Data technical trigger decision word after mask for BxInEvent = " + str;
510  histTitle = hTitle.c_str();
511 
512  m_fdlDataTechDecisionMask[iHist][iRec] =
513  ibooker.book1D(histName, histTitle, numberTechTriggers, 0., numberTechTriggers);
514 
515  //
516  hName = recString + "Emul_TechDecisionAfterMask_" + str;
517  histName = hName.c_str();
518 
519  hTitle = "Emul: technical trigger decision word after mask for BxInEvent = " + str;
520  histTitle = hTitle.c_str();
521 
522  m_fdlEmulTechDecisionMask[iHist][iRec] =
523  ibooker.book1D(histName, histTitle, numberTechTriggers, 0., numberTechTriggers);
524 
525  //
526  hName = recString + "DataEmul_TechDecision_" + str;
527  histName = hName.c_str();
528 
529  hTitle = "Data vs emul: non-matching technical trigger decision word for BxInEvent = " + str;
530  histTitle = hTitle.c_str();
531 
532  m_fdlDataEmulTechDecision[iHist][iRec] =
533  ibooker.book1D(histName, histTitle, numberTechTriggers, 0., numberTechTriggers);
534 
535  hName = recString + "DataEmul_TechDecisionAfterMask_" + str;
536  histName = hName.c_str();
537 
538  hTitle = "Data vs emul: non-matching technical trigger decision word after mask for BxInEvent = " + str;
539  histTitle = hTitle.c_str();
540 
541  m_fdlDataEmulTechDecisionMask[iHist][iRec] =
542  ibooker.book1D(histName, histTitle, numberTechTriggers, 0., numberTechTriggers);
543  }
544 
545  if (iRec == 0) {
546  ibooker.setCurrentFolder(m_dirName + "/DAQ/");
547 
548  } else {
549  ibooker.setCurrentFolder(m_dirName + "/EVM/");
550  }
551 
552  hName = recString + "FdlDataEmul_Err";
553  histName = hName.c_str();
554 
555  m_fdlDataEmul_Err[iRec] =
556  ibooker.book1D(histName, "FDL data vs emul mismatch for non-matching BxInEvent in FDL payload", 13, 0., 13.);
557  m_fdlDataEmul_Err[iRec]->setBinLabel(1, "BoardId", 1);
558  m_fdlDataEmul_Err[iRec]->setBinLabel(2, "BxInEvent", 1);
559  m_fdlDataEmul_Err[iRec]->setBinLabel(3, "BxNr", 1);
560  m_fdlDataEmul_Err[iRec]->setBinLabel(4, "EventNr", 1);
561  m_fdlDataEmul_Err[iRec]->setBinLabel(5, "TechTrigger", 1);
562  m_fdlDataEmul_Err[iRec]->setBinLabel(6, "TechTriggerMask", 1);
563  m_fdlDataEmul_Err[iRec]->setBinLabel(7, "AlgoTrigger", 1);
564  m_fdlDataEmul_Err[iRec]->setBinLabel(8, "AlgoTriggerMask", 1);
565  m_fdlDataEmul_Err[iRec]->setBinLabel(9, "AlgoExtend", 1);
566  m_fdlDataEmul_Err[iRec]->setBinLabel(10, "NoAlgo", 1);
567  m_fdlDataEmul_Err[iRec]->setBinLabel(11, "FinalORAllParts", 1);
568  m_fdlDataEmul_Err[iRec]->setBinLabel(12, "FinalORPhysPart", 1);
569  m_fdlDataEmul_Err[iRec]->setBinLabel(13, "LocalBxNr", 1);
570 
571  hName = recString + "FdlDataAlgoDecision_Err";
572  histName = hName.c_str();
573 
574  m_fdlDataAlgoDecision_Err[iRec] = ibooker.book1D(histName,
575  "Data: algorithm trigger decision word, non-matching BxInEvent",
576  numberAlgoTriggers,
577  0.,
578  numberAlgoTriggers);
579 
580  //
581  hName = recString + "Emul_AlgoDecision_Err";
582  histName = hName.c_str();
583 
584  m_fdlEmulAlgoDecision_Err[iRec] = ibooker.book1D(histName,
585  "Emul: algorithm trigger decision word, non-matching BxInEvent",
586  numberAlgoTriggers,
587  0.,
588  numberAlgoTriggers);
589 
590  hName = recString + "DataEmul_AlgoDecision_Err";
591  histName = hName.c_str();
592 
594  ibooker.book1D(histName,
595  "Data vs emul: algorithm trigger decision word, non-matching BxInEvent",
596  numberAlgoTriggers,
597  0.,
598  numberAlgoTriggers);
599 
600  //
601  hName = recString + "Data_TechDecision_Err";
602  histName = hName.c_str();
603 
604  m_fdlDataTechDecision_Err[iRec] = ibooker.book1D(histName,
605  "Data: technical trigger decision word, non-matching BxInEvent",
606  numberTechTriggers,
607  0.,
608  numberTechTriggers);
609 
610  hName = recString + "Emul_TechDecision_Err";
611  histName = hName.c_str();
612 
613  m_fdlEmulTechDecision_Err[iRec] = ibooker.book1D(histName,
614  "Emul: technical trigger decision word, non-matching BxInEvent",
615  numberTechTriggers,
616  0.,
617  numberTechTriggers);
618 
619  hName = recString + "DataEmul_TechDecision_Err";
620  histName = hName.c_str();
621 
623  ibooker.book1D(histName,
624  "Data vs emul: technical trigger decision word, non-matching BxInEvent",
625  numberTechTriggers,
626  0.,
627  numberTechTriggers);
628  }
629 
630  ibooker.setCurrentFolder(m_dirName);
631 
632  //
633  m_excludedAlgorithmsAgreement = ibooker.book1D("ExcludedAlgorithmsFromAgreement",
634  "Algorithms excluded from data versus emulator agreement flag",
635  numberAlgoTriggers,
636  0.,
637  numberAlgoTriggers);
638 
639  //
640 
641  m_gtErrorFlag = ibooker.book1D("GTErrorFlag", "L1 GT error flag for data versus emulator comparison", 5, 0., 5);
642 
643  m_gtErrorFlag->setBinLabel(1, "Agree", 1);
644  m_gtErrorFlag->setBinLabel(2, "", 1);
645  m_gtErrorFlag->setBinLabel(3, "", 1);
646  m_gtErrorFlag->setBinLabel(4, "Data only", 1);
647  m_gtErrorFlag->setBinLabel(5, "Emul only", 1);
648 
649  m_nrEvRun = 0;
650 
651  // get / update the trigger menu from the EventSetup
652  // local cache & check on cacheIdentifier
653 
654  unsigned long long l1GtMenuCacheID = evSetup.get<L1GtTriggerMenuRcd>().cacheIdentifier();
655 
656  if (m_l1GtMenuCacheID != l1GtMenuCacheID) {
658  evSetup.get<L1GtTriggerMenuRcd>().get(l1GtMenu);
659  m_l1GtMenu = l1GtMenu.product();
660 
661  // compute the list of algorithms excluded from the computing of the agreement flag
662  m_excludedAlgoList.clear();
664 
665  m_l1GtMenuCacheID = l1GtMenuCacheID;
666  }
667 
668  // FIXME when the menu changes, make a copy of histograms, and clear the old one
669  // otherwise the labels are wrong
670 
671  LogDebug("L1GtHwValidation") << "\nUsing L1 menu: \n " << m_l1GtMenu->gtTriggerMenuImplementation() << "\n"
672  << std::endl;
673 
674  const AlgorithmMap& algorithmMap = m_l1GtMenu->gtAlgorithmMap();
675 
676  for (CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
677  const int algBitNumber = (itAlgo->second).algoBitNumber();
678 
679  std::stringstream ss;
680  std::string algBitString;
681  ss << std::uppercase << algBitNumber;
682  ss >> algBitString;
683 
684  const std::string& aName = algBitString + " " + itAlgo->first;
685  const char* algName = aName.c_str();
686 
687  for (int iRec = 0; iRec < NumberOfGtRecords; ++iRec) {
688  for (int iBxInEvent = 0; iBxInEvent < TotalBxInEvent; ++iBxInEvent) {
689  // convert [0, TotalBxInEvent] to [-X, +X]
690  int iIndex = iBxInEvent - ((TotalBxInEvent + 1) / 2 - 1);
691  int hIndex = (iIndex + 16) % 16;
692 
693  std::stringstream ss;
695  ss << std::uppercase << std::hex << hIndex;
696  ss >> str;
697 
698  if (iRec == 0) {
699  //if (m_dbe) {
700  ibooker.setCurrentFolder(m_dirName + "/DAQ/BxInEvent_" + str);
701  //}
702 
703  } else {
704  //if (m_dbe) {
705  ibooker.setCurrentFolder(m_dirName + "/EVM/BxInEvent_" + str);
706  //}
707  }
708 
709  m_fdlDataAlgoDecision[iBxInEvent][iRec]->setBinLabel(algBitNumber + 1, algName, 1);
710  m_fdlDataAlgoDecisionPrescaled[iBxInEvent][iRec]->setBinLabel(algBitNumber + 1, algName, 1);
711  m_fdlDataAlgoDecisionUnprescaled[iBxInEvent][iRec]->setBinLabel(algBitNumber + 1, algName, 1);
712  m_fdlDataAlgoDecisionMask[iBxInEvent][iRec]->setBinLabel(algBitNumber + 1, algName, 1);
713  m_fdlDataAlgoDecision_NoMatch[iBxInEvent][iRec]->setBinLabel(algBitNumber + 1, algName, 1);
714 
715  m_fdlEmulAlgoDecision[iBxInEvent][iRec]->setBinLabel(algBitNumber + 1, algName, 1);
716  m_fdlEmulAlgoDecisionPrescaled[iBxInEvent][iRec]->setBinLabel(algBitNumber + 1, algName, 1);
717  m_fdlEmulAlgoDecisionUnprescaled[iBxInEvent][iRec]->setBinLabel(algBitNumber + 1, algName, 1);
718  m_fdlEmulAlgoDecisionMask[iBxInEvent][iRec]->setBinLabel(algBitNumber + 1, algName, 1);
719  m_fdlEmulAlgoDecision_NoMatch[iBxInEvent][iRec]->setBinLabel(algBitNumber + 1, algName, 1);
720 
721  m_fdlDataEmulAlgoDecision[iBxInEvent][iRec]->setBinLabel(algBitNumber + 1, algName, 1);
722  m_fdlDataEmulAlgoDecisionPrescaled[iBxInEvent][iRec]->setBinLabel(algBitNumber + 1, algName, 1);
723  m_fdlDataEmulAlgoDecisionUnprescaled[iBxInEvent][iRec]->setBinLabel(algBitNumber + 1, algName, 1);
724  m_fdlDataEmulAlgoDecisionUnprescaledAllowed[iBxInEvent][iRec]->setBinLabel(algBitNumber + 1, algName, 1);
725  m_fdlDataEmulAlgoDecisionMask[iBxInEvent][iRec]->setBinLabel(algBitNumber + 1, algName, 1);
726  }
727 
728  if (iRec == 0) {
729  ibooker.setCurrentFolder(m_dirName + "/DAQ/");
730 
731  } else {
732  ibooker.setCurrentFolder(m_dirName + "/EVM/");
733  }
734 
735  m_fdlDataAlgoDecision_Err[iRec]->setBinLabel(algBitNumber + 1, algName, 1);
736 
737  m_fdlEmulAlgoDecision_Err[iRec]->setBinLabel(algBitNumber + 1, algName, 1);
738 
739  m_fdlDataEmulAlgoDecision_Err[iRec]->setBinLabel(algBitNumber + 1, algName, 1);
740  }
741 
742  //
743  for (std::vector<int>::const_iterator itAlgo = m_excludedAlgoList.begin(); itAlgo != m_excludedAlgoList.end();
744  ++itAlgo) {
745  if (algBitNumber == *itAlgo) {
746  m_excludedAlgorithmsAgreement->setBinLabel(algBitNumber + 1, algName, 1);
747  }
748  }
749  }
750 
751  // get / update the prescale factors from the EventSetup
752  // local cache & check on cacheIdentifier
753 
754  unsigned long long l1GtPfAlgoCacheID = evSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().cacheIdentifier();
755 
756  if (m_l1GtPfAlgoCacheID != l1GtPfAlgoCacheID) {
758  evSetup.get<L1GtPrescaleFactorsAlgoTrigRcd>().get(l1GtPfAlgo);
759  m_l1GtPfAlgo = l1GtPfAlgo.product();
760 
762 
763  m_l1GtPfAlgoCacheID = l1GtPfAlgoCacheID;
764  }
765 
766  unsigned long long l1GtPfTechCacheID = evSetup.get<L1GtPrescaleFactorsTechTrigRcd>().cacheIdentifier();
767 
768  if (m_l1GtPfTechCacheID != l1GtPfTechCacheID) {
770  evSetup.get<L1GtPrescaleFactorsTechTrigRcd>().get(l1GtPfTech);
771  m_l1GtPfTech = l1GtPfTech.product();
772 
774 
775  m_l1GtPfTechCacheID = l1GtPfTechCacheID;
776  }
777 
778  // get / update the trigger mask from the EventSetup
779  // local cache & check on cacheIdentifier
780 
781  unsigned long long l1GtTmAlgoCacheID = evSetup.get<L1GtTriggerMaskAlgoTrigRcd>().cacheIdentifier();
782 
783  if (m_l1GtTmAlgoCacheID != l1GtTmAlgoCacheID) {
785  evSetup.get<L1GtTriggerMaskAlgoTrigRcd>().get(l1GtTmAlgo);
786  m_l1GtTmAlgo = l1GtTmAlgo.product();
787 
789 
790  m_l1GtTmAlgoCacheID = l1GtTmAlgoCacheID;
791  }
792 
793  unsigned long long l1GtTmTechCacheID = evSetup.get<L1GtTriggerMaskTechTrigRcd>().cacheIdentifier();
794 
795  if (m_l1GtTmTechCacheID != l1GtTmTechCacheID) {
797  evSetup.get<L1GtTriggerMaskTechTrigRcd>().get(l1GtTmTech);
798  m_l1GtTmTech = l1GtTmTech.product();
799 
801 
802  m_l1GtTmTechCacheID = l1GtTmTechCacheID;
803  }
804 }
805 
806 //compare the GTFE board
808  const edm::EventSetup& evSetup,
809  const L1GtfeWord& gtfeBlockData,
810  const L1GtfeWord& gtfeBlockEmul,
811  const int iRec) {
812  std::string recString;
813  if (gtfeBlockData == gtfeBlockEmul) {
814  m_myCoutStream << "\n" << recString << " Data and emulated GTFE blocks: identical.\n";
815  gtfeBlockData.print(m_myCoutStream);
816  } else {
817  m_myCoutStream << "\n" << recString << " Data and emulated GTFE blocks: different.\n";
818 
819  m_myCoutStream << "\nData: GTFE block\n";
820  gtfeBlockData.print(m_myCoutStream);
821 
822  m_myCoutStream << "\nEmul: GTFE block\n";
823  gtfeBlockEmul.print(m_myCoutStream);
824  }
825 
826  LogDebug("L1GtHwValidation") << m_myCoutStream.str() << std::endl;
827 
828  m_myCoutStream.str("");
829  m_myCoutStream.clear();
830 
831  // get BoardId value
832  const uint16_t boardIdData = gtfeBlockData.boardId();
833  const uint16_t boardIdEmul = gtfeBlockEmul.boardId();
834 
835  if (boardIdData == boardIdEmul) {
836  m_myCoutStream << "\n" << recString << " Data and emulated GTFE boardId identical.";
837  m_myCoutStream << "\n boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdData
838  << std::setfill(' ') << std::dec;
839  m_myCoutStream << "\n";
840 
841  } else {
842  m_myCoutStream << "\n" << recString << " Data and emulated GTFE boardId different.";
843  m_myCoutStream << "\n Data: boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdData
844  << std::setfill(' ') << std::dec;
845  m_myCoutStream << "\n Emul: boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdEmul
846  << std::setfill(' ') << std::dec;
847  m_myCoutStream << "\n";
848  m_gtfeDataEmul[iRec]->Fill(0);
849  }
850 
852  const uint16_t recordLength1Data = gtfeBlockData.recordLength1();
853  const uint16_t recordLength1Emul = gtfeBlockEmul.recordLength1();
854 
855  if (recordLength1Data == recordLength1Emul) {
856  m_myCoutStream << "\n" << recString << " Data and emulated GTFE recordLength for alternative 1 identical.";
857  m_myCoutStream << "\n recordLength1() = " << recordLength1Data;
858  m_myCoutStream << "\n";
859 
860  } else {
861  m_myCoutStream << "\n" << recString << " Data and emulated GTFE recordLength for alternative 1 different.";
862  m_myCoutStream << "\n Data: recordLength1() = " << recordLength1Data;
863  m_myCoutStream << "\n Emul: recordLength1() = " << recordLength1Emul;
864  m_myCoutStream << "\n";
865  m_gtfeDataEmul[iRec]->Fill(1);
866  }
867 
869  const uint16_t recordLengthData = gtfeBlockData.recordLength();
870  const uint16_t recordLengthEmul = gtfeBlockEmul.recordLength();
871 
872  if (recordLengthData == recordLengthEmul) {
873  m_myCoutStream << "\n" << recString << " Data and emulated GTFE recordLength for alternative 0 identical.";
874  m_myCoutStream << "\n recordLength() = " << recordLengthData;
875  m_myCoutStream << "\n";
876 
877  } else {
878  m_myCoutStream << "\n" << recString << " Data and emulated GTFE recordLength for alternative 1 different.";
879  m_myCoutStream << "\n Data: recordLength() = " << recordLengthData;
880  m_myCoutStream << "\n Emul: recordLength() = " << recordLengthEmul;
881  m_myCoutStream << "\n";
882  m_gtfeDataEmul[iRec]->Fill(2);
883  }
884 
886  const uint16_t bxNrData = gtfeBlockData.bxNr();
887  const uint16_t bxNrEmul = gtfeBlockEmul.bxNr();
888 
889  if (bxNrData == bxNrEmul) {
890  m_myCoutStream << "\n" << recString << " Data and emulated GTFE bxNr identical.";
891  m_myCoutStream << "\n bxNr() = " << bxNrData;
892  m_myCoutStream << "\n";
893 
894  } else {
895  m_myCoutStream << "\n" << recString << " Data and emulated GTFE bxNr different.";
896  m_myCoutStream << "\n Data: bxNr() = " << bxNrData;
897  m_myCoutStream << "\n Emul: bxNr() = " << bxNrEmul;
898  m_myCoutStream << "\n";
899  m_gtfeDataEmul[iRec]->Fill(3);
900  }
901 
903  const uint32_t setupVersionData = gtfeBlockData.setupVersion();
904  const uint32_t setupVersionEmul = gtfeBlockEmul.setupVersion();
905 
906  if (setupVersionData == setupVersionEmul) {
907  m_myCoutStream << "\n" << recString << " Data and emulated GTFE setupVersion identical.";
908  m_myCoutStream << "\n setupVersion() = " << setupVersionData;
909  m_myCoutStream << "\n";
910 
911  } else {
912  m_myCoutStream << "\n" << recString << " Data and emulated GTFE setupVersion different.";
913  m_myCoutStream << "\n Data: setupVersion() = " << setupVersionData;
914  m_myCoutStream << "\n Emul: setupVersion() = " << setupVersionEmul;
915  m_myCoutStream << "\n";
916  m_gtfeDataEmul[iRec]->Fill(4);
917  }
918 
920  const uint16_t activeBoardsData = gtfeBlockData.activeBoards();
921  const uint16_t activeBoardsEmul = gtfeBlockEmul.activeBoards();
922 
923  if (activeBoardsData == activeBoardsEmul) {
924  m_myCoutStream << "\n" << recString << " Data and emulated GTFE activeBoards identical.";
925  m_myCoutStream << "\n activeBoards() = " << std::hex << "0x" << std::setw(4) << std::setfill('0')
926  << activeBoardsData << std::setfill(' ') << std::dec;
927  m_myCoutStream << "\n";
928 
929  } else {
930  m_myCoutStream << "\n" << recString << " Data and emulated GTFE activeBoards different.";
931  m_myCoutStream << "\n Data: activeBoards() = " << std::hex << "0x" << std::setw(4) << std::setfill('0')
932  << activeBoardsData << std::setfill(' ') << std::dec;
933  m_myCoutStream << "\n Emul: activeBoards() = " << std::hex << "0x" << std::setw(4) << std::setfill('0')
934  << activeBoardsEmul << std::setfill(' ') << std::dec;
935  m_myCoutStream << "\n";
936  m_gtfeDataEmul[iRec]->Fill(5);
937  }
942  const uint16_t altNrBxBoardData = gtfeBlockData.altNrBxBoard();
943  const uint16_t altNrBxBoardEmul = gtfeBlockEmul.altNrBxBoard();
944 
945  if (altNrBxBoardData == altNrBxBoardEmul) {
946  m_myCoutStream << "\n" << recString << " Data and emulated GTFE altNrBxBoard identical.";
947  m_myCoutStream << "\n altNrBxBoard() = " << altNrBxBoardData;
948  m_myCoutStream << "\n";
949 
950  } else {
951  m_myCoutStream << "\n" << recString << " Data and emulated GTFE altNrBxBoard different.";
952  m_myCoutStream << "\n Data: altNrBxBoard() = " << altNrBxBoardData;
953  m_myCoutStream << "\n Emul: altNrBxBoard() = " << altNrBxBoardEmul;
954  m_myCoutStream << "\n";
955  m_gtfeDataEmul[iRec]->Fill(6);
956  }
957 
959  const uint32_t totalTriggerNrData = gtfeBlockData.totalTriggerNr();
960  const uint32_t totalTriggerNrEmul = gtfeBlockEmul.totalTriggerNr();
961 
962  if (totalTriggerNrData == totalTriggerNrEmul) {
963  m_myCoutStream << "\n" << recString << " Data and emulated GTFE totalTriggerNr identical.";
964  m_myCoutStream << "\n totalTriggerNr() = " << totalTriggerNrData;
965  m_myCoutStream << "\n";
966 
967  } else {
968  m_myCoutStream << "\n" << recString << " Data and emulated GTFE totalTriggerNr different.";
969  m_myCoutStream << "\n Data: totalTriggerNr() = " << totalTriggerNrData;
970  m_myCoutStream << "\n Emul: totalTriggerNr() = " << totalTriggerNrEmul;
971  m_myCoutStream << "\n";
972  m_gtfeDataEmul[iRec]->Fill(7);
973  }
974 
975  edm::LogInfo("L1GtHwValidation") << m_myCoutStream.str() << std::endl;
976  m_myCoutStream.str("");
977  m_myCoutStream.clear();
978 }
979 
980 //compare the FDL board
982  const edm::EventSetup& evSetup,
983  const L1GtFdlWord& fdlBlockData,
984  const L1GtFdlWord& fdlBlockEmul,
985  const int iRec) {
986  // index of physics partition
987  int PhysicsPartition = 0;
988 
989  //
990  std::string recString;
991 
992  if (fdlBlockData == fdlBlockEmul) {
993  m_myCoutStream << "\n" << recString << " Data and emulated FDL blocks: identical.\n";
994  fdlBlockData.print(m_myCoutStream);
995 
996  } else {
997  m_myCoutStream << "\n" << recString << " Data and emulated FDL blocks: different.\n";
998 
999  m_myCoutStream << "\nData: FDL block\n";
1000  fdlBlockData.print(m_myCoutStream);
1001 
1002  m_myCoutStream << "\nEmul: FDL block\n";
1003  fdlBlockEmul.print(m_myCoutStream);
1004  }
1005 
1006  LogDebug("L1GtHwValidation") << m_myCoutStream.str() << std::endl;
1007 
1008  m_myCoutStream.str("");
1009  m_myCoutStream.clear();
1010 
1011  // get bunch cross in the GT event record -
1012  // move it first as histograms are BxInEvent dependent
1013  const int bxInEventData = fdlBlockData.bxInEvent();
1014  const int bxInEventEmul = fdlBlockEmul.bxInEvent();
1015 
1016  bool matchBxInEvent = false;
1017 
1018  if (bxInEventData == bxInEventEmul) {
1019  m_myCoutStream << "\n" << recString << " Data and emulated FDL bxInEvent identical.";
1020  m_myCoutStream << "\n bxInEvent() = " << bxInEventData;
1021  m_myCoutStream << "\n";
1022  matchBxInEvent = true;
1023 
1024  } else {
1025  m_myCoutStream << "\n" << recString << " Data and emulated FDL bxInEvent different.";
1026  m_myCoutStream << "\n Data: bxInEvent() = " << bxInEventData;
1027  m_myCoutStream << "\n Emul: bxInEvent() = " << bxInEventEmul;
1028  m_myCoutStream << "\n";
1029 
1030  m_fdlDataEmul_Err[iRec]->Fill(1);
1031 
1032  if (iRec == 0) {
1033  m_agree = false;
1034 
1035  m_myCoutStream << "\nDisagreement data versus emulator: "
1036  << "\n Data and emulated FDL bxInEvent different \n";
1037  }
1038  }
1039 
1040  LogDebug("L1GtHwValidation") << m_myCoutStream.str() << std::endl;
1041  m_myCoutStream.str("");
1042  m_myCoutStream.clear();
1043 
1044  // symmetrize
1045  bool validBxInEvent = false;
1046  int histIndex = bxInEventData + (TotalBxInEvent + 1) / 2 - 1;
1047  LogDebug("L1GtHwValidation") << "\n Convert bxInEvent = " << bxInEventData << " to histIndex = " << histIndex
1048  << std::endl;
1049  if ((histIndex <= TotalBxInEvent) && (histIndex >= 0)) {
1050  validBxInEvent = true;
1051  }
1052 
1053  // loop over algorithms and increase the corresponding counters
1054 
1055  // get BoardId value
1056  const uint16_t boardIdData = fdlBlockData.boardId();
1057  const uint16_t boardIdEmul = fdlBlockEmul.boardId();
1058 
1059  if (boardIdData == boardIdEmul) {
1060  m_myCoutStream << "\n" << recString << " Data and emulated FDL boardId identical.";
1061  m_myCoutStream << "\n boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdData
1062  << std::setfill(' ') << std::dec;
1063  m_myCoutStream << "\n";
1064 
1065  } else {
1066  m_myCoutStream << "\n" << recString << " Data and emulated FDL boardId different.";
1067  m_myCoutStream << "\n Data: boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdData
1068  << std::setfill(' ') << std::dec;
1069  m_myCoutStream << "\n Emul: boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdEmul
1070  << std::setfill(' ') << std::dec;
1071  m_myCoutStream << "\n";
1072 
1073  if (matchBxInEvent && validBxInEvent) {
1074  m_fdlDataEmul[histIndex][iRec]->Fill(0);
1075  } else {
1076  m_fdlDataEmul_Err[iRec]->Fill(0);
1077  }
1078  }
1079 
1080  LogDebug("L1GtHwValidation") << m_myCoutStream.str() << std::endl;
1081  m_myCoutStream.str("");
1082  m_myCoutStream.clear();
1083 
1084  // get BxNr - bunch cross number of the actual bx
1085  const uint16_t bxNrData = fdlBlockData.bxNr();
1086  const uint16_t bxNrEmul = fdlBlockEmul.bxNr();
1087 
1088  if (bxNrData == bxNrEmul) {
1089  m_myCoutStream << "\n" << recString << " Data and emulated FDL bxNr identical.";
1090  m_myCoutStream << "\n bxNr() = " << bxNrData;
1091  m_myCoutStream << "\n";
1092 
1093  } else {
1094  m_myCoutStream << "\n" << recString << " Data and emulated FDL bxNr different.";
1095  m_myCoutStream << "\n Data: bxNr() = " << bxNrData;
1096  m_myCoutStream << "\n Emul: bxNr() = " << bxNrEmul;
1097  m_myCoutStream << "\n";
1098 
1099  if (matchBxInEvent && validBxInEvent) {
1100  m_fdlDataEmul[histIndex][iRec]->Fill(2);
1101  } else {
1102  m_fdlDataEmul_Err[iRec]->Fill(2);
1103  }
1104  }
1105 
1106  LogDebug("L1GtHwValidation") << m_myCoutStream.str() << std::endl;
1107  m_myCoutStream.str("");
1108  m_myCoutStream.clear();
1109 
1110  // get event number since last L1 reset generated in FDL
1111  const uint32_t eventNrData = fdlBlockData.eventNr();
1112  const uint32_t eventNrEmul = fdlBlockEmul.eventNr();
1113 
1114  if (eventNrData == eventNrEmul) {
1115  m_myCoutStream << "\n" << recString << " Data and emulated FDL eventNr identical.";
1116  m_myCoutStream << "\n eventNr() = " << eventNrData;
1117  m_myCoutStream << "\n";
1118 
1119  } else {
1120  m_myCoutStream << "\n" << recString << " Data and emulated FDL eventNr different.";
1121  m_myCoutStream << "\n Data: eventNr() = " << eventNrData;
1122  m_myCoutStream << "\n Emul: eventNr() = " << eventNrEmul;
1123  m_myCoutStream << "\n";
1124 
1125  if (matchBxInEvent && validBxInEvent) {
1126  m_fdlDataEmul[histIndex][iRec]->Fill(3);
1127  } else {
1128  m_fdlDataEmul_Err[iRec]->Fill(3);
1129  }
1130  }
1131 
1132  LogDebug("L1GtHwValidation") << m_myCoutStream.str() << std::endl;
1133  m_myCoutStream.str("");
1134  m_myCoutStream.clear();
1135 
1136  // get technical trigger bits
1137  const TechnicalTriggerWord& gtTechnicalTriggerWordData = fdlBlockData.gtTechnicalTriggerWord();
1138  const TechnicalTriggerWord& gtTechnicalTriggerWordEmul = fdlBlockEmul.gtTechnicalTriggerWord();
1139 
1140  int nTechBits = gtTechnicalTriggerWordData.size();
1141 
1142  TechnicalTriggerWord gtTechnicalTriggerWordDataMask(nTechBits);
1143  TechnicalTriggerWord gtTechnicalTriggerWordEmulMask(nTechBits);
1144 
1145  unsigned int bitValue = 0;
1146 
1147  if (matchBxInEvent && validBxInEvent) {
1148  for (int iBit = 0; iBit < nTechBits; ++iBit) {
1149  unsigned int triggerMask = (m_triggerMaskTechTrig.at(iBit)) & (1 << PhysicsPartition);
1150 
1151  if (gtTechnicalTriggerWordData[iBit]) {
1152  m_fdlDataTechDecision[histIndex][iRec]->Fill(iBit);
1153 
1154  bitValue = (triggerMask) ? 0 : 1;
1155  gtTechnicalTriggerWordDataMask[iBit] = bitValue;
1156  if (bitValue) {
1157  m_fdlDataTechDecisionMask[histIndex][iRec]->Fill(iBit);
1158  }
1159  }
1160 
1161  if (gtTechnicalTriggerWordEmul.at(iBit)) {
1162  m_fdlEmulTechDecision[histIndex][iRec]->Fill(iBit);
1163 
1164  bitValue = (triggerMask) ? 0 : 1;
1165  gtTechnicalTriggerWordEmulMask[iBit] = bitValue;
1166  if (bitValue) {
1167  m_fdlEmulTechDecisionMask[histIndex][iRec]->Fill(iBit);
1168  }
1169  }
1170  }
1171  } else {
1172  for (int iBit = 0; iBit < nTechBits; ++iBit) {
1173  if (gtTechnicalTriggerWordData[iBit]) {
1174  m_fdlDataTechDecision_Err[iRec]->Fill(iBit);
1175  }
1176 
1177  if (gtTechnicalTriggerWordEmul.at(iBit)) {
1178  m_fdlEmulTechDecision_Err[iRec]->Fill(iBit);
1179  }
1180  }
1181  }
1182 
1183  if (gtTechnicalTriggerWordData == gtTechnicalTriggerWordEmul) {
1184  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtTechnicalTriggerWord identical.\n";
1186  m_myCoutStream << "\n";
1187 
1188  } else {
1189  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtTechnicalTriggerWord different.";
1190  m_myCoutStream << "\n Data: ";
1192  m_myCoutStream << "\n Emul: ";
1194  m_myCoutStream << "\n";
1195 
1196  if (matchBxInEvent && validBxInEvent) {
1197  m_fdlDataEmul[histIndex][iRec]->Fill(4);
1198  } else {
1199  m_fdlDataEmul_Err[iRec]->Fill(4);
1200  }
1201 
1202  if (matchBxInEvent && validBxInEvent) {
1203  for (int iBit = 0; iBit < nTechBits; ++iBit) {
1204  if (gtTechnicalTriggerWordData[iBit] != gtTechnicalTriggerWordEmul.at(iBit)) {
1205  m_fdlDataEmulTechDecision[histIndex][iRec]->Fill(iBit);
1206  }
1207  }
1208  } else {
1209  for (int iBit = 0; iBit < nTechBits; ++iBit) {
1210  if (gtTechnicalTriggerWordData[iBit] != gtTechnicalTriggerWordEmul.at(iBit)) {
1211  m_fdlDataEmulTechDecision_Err[iRec]->Fill(iBit);
1212  }
1213  }
1214  }
1215  }
1216 
1217  LogDebug("L1GtHwValidation") << m_myCoutStream.str() << std::endl;
1218  m_myCoutStream.str("");
1219  m_myCoutStream.clear();
1220 
1221  if (gtTechnicalTriggerWordDataMask == gtTechnicalTriggerWordEmulMask) {
1222  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtTechnicalTriggerWord after mask identical.\n";
1223  m_myCoutStream << "\n";
1224 
1225  } else {
1226  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtTechnicalTriggerWord after mask different.";
1227  m_myCoutStream << "\n Data: ";
1228  m_myCoutStream << "\n Emul: ";
1229  m_myCoutStream << "\n";
1230 
1231  if (matchBxInEvent && validBxInEvent) {
1232  m_fdlDataEmul[histIndex][iRec]->Fill(5);
1233  } else {
1234  m_fdlDataEmul_Err[iRec]->Fill(5);
1235  }
1236 
1237  if (matchBxInEvent && validBxInEvent) {
1238  for (int iBit = 0; iBit < nTechBits; ++iBit) {
1239  if (gtTechnicalTriggerWordData[iBit] != gtTechnicalTriggerWordEmul.at(iBit)) {
1240  m_fdlDataEmulTechDecisionMask[histIndex][iRec]->Fill(iBit);
1241  }
1242  }
1243  }
1244  }
1245 
1246  LogDebug("L1GtHwValidation") << m_myCoutStream.str() << std::endl;
1247  m_myCoutStream.str("");
1248  m_myCoutStream.clear();
1249 
1250  // get algorithms bits (decision word)
1251  const DecisionWord& gtDecisionWordData = fdlBlockData.gtDecisionWord();
1252  const DecisionWord& gtDecisionWordEmul = fdlBlockEmul.gtDecisionWord();
1253 
1254  int nAlgoBits = gtDecisionWordData.size();
1255 
1256  DecisionWord gtDecisionWordDataMask(nAlgoBits);
1257  DecisionWord gtDecisionWordEmulMask(nAlgoBits);
1258 
1259  // get the index of the prescale factor set from data
1260  int iPfSet = fdlBlockData.gtPrescaleFactorIndexAlgo();
1261 
1262  // check that the prescale factor is not out of range for the prescale factor
1263  // record retrieved from event setup
1264  size_t pfSetsSize = (*m_prescaleFactorsAlgoTrig).size();
1265 
1266  if (iPfSet < 0) {
1267  LogDebug("L1GtHwValidation") << "\nError: index of prescale factor set retrieved from the data \n"
1268  << "less than zero."
1269  << "\n Value of index retrieved from data = " << iPfSet << std::endl;
1270 
1271  // FIXME add a histogram to be used for a quality test
1272 
1273  return;
1274 
1275  } else if (iPfSet >= (static_cast<int>(pfSetsSize))) {
1276  LogDebug("L1GtHwValidation") << "\nError: index of prescale factor set retrieved from the data \n"
1277  << "greater than the size of the vector of prescale factor sets."
1278  << "\n Value of index retrieved from data = " << iPfSet
1279  << "\n Vector size = " << pfSetsSize << std::endl;
1280 
1281  // FIXME add a histogram to be used for a quality test
1282 
1283  return;
1284  }
1285 
1286  const std::vector<int>& prescaleFactorsAlgoTrig = (*m_prescaleFactorsAlgoTrig).at(iPfSet);
1287 
1288  if (matchBxInEvent && validBxInEvent) {
1289  for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
1290  unsigned int triggerMask = (m_triggerMaskAlgoTrig.at(iBit)) & (1 << PhysicsPartition);
1291 
1292  int prescaleFactor = prescaleFactorsAlgoTrig.at(iBit);
1293 
1294  LogTrace("L1GtHwValidation") << "Bit " << iBit << ": prescale factor = " << prescaleFactor
1295  << " trigger mask = " << triggerMask << std::endl;
1296 
1297  if (gtDecisionWordData[iBit]) {
1298  m_fdlDataAlgoDecision[histIndex][iRec]->Fill(iBit);
1299 
1300  if (prescaleFactor == 1) {
1301  m_fdlDataAlgoDecisionUnprescaled[histIndex][iRec]->Fill(iBit);
1302  } else {
1303  m_fdlDataAlgoDecisionPrescaled[histIndex][iRec]->Fill(iBit);
1304  }
1305 
1306  bitValue = (triggerMask) ? 0 : 1;
1307  gtDecisionWordDataMask[iBit] = bitValue;
1308  if (bitValue) {
1309  m_fdlDataAlgoDecisionMask[histIndex][iRec]->Fill(iBit);
1310  }
1311  }
1312 
1313  if (gtDecisionWordEmul.at(iBit)) {
1314  m_fdlEmulAlgoDecision[histIndex][iRec]->Fill(iBit);
1315 
1316  bitValue = (triggerMask) ? 0 : 1;
1317  gtDecisionWordEmulMask[iBit] = bitValue;
1318  if (bitValue) {
1319  m_fdlEmulAlgoDecisionMask[histIndex][iRec]->Fill(iBit);
1320  }
1321  }
1322  }
1323  } else {
1324  for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
1325  if (gtDecisionWordData[iBit]) {
1326  m_fdlDataAlgoDecision_Err[iRec]->Fill(iBit);
1327  }
1328  }
1329 
1330  for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
1331  if (gtDecisionWordEmul.at(iBit)) {
1332  m_fdlEmulAlgoDecision_Err[iRec]->Fill(iBit);
1333  }
1334  }
1335 
1336  if (iRec == 0) {
1337  m_agree = false;
1338 
1339  m_myCoutStream << "\nDisagreement data versus emulator: "
1340  << "\n matchBxInEvent && validBxInEvent false \n";
1341  }
1342  }
1343 
1344  if (gtDecisionWordData == gtDecisionWordEmul) {
1345  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtDecisionWord identical.";
1346  fdlBlockData.printGtDecisionWord(m_myCoutStream);
1347  m_myCoutStream << "\n";
1348 
1349  } else {
1350  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtDecisionWord different.";
1351  m_myCoutStream << "\n Data: ";
1352  fdlBlockData.printGtDecisionWord(m_myCoutStream);
1353  m_myCoutStream << "\n Emul: ";
1354  fdlBlockEmul.printGtDecisionWord(m_myCoutStream);
1355  m_myCoutStream << "\n";
1356 
1357  if (matchBxInEvent && validBxInEvent) {
1358  m_fdlDataEmul[histIndex][iRec]->Fill(6);
1359  } else {
1360  m_fdlDataEmul_Err[iRec]->Fill(6);
1361  }
1362 
1363  if (matchBxInEvent && validBxInEvent) {
1364  for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
1365  int prescaleFactor = prescaleFactorsAlgoTrig.at(iBit);
1366 
1367  if (gtDecisionWordData[iBit] != gtDecisionWordEmul.at(iBit)) {
1368  m_fdlDataEmulAlgoDecision[histIndex][iRec]->Fill(iBit);
1369 
1370  // for excluded algorithms, fill mismatch for BxInEvent = 0 and DAQ record only
1371  if (excludedAlgo(iBit) && (bxInEventData == 0) && (iRec == 0)) {
1373  }
1374 
1375  if (prescaleFactor == 1) {
1376  m_fdlDataEmulAlgoDecisionUnprescaled[histIndex][iRec]->Fill(iBit);
1377 
1378  // fill a histogram for allowed algorithm triggers only
1379  if (!excludedAlgo(iBit)) {
1380  m_fdlDataEmulAlgoDecisionUnprescaledAllowed[histIndex][iRec]->Fill(iBit);
1381  }
1382 
1383  } else {
1384  m_fdlDataEmulAlgoDecisionPrescaled[histIndex][iRec]->Fill(iBit);
1385  }
1386 
1387  if (gtDecisionWordData[iBit]) {
1388  m_fdlDataAlgoDecision_NoMatch[histIndex][iRec]->Fill(iBit);
1389 
1390  if (prescaleFactor == 1) {
1391  m_fdlDataAlgoDecisionUnprescaled_NoMatch[histIndex][iRec]->Fill(iBit);
1392 
1393  // compare for agreement only unprescaled algorithms and algorithms which
1394  // are not excluded from comparison
1395  if ((!excludedAlgo(iBit)) && (bxInEventData == 0) && (iRec == 0)) {
1396  m_agree = false;
1397  m_dataOnly = true;
1398 
1399  m_myCoutStream << "\nDisagreement data versus emulator: "
1400  << "result before mask for algorithm with bit number " << iBit
1401  << "\n Data: true, emulator: false \n";
1402  }
1403 
1404  } else {
1405  m_fdlDataAlgoDecisionPrescaled_NoMatch[histIndex][iRec]->Fill(iBit);
1406  }
1407 
1408  } else {
1409  m_fdlEmulAlgoDecision_NoMatch[histIndex][iRec]->Fill(iBit);
1410 
1411  if (prescaleFactor == 1) {
1412  m_fdlEmulAlgoDecisionUnprescaled_NoMatch[histIndex][iRec]->Fill(iBit);
1413 
1414  // compare for agreement only unprescaled algorithms and algorithms which
1415  // are not excluded from comparison
1416  if ((!excludedAlgo(iBit)) && (bxInEventData == 0) && (iRec == 0)) {
1417  m_agree = false;
1418  m_emulOnly = true;
1419 
1420  m_myCoutStream << "\nDisagreement data versus emulator: "
1421  << "result before mask for algorithm with bit number " << iBit
1422  << "\n Data: false, emulator: true \n";
1423  }
1424 
1425  } else {
1426  m_fdlEmulAlgoDecisionPrescaled_NoMatch[histIndex][iRec]->Fill(iBit);
1427  }
1428  }
1429  }
1430  }
1431  } else {
1432  for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
1433  if (gtDecisionWordData[iBit] != gtDecisionWordEmul.at(iBit)) {
1434  m_fdlDataEmulAlgoDecision_Err[iRec]->Fill(iBit);
1435  }
1436  }
1437 
1438  if (iRec == 0) {
1439  m_agree = false;
1440 
1441  m_myCoutStream << "\nDisagreement data versus emulator: "
1442  << "\n matchBxInEvent && validBxInEvent false \n";
1443  }
1444  }
1445  }
1446 
1447  if (gtDecisionWordDataMask == gtDecisionWordEmulMask) {
1448  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtDecisionWord after mask identical.";
1449  m_myCoutStream << "\n";
1450 
1451  } else {
1452  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtDecisionWord after mask different.";
1453  m_myCoutStream << "\n Data: ";
1454  m_myCoutStream << "\n Emul: ";
1455  m_myCoutStream << "\n";
1456 
1457  if (matchBxInEvent && validBxInEvent) {
1458  m_fdlDataEmul[histIndex][iRec]->Fill(7);
1459  } else {
1460  m_fdlDataEmul_Err[iRec]->Fill(7);
1461  }
1462 
1463  if (matchBxInEvent && validBxInEvent) {
1464  for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
1465  if (gtDecisionWordDataMask[iBit] != gtDecisionWordEmulMask.at(iBit)) {
1466  m_fdlDataEmulAlgoDecisionMask[histIndex][iRec]->Fill(iBit);
1467 
1468  int prescaleFactor = prescaleFactorsAlgoTrig.at(iBit);
1469 
1470  if (gtDecisionWordDataMask[iBit]) {
1471  m_fdlDataAlgoDecisionMask_NoMatch[histIndex][iRec]->Fill(iBit);
1472 
1473  if (prescaleFactor == 1) {
1474  m_fdlDataAlgoDecisionUnprescaledMask_NoMatch[histIndex][iRec]->Fill(iBit);
1475 
1476  // compare for agreement only unprescaled algorithms and algorithms which
1477  // are not excluded from comparison
1478  if ((!excludedAlgo(iBit)) && (bxInEventData == 0) && (iRec == 0)) {
1479  m_agree = false;
1480  m_dataOnlyMask = true;
1481 
1482  m_myCoutStream << "\nDisagreement data versus emulator: "
1483  << "result after mask for algorithm with bit number " << iBit
1484  << " different in data versus emulator "
1485  << "\n Data: true, emulator: false \n";
1486  }
1487 
1488  } else {
1489  m_fdlDataAlgoDecisionPrescaledMask_NoMatch[histIndex][iRec]->Fill(iBit);
1490  }
1491 
1492  } else {
1493  m_fdlEmulAlgoDecisionMask_NoMatch[histIndex][iRec]->Fill(iBit);
1494 
1495  if (prescaleFactor == 1) {
1496  m_fdlEmulAlgoDecisionUnprescaledMask_NoMatch[histIndex][iRec]->Fill(iBit);
1497 
1498  // compare for agreement only unprescaled algorithms and algorithms which
1499  // are not excluded from comparison
1500  if ((!excludedAlgo(iBit)) && (bxInEventData == 0) && (iRec == 0)) {
1501  m_agree = false;
1502  m_emulOnlyMask = true;
1503 
1504  m_myCoutStream << "\nDisagreement data versus emulator: "
1505  << "result after mask for algorithm with bit number " << iBit
1506  << " different in data versus emulator "
1507  << "\n Data: false, emulator: true \n";
1508  }
1509 
1510  } else {
1511  m_fdlEmulAlgoDecisionPrescaledMask_NoMatch[histIndex][iRec]->Fill(iBit);
1512  }
1513  }
1514  }
1515  }
1516  }
1517  }
1518 
1519  // get extended algorithms bits (extended decision word)
1520  const DecisionWordExtended& gtDecisionWordExtendedData = fdlBlockData.gtDecisionWordExtended();
1521  const DecisionWordExtended& gtDecisionWordExtendedEmul = fdlBlockEmul.gtDecisionWordExtended();
1522 
1523  if (gtDecisionWordExtendedData == gtDecisionWordExtendedEmul) {
1524  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtDecisionWordExtended identical.\n";
1526  m_myCoutStream << "\n";
1527 
1528  } else {
1529  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtDecisionWordExtended different.\n";
1530  m_myCoutStream << "\n Data: ";
1532  m_myCoutStream << "\n Emul: ";
1534  m_myCoutStream << "\n";
1535 
1536  if (matchBxInEvent && validBxInEvent) {
1537  m_fdlDataEmul[histIndex][iRec]->Fill(8);
1538  } else {
1539  m_fdlDataEmul_Err[iRec]->Fill(8);
1540  }
1541  }
1542 
1543  // get NoAlgo
1544  const uint16_t noAlgoData = fdlBlockData.noAlgo();
1545  const uint16_t noAlgoEmul = fdlBlockEmul.noAlgo();
1546 
1547  if (noAlgoData == noAlgoEmul) {
1548  m_myCoutStream << "\n" << recString << " Data and emulated FDL noAlgo identical.";
1549  m_myCoutStream << "\n noAlgo() = " << noAlgoData;
1550  m_myCoutStream << "\n";
1551 
1552  } else {
1553  m_myCoutStream << "\n" << recString << " Data and emulated FDL noAlgo different.";
1554  m_myCoutStream << "\n Data: noAlgo() = " << noAlgoData;
1555  m_myCoutStream << "\n Emul: noAlgo() = " << noAlgoEmul;
1556  m_myCoutStream << "\n";
1557 
1558  if (matchBxInEvent && validBxInEvent) {
1559  m_fdlDataEmul[histIndex][iRec]->Fill(9);
1560  } else {
1561  m_fdlDataEmul_Err[iRec]->Fill(9);
1562  }
1563  }
1564 
1565  // get "Final OR" bits
1566  const uint16_t finalORData = fdlBlockData.finalOR();
1567  const uint16_t finalOREmul = fdlBlockEmul.finalOR();
1568 
1569  if (finalORData == finalOREmul) {
1570  m_myCoutStream << "\n" << recString << " Data and emulated FDL finalOR identical.";
1571  m_myCoutStream << "\n finalOR() = " << std::hex << "0x" << std::setw(2) << std::setfill('0') << finalORData
1572  << std::setfill(' ') << std::dec;
1573  m_myCoutStream << "\n";
1574 
1575  } else {
1576  m_myCoutStream << "\n" << recString << " Data and emulated FDL finalOR different.";
1577  m_myCoutStream << "\n Data: finalOR() = " << std::hex << "0x" << std::setw(2) << std::setfill('0') << finalORData
1578  << std::setfill(' ') << std::dec;
1579  m_myCoutStream << "\n Emul: finalOR() = " << std::hex << "0x" << std::setw(2) << std::setfill('0') << finalOREmul
1580  << std::setfill(' ') << std::dec;
1581  m_myCoutStream << "\n";
1582 
1583  if (matchBxInEvent && validBxInEvent) {
1584  m_fdlDataEmul[histIndex][iRec]->Fill(10);
1585  } else {
1586  m_fdlDataEmul_Err[iRec]->Fill(10);
1587  }
1588  }
1589 
1590  // get "Final OR" for physics partition
1591  const int finalORPhysData = finalORData & (1 << PhysicsPartition);
1592  const int finalORPhysEmul = finalOREmul & (1 << PhysicsPartition);
1593 
1594  if (finalORPhysData == finalORPhysEmul) {
1595  m_myCoutStream << "\n" << recString << " Data and emulated FDL finalOR for the physics partition identical.";
1596  m_myCoutStream << "\n finalOR() = " << finalORPhysData;
1597  m_myCoutStream << "\n";
1598 
1599  } else {
1600  m_myCoutStream << "\n" << recString << " Data and emulated FDL finalOR for the physics partition different.";
1601  m_myCoutStream << "\n Data: finalOR() = " << finalORPhysData;
1602  m_myCoutStream << "\n Emul: finalOR() = " << finalORPhysEmul;
1603  m_myCoutStream << "\n";
1604 
1605  if (matchBxInEvent && validBxInEvent) {
1606  m_fdlDataEmul[histIndex][iRec]->Fill(11);
1607  } else {
1608  m_fdlDataEmul_Err[iRec]->Fill(11);
1609  }
1610  }
1611 
1612  // get local bunch cross number of the actual bx
1613  const uint16_t localBxNrData = fdlBlockData.localBxNr();
1614  const uint16_t localBxNrEmul = fdlBlockEmul.localBxNr();
1615 
1616  if (localBxNrData == localBxNrEmul) {
1617  m_myCoutStream << "\n" << recString << " Data and emulated FDL localBxNr identical.";
1618  m_myCoutStream << "\n localBxNr() = " << localBxNrData;
1619  m_myCoutStream << "\n";
1620 
1621  } else {
1622  m_myCoutStream << "\n" << recString << " Data and emulated FDL localBxNr different.";
1623  m_myCoutStream << "\n Data: localBxNr() = " << localBxNrData;
1624  m_myCoutStream << "\n Emul: localBxNr() = " << localBxNrEmul;
1625  m_myCoutStream << "\n";
1626 
1627  if (matchBxInEvent && validBxInEvent) {
1628  m_fdlDataEmul[histIndex][iRec]->Fill(12);
1629  } else {
1630  m_fdlDataEmul_Err[iRec]->Fill(12);
1631  }
1632  }
1633 
1634  edm::LogInfo("L1GtHwValidation") << m_myCoutStream.str() << std::endl;
1635  m_myCoutStream.str("");
1636  m_myCoutStream.clear();
1637 }
1638 
1639 //compare the PSB board
1641  const edm::EventSetup& evSetup,
1642  const L1GtPsbWord& psbBlockData,
1643  const L1GtPsbWord& psbBlockEmul) {
1644  if (psbBlockData == psbBlockEmul) {
1645  m_myCoutStream << "\nData and emulated PSB blocks: identical.\n";
1646  psbBlockData.print(m_myCoutStream);
1647 
1648  } else {
1649  m_myCoutStream << "\nData and emulated PSB blocks: different.\n";
1650 
1651  m_myCoutStream << "\nData: PSB block\n";
1652  psbBlockData.print(m_myCoutStream);
1653 
1654  m_myCoutStream << "\nEmul: PSB block\n";
1655  psbBlockEmul.print(m_myCoutStream);
1656  }
1657 
1658  LogDebug("L1GtHwValidation") << m_myCoutStream.str() << std::endl;
1659 
1660  m_myCoutStream.str("");
1661  m_myCoutStream.clear();
1662 
1663  // get BoardId value
1664  const uint16_t boardIdData = psbBlockData.boardId();
1665  const uint16_t boardIdEmul = psbBlockEmul.boardId();
1666 
1667  if (boardIdData == boardIdEmul) {
1668  m_myCoutStream << "\nData and emulated PSB boardId identical.";
1669  m_myCoutStream << "\n boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdData
1670  << std::setfill(' ') << std::dec;
1671  m_myCoutStream << "\n";
1672 
1673  } else {
1674  m_myCoutStream << "\nData and emulated PSB boardId different.";
1675  m_myCoutStream << "\n Data: boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdData
1676  << std::setfill(' ') << std::dec;
1677  m_myCoutStream << "\n Emul: boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdEmul
1678  << std::setfill(' ') << std::dec;
1679  m_myCoutStream << "\n";
1680  }
1681 
1682  // get bunch cross in the GT event record
1683  const int bxInEventData = psbBlockData.bxInEvent();
1684  const int bxInEventEmul = psbBlockEmul.bxInEvent();
1685 
1686  if (bxInEventData == bxInEventEmul) {
1687  m_myCoutStream << "\nData and emulated PSB bxInEvent identical.";
1688  m_myCoutStream << "\n bxInEvent() = " << bxInEventData;
1689  m_myCoutStream << "\n";
1690 
1691  } else {
1692  m_myCoutStream << "\nData and emulated PSB bxInEvent different.";
1693  m_myCoutStream << "\n Data: bxInEvent() = " << bxInEventData;
1694  m_myCoutStream << "\n Emul: bxInEvent() = " << bxInEventEmul;
1695  m_myCoutStream << "\n";
1696  }
1697 
1698  // get BxNr - bunch cross number of the actual bx
1699  const uint16_t bxNrData = psbBlockData.bxNr();
1700  const uint16_t bxNrEmul = psbBlockEmul.bxNr();
1701 
1702  if (bxNrData == bxNrEmul) {
1703  m_myCoutStream << "\nData and emulated PSB bxNr identical.";
1704  m_myCoutStream << "\n bxNr() = " << bxNrData;
1705  m_myCoutStream << "\n";
1706 
1707  } else {
1708  m_myCoutStream << "\nData and emulated PSB bxNr different.";
1709  m_myCoutStream << "\n Data: bxNr() = " << bxNrData;
1710  m_myCoutStream << "\n Emul: bxNr() = " << bxNrEmul;
1711  m_myCoutStream << "\n";
1712  }
1713 
1714  // get event number since last L1 reset generated in FDL
1715  const uint32_t eventNrData = psbBlockData.eventNr();
1716  const uint32_t eventNrEmul = psbBlockEmul.eventNr();
1717 
1718  if (eventNrData == eventNrEmul) {
1719  m_myCoutStream << "\nData and emulated PSB eventNr identical.";
1720  m_myCoutStream << "\n eventNr() = " << eventNrData;
1721  m_myCoutStream << "\n";
1722 
1723  } else {
1724  m_myCoutStream << "\nData and emulated PSB eventNr different.";
1725  m_myCoutStream << "\n Data: eventNr() = " << eventNrData;
1726  m_myCoutStream << "\n Emul: eventNr() = " << eventNrEmul;
1727  m_myCoutStream << "\n";
1728  }
1729 
1731  uint16_t valData;
1732  uint16_t valEmul;
1733 
1734  for (int iA = 0; iA < psbBlockData.NumberAData; ++iA) {
1735  valData = psbBlockData.aData(iA);
1736  valEmul = psbBlockEmul.aData(iA);
1737 
1738  if (valData == valEmul) {
1739  m_myCoutStream << "\nData and emulated PSB aData(" << iA << ") identical.";
1740  m_myCoutStream << "\n aData(iA) = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << valData
1741  << std::setfill(' ') << std::dec;
1742  m_myCoutStream << "\n";
1743 
1744  } else {
1745  m_myCoutStream << "\nData and emulated PSB aData(" << iA << ") different.";
1746  m_myCoutStream << "\n Data: aData(iA) = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << valData
1747  << std::setfill(' ') << std::dec;
1748  m_myCoutStream << "\n Emul: aData(iA) = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << valEmul
1749  << std::setfill(' ') << std::dec;
1750  m_myCoutStream << "\n";
1751  }
1752  }
1753 
1755  for (int iB = 0; iB < psbBlockData.NumberBData; ++iB) {
1756  valData = psbBlockData.bData(iB);
1757  valEmul = psbBlockEmul.bData(iB);
1758 
1759  if (valData == valEmul) {
1760  m_myCoutStream << "\nData and emulated PSB bData(" << iB << ") identical.";
1761  m_myCoutStream << "\n bData(iA) = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << valData
1762  << std::setfill(' ') << std::dec;
1763  m_myCoutStream << "\n";
1764 
1765  } else {
1766  m_myCoutStream << "\nData and emulated PSB bData(" << iB << ") different.";
1767  m_myCoutStream << "\n Data: bData(iA) = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << valData
1768  << std::setfill(' ') << std::dec;
1769  m_myCoutStream << "\n Emul: bData(iA) = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << valEmul
1770  << std::setfill(' ') << std::dec;
1771  m_myCoutStream << "\n";
1772  }
1773  }
1774 
1775  // get local bunch cross number of the actual bx
1776  const uint16_t localBxNrData = psbBlockData.localBxNr();
1777  const uint16_t localBxNrEmul = psbBlockEmul.localBxNr();
1778 
1779  if (localBxNrData == localBxNrEmul) {
1780  m_myCoutStream << "\nData and emulated PSB localBxNr identical.";
1781  m_myCoutStream << "\n localBxNr() = " << localBxNrData;
1782  m_myCoutStream << "\n";
1783 
1784  } else {
1785  m_myCoutStream << "\nData and emulated PSB localBxNr different.";
1786  m_myCoutStream << "\n Data: localBxNr() = " << localBxNrData;
1787  m_myCoutStream << "\n Emul: localBxNr() = " << localBxNrEmul;
1788  m_myCoutStream << "\n";
1789  }
1790 
1791  edm::LogInfo("L1GtHwValidation") << m_myCoutStream.str() << std::endl;
1792  m_myCoutStream.str("");
1793  m_myCoutStream.clear();
1794 }
1795 
1796 //compare the TCS board
1798  const edm::EventSetup& evSetup,
1799  const L1TcsWord&,
1800  const L1TcsWord&) {
1801  // empty
1802 }
1803 
1804 //L1 GT DAQ record comparison
1806  // formal index for DAQ record
1807  int iRec = 0;
1808 
1809  // reset the flags - they are used for DAQ recor only
1810  m_agree = true;
1811  m_dataOnly = false;
1812  m_emulOnly = false;
1813  m_dataOnlyMask = false;
1814  m_emulOnlyMask = false;
1815 
1816  // get the L1 GT hardware DAQ record L1GlobalTriggerReadoutRecord
1817  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
1818  iEvent.getByToken(m_l1GtDataDaqInputToken_, gtReadoutRecordData);
1819 
1820  bool validData = false;
1821 
1822  if (!gtReadoutRecordData.isValid()) {
1824  } else {
1825  validData = true;
1826  }
1827 
1828  // get the L1 GT emulator DAQ record L1GlobalTriggerReadoutRecord
1829  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordEmul;
1830  iEvent.getByToken(m_l1GtEmulDaqInputToken_, gtReadoutRecordEmul);
1831 
1832  bool validEmul = false;
1833 
1834  if (!gtReadoutRecordEmul.isValid()) {
1836  } else {
1837  validEmul = true;
1838  }
1839 
1840  if ((!validData) || (!validEmul)) {
1841  edm::LogWarning("L1GtHwValidation") << "\n No valid product found: DAQ L1GlobalTriggerReadoutRecord"
1842  << "\n Data validity [1 = true; 0 = false]: " << validData
1843  << "\n Emulator validity: [1 = true; 0 = false]: " << validEmul
1844  << "\n DAQ histograms will not be filled.\n"
1845  << std::endl;
1846 
1847  return;
1848  }
1849 
1850  // compare GTFE
1851  const L1GtfeWord& gtfeBlockData = gtReadoutRecordData->gtfeWord();
1852  const L1GtfeWord& gtfeBlockEmul = gtReadoutRecordEmul->gtfeWord();
1853 
1854  compareGTFE(iEvent, evSetup, gtfeBlockData, gtfeBlockEmul, iRec);
1855 
1856  // FDL comparison
1857  const std::vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
1858  const std::vector<L1GtFdlWord>& gtFdlVectorEmul = gtReadoutRecordEmul->gtFdlVector();
1859 
1860  int gtFdlVectorDataSize = gtFdlVectorData.size();
1861  int gtFdlVectorEmulSize = gtFdlVectorEmul.size();
1862 
1863  if (gtFdlVectorDataSize == gtFdlVectorEmulSize) {
1864  m_myCoutStream << "\nData and emulated FDL vector size: identical.\n";
1865  m_myCoutStream << " Size: " << gtFdlVectorDataSize << std::endl;
1866 
1867  for (int iFdl = 0; iFdl < gtFdlVectorDataSize; ++iFdl) {
1868  const L1GtFdlWord& fdlBlockData = gtFdlVectorData[iFdl];
1869  const L1GtFdlWord& fdlBlockEmul = gtFdlVectorEmul[iFdl];
1870 
1871  compareFDL(iEvent, evSetup, fdlBlockData, fdlBlockEmul, iRec);
1872  }
1873  } else {
1874  m_myCoutStream << "\nData and emulated FDL vector size: different.\n";
1875  m_myCoutStream << " Data: size = " << gtFdlVectorDataSize << std::endl;
1876  m_myCoutStream << " Emul: size = " << gtFdlVectorEmulSize << std::endl;
1877  }
1878 
1879  LogDebug("L1GtHwValidation") << m_myCoutStream.str() << std::endl;
1880 
1881  m_myCoutStream.str("");
1882  m_myCoutStream.clear();
1883 
1884  // PSB comparison
1885  const std::vector<L1GtPsbWord>& gtPsbVectorData = gtReadoutRecordData->gtPsbVector();
1886  const std::vector<L1GtPsbWord>& gtPsbVectorEmul = gtReadoutRecordEmul->gtPsbVector();
1887 
1888  int gtPsbVectorDataSize = gtPsbVectorData.size();
1889  int gtPsbVectorEmulSize = gtPsbVectorEmul.size();
1890 
1891  if (gtPsbVectorDataSize == gtPsbVectorEmulSize) {
1892  m_myCoutStream << "\nData and emulated PSB vector size: identical.\n";
1893  m_myCoutStream << " Size: " << gtPsbVectorDataSize << std::endl;
1894  } else {
1895  m_myCoutStream << "\nData and emulated PSB vector size: different.\n";
1896  m_myCoutStream << " Data: size = " << gtPsbVectorDataSize << std::endl;
1897  m_myCoutStream << " Emul: size = " << gtPsbVectorEmulSize << std::endl;
1898  }
1899 
1900  // the order of PSB block in the gtPsbVector is different in emulator and in data
1901  // in emulator: all active PSB in one BxInEvent, ordered L1A-1, L1A, L1A+1
1902  // in unpacker: every PSB in all BxInEvent
1903  for (int iPsb = 0; iPsb < gtPsbVectorDataSize; ++iPsb) {
1904  const L1GtPsbWord& psbBlockData = gtPsbVectorData[iPsb];
1905  const uint16_t boardIdData = psbBlockData.boardId();
1906  const int bxInEventData = psbBlockData.bxInEvent();
1907 
1908  // search the corresponding PSB in the emulated record using the
1909  // BoardId and the BxInEvent
1910 
1911  bool foundPSB = false;
1912 
1913  for (int iPsbF = 0; iPsbF < gtPsbVectorEmulSize; ++iPsbF) {
1914  const L1GtPsbWord& psbBlockEmul = gtPsbVectorEmul[iPsbF];
1915  const uint16_t boardIdEmul = psbBlockEmul.boardId();
1916  const int bxInEventEmul = psbBlockEmul.bxInEvent();
1917 
1918  if ((boardIdEmul == boardIdData) && (bxInEventData == bxInEventEmul)) {
1919  foundPSB = true;
1920 
1921  // compare the boards
1922  comparePSB(iEvent, evSetup, psbBlockData, psbBlockEmul);
1923  }
1924  }
1925 
1926  if (!foundPSB) {
1927  m_myCoutStream << "\nNo emulated PSB with boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0')
1928  << boardIdData << std::setfill(' ') << std::dec << " and BxInEvent = " << bxInEventData
1929  << " was found";
1930  }
1931  }
1932 
1933  edm::LogInfo("L1GtHwValidation") << m_myCoutStream.str() << std::endl;
1934 
1935  m_myCoutStream.str("");
1936  m_myCoutStream.clear();
1937 
1938  // fill the m_gtErrorFlag histogram (only for L1 GT DAQ record)
1939 
1940  if (m_agree) {
1941  m_gtErrorFlag->Fill(0.0001);
1942  }
1943 
1944  if (m_dataOnly || m_dataOnlyMask) {
1945  m_gtErrorFlag->Fill(3.0001);
1946  }
1947 
1948  if (m_emulOnly || m_emulOnlyMask) {
1949  m_gtErrorFlag->Fill(4.0001);
1950  }
1951 }
1952 
1953 // L1 GT EVM record comparison
1955  // formal index for EVM record
1956  int iRec = 1;
1957 
1958  // get the L1 GT hardware EVM record L1GlobalTriggerEvmReadoutRecord
1960  iEvent.getByToken(m_l1GtDataEvmInputToken_, gtReadoutRecordData);
1961 
1962  bool validData = false;
1963 
1964  if (!gtReadoutRecordData.isValid()) {
1966  } else {
1967  validData = true;
1968  }
1969 
1970  // get the L1 GT emulator EVM record L1GlobalTriggerEvmReadoutRecord
1972  iEvent.getByToken(m_l1GtEmulEvmInputToken_, gtReadoutRecordEmul);
1973 
1974  bool validEmul = false;
1975 
1976  if (!gtReadoutRecordEmul.isValid()) {
1978  } else {
1979  validEmul = true;
1980  }
1981 
1982  if ((!validData) || (!validEmul)) {
1983  edm::LogWarning("L1GtHwValidation") << "\n No valid product found: EVM L1GlobalTriggerEvmReadoutRecord"
1984  << "\n Data validity [1 = true; 0 = false]: " << validData
1985  << "\n Emulator validity: [1 = true; 0 = false]: " << validEmul
1986  << "\n EVM histograms will not be filled.\n"
1987  << std::endl;
1988 
1989  return;
1990  }
1991 
1992  // compare GTFE
1993  const L1GtfeWord& gtfeBlockData = gtReadoutRecordData->gtfeWord();
1994  const L1GtfeWord& gtfeBlockEmul = gtReadoutRecordEmul->gtfeWord();
1995 
1996  compareGTFE(iEvent, evSetup, gtfeBlockData, gtfeBlockEmul, iRec);
1997 
1998  // FDL comparison
1999  const std::vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
2000  const std::vector<L1GtFdlWord>& gtFdlVectorEmul = gtReadoutRecordEmul->gtFdlVector();
2001 
2002  int gtFdlVectorDataSize = gtFdlVectorData.size();
2003  int gtFdlVectorEmulSize = gtFdlVectorEmul.size();
2004 
2005  if (gtFdlVectorDataSize == gtFdlVectorEmulSize) {
2006  m_myCoutStream << "\nData and emulated FDL vector size: identical.\n";
2007  m_myCoutStream << " Size: " << gtFdlVectorDataSize << std::endl;
2008 
2009  for (int iFdl = 0; iFdl < gtFdlVectorDataSize; ++iFdl) {
2010  const L1GtFdlWord& fdlBlockData = gtFdlVectorData[iFdl];
2011  const L1GtFdlWord& fdlBlockEmul = gtFdlVectorEmul[iFdl];
2012 
2013  compareFDL(iEvent, evSetup, fdlBlockData, fdlBlockEmul, iRec);
2014  }
2015  } else {
2016  m_myCoutStream << "\nData and emulated FDL vector size: different.\n";
2017  m_myCoutStream << " Data: size = " << gtFdlVectorDataSize << std::endl;
2018  m_myCoutStream << " Emul: size = " << gtFdlVectorEmulSize << std::endl;
2019  }
2020 
2021  // FIXME compare TCS
2022 
2023  LogDebug("L1GtHwValidation") << m_myCoutStream.str() << std::endl;
2024 
2025  m_myCoutStream.str("");
2026  m_myCoutStream.clear();
2027 
2028  edm::LogInfo("L1GtHwValidation") << m_myCoutStream.str() << std::endl;
2029 
2030  m_myCoutStream.str("");
2031  m_myCoutStream.clear();
2032 }
2033 
2034 // compare the GCT collections obtained from L1 GT PSB with the input
2035 // GCT collections
2037  // FIXME
2038 }
2039 
2040 // analyze each event: event loop
2042  ++m_nrEvJob;
2043  ++m_nrEvRun;
2044 
2045  // L1 GT DAQ record comparison
2046  compareDaqRecord(iEvent, evSetup);
2047 
2048  // L1 GT EVM record comparison
2049  compareEvmRecord(iEvent, evSetup);
2050 
2051  // GCT collections from L1 GT PSB versus unpacked GCT
2052  compareGt_Gct(iEvent, evSetup);
2053 }
2054 
2056  const L1GtConditionCategory& excludedCategory) {
2057  bool matchValue = false;
2058 
2059  if (excludedCategory == CondNull) {
2060  matchValue = true;
2061  } else {
2062  if (conditionCategory == excludedCategory) {
2063  matchValue = true;
2064  }
2065  }
2066 
2067  return matchValue;
2068 }
2069 
2071  bool matchValue = false;
2072 
2073  if (excludedType == TypeNull) {
2074  matchValue = true;
2075  } else {
2076  if (conditionType == excludedType) {
2077  matchValue = true;
2078  }
2079  }
2080 
2081  return matchValue;
2082 }
2083 
2084 bool L1GtHwValidation::matchCondL1GtObject(const std::vector<L1GtObject>& condObjects,
2085  const L1GtObject& excludedObject) {
2086  bool matchValue = false;
2087 
2088  if (excludedObject == ObjNull) {
2089  matchValue = true;
2090 
2091  } else {
2092  for (std::vector<L1GtObject>::const_iterator itCondObj = condObjects.begin(); itCondObj != condObjects.end();
2093  ++itCondObj) {
2094  if ((*itCondObj) == excludedObject) {
2095  matchValue = true;
2096  }
2097  }
2098  }
2099 
2100  return matchValue;
2101 }
2102 
2104  const AlgorithmMap& algorithmMap = m_l1GtMenu->gtAlgorithmMap();
2105 
2106  for (CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
2107  const std::string& algName = itAlgo->first;
2108  const int algBitNumber = (itAlgo->second).algoBitNumber();
2109  const int chipNr = (itAlgo->second).algoChipNumber();
2110 
2111  const ConditionMap& conditionMap = (m_l1GtMenu->gtConditionMap()).at(chipNr);
2112 
2113  const std::vector<L1GtLogicParser::TokenRPN>& aRpnVector = (itAlgo->second).algoRpnVector();
2114  size_t aRpnVectorSize = aRpnVector.size();
2115 
2116  bool algWithExcludedCondition = false;
2117  bool algWithConditionNotInMap = false;
2118 
2119  // loop over RpnVector and check each conditions against list of excluded conditions
2120  for (size_t opI = 0; opI < aRpnVectorSize; ++opI) {
2121  const std::string& cndName = (aRpnVector[opI]).operand;
2122 
2123  if (!cndName.empty()) {
2124  bool foundCond = false;
2125 
2126  CItCond itCond = conditionMap.find(cndName);
2127  if (itCond != conditionMap.end()) {
2128  const L1GtConditionCategory& cCateg = (itCond->second)->condCategory();
2129  const L1GtConditionType& cType = (itCond->second)->condType();
2130  const std::vector<L1GtObject>& objType = (itCond->second)->objectType();
2131 
2132  // condition index in the m_excludedCondCategory, m_excludedCondType, m_excludedL1GtObject vectors
2133  int iCond = -1;
2134 
2135  for (std::vector<L1GtConditionCategory>::const_iterator itCateg = m_excludedCondCategory.begin();
2136  itCateg != m_excludedCondCategory.end();
2137  ++itCateg) {
2138  iCond++;
2139 
2140  bool matchCondCategoryValue = matchCondCategory(cCateg, (*itCateg));
2141  bool matchCondTypeValue = matchCondType(cType, m_excludedCondType.at(iCond));
2142  bool matchCondL1GtObjectValue = matchCondL1GtObject(objType, m_excludedL1GtObject.at(iCond));
2143 
2144  LogTrace("L1GtHwValidation") << "\n "
2145  << "Algorithm: " << algName << " Condition: " << cndName << "\n "
2146  << "Category: " << l1GtConditionCategoryEnumToString(cCateg)
2147  << "; excluded: " << l1GtConditionCategoryEnumToString((*itCateg)) << "\n "
2148  << "Type: " << l1GtConditionTypeEnumToString(cType) << "; excluded: "
2149  << l1GtConditionTypeEnumToString(m_excludedCondType.at(iCond)) << "\n "
2150  << "Object excluded: "
2151  << l1GtObjectEnumToString(m_excludedL1GtObject.at(iCond)) << std::endl;
2152 
2153  if (matchCondCategoryValue && matchCondTypeValue && matchCondL1GtObjectValue) {
2154  algWithExcludedCondition = true;
2155  }
2156  }
2157 
2158  foundCond = true;
2159  }
2160 
2161  if (!foundCond) {
2162  // it should never be happen, all conditions are in the maps
2163 
2164  algWithConditionNotInMap = true;
2165 
2166  LogTrace("L1GtHwValidation") << "\n Error: condition " << cndName << " not found in condition map!"
2167  << "\n Add algorithm " << algName << " (bit number " << algBitNumber << ") "
2168  << "\n to list of algorithms excluded from comparison"
2169  << "\n data versus emulator." << std::endl;
2170  }
2171  }
2172  }
2173 
2174  if (algWithConditionNotInMap) {
2175  // it should never be happen, all conditions are in the maps
2176 
2177  m_excludedAlgoList.push_back(algBitNumber);
2178 
2179  LogTrace("L1GtHwValidation") << "\n Error: one or more conditions from algorithm " << algName << " (bit number "
2180  << algBitNumber << ") "
2181  << " not found in condition map!"
2182  << "\n Add it to list of algorithms excluded from comparison"
2183  << "\n data versus emulator." << std::endl;
2184  }
2185 
2186  if (algWithExcludedCondition) {
2187  m_excludedAlgoList.push_back(algBitNumber);
2188 
2189  LogTrace("L1GtHwValidation") << "\n Algorithm " << algName << " (bit number " << algBitNumber
2190  << ") contains an excluded condition."
2191  << "\n Add it to list of algorithms excluded from comparison"
2192  << "\n data versus emulator." << std::endl;
2193  }
2194 
2195  // add algorithm triggers from ExcludeAlgoTrigByName
2196  for (std::vector<std::string>::const_iterator itExcl = m_excludeAlgoTrigByName.begin();
2197  itExcl != m_excludeAlgoTrigByName.end();
2198  ++itExcl) {
2199  if ((*itExcl) == algName) {
2200  m_excludedAlgoList.push_back(algBitNumber);
2201 
2202  LogTrace("L1GtHwValidation") << "\n Algorithm " << algName << " (bit number " << algBitNumber
2203  << ")\n added to list of algorithms excluded from comparison"
2204  << " \n data versus emulator by ExcludeAlgoTrigByName." << std::endl;
2205  }
2206  }
2207 
2208  // add algorithm triggers from ExcludeAlgoTrigByBit
2209  for (std::vector<int>::const_iterator itExcl = m_excludeAlgoTrigByBit.begin();
2210  itExcl != m_excludeAlgoTrigByBit.end();
2211  ++itExcl) {
2212  if ((*itExcl) == algBitNumber) {
2213  m_excludedAlgoList.push_back(algBitNumber);
2214 
2215  LogTrace("L1GtHwValidation") << "\n Algorithm " << algName << " (bit number " << algBitNumber
2216  << ")\n added to list of algorithms excluded from comparison"
2217  << " \n data versus emulator by ExcludeAlgoTrigByBit." << std::endl;
2218  }
2219  }
2220  }
2221 }
2222 
2223 bool L1GtHwValidation::excludedAlgo(const int& iBit) const {
2224  for (std::vector<int>::const_iterator itAlgo = m_excludedAlgoList.begin(); itAlgo != m_excludedAlgoList.end();
2225  ++itAlgo) {
2226  if (iBit == *itAlgo) {
2227  return true;
2228  }
2229  }
2230 
2231  return false;
2232 }
#define LogDebug(id)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
Definition: DQMStore.cc:239
T getParameter(std::string const &) const
const cms_uint16_t bData(int iB) const
get/set B_DATA_CH_IB
Definition: L1GtPsbWord.cc:253
MonitorElement * m_fdlDataEmulAlgoDecision[TotalBxInEvent][NumberOfGtRecords]
MonitorElement * m_fdlDataAlgoDecisionPrescaledMask_NoMatch[TotalBxInEvent][NumberOfGtRecords]
const cms_uint16_t bxNr() const
get/set bunch cross number of the actual bx
Definition: L1GtPsbWord.h:84
const TechnicalTriggerWord & gtTechnicalTriggerWord() const
get/set technical trigger bits
Definition: L1GtFdlWord.h:112
MonitorElement * m_fdlEmulAlgoDecisionUnprescaled_NoMatch[TotalBxInEvent][NumberOfGtRecords]
const L1GtTriggerMask * m_l1GtTmTech
const cms_uint16_t boardId() const
get/set board ID
Definition: L1GtPsbWord.h:58
~L1GtHwValidation() override
MonitorElement * m_fdlDataAlgoDecision_Err[NumberOfGtRecords]
const cms_uint16_t noAlgo() const
get/set NoAlgo
Definition: L1GtFdlWord.h:209
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtDataEvmInputToken_
virtual void compareGTFE(const edm::Event &, const edm::EventSetup &, const L1GtfeWord &, const L1GtfeWord &, const int)
compare the GTFE board
bool matchCondCategory(const L1GtConditionCategory &, const L1GtConditionCategory &)
book all histograms for the module
virtual void comparePSB(const edm::Event &, const edm::EventSetup &, const L1GtPsbWord &, const L1GtPsbWord &)
compare the PSB board
virtual void print(std::ostream &myCout) const
pretty print the content of a L1GtfeWord
Definition: L1GtfeWord.cc:253
const std::vector< std::vector< int > > * m_prescaleFactorsAlgoTrig
MonitorElement * m_gtErrorFlag
PSB.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
std::map< std::string, L1GtCondition * > ConditionMap
map containing the conditions
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
std::map< std::string, L1GtAlgorithm > AlgorithmMap
map containing the algorithms
static const unsigned int NumberTechnicalTriggers
MonitorElement * m_fdlEmulTechDecision[TotalBxInEvent][NumberOfGtRecords]
ConditionMap::const_iterator CItCond
iterators through map containing the conditions
std::vector< L1GtConditionType > m_excludedCondType
excluded condition types
const L1GtfeExtWord gtfeWord() const
get / set GTFE word (record) in the GT readout record
const std::vector< L1GtFdlWord > gtFdlVector() const
get the vector of L1GtFdlWord
const L1GtfeWord gtfeWord() const
get / set GTFE word (record) in the GT readout record
MonitorElement * m_fdlDataEmulAlgoDecisionPrescaled[TotalBxInEvent][NumberOfGtRecords]
const std::string & gtTriggerMenuImplementation() const
MonitorElement * m_fdlDataEmulAlgoDecisionUnprescaledAllowed[TotalBxInEvent][NumberOfGtRecords]
void excludedAlgoList()
exclude from comparison some bits with known disagreement - bit list
MonitorElement * m_fdlDataAlgoDecisionUnprescaledMask_NoMatch[TotalBxInEvent][NumberOfGtRecords]
const std::vector< L1GtPsbWord > gtPsbVector() const
get the vector of L1GtPsbWord
std::string l1GtConditionCategoryEnumToString(const L1GtConditionCategory &)
edm::InputTag m_l1GtEmulEvmInputTag
input tag for the L1 GT emulator EVM record
MonitorElement * m_fdlEmulAlgoDecisionMask[TotalBxInEvent][NumberOfGtRecords]
L1GtConditionType
const std::vector< ConditionMap > & gtConditionMap() const
get / set / build the condition maps
MonitorElement * m_fdlDataAlgoDecisionUnprescaled[TotalBxInEvent][NumberOfGtRecords]
unsigned long long m_l1GtMenuCacheID
const L1GtPrescaleFactors * m_l1GtPfTech
std::string l1GtObjectEnumToString(const L1GtObject &)
Definition: L1GtObject.cc:69
MonitorElement * m_fdlEmulAlgoDecisionPrescaledMask_NoMatch[TotalBxInEvent][NumberOfGtRecords]
virtual void compareFDL(const edm::Event &, const edm::EventSetup &, const L1GtFdlWord &, const L1GtFdlWord &, const int)
compare the FDL board
const cms_uint16_t altNrBxBoard() const
get/set alternative for number of BX per board
Definition: L1GtfeWord.h:134
bool matchCondL1GtObject(const std::vector< L1GtObject > &, const L1GtObject &)
std::vector< int > m_excludeAlgoTrigByBit
exclude algorithm triggers from comparison data - emulator by algorithm bit number ...
virtual void compareTCS(const edm::Event &, const edm::EventSetup &, const L1TcsWord &, const L1TcsWord &)
compare the TCS board
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
unsigned long long m_l1GtTmAlgoCacheID
MonitorElement * m_fdlEmulTechDecisionMask[TotalBxInEvent][NumberOfGtRecords]
const cms_uint16_t bxNr() const
get/set BxNr - bunch cross number of the actual bx
Definition: L1GtFdlWord.h:88
MonitorElement * m_fdlDataAlgoDecisionPrescaled[TotalBxInEvent][NumberOfGtRecords]
const cms_uint16_t boardId() const
get/set board ID
Definition: L1GtFdlWord.h:63
void Fill(long long x)
MonitorElement * m_fdlDataAlgoDecisionMask_NoMatch[TotalBxInEvent][NumberOfGtRecords]
void printGtDecisionWord(std::ostream &myCout) const
Definition: L1GtFdlWord.cc:286
const cms_uint16_t recordLength() const
get/set record length for alternative 0
Definition: L1GtfeWord.h:82
const cms_uint32_t eventNr() const
get/set event number since last L1 reset generated in FDL
Definition: L1GtFdlWord.h:100
MonitorElement * m_gtfeDataEmul[NumberOfGtRecords]
histograms
L1GtConditionType l1GtConditionTypeStringToEnum(const std::string &)
MonitorElement * m_fdlDataAlgoDecisionUnprescaled_NoMatch[TotalBxInEvent][NumberOfGtRecords]
std::vector< bool > DecisionWordExtended
std::vector< unsigned int > m_triggerMaskTechTrig
int iEvent
Definition: GenABIO.cc:224
MonitorElement * m_fdlDataEmulAlgoDecisionMask[TotalBxInEvent][NumberOfGtRecords]
L1GtObject l1GtObjectStringToEnum(const std::string &)
Definition: L1GtObject.cc:24
const cms_uint16_t aData(int iA) const
get/set A_DATA_CH_IA
Definition: L1GtPsbWord.cc:181
std::vector< L1GtObject > m_excludedL1GtObject
excluded L1 GT objects
MonitorElement * m_fdlDataAlgoDecisionPrescaled_NoMatch[TotalBxInEvent][NumberOfGtRecords]
const std::vector< unsigned int > & gtTriggerMask() const
get the trigger mask
std::vector< std::string > m_excludeAlgoTrigByName
exclude algorithm triggers from comparison data - emulator by algorithm name
std::vector< bool > DecisionWord
typedefs
MonitorElement * m_excludedAlgorithmsAgreement
const L1GtTriggerMask * m_l1GtTmAlgo
trigger masks
bool m_agree
internal members
edm::InputTag m_l1GtEmulDaqInputTag
input tag for the L1 GT emulator DAQ record
MonitorElement * m_fdlDataEmulTechDecision[TotalBxInEvent][NumberOfGtRecords]
MonitorElement * m_fdlEmulAlgoDecisionUnprescaledMask_NoMatch[TotalBxInEvent][NumberOfGtRecords]
const int bxInEvent() const
get/set bunch cross in the GT event record
Definition: L1GtFdlWord.h:76
const cms_uint32_t totalTriggerNr() const
get/set total number of L1A sent since start of run
Definition: L1GtfeWord.h:149
void printGtDecisionWordExtended(std::ostream &myCout) const
Definition: L1GtFdlWord.cc:413
L1GtConditionCategory
condition categories
virtual void compareEvmRecord(const edm::Event &, const edm::EventSetup &)
L1 GT EVM record comparison.
MonitorElement * m_fdlDataTechDecision_Err[NumberOfGtRecords]
bool matchCondType(const L1GtConditionType &, const L1GtConditionType &)
MonitorElement * m_fdlDataAlgoDecision[TotalBxInEvent][NumberOfGtRecords]
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
L1GtHwValidation(const edm::ParameterSet &)
static const unsigned int NumberPhysTriggers
L1GtConditionCategory l1GtConditionCategoryStringToEnum(const std::string &)
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtDataDaqInputToken_
static const int TotalBxInEvent
MonitorElement * m_fdlEmulAlgoDecisionUnprescaled[TotalBxInEvent][NumberOfGtRecords]
const cms_uint16_t localBxNr() const
get/set local bunch cross number of the actual bx
Definition: L1GtPsbWord.h:134
bool isValid() const
Definition: HandleBase.h:70
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
const cms_uint16_t activeBoards() const
get/set boards contributing to EVM respectively DAQ record
Definition: L1GtfeWord.h:119
#define LogTrace(id)
const L1GtTriggerMenu * m_l1GtMenu
trigger menu
MonitorElement * m_fdlEmulAlgoDecision_Err[NumberOfGtRecords]
const cms_uint16_t bxNr() const
get/set bunch cross number as counted in the GTFE board
Definition: L1GtfeWord.h:93
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > m_l1GtEmulEvmInputToken_
void print(std::ostream &myCout) const
pretty print the content of a L1GtFdlWord
Definition: L1GtFdlWord.cc:595
void print(std::ostream &myCout) const
pretty print
Definition: L1GtPsbWord.cc:348
std::string l1GtConditionTypeEnumToString(const L1GtConditionType &)
const cms_uint16_t boardId() const
get/set board ID
Definition: L1GtfeWord.h:58
unsigned long long m_l1GtPfAlgoCacheID
const cms_uint32_t eventNr() const
get/set event number since last L1 reset generated in PSB
Definition: L1GtPsbWord.h:97
MonitorElement * m_fdlDataTechDecisionMask[TotalBxInEvent][NumberOfGtRecords]
edm::InputTag m_l1GtDataDaqInputTag
input tag for the L1 GT hardware DAQ record
MonitorElement * m_fdlDataAlgoDecision_NoMatch[TotalBxInEvent][NumberOfGtRecords]
MonitorElement * m_fdlDataEmul[TotalBxInEvent][NumberOfGtRecords]
FDL (0 for DAQ, 1 for EVM record)
const cms_uint16_t gtPrescaleFactorIndexAlgo() const
Definition: L1GtFdlWord.h:195
MonitorElement * m_fdlDataEmul_Err[NumberOfGtRecords]
const std::vector< std::vector< int > > & gtPrescaleFactors() const
get the prescale factors by reference
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtEmulDaqInputToken_
std::vector< L1GtConditionCategory > m_excludedCondCategory
excluded condition categories
std::ostringstream m_myCoutStream
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &) override
static const int NumberBData
Definition: L1GtPsbWord.h:32
int m_nrDataEventError
counters
MonitorElement * m_fdlEmulAlgoDecisionMask_NoMatch[TotalBxInEvent][NumberOfGtRecords]
const int bxInEvent() const
get/set bunch cross in the GT event record
Definition: L1GtPsbWord.h:71
const DecisionWord & gtDecisionWord() const
get/set/print algorithms bits (decision word)
Definition: L1GtFdlWord.h:128
unsigned long long m_l1GtTmTechCacheID
virtual void compareGt_Gct(const edm::Event &, const edm::EventSetup &)
MonitorElement * m_fdlEmulTechDecision_Err[NumberOfGtRecords]
static const int NumberAData
Definition: L1GtPsbWord.h:31
HLT enums.
edm::InputTag m_l1GctDataInputTag
input tag for the L1 GCT hardware record
T get() const
Definition: EventSetup.h:73
std::vector< edm::ParameterSet > m_excludeCondCategTypeObject
void printGtTechnicalTriggerWord(std::ostream &myCout) const
Definition: L1GtFdlWord.cc:227
MonitorElement * m_fdlDataEmulAlgoDecision_Err[NumberOfGtRecords]
const cms_uint32_t setupVersion() const
get/set setup version
Definition: L1GtfeWord.h:104
const AlgorithmMap & gtAlgorithmMap() const
get / set the algorithm map (by name)
static const int NumberOfGtRecords
MonitorElement * m_fdlDataTechDecision[TotalBxInEvent][NumberOfGtRecords]
MonitorElement * m_fdlEmulAlgoDecision[TotalBxInEvent][NumberOfGtRecords]
const std::vector< std::vector< int > > * m_prescaleFactorsTechTrig
MonitorElement * m_fdlEmulAlgoDecision_NoMatch[TotalBxInEvent][NumberOfGtRecords]
const DecisionWordExtended & gtDecisionWordExtended() const
get/set extended algorithms bits (extended decision word)
Definition: L1GtFdlWord.h:153
MonitorElement * m_fdlDataEmulTechDecisionMask[TotalBxInEvent][NumberOfGtRecords]
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
MonitorElement * m_fdlDataAlgoDecisionMask[TotalBxInEvent][NumberOfGtRecords]
virtual void compareDaqRecord(const edm::Event &, const edm::EventSetup &)
L1 GT DAQ record comparison.
const cms_uint16_t recordLength1() const
get/set record length for alternative 1
Definition: L1GtfeWord.h:71
#define str(s)
std::vector< unsigned int > m_triggerMaskAlgoTrig
T const * product() const
Definition: ESHandle.h:86
std::vector< int > m_excludedAlgoList
MonitorElement * m_fdlDataEmulTechDecision_Err[NumberOfGtRecords]
MonitorElement * m_fdlEmulAlgoDecisionPrescaled_NoMatch[TotalBxInEvent][NumberOfGtRecords]
void analyze(const edm::Event &, const edm::EventSetup &) override
const cms_uint16_t localBxNr() const
get/set local bunch cross number of the actual bx
Definition: L1GtFdlWord.h:259
const L1GtPrescaleFactors * m_l1GtPfAlgo
prescale factors
edm::InputTag m_l1GtDataEvmInputTag
input tag for the L1 GT hardware EVM record
Definition: Run.h:45
const cms_uint16_t finalOR() const
get/set "Final OR" bits
Definition: L1GtFdlWord.h:221
unsigned long long m_l1GtPfTechCacheID
MonitorElement * m_fdlEmulAlgoDecisionPrescaled[TotalBxInEvent][NumberOfGtRecords]
bool excludedAlgo(const int &) const
exclusion status for algorithm with bit i
const std::vector< L1GtFdlWord > gtFdlVector() const
get the vector of L1GtFdlWord
std::string m_dirName
directory name for L1Extra plots
MonitorElement * m_fdlDataEmulAlgoDecisionUnprescaled[TotalBxInEvent][NumberOfGtRecords]