CMS 3D CMS Logo

L1GtDataEmulAnalyzer.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
29 
33 
36 
39 
43 
44 #include "TH1.h"
45 #include "TH2.h"
46 #include "TTree.h"
47 
48 // constructor(s)
50  usesResource(TFileService::kSharedResource);
51 
52  // input tag for the L1 GT hardware DAQ/EVM record
53  m_l1GtDataInputTag = parSet.getParameter<edm::InputTag>("L1GtDataInputTag");
54 
55  // input tag for the L1 GT emulator DAQ/EVM record
56  m_l1GtEmulInputTag = parSet.getParameter<edm::InputTag>("L1GtEmulInputTag");
57 
58  // input tag for the L1 GCT hardware record
59  m_l1GctDataInputTag = parSet.getParameter<edm::InputTag>("L1GctDataInputTag");
60 
61  LogDebug("L1GtDataEmulAnalyzer") << "\nInput tag for the L1 GT hardware records: " << m_l1GtDataInputTag
62  << "\nInput tag for the L1 GT emulator records: " << m_l1GtEmulInputTag
63  << "\nInput tag for the L1 GCT hardware record: " << m_l1GctDataInputTag
64  << std::endl;
65 
66  // initialize counters
69 
70  // cache
71  m_l1GtMenuCacheID = 0ULL;
72 
73  m_l1GtTmAlgoCacheID = 0ULL;
74  m_l1GtTmTechCacheID = 0ULL;
75 
76  // book histograms
78 
82 }
83 
84 // destructor
86  // empty
87 }
88 
89 // member functions
90 
91 // method called once each job just before starting event loop
93  // empty
94 }
95 
96 //compare the GTFE board
98  const edm::EventSetup& evSetup,
99  const L1GtfeWord& gtfeBlockData,
100  const L1GtfeWord& gtfeBlockEmul) {
101  if (gtfeBlockData == gtfeBlockEmul) {
102  m_myCoutStream << "\nData and emulated GTFE blocks: identical.\n";
103  gtfeBlockData.print(m_myCoutStream);
104  } else {
105  m_myCoutStream << "\nData and emulated GTFE blocks: different.\n";
106 
107  m_myCoutStream << "\nData: GTFE block\n";
108  gtfeBlockData.print(m_myCoutStream);
109 
110  m_myCoutStream << "\nEmul: GTFE block\n";
111  gtfeBlockEmul.print(m_myCoutStream);
112  }
113 
114  LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
115 
116  m_myCoutStream.str("");
117  m_myCoutStream.clear();
118 
119  // get BoardId value
120  const uint16_t boardIdData = gtfeBlockData.boardId();
121  const uint16_t boardIdEmul = gtfeBlockEmul.boardId();
122 
123  if (boardIdData == boardIdEmul) {
124  m_myCoutStream << "\nData and emulated GTFE boardId identical.";
125  m_myCoutStream << "\n boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdData
126  << std::setfill(' ') << std::dec;
127  m_myCoutStream << "\n";
128 
129  } else {
130  m_myCoutStream << "\nData and emulated GTFE boardId different.";
131  m_myCoutStream << "\n Data: boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdData
132  << std::setfill(' ') << std::dec;
133  m_myCoutStream << "\n Emul: boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdEmul
134  << std::setfill(' ') << std::dec;
135  m_myCoutStream << "\n";
136  m_gtfeDataEmul->Fill(0);
137  }
138 
140  const uint16_t recordLengthData = gtfeBlockData.recordLength();
141  const uint16_t recordLengthEmul = gtfeBlockEmul.recordLength();
142 
143  if (recordLengthData == recordLengthEmul) {
144  m_myCoutStream << "\nData and emulated GTFE recordLength identical.";
145  m_myCoutStream << "\n recordLength() = " << recordLengthData;
146  m_myCoutStream << "\n";
147 
148  } else {
149  m_myCoutStream << "\nData and emulated GTFE recordLength different.";
150  m_myCoutStream << "\n Data: recordLength() = " << recordLengthData;
151  m_myCoutStream << "\n Emul: recordLength() = " << recordLengthEmul;
152  m_myCoutStream << "\n";
153  m_gtfeDataEmul->Fill(1);
154  }
155 
157  const uint16_t bxNrData = gtfeBlockData.bxNr();
158  const uint16_t bxNrEmul = gtfeBlockEmul.bxNr();
159 
160  if (bxNrData == bxNrEmul) {
161  m_myCoutStream << "\nData and emulated GTFE bxNr identical.";
162  m_myCoutStream << "\n bxNr() = " << bxNrData;
163  m_myCoutStream << "\n";
164 
165  } else {
166  m_myCoutStream << "\nData and emulated GTFE bxNr different.";
167  m_myCoutStream << "\n Data: bxNr() = " << bxNrData;
168  m_myCoutStream << "\n Emul: bxNr() = " << bxNrEmul;
169  m_myCoutStream << "\n";
170  m_gtfeDataEmul->Fill(2);
171  }
172 
174  const uint32_t setupVersionData = gtfeBlockData.setupVersion();
175  const uint32_t setupVersionEmul = gtfeBlockEmul.setupVersion();
176 
177  if (setupVersionData == setupVersionEmul) {
178  m_myCoutStream << "\nData and emulated GTFE setupVersion identical.";
179  m_myCoutStream << "\n setupVersion() = " << setupVersionData;
180  m_myCoutStream << "\n";
181 
182  } else {
183  m_myCoutStream << "\nData and emulated GTFE setupVersion different.";
184  m_myCoutStream << "\n Data: setupVersion() = " << setupVersionData;
185  m_myCoutStream << "\n Emul: setupVersion() = " << setupVersionEmul;
186  m_myCoutStream << "\n";
187  m_gtfeDataEmul->Fill(3);
188  }
189 
191  const uint16_t activeBoardsData = gtfeBlockData.activeBoards();
192  const uint16_t activeBoardsEmul = gtfeBlockEmul.activeBoards();
193 
194  if (activeBoardsData == activeBoardsEmul) {
195  m_myCoutStream << "\nData and emulated GTFE activeBoards identical.";
196  m_myCoutStream << "\n activeBoards() = " << std::hex << "0x" << std::setw(4) << std::setfill('0')
197  << activeBoardsData << std::setfill(' ') << std::dec;
198  m_myCoutStream << "\n";
199 
200  } else {
201  m_myCoutStream << "\nData and emulated GTFE activeBoards different.";
202  m_myCoutStream << "\n Data: activeBoards() = " << std::hex << "0x" << std::setw(4) << std::setfill('0')
203  << activeBoardsData << std::setfill(' ') << std::dec;
204  m_myCoutStream << "\n Emul: activeBoards() = " << std::hex << "0x" << std::setw(4) << std::setfill('0')
205  << activeBoardsEmul << std::setfill(' ') << std::dec;
206  m_myCoutStream << "\n";
207  m_gtfeDataEmul->Fill(4);
208  }
209 
211  const uint32_t totalTriggerNrData = gtfeBlockData.totalTriggerNr();
212  const uint32_t totalTriggerNrEmul = gtfeBlockEmul.totalTriggerNr();
213 
214  if (totalTriggerNrData == totalTriggerNrEmul) {
215  m_myCoutStream << "\nData and emulated GTFE totalTriggerNr identical.";
216  m_myCoutStream << "\n totalTriggerNr() = " << totalTriggerNrData;
217  m_myCoutStream << "\n";
218 
219  } else {
220  m_myCoutStream << "\nData and emulated GTFE totalTriggerNr different.";
221  m_myCoutStream << "\n Data: totalTriggerNr() = " << totalTriggerNrData;
222  m_myCoutStream << "\n Emul: totalTriggerNr() = " << totalTriggerNrEmul;
223  m_myCoutStream << "\n";
224  m_gtfeDataEmul->Fill(5);
225  }
226 
227  edm::LogInfo("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
228  m_myCoutStream.str("");
229  m_myCoutStream.clear();
230 }
231 
232 //compare the FDL board
234  const edm::EventSetup& evSetup,
235  const L1GtFdlWord& fdlBlockData,
236  const L1GtFdlWord& fdlBlockEmul,
237  const int iRec) {
238  // index of physics partition
239  int PhysicsPartition = 0;
240 
241  //
242  std::string recString;
243  if (iRec == 0) {
244  recString = "Daq";
245  } else {
246  recString = "Evm";
247  }
248 
249  if (fdlBlockData == fdlBlockEmul) {
250  m_myCoutStream << "\n" << recString << " Data and emulated FDL blocks: identical.\n";
251  fdlBlockData.print(m_myCoutStream);
252 
253  } else {
254  m_myCoutStream << "\n" << recString << " Data and emulated FDL blocks: different.\n";
255 
256  m_myCoutStream << "\nData: FDL block\n";
257  fdlBlockData.print(m_myCoutStream);
258 
259  m_myCoutStream << "\nEmul: FDL block\n";
260  fdlBlockEmul.print(m_myCoutStream);
261  }
262 
263  LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
264 
265  m_myCoutStream.str("");
266  m_myCoutStream.clear();
267 
268  // get bunch cross in the GT event record -
269  // move it first as histograms are BxInEvent dependent
270  const int bxInEventData = fdlBlockData.bxInEvent();
271  const int bxInEventEmul = fdlBlockEmul.bxInEvent();
272 
273  bool matchBxInEvent = false;
274 
275  if (bxInEventData == bxInEventEmul) {
276  m_myCoutStream << "\n" << recString << " Data and emulated FDL bxInEvent identical.";
277  m_myCoutStream << "\n bxInEvent() = " << bxInEventData;
278  m_myCoutStream << "\n";
279  matchBxInEvent = true;
280 
281  } else {
282  m_myCoutStream << "\n" << recString << " Data and emulated FDL bxInEvent different.";
283  m_myCoutStream << "\n Data: bxInEvent() = " << bxInEventData;
284  m_myCoutStream << "\n Emul: bxInEvent() = " << bxInEventEmul;
285  m_myCoutStream << "\n";
286 
287  m_fdlDataEmul_Err[iRec]->Fill(1);
288  }
289 
290  LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
291  m_myCoutStream.str("");
292  m_myCoutStream.clear();
293 
294  // symmetrize
295  bool validBxInEvent = false;
296  int histIndex = bxInEventData + (TotalBxInEvent + 1) / 2 - 1;
297  if ((histIndex <= TotalBxInEvent) && (histIndex >= 0)) {
298  validBxInEvent = true;
299  }
300 
301  // get / update the trigger menu from the EventSetup
302  // local cache & check on cacheIdentifier
303 
304  unsigned long long l1GtMenuCacheID = evSetup.get<L1GtTriggerMenuRcd>().cacheIdentifier();
305 
306  if (m_l1GtMenuCacheID != l1GtMenuCacheID) {
307  m_l1GtMenu = &evSetup.getData(m_l1GtMenuToken);
308 
309  m_l1GtMenuCacheID = l1GtMenuCacheID;
310  }
311  // get / update the trigger mask from the EventSetup
312  // local cache & check on cacheIdentifier
313 
314  unsigned long long l1GtTmAlgoCacheID = evSetup.get<L1GtTriggerMaskAlgoTrigRcd>().cacheIdentifier();
315 
316  if (m_l1GtTmAlgoCacheID != l1GtTmAlgoCacheID) {
318 
320 
321  m_l1GtTmAlgoCacheID = l1GtTmAlgoCacheID;
322  }
323 
324  unsigned long long l1GtTmTechCacheID = evSetup.get<L1GtTriggerMaskTechTrigRcd>().cacheIdentifier();
325 
326  if (m_l1GtTmTechCacheID != l1GtTmTechCacheID) {
328 
330 
331  m_l1GtTmTechCacheID = l1GtTmTechCacheID;
332  }
333 
334  // loop over algorithms and increase the corresponding counters
335  // FIXME put it back in cache
336  // FIXME when the menu changes, make a copy of histograms, and clear the old one
337  // otherwise the labels are wrong
338  const AlgorithmMap& algorithmMap = m_l1GtMenu->gtAlgorithmMap();
339 
340  for (CItAlgo itAlgo = algorithmMap.begin(); itAlgo != algorithmMap.end(); itAlgo++) {
341  std::string aName = itAlgo->first;
342  const char* algName = aName.c_str();
343  int algBitNumber = (itAlgo->second).algoBitNumber();
344 
345  (m_fdlDataAlgoDecision[histIndex][iRec])->GetXaxis()->SetBinLabel(algBitNumber + 1, algName);
346  m_fdlDataAlgoDecision_Err[iRec]->GetXaxis()->SetBinLabel(algBitNumber + 1, algName);
347 
348  m_fdlEmulAlgoDecision[histIndex][iRec]->GetXaxis()->SetBinLabel(algBitNumber + 1, algName);
349  m_fdlEmulAlgoDecision_Err[iRec]->GetXaxis()->SetBinLabel(algBitNumber + 1, algName);
350 
351  m_fdlDataEmulAlgoDecision[histIndex][iRec]->GetXaxis()->SetBinLabel(algBitNumber + 1, algName);
352  m_fdlDataEmulAlgoDecision_Err[iRec]->GetXaxis()->SetBinLabel(algBitNumber + 1, algName);
353  }
354 
355  // get BoardId value
356  const uint16_t boardIdData = fdlBlockData.boardId();
357  const uint16_t boardIdEmul = fdlBlockEmul.boardId();
358 
359  if (boardIdData == boardIdEmul) {
360  m_myCoutStream << "\n" << recString << " Data and emulated FDL boardId identical.";
361  m_myCoutStream << "\n boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdData
362  << std::setfill(' ') << std::dec;
363  m_myCoutStream << "\n";
364 
365  } else {
366  m_myCoutStream << "\n" << recString << " Data and emulated FDL boardId different.";
367  m_myCoutStream << "\n Data: boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdData
368  << std::setfill(' ') << std::dec;
369  m_myCoutStream << "\n Emul: boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdEmul
370  << std::setfill(' ') << std::dec;
371  m_myCoutStream << "\n";
372 
373  if (matchBxInEvent && validBxInEvent) {
374  m_fdlDataEmul[histIndex][iRec]->Fill(0);
375  } else {
376  m_fdlDataEmul_Err[iRec]->Fill(0);
377  }
378  }
379 
380  LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
381  m_myCoutStream.str("");
382  m_myCoutStream.clear();
383 
384  // get BxNr - bunch cross number of the actual bx
385  const uint16_t bxNrData = fdlBlockData.bxNr();
386  const uint16_t bxNrEmul = fdlBlockEmul.bxNr();
387 
388  if (bxNrData == bxNrEmul) {
389  m_myCoutStream << "\n" << recString << " Data and emulated FDL bxNr identical.";
390  m_myCoutStream << "\n bxNr() = " << bxNrData;
391  m_myCoutStream << "\n";
392 
393  } else {
394  m_myCoutStream << "\n" << recString << " Data and emulated FDL bxNr different.";
395  m_myCoutStream << "\n Data: bxNr() = " << bxNrData;
396  m_myCoutStream << "\n Emul: bxNr() = " << bxNrEmul;
397  m_myCoutStream << "\n";
398 
399  if (matchBxInEvent && validBxInEvent) {
400  m_fdlDataEmul[histIndex][iRec]->Fill(2);
401  } else {
402  m_fdlDataEmul_Err[iRec]->Fill(2);
403  }
404  }
405 
406  LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
407  m_myCoutStream.str("");
408  m_myCoutStream.clear();
409 
410  // get event number since last L1 reset generated in FDL
411  const uint32_t eventNrData = fdlBlockData.eventNr();
412  const uint32_t eventNrEmul = fdlBlockEmul.eventNr();
413 
414  if (eventNrData == eventNrEmul) {
415  m_myCoutStream << "\n" << recString << " Data and emulated FDL eventNr identical.";
416  m_myCoutStream << "\n eventNr() = " << eventNrData;
417  m_myCoutStream << "\n";
418 
419  } else {
420  m_myCoutStream << "\n" << recString << " Data and emulated FDL eventNr different.";
421  m_myCoutStream << "\n Data: eventNr() = " << eventNrData;
422  m_myCoutStream << "\n Emul: eventNr() = " << eventNrEmul;
423  m_myCoutStream << "\n";
424 
425  if (matchBxInEvent && validBxInEvent) {
426  m_fdlDataEmul[histIndex][iRec]->Fill(3);
427  } else {
428  m_fdlDataEmul_Err[iRec]->Fill(3);
429  }
430  }
431 
432  LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
433  m_myCoutStream.str("");
434  m_myCoutStream.clear();
435 
436  // get technical trigger bits
437  const TechnicalTriggerWord& gtTechnicalTriggerWordData = fdlBlockData.gtTechnicalTriggerWord();
438  const TechnicalTriggerWord& gtTechnicalTriggerWordEmul = fdlBlockEmul.gtTechnicalTriggerWord();
439 
440  int nTechBits = gtTechnicalTriggerWordData.size();
441 
442  TechnicalTriggerWord gtTechnicalTriggerWordDataMask(nTechBits);
443  TechnicalTriggerWord gtTechnicalTriggerWordEmulMask(nTechBits);
444 
445  unsigned int triggerMask = 0;
446  unsigned int bitValue = 0;
447 
448  if (matchBxInEvent && validBxInEvent) {
449  for (int iBit = 0; iBit < nTechBits; ++iBit) {
450  triggerMask = (m_triggerMaskTechTrig.at(iBit)) & (1 << PhysicsPartition);
451 
452  if (gtTechnicalTriggerWordData[iBit]) {
453  m_fdlDataTechDecision[histIndex][iRec]->Fill(iBit);
454 
455  bitValue = (triggerMask) ? 0 : 1;
456  gtTechnicalTriggerWordDataMask[iBit] = bitValue;
457  if (bitValue) {
458  m_fdlDataTechDecisionMask[histIndex][iRec]->Fill(iBit);
459  }
460  }
461 
462  if (gtTechnicalTriggerWordEmul.at(iBit)) {
463  m_fdlEmulTechDecision[histIndex][iRec]->Fill(iBit);
464 
465  bitValue = (triggerMask) ? 0 : 1;
466  gtTechnicalTriggerWordEmulMask[iBit] = bitValue;
467  if (bitValue) {
468  m_fdlEmulTechDecisionMask[histIndex][iRec]->Fill(iBit);
469  }
470  }
471  }
472  } else {
473  for (int iBit = 0; iBit < nTechBits; ++iBit) {
474  if (gtTechnicalTriggerWordData[iBit]) {
475  m_fdlDataTechDecision_Err[iRec]->Fill(iBit);
476  }
477 
478  if (gtTechnicalTriggerWordEmul.at(iBit)) {
479  m_fdlEmulTechDecision_Err[iRec]->Fill(iBit);
480  }
481  }
482  }
483 
484  if (gtTechnicalTriggerWordData == gtTechnicalTriggerWordEmul) {
485  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtTechnicalTriggerWord identical.\n";
487  m_myCoutStream << "\n";
488 
489  } else {
490  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtTechnicalTriggerWord different.";
491  m_myCoutStream << "\n Data: ";
493  m_myCoutStream << "\n Emul: ";
495  m_myCoutStream << "\n";
496 
497  if (matchBxInEvent && validBxInEvent) {
498  m_fdlDataEmul[histIndex][iRec]->Fill(4);
499  } else {
500  m_fdlDataEmul_Err[iRec]->Fill(4);
501  }
502 
503  if (matchBxInEvent && validBxInEvent) {
504  for (int iBit = 0; iBit < nTechBits; ++iBit) {
505  if (gtTechnicalTriggerWordData[iBit] != gtTechnicalTriggerWordEmul.at(iBit)) {
506  m_fdlDataEmulTechDecision[histIndex][iRec]->Fill(iBit);
507  }
508  }
509  } else {
510  for (int iBit = 0; iBit < nTechBits; ++iBit) {
511  if (gtTechnicalTriggerWordData[iBit] != gtTechnicalTriggerWordEmul.at(iBit)) {
512  m_fdlDataEmulTechDecision_Err[iRec]->Fill(iBit);
513  }
514  }
515  }
516  }
517 
518  LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
519  m_myCoutStream.str("");
520  m_myCoutStream.clear();
521 
522  if (gtTechnicalTriggerWordDataMask == gtTechnicalTriggerWordEmulMask) {
523  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtTechnicalTriggerWord after mask identical.\n";
524  m_myCoutStream << "\n";
525 
526  } else {
527  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtTechnicalTriggerWord after mask different.";
528  m_myCoutStream << "\n Data: ";
529  m_myCoutStream << "\n Emul: ";
530  m_myCoutStream << "\n";
531 
532  if (matchBxInEvent && validBxInEvent) {
533  m_fdlDataEmul[histIndex][iRec]->Fill(5);
534  } else {
535  m_fdlDataEmul_Err[iRec]->Fill(5);
536  }
537 
538  if (matchBxInEvent && validBxInEvent) {
539  for (int iBit = 0; iBit < nTechBits; ++iBit) {
540  if (gtTechnicalTriggerWordData[iBit] != gtTechnicalTriggerWordEmul.at(iBit)) {
541  m_fdlDataEmulTechDecisionMask[histIndex][iRec]->Fill(iBit);
542  }
543  }
544  }
545  }
546 
547  LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
548  m_myCoutStream.str("");
549  m_myCoutStream.clear();
550 
551  // get algorithms bits (decision word)
552  const DecisionWord& gtDecisionWordData = fdlBlockData.gtDecisionWord();
553  const DecisionWord& gtDecisionWordEmul = fdlBlockEmul.gtDecisionWord();
554 
555  int nAlgoBits = gtDecisionWordData.size();
556 
557  DecisionWord gtDecisionWordDataMask(nAlgoBits);
558  DecisionWord gtDecisionWordEmulMask(nAlgoBits);
559 
560  if (matchBxInEvent && validBxInEvent) {
561  for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
562  triggerMask = (m_triggerMaskAlgoTrig.at(iBit)) & (1 << PhysicsPartition);
563 
564  if (gtDecisionWordData[iBit]) {
565  m_fdlDataAlgoDecision[histIndex][iRec]->Fill(iBit);
566 
567  bitValue = (triggerMask) ? 0 : 1;
568  gtDecisionWordDataMask[iBit] = bitValue;
569  if (bitValue) {
570  m_fdlDataAlgoDecisionMask[histIndex][iRec]->Fill(iBit);
571  }
572  }
573 
574  if (gtDecisionWordEmul.at(iBit)) {
575  m_fdlEmulAlgoDecision[histIndex][iRec]->Fill(iBit);
576 
577  bitValue = (triggerMask) ? 0 : 1;
578  gtDecisionWordEmulMask[iBit] = bitValue;
579  if (bitValue) {
580  m_fdlEmulAlgoDecisionMask[histIndex][iRec]->Fill(iBit);
581  }
582  }
583  }
584  } else {
585  for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
586  if (gtDecisionWordData[iBit]) {
587  m_fdlDataAlgoDecision_Err[iRec]->Fill(iBit);
588  }
589  }
590 
591  for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
592  if (gtDecisionWordEmul.at(iBit)) {
593  m_fdlEmulAlgoDecision_Err[iRec]->Fill(iBit);
594  }
595  }
596  }
597 
598  if (gtDecisionWordData == gtDecisionWordEmul) {
599  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtDecisionWord identical.";
600  fdlBlockData.printGtDecisionWord(m_myCoutStream);
601  m_myCoutStream << "\n";
602 
603  } else {
604  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtDecisionWord different.";
605  m_myCoutStream << "\n Data: ";
606  fdlBlockData.printGtDecisionWord(m_myCoutStream);
607  m_myCoutStream << "\n Emul: ";
608  fdlBlockEmul.printGtDecisionWord(m_myCoutStream);
609  m_myCoutStream << "\n";
610 
611  if (matchBxInEvent && validBxInEvent) {
612  m_fdlDataEmul[histIndex][iRec]->Fill(6);
613  } else {
614  m_fdlDataEmul_Err[iRec]->Fill(6);
615  }
616 
617  if (matchBxInEvent && validBxInEvent) {
618  for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
619  if (gtDecisionWordData[iBit] != gtDecisionWordEmul.at(iBit)) {
620  m_fdlDataEmulAlgoDecision[histIndex][iRec]->Fill(iBit);
621  }
622  }
623  } else {
624  for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
625  if (gtDecisionWordData[iBit] != gtDecisionWordEmul.at(iBit)) {
626  m_fdlDataEmulAlgoDecision_Err[iRec]->Fill(iBit);
627  }
628  }
629  }
630  }
631 
632  if (gtDecisionWordDataMask == gtDecisionWordEmulMask) {
633  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtDecisionWord after mask identical.";
634  m_myCoutStream << "\n";
635 
636  } else {
637  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtDecisionWord after mask different.";
638  m_myCoutStream << "\n Data: ";
639  m_myCoutStream << "\n Emul: ";
640  m_myCoutStream << "\n";
641 
642  if (matchBxInEvent && validBxInEvent) {
643  m_fdlDataEmul[histIndex][iRec]->Fill(7);
644  } else {
645  m_fdlDataEmul_Err[iRec]->Fill(7);
646  }
647 
648  if (matchBxInEvent && validBxInEvent) {
649  for (int iBit = 0; iBit < nAlgoBits; ++iBit) {
650  if (gtDecisionWordDataMask[iBit] != gtDecisionWordEmulMask.at(iBit)) {
651  m_fdlDataEmulAlgoDecisionMask[histIndex][iRec]->Fill(iBit);
652  }
653  }
654  }
655  }
656 
657  // get extended algorithms bits (extended decision word)
658  const DecisionWordExtended& gtDecisionWordExtendedData = fdlBlockData.gtDecisionWordExtended();
659  const DecisionWordExtended& gtDecisionWordExtendedEmul = fdlBlockEmul.gtDecisionWordExtended();
660 
661  if (gtDecisionWordExtendedData == gtDecisionWordExtendedEmul) {
662  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtDecisionWordExtended identical.\n";
664  m_myCoutStream << "\n";
665 
666  } else {
667  m_myCoutStream << "\n" << recString << " Data and emulated FDL gtDecisionWordExtended different.\n";
668  m_myCoutStream << "\n Data: ";
670  m_myCoutStream << "\n Emul: ";
672  m_myCoutStream << "\n";
673 
674  if (matchBxInEvent && validBxInEvent) {
675  m_fdlDataEmul[histIndex][iRec]->Fill(8);
676  } else {
677  m_fdlDataEmul_Err[iRec]->Fill(8);
678  }
679  }
680 
681  // get NoAlgo
682  const uint16_t noAlgoData = fdlBlockData.noAlgo();
683  const uint16_t noAlgoEmul = fdlBlockEmul.noAlgo();
684 
685  if (noAlgoData == noAlgoEmul) {
686  m_myCoutStream << "\n" << recString << " Data and emulated FDL noAlgo identical.";
687  m_myCoutStream << "\n noAlgo() = " << noAlgoData;
688  m_myCoutStream << "\n";
689 
690  } else {
691  m_myCoutStream << "\n" << recString << " Data and emulated FDL noAlgo different.";
692  m_myCoutStream << "\n Data: noAlgo() = " << noAlgoData;
693  m_myCoutStream << "\n Emul: noAlgo() = " << noAlgoEmul;
694  m_myCoutStream << "\n";
695 
696  if (matchBxInEvent && validBxInEvent) {
697  m_fdlDataEmul[histIndex][iRec]->Fill(9);
698  } else {
699  m_fdlDataEmul_Err[iRec]->Fill(9);
700  }
701  }
702 
703  // get "Final OR" bits
704  const uint16_t finalORData = fdlBlockData.finalOR();
705  const uint16_t finalOREmul = fdlBlockEmul.finalOR();
706 
707  if (finalORData == finalOREmul) {
708  m_myCoutStream << "\n" << recString << " Data and emulated FDL finalOR identical.";
709  m_myCoutStream << "\n finalOR() = " << std::hex << "0x" << std::setw(2) << std::setfill('0') << finalORData
710  << std::setfill(' ') << std::dec;
711  m_myCoutStream << "\n";
712 
713  } else {
714  m_myCoutStream << "\n" << recString << " Data and emulated FDL finalOR different.";
715  m_myCoutStream << "\n Data: finalOR() = " << std::hex << "0x" << std::setw(2) << std::setfill('0') << finalORData
716  << std::setfill(' ') << std::dec;
717  m_myCoutStream << "\n Emul: finalOR() = " << std::hex << "0x" << std::setw(2) << std::setfill('0') << finalOREmul
718  << std::setfill(' ') << std::dec;
719  m_myCoutStream << "\n";
720 
721  if (matchBxInEvent && validBxInEvent) {
722  m_fdlDataEmul[histIndex][iRec]->Fill(10);
723  } else {
724  m_fdlDataEmul_Err[iRec]->Fill(10);
725  }
726  }
727 
728  // get "Final OR" for physics partition
729  const int finalORPhysData = finalORData & (1 << PhysicsPartition);
730  const int finalORPhysEmul = finalOREmul & (1 << PhysicsPartition);
731 
732  if (finalORPhysData == finalORPhysEmul) {
733  m_myCoutStream << "\n" << recString << " Data and emulated FDL finalOR for the physics partition identical.";
734  m_myCoutStream << "\n finalOR() = " << finalORPhysData;
735  m_myCoutStream << "\n";
736 
737  } else {
738  m_myCoutStream << "\n" << recString << " Data and emulated FDL finalOR for the physics partition different.";
739  m_myCoutStream << "\n Data: finalOR() = " << finalORPhysData;
740  m_myCoutStream << "\n Emul: finalOR() = " << finalORPhysEmul;
741  m_myCoutStream << "\n";
742 
743  if (matchBxInEvent && validBxInEvent) {
744  m_fdlDataEmul[histIndex][iRec]->Fill(11);
745  } else {
746  m_fdlDataEmul_Err[iRec]->Fill(11);
747  }
748  }
749 
750  // get local bunch cross number of the actual bx
751  const uint16_t localBxNrData = fdlBlockData.localBxNr();
752  const uint16_t localBxNrEmul = fdlBlockEmul.localBxNr();
753 
754  if (localBxNrData == localBxNrEmul) {
755  m_myCoutStream << "\n" << recString << " Data and emulated FDL localBxNr identical.";
756  m_myCoutStream << "\n localBxNr() = " << localBxNrData;
757  m_myCoutStream << "\n";
758 
759  } else {
760  m_myCoutStream << "\n" << recString << " Data and emulated FDL localBxNr different.";
761  m_myCoutStream << "\n Data: localBxNr() = " << localBxNrData;
762  m_myCoutStream << "\n Emul: localBxNr() = " << localBxNrEmul;
763  m_myCoutStream << "\n";
764 
765  if (matchBxInEvent && validBxInEvent) {
766  m_fdlDataEmul[histIndex][iRec]->Fill(12);
767  } else {
768  m_fdlDataEmul_Err[iRec]->Fill(12);
769  }
770  }
771 
772  edm::LogInfo("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
773  m_myCoutStream.str("");
774  m_myCoutStream.clear();
775 }
776 
777 //compare the PSB board
779  const edm::EventSetup& evSetup,
780  const L1GtPsbWord& psbBlockData,
781  const L1GtPsbWord& psbBlockEmul) {
782  if (psbBlockData == psbBlockEmul) {
783  m_myCoutStream << "\nData and emulated PSB blocks: identical.\n";
784  psbBlockData.print(m_myCoutStream);
785 
786  } else {
787  m_myCoutStream << "\nData and emulated PSB blocks: different.\n";
788 
789  m_myCoutStream << "\nData: PSB block\n";
790  psbBlockData.print(m_myCoutStream);
791 
792  m_myCoutStream << "\nEmul: PSB block\n";
793  psbBlockEmul.print(m_myCoutStream);
794  }
795 
796  LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
797 
798  m_myCoutStream.str("");
799  m_myCoutStream.clear();
800 
801  // get BoardId value
802  const uint16_t boardIdData = psbBlockData.boardId();
803  const uint16_t boardIdEmul = psbBlockEmul.boardId();
804 
805  if (boardIdData == boardIdEmul) {
806  m_myCoutStream << "\nData and emulated PSB boardId identical.";
807  m_myCoutStream << "\n boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdData
808  << std::setfill(' ') << std::dec;
809  m_myCoutStream << "\n";
810 
811  } else {
812  m_myCoutStream << "\nData and emulated PSB boardId different.";
813  m_myCoutStream << "\n Data: boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdData
814  << std::setfill(' ') << std::dec;
815  m_myCoutStream << "\n Emul: boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << boardIdEmul
816  << std::setfill(' ') << std::dec;
817  m_myCoutStream << "\n";
818  }
819 
820  // get bunch cross in the GT event record
821  const int bxInEventData = psbBlockData.bxInEvent();
822  const int bxInEventEmul = psbBlockEmul.bxInEvent();
823 
824  if (bxInEventData == bxInEventEmul) {
825  m_myCoutStream << "\nData and emulated PSB bxInEvent identical.";
826  m_myCoutStream << "\n bxInEvent() = " << bxInEventData;
827  m_myCoutStream << "\n";
828 
829  } else {
830  m_myCoutStream << "\nData and emulated PSB bxInEvent different.";
831  m_myCoutStream << "\n Data: bxInEvent() = " << bxInEventData;
832  m_myCoutStream << "\n Emul: bxInEvent() = " << bxInEventEmul;
833  m_myCoutStream << "\n";
834  }
835 
836  // get BxNr - bunch cross number of the actual bx
837  const uint16_t bxNrData = psbBlockData.bxNr();
838  const uint16_t bxNrEmul = psbBlockEmul.bxNr();
839 
840  if (bxNrData == bxNrEmul) {
841  m_myCoutStream << "\nData and emulated PSB bxNr identical.";
842  m_myCoutStream << "\n bxNr() = " << bxNrData;
843  m_myCoutStream << "\n";
844 
845  } else {
846  m_myCoutStream << "\nData and emulated PSB bxNr different.";
847  m_myCoutStream << "\n Data: bxNr() = " << bxNrData;
848  m_myCoutStream << "\n Emul: bxNr() = " << bxNrEmul;
849  m_myCoutStream << "\n";
850  }
851 
852  // get event number since last L1 reset generated in FDL
853  const uint32_t eventNrData = psbBlockData.eventNr();
854  const uint32_t eventNrEmul = psbBlockEmul.eventNr();
855 
856  if (eventNrData == eventNrEmul) {
857  m_myCoutStream << "\nData and emulated PSB eventNr identical.";
858  m_myCoutStream << "\n eventNr() = " << eventNrData;
859  m_myCoutStream << "\n";
860 
861  } else {
862  m_myCoutStream << "\nData and emulated PSB eventNr different.";
863  m_myCoutStream << "\n Data: eventNr() = " << eventNrData;
864  m_myCoutStream << "\n Emul: eventNr() = " << eventNrEmul;
865  m_myCoutStream << "\n";
866  }
867 
869  uint16_t valData;
870  uint16_t valEmul;
871 
872  for (int iA = 0; iA < psbBlockData.NumberAData; ++iA) {
873  valData = psbBlockData.aData(iA);
874  valEmul = psbBlockEmul.aData(iA);
875 
876  if (valData == valEmul) {
877  m_myCoutStream << "\nData and emulated PSB aData(" << iA << ") identical.";
878  m_myCoutStream << "\n aData(iA) = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << valData
879  << std::setfill(' ') << std::dec;
880  m_myCoutStream << "\n";
881 
882  } else {
883  m_myCoutStream << "\nData and emulated PSB aData(" << iA << ") different.";
884  m_myCoutStream << "\n Data: aData(iA) = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << valData
885  << std::setfill(' ') << std::dec;
886  m_myCoutStream << "\n Emul: aData(iA) = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << valEmul
887  << std::setfill(' ') << std::dec;
888  m_myCoutStream << "\n";
889  }
890  }
891 
893  for (int iB = 0; iB < psbBlockData.NumberBData; ++iB) {
894  valData = psbBlockData.bData(iB);
895  valEmul = psbBlockEmul.bData(iB);
896 
897  if (valData == valEmul) {
898  m_myCoutStream << "\nData and emulated PSB bData(" << iB << ") identical.";
899  m_myCoutStream << "\n bData(iA) = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << valData
900  << std::setfill(' ') << std::dec;
901  m_myCoutStream << "\n";
902 
903  } else {
904  m_myCoutStream << "\nData and emulated PSB bData(" << iB << ") different.";
905  m_myCoutStream << "\n Data: bData(iA) = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << valData
906  << std::setfill(' ') << std::dec;
907  m_myCoutStream << "\n Emul: bData(iA) = " << std::hex << "0x" << std::setw(4) << std::setfill('0') << valEmul
908  << std::setfill(' ') << std::dec;
909  m_myCoutStream << "\n";
910  }
911  }
912 
913  // get local bunch cross number of the actual bx
914  const uint16_t localBxNrData = psbBlockData.localBxNr();
915  const uint16_t localBxNrEmul = psbBlockEmul.localBxNr();
916 
917  if (localBxNrData == localBxNrEmul) {
918  m_myCoutStream << "\nData and emulated PSB localBxNr identical.";
919  m_myCoutStream << "\n localBxNr() = " << localBxNrData;
920  m_myCoutStream << "\n";
921 
922  } else {
923  m_myCoutStream << "\nData and emulated PSB localBxNr different.";
924  m_myCoutStream << "\n Data: localBxNr() = " << localBxNrData;
925  m_myCoutStream << "\n Emul: localBxNr() = " << localBxNrEmul;
926  m_myCoutStream << "\n";
927  }
928 
929  edm::LogInfo("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
930  m_myCoutStream.str("");
931  m_myCoutStream.clear();
932 }
933 
934 //compare the TCS board
936  const edm::EventSetup& evSetup,
937  const L1TcsWord&,
938  const L1TcsWord&) {
939  // empty
940 }
941 
942 //L1 GT DAQ record comparison
944  // formal index for DAQ record
945  int iRec = 0;
946 
947  // get the L1 GT hardware DAQ record L1GlobalTriggerReadoutRecord
948  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordData;
949  iEvent.getByLabel(m_l1GtDataInputTag, gtReadoutRecordData);
950 
951  bool validData = false;
952 
953  if (!gtReadoutRecordData.isValid()) {
955  } else {
956  validData = true;
957  }
958 
959  // get the L1 GT emulator DAQ record L1GlobalTriggerReadoutRecord
960  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordEmul;
961  iEvent.getByLabel(m_l1GtEmulInputTag, gtReadoutRecordEmul);
962 
963  bool validEmul = false;
964 
965  if (!gtReadoutRecordEmul.isValid()) {
967  } else {
968  validEmul = true;
969  }
970 
971  if ((!validData) || (!validEmul)) {
972  edm::LogWarning("L1GtDataEmulAnalyzer")
973  << "\n Valid data:" << validData << "\n Valid emulator:" << validEmul << std::endl;
974  }
975 
976  // compare GTFE
977  const L1GtfeWord& gtfeBlockData = gtReadoutRecordData->gtfeWord();
978  const L1GtfeWord& gtfeBlockEmul = gtReadoutRecordEmul->gtfeWord();
979 
980  compareGTFE(iEvent, evSetup, gtfeBlockData, gtfeBlockEmul);
981 
982  // FDL comparison
983  const std::vector<L1GtFdlWord>& gtFdlVectorData = gtReadoutRecordData->gtFdlVector();
984  const std::vector<L1GtFdlWord>& gtFdlVectorEmul = gtReadoutRecordEmul->gtFdlVector();
985 
986  int gtFdlVectorDataSize = gtFdlVectorData.size();
987  int gtFdlVectorEmulSize = gtFdlVectorEmul.size();
988 
989  if (gtFdlVectorDataSize == gtFdlVectorEmulSize) {
990  m_myCoutStream << "\nData and emulated FDL vector size: identical.\n";
991  m_myCoutStream << " Size: " << gtFdlVectorDataSize << std::endl;
992 
993  for (int iFdl = 0; iFdl < gtFdlVectorDataSize; ++iFdl) {
994  const L1GtFdlWord& fdlBlockData = gtFdlVectorData[iFdl];
995  const L1GtFdlWord& fdlBlockEmul = gtFdlVectorEmul[iFdl];
996 
997  compareFDL(iEvent, evSetup, fdlBlockData, fdlBlockEmul, iRec);
998  }
999  } else {
1000  m_myCoutStream << "\nData and emulated FDL vector size: different.\n";
1001  m_myCoutStream << " Data: size = " << gtFdlVectorDataSize << std::endl;
1002  m_myCoutStream << " Emul: size = " << gtFdlVectorEmulSize << std::endl;
1003  }
1004 
1005  LogDebug("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
1006 
1007  m_myCoutStream.str("");
1008  m_myCoutStream.clear();
1009 
1010  // PSB comparison
1011  const std::vector<L1GtPsbWord>& gtPsbVectorData = gtReadoutRecordData->gtPsbVector();
1012  const std::vector<L1GtPsbWord>& gtPsbVectorEmul = gtReadoutRecordEmul->gtPsbVector();
1013 
1014  int gtPsbVectorDataSize = gtPsbVectorData.size();
1015  int gtPsbVectorEmulSize = gtPsbVectorEmul.size();
1016 
1017  if (gtPsbVectorDataSize == gtPsbVectorEmulSize) {
1018  m_myCoutStream << "\nData and emulated PSB vector size: identical.\n";
1019  m_myCoutStream << " Size: " << gtPsbVectorDataSize << std::endl;
1020  } else {
1021  m_myCoutStream << "\nData and emulated PSB vector size: different.\n";
1022  m_myCoutStream << " Data: size = " << gtPsbVectorDataSize << std::endl;
1023  m_myCoutStream << " Emul: size = " << gtPsbVectorEmulSize << std::endl;
1024  }
1025 
1026  // the order of PSB block in the gtPsbVector is different in emulator and in data
1027  // in emulator: all active PSB in one BxInEvent, ordered L1A-1, L1A, L1A+1
1028  // in unpacker: every PSB in all BxInEvent
1029  for (int iPsb = 0; iPsb < gtPsbVectorDataSize; ++iPsb) {
1030  const L1GtPsbWord& psbBlockData = gtPsbVectorData[iPsb];
1031  const uint16_t boardIdData = psbBlockData.boardId();
1032  const int bxInEventData = psbBlockData.bxInEvent();
1033 
1034  // search the corresponding PSB in the emulated record using the
1035  // BoardId and the BxInEvent
1036 
1037  bool foundPSB = false;
1038 
1039  for (int iPsbF = 0; iPsbF < gtPsbVectorEmulSize; ++iPsbF) {
1040  const L1GtPsbWord& psbBlockEmul = gtPsbVectorEmul[iPsbF];
1041  const uint16_t boardIdEmul = psbBlockEmul.boardId();
1042  const int bxInEventEmul = psbBlockEmul.bxInEvent();
1043 
1044  if ((boardIdEmul == boardIdData) && (bxInEventData == bxInEventEmul)) {
1045  foundPSB = true;
1046 
1047  // compare the boards
1048  comparePSB(iEvent, evSetup, psbBlockData, psbBlockEmul);
1049  }
1050  }
1051 
1052  if (!foundPSB) {
1053  m_myCoutStream << "\nNo emulated PSB with boardId() = " << std::hex << "0x" << std::setw(4) << std::setfill('0')
1054  << boardIdData << std::setfill(' ') << std::dec << " and BxInEvent = " << bxInEventData
1055  << " was found";
1056  }
1057  }
1058 
1059  edm::LogInfo("L1GtDataEmulAnalyzer") << m_myCoutStream.str() << std::endl;
1060 
1061  m_myCoutStream.str("");
1062  m_myCoutStream.clear();
1063 }
1064 
1065 // L1 GT EVM record comparison
1067  // FIXME
1068 }
1069 
1070 // compare the GCT collections obtained from L1 GT PSB with the input
1071 // GCT collections
1073  // FIXME
1074 }
1075 
1076 // analyze each event: event loop
1078  // L1 GT DAQ record comparison
1079  compareDaqRecord(iEvent, evSetup);
1080 
1081  // L1 GT EVM record comparison
1082  compareEvmRecord(iEvent, evSetup);
1083 
1084  // GCT collections from L1 GT PSB versus unpacked GCT
1085  compareGt_Gct(iEvent, evSetup);
1086 }
1087 
1088 // book all histograms for the module
1090  // histogram service
1091  edm::Service<TFileService> histServ;
1092 
1093  // histograms
1094 
1095  // GTFE histograms
1096  TFileDirectory gtfeHist = histServ->mkdir("GTFE");
1097  m_gtfeDataEmul = gtfeHist.make<TH1F>("gtfeDataEmul", "GTFE data vs emul", 6, 0., 6.);
1098  m_gtfeDataEmul->GetXaxis()->SetBinLabel(1, "BoardId");
1099  m_gtfeDataEmul->GetXaxis()->SetBinLabel(2, "RecordLength");
1100  m_gtfeDataEmul->GetXaxis()->SetBinLabel(3, "BxNr");
1101  m_gtfeDataEmul->GetXaxis()->SetBinLabel(4, "SetupVersion");
1102  m_gtfeDataEmul->GetXaxis()->SetBinLabel(5, "DaqActiveBoards");
1103  m_gtfeDataEmul->GetXaxis()->SetBinLabel(6, "TotalTriggerNr");
1104 
1105  // FDL histograms
1106 
1107  TFileDirectory fdlHist = histServ->mkdir("FDL");
1108 
1109  const unsigned int numberTechTriggers = L1GlobalTriggerReadoutSetup::NumberTechnicalTriggers;
1110 
1111  const unsigned int numberAlgoTriggers = L1GlobalTriggerReadoutSetup::NumberPhysTriggers;
1112 
1113  for (int iRec = 0; iRec < 2; ++iRec) {
1114  std::string recString;
1115  if (iRec == 0) {
1116  recString = "Daq";
1117  } else {
1118  recString = "Evm";
1119  }
1120 
1121  std::string hName;
1122  const char* histName;
1123 
1124  for (int iHist = 0; iHist < TotalBxInEvent; ++iHist) {
1125  // convert [0, TotalBxInEvent] to [-X, +X] and add to histogram name
1126  int iIndex = iHist - ((TotalBxInEvent + 1) / 2 - 1);
1127  int hIndex = (iIndex + 16) % 16;
1128 
1129  std::stringstream ss;
1130  std::string str;
1131  ss << std::uppercase << std::hex << hIndex;
1132  ss >> str;
1133 
1134  hName = recString + "FdlDataEmul_" + str;
1135  histName = hName.c_str();
1136 
1137  std::string hTitle = "FDL data vs emul mismatch for BxInEvent = " + str;
1138  const char* histTitle = hTitle.c_str();
1139 
1140  //
1141 
1142  m_fdlDataEmul[iHist][iRec] = fdlHist.make<TH1F>(histName, histTitle, 13, 0., 13.);
1143  m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(1, "BoardId");
1144  m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(2, "BxInEvent");
1145  m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(3, "BxNr");
1146  m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(4, "EventNr");
1147  m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(5, "TechTrigger");
1148  m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(6, "TechTriggerMask");
1149  m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(7, "AlgoTrigger");
1150  m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(8, "AlgoTriggerMask");
1151  m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(9, "AlgoExtend");
1152  m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(10, "NoAlgo");
1153  m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(11, "FinalORAllParts");
1154  m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(12, "FinalORPhysPart");
1155  m_fdlDataEmul[iHist][iRec]->GetXaxis()->SetBinLabel(13, "LocalBxNr");
1156 
1157  // algorithm decision
1158  // data
1159  hName = recString + "FdlDataAlgoDecision_" + str;
1160  histName = hName.c_str();
1161 
1162  hTitle = "Data: algorithm decision word for BxInEvent = " + str;
1163  histTitle = hTitle.c_str();
1164 
1165  m_fdlDataAlgoDecision[iHist][iRec] =
1166  fdlHist.make<TH1F>(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
1167 
1168  // emul
1169  hName = recString + "FdlEmulAlgoDecision_" + str;
1170  histName = hName.c_str();
1171 
1172  hTitle = "Emul: algorithm decision word for BxInEvent = " + str;
1173  histTitle = hTitle.c_str();
1174 
1175  m_fdlEmulAlgoDecision[iHist][iRec] =
1176  fdlHist.make<TH1F>(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
1177 
1178  // algorithm decision after masking (partition physics)
1179  // data
1180  hName = recString + "FdlDataAlgoDecisionMask_" + str;
1181  histName = hName.c_str();
1182 
1183  hTitle = "Data, physics partition: algorithm decision word after mask for BxInEvent = " + str;
1184  histTitle = hTitle.c_str();
1185 
1186  m_fdlDataAlgoDecisionMask[iHist][iRec] =
1187  fdlHist.make<TH1F>(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
1188 
1189  // emul
1190  hName = recString + "FdlEmulAlgoDecisionMask_" + str;
1191  histName = hName.c_str();
1192 
1193  hTitle = "Emul, physics partition: algorithm decision word after mask for BxInEvent = " + str;
1194  histTitle = hTitle.c_str();
1195 
1196  m_fdlEmulAlgoDecisionMask[iHist][iRec] =
1197  fdlHist.make<TH1F>(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
1198 
1199  //
1200  hName = recString + "FdlDataEmulAlgoDecision_" + str;
1201  histName = hName.c_str();
1202 
1203  hTitle = "Data vs emul: non-matching algorithm decision word for BxInEvent = " + str;
1204  histTitle = hTitle.c_str();
1205 
1206  m_fdlDataEmulAlgoDecision[iHist][iRec] =
1207  fdlHist.make<TH1F>(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
1208 
1209  //
1210  hName = recString + "FdlDataEmulAlgoDecisionMask_" + str;
1211  histName = hName.c_str();
1212 
1213  hTitle =
1214  "Data vs emul, physics partition: non-matching algorithm decision word after mask for BxInEvent = " + str;
1215  histTitle = hTitle.c_str();
1216 
1217  m_fdlDataEmulAlgoDecisionMask[iHist][iRec] =
1218  fdlHist.make<TH1F>(histName, histTitle, numberAlgoTriggers, 0., numberAlgoTriggers);
1219 
1220  // technical trigger decision
1221  // data
1222  hName = recString + "FdlDataTechDecision_" + str;
1223  histName = hName.c_str();
1224 
1225  hTitle = "Data technical trigger decision word for BxInEvent = " + str;
1226  histTitle = hTitle.c_str();
1227 
1228  m_fdlDataTechDecision[iHist][iRec] =
1229  fdlHist.make<TH1F>(histName, histTitle, numberTechTriggers, 0., numberTechTriggers);
1230 
1231  // emul
1232  hName = recString + "FdlEmulTechDecision_" + str;
1233  histName = hName.c_str();
1234 
1235  hTitle = "Emul: technical trigger decision word for BxInEvent = " + str;
1236  histTitle = hTitle.c_str();
1237 
1238  m_fdlEmulTechDecision[iHist][iRec] =
1239  fdlHist.make<TH1F>(histName, histTitle, numberTechTriggers, 0., numberTechTriggers);
1240 
1241  // technical trigger decision after masking (partition physics)
1242  hName = recString + "FdlDataTechDecisionMask_" + str;
1243  histName = hName.c_str();
1244 
1245  hTitle = "Data technical trigger decision word after mask for BxInEvent = " + str;
1246  histTitle = hTitle.c_str();
1247 
1248  m_fdlDataTechDecisionMask[iHist][iRec] =
1249  fdlHist.make<TH1F>(histName, histTitle, numberTechTriggers, 0., numberTechTriggers);
1250 
1251  //
1252  hName = recString + "FdlEmulTechDecisionMask_" + str;
1253  histName = hName.c_str();
1254 
1255  hTitle = "Emul: technical trigger decision word after mask for BxInEvent = " + str;
1256  histTitle = hTitle.c_str();
1257 
1258  m_fdlEmulTechDecisionMask[iHist][iRec] =
1259  fdlHist.make<TH1F>(histName, histTitle, numberTechTriggers, 0., numberTechTriggers);
1260 
1261  //
1262  hName = recString + "FdlDataEmulTechDecision_" + str;
1263  histName = hName.c_str();
1264 
1265  hTitle = "Data vs emul: non-matching technical trigger decision word for BxInEvent = " + str;
1266  histTitle = hTitle.c_str();
1267 
1268  m_fdlDataEmulTechDecision[iHist][iRec] =
1269  fdlHist.make<TH1F>(histName, histTitle, numberTechTriggers, 0., numberTechTriggers);
1270 
1271  hName = recString + "FdlDataEmulTechDecisionMask_" + str;
1272  histName = hName.c_str();
1273 
1274  hTitle = "Data vs emul: non-matching technical trigger decision word after mask for BxInEvent = " + str;
1275  histTitle = hTitle.c_str();
1276 
1277  m_fdlDataEmulTechDecisionMask[iHist][iRec] =
1278  fdlHist.make<TH1F>(histName, histTitle, numberTechTriggers, 0., numberTechTriggers);
1279  }
1280 
1281  hName = recString + "FdlDataEmul_Err";
1282  histName = hName.c_str();
1283 
1284  m_fdlDataEmul_Err[iRec] = fdlHist.make<TH1F>(histName, "FDL data vs emul: non-matching BxInEvent", 13, 0., 13.);
1285  m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(1, "BoardId");
1286  m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(2, "BxInEvent");
1287  m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(3, "BxNr");
1288  m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(4, "EventNr");
1289  m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(5, "TechTrigger");
1290  m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(6, "TechTriggerMask");
1291  m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(7, "AlgoTrigger");
1292  m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(8, "AlgoTriggerMask");
1293  m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(9, "AlgoExtend");
1294  m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(10, "NoAlgo");
1295  m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(11, "FinalORAllParts");
1296  m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(12, "FinalORPhysPart");
1297  m_fdlDataEmul_Err[iRec]->GetXaxis()->SetBinLabel(13, "LocalBxNr");
1298 
1299  hName = recString + "FdlDataAlgoDecision_Err";
1300  histName = hName.c_str();
1301 
1303  fdlHist.make<TH1F>(histName,
1304  "Data: algorithm trigger decision word, non-matching BxInEvent",
1305  numberAlgoTriggers,
1306  0.,
1307  numberAlgoTriggers);
1308 
1309  //
1310  hName = recString + "FdlEmulAlgoDecision_Err";
1311  histName = hName.c_str();
1312 
1314  fdlHist.make<TH1F>(histName,
1315  "Emul: algorithm trigger decision word, non-matching BxInEvent",
1316  numberAlgoTriggers,
1317  0.,
1318  numberAlgoTriggers);
1319 
1320  hName = recString + "FdlDataEmulAlgoDecision_Err";
1321  histName = hName.c_str();
1322 
1324  fdlHist.make<TH1F>(histName,
1325  "Data vs emul: algorithm trigger decision word, non-matching BxInEvent",
1326  numberAlgoTriggers,
1327  0.,
1328  numberAlgoTriggers);
1329 
1330  //
1331  hName = recString + "FdlDataTechDecision_Err";
1332  histName = hName.c_str();
1333 
1335  fdlHist.make<TH1F>(histName,
1336  "Data: technical trigger decision word, non-matching BxInEvent",
1337  numberTechTriggers,
1338  0.,
1339  numberTechTriggers);
1340 
1341  hName = recString + "FdlEmulTechDecision_Err";
1342  histName = hName.c_str();
1343 
1345  fdlHist.make<TH1F>(histName,
1346  "Emul: technical trigger decision word, non-matching BxInEvent",
1347  numberTechTriggers,
1348  0.,
1349  numberTechTriggers);
1350 
1351  hName = recString + "FdlDataEmulTechDecision_Err";
1352  histName = hName.c_str();
1353 
1355  fdlHist.make<TH1F>(histName,
1356  "Data vs emul: technical trigger decision word, non-matching BxInEvent",
1357  numberTechTriggers,
1358  0.,
1359  numberTechTriggers);
1360  }
1361 }
1362 
1363 // method called once each job just after ending the event loop
1365  // empty
1366 }
static const std::string kSharedResource
Definition: TFileService.h:76
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskTechTrigRcd > m_l1GtTmTechToken
const cms_uint16_t boardId() const
get/set board ID
Definition: L1GtPsbWord.h:58
const std::vector< unsigned int > & gtTriggerMask() const
get the trigger mask
TH1F * m_gtfeDataEmul
histograms
virtual void print(std::ostream &myCout) const
pretty print the content of a L1GtfeWord
Definition: L1GtfeWord.cc:253
void printGtDecisionWord(std::ostream &myCout) const
Definition: L1GtFdlWord.cc:286
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
TH1F * m_fdlEmulTechDecision[TotalBxInEvent][2]
virtual void compareTCS(const edm::Event &, const edm::EventSetup &, const L1TcsWord &, const L1TcsWord &)
compare the TCS board
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const int bxInEvent() const
get/set bunch cross in the GT event record
Definition: L1GtFdlWord.h:76
TH1F * m_fdlDataEmul[TotalBxInEvent][2]
FDL (0 for DAQ, 1 for EVM record)
const cms_uint16_t aData(int iA) const
get/set A_DATA_CH_IA
Definition: L1GtPsbWord.cc:181
const DecisionWordExtended & gtDecisionWordExtended() const
get/set extended algorithms bits (extended decision word)
Definition: L1GtFdlWord.h:153
TH1F * m_fdlEmulAlgoDecision[TotalBxInEvent][2]
std::vector< unsigned int > m_triggerMaskTechTrig
std::map< std::string, L1GtAlgorithm > AlgorithmMap
map containing the algorithms
static const unsigned int NumberTechnicalTriggers
const cms_uint32_t setupVersion() const
get/set setup version
Definition: L1GtfeWord.h:104
const cms_uint32_t totalTriggerNr() const
get/set total number of L1A sent since start of run
Definition: L1GtfeWord.h:149
const cms_uint16_t noAlgo() const
get/set NoAlgo
Definition: L1GtFdlWord.h:209
virtual void compareDaqRecord(const edm::Event &, const edm::EventSetup &)
L1 GT DAQ record comparison.
const L1GtfeWord gtfeWord() const
get / set GTFE word (record) in the GT readout record
const int bxInEvent() const
get/set bunch cross in the GT event record
Definition: L1GtPsbWord.h:71
TH1F * m_fdlDataEmulAlgoDecisionMask[TotalBxInEvent][2]
const cms_uint16_t localBxNr() const
get/set local bunch cross number of the actual bx
Definition: L1GtFdlWord.h:259
unsigned long long m_l1GtTmTechCacheID
virtual void compareGTFE(const edm::Event &, const edm::EventSetup &, const L1GtfeWord &, const L1GtfeWord &)
compare the GTFE board
void analyze(const edm::Event &, const edm::EventSetup &) override
analyze each event
L1GtDataEmulAnalyzer(const edm::ParameterSet &)
TH1F * m_fdlEmulAlgoDecisionMask[TotalBxInEvent][2]
const cms_uint32_t eventNr() const
get/set event number since last L1 reset generated in FDL
Definition: L1GtFdlWord.h:100
const cms_uint16_t bData(int iB) const
get/set B_DATA_CH_IB
Definition: L1GtPsbWord.cc:253
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
const cms_uint16_t bxNr() const
get/set bunch cross number of the actual bx
Definition: L1GtPsbWord.h:84
const cms_uint16_t recordLength() const
get/set record length for alternative 0
Definition: L1GtfeWord.h:82
const cms_uint16_t boardId() const
get/set board ID
Definition: L1GtFdlWord.h:63
T * make(const Args &...args) const
make new ROOT object
std::vector< bool > DecisionWordExtended
int iEvent
Definition: GenABIO.cc:224
void print(std::ostream &myCout) const
pretty print
Definition: L1GtPsbWord.cc:348
const std::vector< L1GtFdlWord > gtFdlVector() const
get the vector of L1GtFdlWord
std::vector< bool > DecisionWord
typedefs
TH1F * m_fdlDataEmulTechDecisionMask[TotalBxInEvent][2]
edm::InputTag m_l1GtEmulInputTag
input tag for the L1 GT emulator DAQ/EVM record
T get() const
Definition: EventSetup.h:79
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
static const unsigned int NumberPhysTriggers
void printGtDecisionWordExtended(std::ostream &myCout) const
Definition: L1GtFdlWord.cc:411
void bookHistograms()
book all histograms for the module
std::ostringstream m_myCoutStream
TH1F * m_fdlDataAlgoDecisionMask[TotalBxInEvent][2]
const DecisionWord & gtDecisionWord() const
get/set/print algorithms bits (decision word)
Definition: L1GtFdlWord.h:128
TH1F * m_fdlEmulTechDecisionMask[TotalBxInEvent][2]
const L1GtTriggerMenu * m_l1GtMenu
trigger menu
std::vector< unsigned int > m_triggerMaskAlgoTrig
TH1F * m_fdlDataEmulTechDecision[TotalBxInEvent][2]
const L1GtTriggerMask * m_l1GtTmAlgo
trigger masks
static constexpr int TotalBxInEvent
Log< level::Info, false > LogInfo
edm::ESGetToken< L1GtTriggerMask, L1GtTriggerMaskAlgoTrigRcd > m_l1GtTmAlgoToken
TH1F * m_fdlDataAlgoDecision[TotalBxInEvent][2]
void endJob() override
end of job
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
const cms_uint32_t eventNr() const
get/set event number since last L1 reset generated in PSB
Definition: L1GtPsbWord.h:97
const cms_uint16_t bxNr() const
get/set bunch cross number as counted in the GTFE board
Definition: L1GtfeWord.h:93
static const int NumberBData
Definition: L1GtPsbWord.h:32
const TechnicalTriggerWord & gtTechnicalTriggerWord() const
get/set technical trigger bits
Definition: L1GtFdlWord.h:112
TH1F * m_fdlDataEmulAlgoDecision[TotalBxInEvent][2]
const cms_uint16_t bxNr() const
get/set BxNr - bunch cross number of the actual bx
Definition: L1GtFdlWord.h:88
virtual void compareGt_Gct(const edm::Event &, const edm::EventSetup &)
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag m_l1GtDataInputTag
input tag for the L1 GT hardware DAQ/EVM record
const cms_uint16_t localBxNr() const
get/set local bunch cross number of the actual bx
Definition: L1GtPsbWord.h:134
static const int NumberAData
Definition: L1GtPsbWord.h:31
const cms_uint16_t boardId() const
get/set board ID
Definition: L1GtfeWord.h:58
unsigned long long m_l1GtMenuCacheID
TH1F * m_fdlDataTechDecisionMask[TotalBxInEvent][2]
virtual void compareFDL(const edm::Event &, const edm::EventSetup &, const L1GtFdlWord &, const L1GtFdlWord &, const int)
compare the FDL board
virtual void compareEvmRecord(const edm::Event &, const edm::EventSetup &)
L1 GT EVM record comparison.
void printGtTechnicalTriggerWord(std::ostream &myCout) const
Definition: L1GtFdlWord.cc:227
const cms_uint16_t finalOR() const
get/set "Final OR" bits
Definition: L1GtFdlWord.h:221
void print(std::ostream &myCout) const
pretty print the content of a L1GtFdlWord
Definition: L1GtFdlWord.cc:593
const cms_uint16_t activeBoards() const
get/set boards contributing to EVM respectively DAQ record
Definition: L1GtfeWord.h:119
Log< level::Warning, false > LogWarning
const AlgorithmMap & gtAlgorithmMap() const
get / set the algorithm map (by name)
const L1GtTriggerMask * m_l1GtTmTech
#define str(s)
TH1F * m_fdlDataTechDecision[TotalBxInEvent][2]
unsigned long long m_l1GtTmAlgoCacheID
const std::vector< L1GtPsbWord > gtPsbVector() const
get the vector of L1GtPsbWord
edm::InputTag m_l1GctDataInputTag
input tag for the L1 GCT hardware record
virtual void comparePSB(const edm::Event &, const edm::EventSetup &, const L1GtPsbWord &, const L1GtPsbWord &)
compare the PSB board
#define LogDebug(id)
edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > m_l1GtMenuToken
PSB.