CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1TGT.cc
Go to the documentation of this file.
1 
14 
17 
19  gtSource_L1GT_(consumes<L1GlobalTriggerReadoutRecord>(ps.getParameter<edm::InputTag> ("gtSource"))),
20  gtSource_L1MuGMT_(consumes<L1MuGMTReadoutCollection>(ps.getParameter<edm::InputTag> ("gtSource"))),
21  gtEvmSource_(consumes<L1GlobalTriggerEvmReadoutRecord>(ps.getParameter<edm::InputTag> ("gtEvmSource"))),
22  m_runInEventLoop(ps.getUntrackedParameter<bool>("runInEventLoop", false)),
23  m_runInEndLumi(ps.getUntrackedParameter<bool>("runInEndLumi", false)),
24  m_runInEndRun(ps.getUntrackedParameter<bool>("runInEndRun", false)),
25  m_runInEndJob(ps.getUntrackedParameter<bool>("runInEndJob", false)),
26  verbose_(ps.getUntrackedParameter<bool> ("verbose", false)),
27  m_dbe(0),
28  //
29  m_nrEvJob(0), m_nrEvRun(0),
30  preGps_(0ULL), preOrb_(0ULL)
31 {
32 
34  "L1T/L1TGT");
35 
37  if (m_dbe == 0) {
38  edm::LogInfo("L1TGT") << "\n Unable to get DQMStore service.";
39  } else {
40 
41  m_dbe->setVerbose(0);
42  m_dbe->setCurrentFolder(m_histFolder);
43 
44  }
45 
46  // reserve space for 1000 LS
47  m_pairLsNumberPfIndex.reserve(1000);
48 }
49 
51 
52  // empty
53 }
54 
56 
57  m_nrEvJob = 0;
58 
59  preGps_ = 0ULL;
60  preOrb_ = 0ULL;
61 
62 }
63 
64 void L1TGT::beginRun(const edm::Run& iRun, const edm::EventSetup& evSetup) {
65 
66  m_nrEvRun = 0;
67 
69 
70  if (m_dbe == 0) {
71  edm::LogInfo("L1TGT") << "\n Unable to get DQMStore service.";
72  } else {
73 
74  // clean up directory
78  }
79 
81 
82  }
83 
84  // book histograms
86 
87  // clear bookkeeping for prescale factor change
88  m_pairLsNumberPfIndex.clear();
89 
90 }
91 
93  const edm::EventSetup& evSetup) {
94 
95  //
96 
97 }
98 
99 
100 //
101 void L1TGT::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
102 
103  m_nrEvJob++;
104 
105  if (verbose_) {
106  edm::LogInfo("L1TGT") << "L1TGT: analyze...." << std::endl;
107  }
108 
109  // initialize Bx, orbit number, luminosity segment number to invalid value
110  int tcsBx = -1;
111  int gtfeEvmBx = -1;
112 
113  long long int orbitTcs = -1;
114  int orbitEvmFdl = -1;
115 
116  int lsTcs = -1;
117  int lsEvmFdl = -1;
118 
119  // get once only the LS block number, to be used in many histograms
120  const int lsNumber = iEvent.luminosityBlock();
121 
122  // open EVM readout record if available
124  iEvent.getByToken(gtEvmSource_, gtEvmReadoutRecord);
125 
126  if (!gtEvmReadoutRecord.isValid()) {
127  edm::LogInfo("L1TGT")
128  << "can't find L1GlobalTriggerEvmReadoutRecord";
129  } else {
130 
131  // get all info from the EVM record if available and fill the histograms
132 
133  const L1GtfeWord& gtfeEvmWord = gtEvmReadoutRecord->gtfeWord();
134  const L1GtfeExtWord& gtfeEvmExtWord = gtEvmReadoutRecord->gtfeWord();
135 
136  gtfeEvmBx = gtfeEvmWord.bxNr();
137  int gtfeEvmActiveBoards = gtfeEvmWord.activeBoards();
138 
139  if (isActive(gtfeEvmActiveBoards, TCS)) { // if TCS present in the record
140 
141  const L1TcsWord& tcsWord = gtEvmReadoutRecord->tcsWord();
142 
143  tcsBx = tcsWord.bxNr();
144  orbitTcs = tcsWord.orbitNr();
145  lsTcs = tcsWord.luminositySegmentNr();
146 
147  event_type->Fill(tcsWord.triggerType());
148  orbit_lumi->Fill(lsNumber, orbitTcs);
149 
150  trigger_number->Fill(tcsWord.partTrigNr());
151  event_number->Fill(tcsWord.eventNr());
152 
153  trigger_lumi->Fill(lsNumber, tcsWord.partTrigNr());
154  event_lumi->Fill(lsNumber, tcsWord.eventNr());
155  evnum_trignum_lumi->Fill(lsNumber,
156  static_cast<double>(tcsWord.eventNr()) / static_cast<double>(tcsWord.partTrigNr()));
157 
158  boost::uint16_t master = gtfeEvmExtWord.bstMasterStatus();
159  boost::uint32_t turnCount = gtfeEvmExtWord.turnCountNumber();
160  boost::uint32_t lhcFill = gtfeEvmExtWord.lhcFillNumber();
161  boost::uint16_t beam = gtfeEvmExtWord.beamMode();
162  boost::uint16_t momentum = gtfeEvmExtWord.beamMomentum();
163  boost::uint32_t intensity1 = gtfeEvmExtWord.totalIntensityBeam1();
164  boost::uint32_t intensity2 = gtfeEvmExtWord.totalIntensityBeam2();
165 
166  BST_MasterStatus->Fill(lsNumber, static_cast<double>(master));
167  BST_turnCountNumber->Fill(lsNumber, static_cast<double>(turnCount));
168  BST_lhcFillNumber->Fill(static_cast<double>(lhcFill % 1000));
169  BST_beamMode->Fill(lsNumber, static_cast<double>(beam));
170 
171  BST_beamMomentum->Fill(lsNumber, static_cast<double>(momentum));
172  BST_intensityBeam1->Fill(lsNumber, static_cast<double>(intensity1));
173  BST_intensityBeam2->Fill(lsNumber, static_cast<double>(intensity2));
174 
175  if (verbose_) {
176  edm::LogInfo("L1TGT") << " check mode = " << beam << " momentum " << momentum
177  << " int2 " << intensity2 << std::endl;
178  }
179 
180  boost::uint64_t gpsr = gtfeEvmExtWord.gpsTime();
181  boost::uint64_t gpshi = (gpsr >> 32) & 0xffffffff;
182  boost::uint64_t gpslo = gpsr & 0xffffffff;
183  boost::uint64_t gps = gpshi * 1000000 + gpslo;
184  // edm::LogInfo("L1TGT") << " gpsr = " << std::hex << gpsr << " hi=" << gpshi << " lo=" << gpslo << " gps=" << gps << std::endl;
185 
186  Long64_t delorb = orbitTcs - preOrb_;
187  Long64_t delgps = gps - preGps_;
188  Double_t freq = -1.;
189 
190  if (delgps > 0) {
191  freq = ((Double_t)(delorb)) * 3564. / ((Double_t)(delgps));
192  }
193 
194  if (delorb > 0) {
195  gpsfreq->Fill(freq);
196  gpsfreqwide->Fill(freq);
197  gpsfreqlum->Fill(lsNumber, freq);
198  if (verbose_) {
199  if (freq > 200.) {
200  edm::LogInfo("L1TGT") << " preOrb_ = " << preOrb_ << " orbitTcs=" << orbitTcs
201  << " delorb=" << delorb << std::hex << " preGps_="
202  << preGps_ << " gps=" << gps << std::dec
203  << " delgps=" << delgps << " freq=" << freq
204  << std::endl;
205 
206  }
207  }
208  }
209 
210  preGps_ = gps;
211  preOrb_ = orbitTcs;
212 
213  }
214 
215  // get info from FDL if active
216  if (isActive(gtfeEvmActiveBoards, FDL)) {
217  const L1GtFdlWord& fdlWord = gtEvmReadoutRecord->gtFdlWord();
218 
219  orbitEvmFdl = fdlWord.orbitNr();
220  lsEvmFdl = fdlWord.lumiSegmentNr();
221  }
222 
223  if ((orbitTcs >= 0) && (orbitEvmFdl >= 0)) {
224 
225  int diffOrbit = static_cast<float> (orbitTcs - orbitEvmFdl);
226  edm::LogInfo("L1TGT") << "\n orbitTcs = " << orbitTcs << " orbitEvmFdl = "
227  << orbitEvmFdl << " diffOrbit = " << diffOrbit
228  << " orbitEvent = " << iEvent.orbitNumber() << std::endl;
229 
230  if (diffOrbit >= MaxOrbitNrDiffTcsFdlEvm) {
232 
233  } else if (diffOrbit <= -MaxOrbitNrDiffTcsFdlEvm) {
235 
236  } else {
237  m_monOrbitNrDiffTcsFdlEvm->Fill(diffOrbit);
239  diffOrbit);
240 
241  }
242 
243  } else {
244 
245  if (orbitTcs >= 0) {
246  // EVM_FDL error
248  } else if (orbitEvmFdl >= 0) {
249  // TCS error
251 
252  } else {
253  // TCS and EVM_FDL error
256  }
257  }
258 
259  if ((lsTcs >= 0) && (lsEvmFdl >= 0)) {
260 
261  int diffLs = static_cast<float> (lsTcs - lsEvmFdl);
262  edm::LogInfo("L1TGT") << "\n lsTcs = " << lsTcs << " lsEvmFdl = " << lsEvmFdl
263  << " diffLs = " << diffLs << " lsEvent = "
264  << lsNumber << std::endl;
265 
266  if (diffLs >= MaxLsNrDiffTcsFdlEvm) {
268 
269  } else if (diffLs <= -MaxLsNrDiffTcsFdlEvm) {
271 
272  } else {
273  m_monLsNrDiffTcsFdlEvm->Fill(diffLs);
274  m_monLsNrDiffTcsFdlEvmLs->Fill(lsNumber, diffLs);
275 
276  }
277 
278  } else {
279 
280  if (lsTcs >= 0) {
281  // EVM_FDL error
283  } else if (lsEvmFdl >= 0) {
284  // TCS error
286 
287  } else {
288  // TCS and EVM_FDL error
291  }
292  }
293 
294  }
295 
296  // open GT DAQ readout record - exit if failed
298  iEvent.getByToken(gtSource_L1GT_, gtReadoutRecord);
299 
300  if (!gtReadoutRecord.isValid()) {
301  edm::LogInfo("L1TGT")
302  << "can't find L1GlobalTriggerReadoutRecord";
303  return;
304  }
305 
306  // initialize bx's to invalid value
307  int gtfeBx = -1;
308  int fdlBx[2] = { -1, -1 };
309  int psbBx[2][7] = { { -1, -1, -1, -1, -1, -1, -1 }, { -1, -1, -1, -1, -1,
310  -1, -1 } };
311  int gmtBx = -1;
312 
313  // get info from GTFE DAQ record
314  const L1GtfeWord& gtfeWord = gtReadoutRecord->gtfeWord();
315  gtfeBx = gtfeWord.bxNr();
316  gtfe_bx->Fill(gtfeBx);
317  setupversion_lumi->Fill(lsNumber, gtfeWord.setupVersion());
318  int gtfeActiveBoards = gtfeWord.activeBoards();
319 
320  // look for GMT readout collection from the same source if GMT active
321  if (isActive(gtfeActiveBoards, GMT)) {
322  edm::Handle<L1MuGMTReadoutCollection> gmtReadoutCollection;
323  iEvent.getByToken(gtSource_L1MuGMT_, gmtReadoutCollection);
324 
325  if (gmtReadoutCollection.isValid()) {
326  gmtBx = gmtReadoutCollection->getRecord().getBxNr();
327  }
328  }
329 
330  // get info from FDL if active (including decision word)
331  if (isActive(gtfeActiveBoards, FDL)) {
332  const L1GtFdlWord& fdlWord = gtReadoutRecord->gtFdlWord();
333  fdlBx[0] = fdlWord.bxNr();
334  fdlBx[1] = fdlWord.localBxNr();
335 
337  const DecisionWord& gtDecisionWord = gtReadoutRecord->decisionWord();
338  const TechnicalTriggerWord& gtTTWord =
339  gtReadoutRecord->technicalTriggerWord();
340 
341  int dbitNumber = 0;
342  DecisionWord::const_iterator GTdbitItr;
343  algo_bits->Fill(-1.); // fill underflow to normalize
344  for (GTdbitItr = gtDecisionWord.begin(); GTdbitItr
345  != gtDecisionWord.end(); GTdbitItr++) {
346  if (*GTdbitItr) {
347  algo_bits->Fill(dbitNumber);
348  algo_bits_lumi->Fill(lsNumber, dbitNumber);
349  int dbitNumber1 = 0;
350  DecisionWord::const_iterator GTdbitItr1;
351  for (GTdbitItr1 = gtDecisionWord.begin(); GTdbitItr1
352  != gtDecisionWord.end(); GTdbitItr1++) {
353  if (*GTdbitItr1)
354  algo_bits_corr->Fill(dbitNumber, dbitNumber1);
355  dbitNumber1++;
356  }
357  int tbitNumber1 = 0;
358  TechnicalTriggerWord::const_iterator GTtbitItr1;
359  for (GTtbitItr1 = gtTTWord.begin(); GTtbitItr1
360  != gtTTWord.end(); GTtbitItr1++) {
361  if (*GTtbitItr1)
362  algo_tt_bits_corr->Fill(dbitNumber, tbitNumber1);
363  tbitNumber1++;
364  }
365  }
366  dbitNumber++;
367  }
368 
369  int tbitNumber = 0;
370  TechnicalTriggerWord::const_iterator GTtbitItr;
371  tt_bits->Fill(-1.); // fill underflow to normalize
372  for (GTtbitItr = gtTTWord.begin(); GTtbitItr != gtTTWord.end(); GTtbitItr++) {
373  if (*GTtbitItr) {
374  tt_bits->Fill(tbitNumber);
375  tt_bits_lumi->Fill(lsNumber, tbitNumber);
376  int tbitNumber1 = 0;
377  TechnicalTriggerWord::const_iterator GTtbitItr1;
378  for (GTtbitItr1 = gtTTWord.begin(); GTtbitItr1
379  != gtTTWord.end(); GTtbitItr1++) {
380  if (*GTtbitItr1)
381  tt_bits_corr->Fill(tbitNumber, tbitNumber1);
382  tbitNumber1++;
383  }
384  }
385  tbitNumber++;
386  }
387 
388 
389  // fill the index of actual prescale factor set
390  // the index for technical triggers and algorithm trigger is the same (constraint in L1 GT TS)
391  // so we read only pfIndexAlgoTrig (boost::uint16_t)
392 
393  const int pfIndexAlgoTrig = fdlWord.gtPrescaleFactorIndexAlgo();
394  m_monL1PrescaleFactorSet->Fill(lsNumber,
395  static_cast<float> (pfIndexAlgoTrig));
396 
397  //
398 
399  // check that the combination (lsNumber, pfIndex) is not already included
400  // to avoid fake entries due to different event order
401 
402  std::pair<int, int> pairLsPfi = std::make_pair(lsNumber,
403  pfIndexAlgoTrig);
404 
405  CItVecPair cIt = find(m_pairLsNumberPfIndex.begin(),
406  m_pairLsNumberPfIndex.end(), pairLsPfi);
407 
408  if (cIt == m_pairLsNumberPfIndex.end()) {
409 
410  m_pairLsNumberPfIndex.push_back(pairLsPfi);
411 
412  }
413 
414  }
415 
416  // get info from active PSB's
417  int ibit = PSB9; // first psb
418  // for now hardcode psb id's - TODO - get them from Vasile's board maps...
419  int psbID[7] = { 0xbb09, 0xbb0d, 0xbb0e, 0xbb0f, 0xbb13, 0xbb14, 0xbb15 };
420  for (int i = 0; i < 7; i++) {
421  if (isActive(gtfeActiveBoards, ibit)) {
422  L1GtPsbWord psbWord = gtReadoutRecord->gtPsbWord(psbID[i]);
423  psbBx[0][i] = psbWord.bxNr();
424  psbBx[1][i] = psbWord.localBxNr();
425  }
426  ibit++;
427  }
428 
429  //fill the dbx histo
430  if (gtfeEvmBx > -1)
431  dbx_module->Fill(0., gtfeEvmBx - gtfeBx);
432  if (tcsBx > -1)
433  dbx_module->Fill(1., tcsBx - gtfeBx);
434  for (int i = 0; i < 2; i++) {
435  if (fdlBx[i] > -1)
436  dbx_module->Fill(2. + i, fdlBx[i] - gtfeBx);
437  }
438  for (int j = 0; j < 7; j++) {
439  for (int i = 0; i < 2; i++) {
440  if (psbBx[i][j] > -1)
441  dbx_module->Fill(4. + i + 2 * j, psbBx[i][j] - gtfeBx);
442  }
443  }
444  if (gmtBx > -1)
445  dbx_module->Fill(18., gmtBx - gtfeBx);
446 
447 }
448 
449 
450 // end section
452  const edm::EventSetup& evSetup) {
453 
454  if (m_runInEndLumi) {
456  }
457 }
458 
459 void L1TGT::endRun(const edm::Run& iRrun, const edm::EventSetup& evSetup) {
460 
461  if (m_runInEndRun) {
463  }
464 
465 }
466 
467 
469 
470  if (m_runInEndJob) {
472  }
473 
474  if (verbose_) {
475  edm::LogInfo("L1TGT") << "\n Analyzed " << m_nrEvJob << " events";
476  }
477 
478  return;
479 }
480 
481 
482 // book all histograms for the module
484 
485  const int TotalNrBinsLs = 1000;
486  const double totalNrBinsLs = static_cast<double>(TotalNrBinsLs);
487 
488  if (m_dbe) {
490 
491  algo_bits = m_dbe->book1D("algo_bits", "GT algorithm trigger bits", 128, -0.5, 127.5);
492  algo_bits->setAxisTitle("Algorithm trigger bits", 1);
493 
494  algo_bits_corr = m_dbe->book2D("algo_bits_corr",
495  "GT algorithm trigger bit correlation",
496  128, -0.5, 127.5, 128, -0.5, 127.5);
497  algo_bits_corr->setAxisTitle("Algorithm trigger bits", 1);
498  algo_bits_corr->setAxisTitle("Algorithm trigger bits", 2);
499 
500  tt_bits = m_dbe->book1D("tt_bits",
501  "GT technical trigger bits",
502  64, -0.5, 63.5);
503  tt_bits->setAxisTitle("Technical trigger bits", 1);
504 
505  tt_bits_corr = m_dbe->book2D("tt_bits_corr",
506  "GT technical trigger bit correlation",
507  64, -0.5, 63.5, 64, -0.5, 63.5);
508  tt_bits_corr->setAxisTitle("Technical trigger bits", 1);
509  tt_bits_corr->setAxisTitle("Technical trigger bits", 2);
510 
511  algo_tt_bits_corr = m_dbe->book2D("algo_tt_bits_corr",
512  "GT algorithm - technical trigger bit correlation",
513  128, -0.5, 127.5, 64, -0.5, 63.5);
514  algo_tt_bits_corr->setAxisTitle("Algorithm trigger bits", 1);
515  algo_tt_bits_corr->setAxisTitle("Technical trigger bits", 2);
516 
517  algo_bits_lumi = m_dbe->book2D("algo_bits_lumi",
518  "GT algorithm trigger bit rate per LS",
519  TotalNrBinsLs, 0., totalNrBinsLs, 128, -0.5, 127.5);
520  algo_bits_lumi->setAxisTitle("Luminosity segment", 1);
521  algo_bits_lumi->setAxisTitle("Algorithm trigger bits", 2);
522 
523  tt_bits_lumi = m_dbe->book2D("tt_bits_lumi",
524  "GT technical trigger bit rate per LS",
525  TotalNrBinsLs, 0., totalNrBinsLs, 64, -0.5, 63.5);
526  tt_bits_lumi->setAxisTitle("Luminosity segment", 1);
527  tt_bits_lumi->setAxisTitle("Technical trigger bits", 2);
528 
529  event_type = m_dbe->book1D("event_type", "GT event type", 10, -0.5, 9.5);
530  event_type->setAxisTitle("Event type", 1);
531  event_type->setBinLabel(2, "Physics", 1);
532  event_type->setBinLabel(3, "Calibration", 1);
533  event_type->setBinLabel(4, "Random", 1);
534  event_type->setBinLabel(6, "Traced", 1);
535  event_type->setBinLabel(7, "Test", 1);
536  event_type->setBinLabel(8, "Error", 1);
537 
538  event_number = m_dbe->book1D("event_number",
539  "GT event number (from last resync)",
540  100, 0., 50000.);
541  event_number->setAxisTitle("Event number", 1);
542 
543  event_lumi = m_dbe->bookProfile("event_lumi",
544  "GT event number (from last resync) vs LS",
545  TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 1.e15, "s");
546  event_lumi->setAxisTitle("Luminosity segment", 1);
547  event_lumi->setAxisTitle("Event number", 2);
548 
549  trigger_number = m_dbe->book1D("trigger_number",
550  "GT trigger number (from start run)",
551  100, 0., 50000.);
552  trigger_number->setAxisTitle("Trigger number", 1);
553 
554  trigger_lumi = m_dbe->bookProfile("trigger_lumi",
555  "GT trigger number (from start run) vs LS",
556  TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 1.e15, "s");
557  trigger_lumi->setAxisTitle("Luminosity segment", 1);
558  trigger_lumi->setAxisTitle("Trigger number", 2);
559 
560  evnum_trignum_lumi = m_dbe->bookProfile("evnum_trignum_lumi",
561  "GT event/trigger number ratio vs LS",
562  TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 2., "s");
563  evnum_trignum_lumi->setAxisTitle("Luminosity segment", 1);
564  evnum_trignum_lumi->setAxisTitle("Event/trigger number ratio", 2);
565 
566  orbit_lumi = m_dbe->bookProfile("orbit_lumi",
567  "GT orbit number vs LS",
568  TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 1.e15, "s");
569  orbit_lumi->setAxisTitle("Luminosity segment", 1);
570  orbit_lumi->setAxisTitle("Orbit number", 2);
571 
572  setupversion_lumi = m_dbe->bookProfile("setupversion_lumi",
573  "GT setup version vs LS",
574  TotalNrBinsLs, 0., totalNrBinsLs, 100, -0.1, 1.e10, "i");
575  setupversion_lumi->setAxisTitle("Luminosity segment", 1);
576  setupversion_lumi->setAxisTitle("Setup version", 2);
577 
578  gtfe_bx = m_dbe->book1D("gtfe_bx", "GTFE Bx number", 3600, 0., 3600.);
579  gtfe_bx->setAxisTitle("GTFE BX number", 1);
580 
581  dbx_module = m_dbe->bookProfile("dbx_module",
582  "delta Bx of GT modules wrt GTFE",
583  20, 0., 20., 100, -4000., 4000., "i");
584  dbx_module->setAxisTitle("GT crate module", 1);
585  dbx_module->setAxisTitle("Module Bx - GTFE Bx", 2);
586  dbx_module->setBinLabel(1, "GTFEevm", 1);
587  dbx_module->setBinLabel(2, "TCS", 1);
588  dbx_module->setBinLabel(3, "FDL", 1);
589  dbx_module->setBinLabel(4, "FDLloc", 1);
590  dbx_module->setBinLabel(5, "PSB9", 1);
591  dbx_module->setBinLabel(6, "PSB9loc", 1);
592  dbx_module->setBinLabel(7, "PSB13", 1);
593  dbx_module->setBinLabel(8, "PSB13loc", 1);
594  dbx_module->setBinLabel(9, "PSB14", 1);
595  dbx_module->setBinLabel(10, "PSB14loc", 1);
596  dbx_module->setBinLabel(11, "PSB15", 1);
597  dbx_module->setBinLabel(12, "PSB15loc", 1);
598  dbx_module->setBinLabel(13, "PSB19", 1);
599  dbx_module->setBinLabel(14, "PSB19loc", 1);
600  dbx_module->setBinLabel(15, "PSB20", 1);
601  dbx_module->setBinLabel(16, "PSB20loc", 1);
602  dbx_module->setBinLabel(17, "PSB21", 1);
603  dbx_module->setBinLabel(18, "PSB21loc", 1);
604  dbx_module->setBinLabel(19, "GMT", 1);
605 
606  BST_MasterStatus = m_dbe->book2D("BST_MasterStatus",
607  "BST master status over LS",
608  TotalNrBinsLs, 0., totalNrBinsLs, 6, -1., 5.);
609  BST_MasterStatus->setAxisTitle("Luminosity segment", 1);
610  BST_MasterStatus->setAxisTitle("BST master status", 2);
611  BST_MasterStatus->setBinLabel(2, "Master Beam 1", 2);
612  BST_MasterStatus->setBinLabel(3, "Master Beam 2", 2);
613 
614  BST_turnCountNumber = m_dbe->book2D("BST_turnCountNumber",
615  "BST turn count over LS",
616  TotalNrBinsLs, 0., totalNrBinsLs, 250, 0., 4.3e9);
617  BST_turnCountNumber->setAxisTitle("Luminosity segment", 1);
618  BST_turnCountNumber->setAxisTitle("BST turn count number", 2);
619 
620  BST_lhcFillNumber = m_dbe->book1D("BST_lhcFillNumber",
621  "BST LHC fill number % 1000", 1000, 0., 1000.);
622  BST_lhcFillNumber->setAxisTitle("BST LHC fill number modulo 1000");
623 
624  BST_beamMode = m_dbe->book2D("BST_beamMode",
625  "BST beam mode over LS",
626  TotalNrBinsLs, 0., totalNrBinsLs, 25, 1., 26.);
627  BST_beamMode->setAxisTitle("Luminosity segment", 1);
628  BST_beamMode->setAxisTitle("Mode", 2);
629  BST_beamMode->setBinLabel(1, "No mode", 2);
630  BST_beamMode->setBinLabel(2, "Setup", 2);
631  BST_beamMode->setBinLabel(3, "Inj pilot", 2);
632  BST_beamMode->setBinLabel(4, "Inj intr", 2);
633  BST_beamMode->setBinLabel(5, "Inj nomn", 2);
634  BST_beamMode->setBinLabel(6, "Pre ramp", 2);
635  BST_beamMode->setBinLabel(7, "Ramp", 2);
636  BST_beamMode->setBinLabel(8, "Flat top", 2);
637  BST_beamMode->setBinLabel(9, "Squeeze", 2);
638  BST_beamMode->setBinLabel(10, "Adjust", 2);
639  BST_beamMode->setBinLabel(11, "Stable", 2);
640  BST_beamMode->setBinLabel(12, "Unstable", 2);
641  BST_beamMode->setBinLabel(13, "Beam dump", 2);
642  BST_beamMode->setBinLabel(14, "Ramp down", 2);
643  BST_beamMode->setBinLabel(15, "Recovery", 2);
644  BST_beamMode->setBinLabel(16, "Inj dump", 2);
645  BST_beamMode->setBinLabel(17, "Circ dump", 2);
646  BST_beamMode->setBinLabel(18, "Abort", 2);
647  BST_beamMode->setBinLabel(19, "Cycling", 2);
648  BST_beamMode->setBinLabel(20, "Warn beam dump", 2);
649  BST_beamMode->setBinLabel(21, "No beam", 2);
650 
651  BST_beamMomentum = m_dbe->book2D("BST_beamMomentum",
652  "BST beam momentum",
653  TotalNrBinsLs, 0., totalNrBinsLs, 100, 0., 7200.);
654  BST_beamMomentum->setAxisTitle("Luminosity segment", 1);
655  BST_beamMomentum->setAxisTitle("Beam momentum", 2);
656 
657  gpsfreq = m_dbe->book1D("gpsfreq", "Clock frequency measured by GPS",
658  1000, 39.95, 40.2);
659  gpsfreq->setAxisTitle("CMS clock frequency (MHz)");
660 
661  gpsfreqwide = m_dbe->book1D("gpsfreqwide",
662  "Clock frequency measured by GPS", 1000, -2., 200.);
663  gpsfreqwide->setAxisTitle("CMS clock frequency (MHz)");
664 
665  gpsfreqlum = m_dbe->book2D("gpsfreqlum",
666  "Clock frequency measured by GPS",
667  TotalNrBinsLs, 0., totalNrBinsLs, 100, 39.95, 40.2);
668  gpsfreqlum->setAxisTitle("Luminosity segment", 1);
669  gpsfreqlum->setAxisTitle("CMS clock frequency (MHz)", 2);
670 
671  BST_intensityBeam1 = m_dbe->book2D("BST_intensityBeam1",
672  "Intensity beam 1",
673  TotalNrBinsLs, 0., totalNrBinsLs, 1000, 0., 5000.);
674  BST_intensityBeam1->setAxisTitle("Luminosity segment", 1);
675  BST_intensityBeam1->setAxisTitle("Beam intensity", 2);
676 
677  BST_intensityBeam2 = m_dbe->book2D("BST_intensityBeam2",
678  "Intensity beam 2",
679  TotalNrBinsLs, 0., totalNrBinsLs, 1000, 0., 5000.);
680  BST_intensityBeam2->setAxisTitle("Luminosity segment", 1);
681  BST_intensityBeam2->setAxisTitle("Beam intensity", 2);
682 
683  // prescale factor index monitoring
684 
685  m_monL1PrescaleFactorSet = m_dbe->book2D("L1PrescaleFactorSet",
686  "Index of L1 prescale factor set",
687  TotalNrBinsLs, 0., totalNrBinsLs, 25, 0., 25.);
688  m_monL1PrescaleFactorSet->setAxisTitle("Luminosity segment", 1);
689  m_monL1PrescaleFactorSet->setAxisTitle("L1 PF set index", 2);
690 
691  m_monL1PfIndicesPerLs = m_dbe->book1D("L1PfIndicesPerLs",
692  "Number of prescale factor indices used per LS", 10, 0., 10.);
693  m_monL1PfIndicesPerLs->setAxisTitle("Number of PF indices used per LS", 1);
694  m_monL1PfIndicesPerLs->setAxisTitle("Entries", 2);
695 
696 
697  // TCS vs FDL common quantity monitoring
698 
699  m_dbe->setCurrentFolder(m_histFolder + "/TCSvsEvmFDL");
700 
701  // orbit number
702  m_monOrbitNrDiffTcsFdlEvm = m_dbe->book1D("OrbitNrDiffTcsFdlEvm",
703  "Orbit number difference (TCS - EVM_FDL)",
704  2 * MaxOrbitNrDiffTcsFdlEvm + 1,
705  static_cast<float>(-(MaxOrbitNrDiffTcsFdlEvm + 1)),
706  static_cast<float>(MaxOrbitNrDiffTcsFdlEvm + 1));
707  m_monOrbitNrDiffTcsFdlEvm->setAxisTitle("Orbit number difference", 1);
708  m_monOrbitNrDiffTcsFdlEvm->setAxisTitle("Entries/run", 2);
709 
710  m_monLsNrDiffTcsFdlEvm = m_dbe->book1D("LsNrDiffTcsFdlEvm",
711  "LS number difference (TCS - EVM_FDL)",
712  2 * MaxLsNrDiffTcsFdlEvm + 1,
713  static_cast<float>(-(MaxLsNrDiffTcsFdlEvm + 1)),
714  static_cast<float>(MaxLsNrDiffTcsFdlEvm + 1));
715  m_monLsNrDiffTcsFdlEvm->setAxisTitle("LS number difference", 1);
716  m_monLsNrDiffTcsFdlEvm->setAxisTitle("Entries/run", 2);
717 
718  // LS number
719 
720  m_monOrbitNrDiffTcsFdlEvmLs = m_dbe->book2D("OrbitNrDiffTcsFdlEvmLs",
721  "Orbit number difference (TCS - EVM_FDL)",
722  TotalNrBinsLs, 0., totalNrBinsLs,
723  2 * MaxOrbitNrDiffTcsFdlEvm + 1,
724  static_cast<float>(-(MaxOrbitNrDiffTcsFdlEvm + 1)),
725  static_cast<float>(MaxOrbitNrDiffTcsFdlEvm + 1));
726  m_monOrbitNrDiffTcsFdlEvmLs->setAxisTitle("Luminosity segment", 1);
727  m_monOrbitNrDiffTcsFdlEvmLs->setAxisTitle("Orbit number difference (TCS - EVM_FDL)", 2);
728 
729  m_monLsNrDiffTcsFdlEvmLs = m_dbe->book2D("LsNrDiffTcsFdlEvmLs",
730  "LS number difference (TCS - EVM_FDL)",
731  TotalNrBinsLs, 0., totalNrBinsLs,
732  2 * MaxLsNrDiffTcsFdlEvm + 1,
733  static_cast<float>(-(MaxLsNrDiffTcsFdlEvm + 1)),
734  static_cast<float>(MaxLsNrDiffTcsFdlEvm + 1));
735  m_monLsNrDiffTcsFdlEvmLs->setAxisTitle("Luminosity segment", 1);
736  m_monLsNrDiffTcsFdlEvmLs->setAxisTitle("LS number difference (TCS - EVM_FDL)", 2);
737 
739  }
740 
741 
742 
743 }
744 
745 
747 bool L1TGT::isActive(int word, int bit) {
748  if (word & (1 << bit))
749  return true;
750  return false;
751 }
752 
753 
755 
756  if (verbose_) {
757  edm::LogInfo("L1TGT") << "\n Prescale factor indices used in a LS "
758  << std::endl;
759 
760  for (CItVecPair cIt = m_pairLsNumberPfIndex.begin(); cIt
761  != m_pairLsNumberPfIndex.end(); ++cIt) {
762 
763  edm::LogVerbatim("L1TGT") << " lsNumber = " << (*cIt).first
764  << " pfIndex = " << (*cIt).second << std::endl;
765  }
766  edm::LogVerbatim("L1TGT") << std::endl;
767  }
768 
769  // reset the histogram...
771 
772  // sort the vector (for pairs: sort after first argument, then after the second argument)
774 
775  int previousLsNumber = -1;
776  int previousPfsIndex = -1;
777 
778  // count the number of pairs (lsNumber, pfIndex) per Ls
779  // there are no duplicate entries, and pairs are sorted after both members
780  // ... and fill again the histogram
781  for (CItVecPair cIt = m_pairLsNumberPfIndex.begin(); cIt
782  != m_pairLsNumberPfIndex.end(); ++cIt) {
783 
784  int pfsIndicesPerLs = 1;
785 
786  if ((*cIt).first == previousLsNumber) {
787 
788  if ((*cIt).second != previousPfsIndex) {
789  pfsIndicesPerLs++;
790  previousPfsIndex = (*cIt).second;
791  }
792 
793  } else {
794 
795  // fill the histogram with the number of PF indices for the previous Ls
796  if (previousLsNumber != -1) {
797  m_monL1PfIndicesPerLs->Fill(pfsIndicesPerLs);
798  }
799 
800  // new Ls
801  previousLsNumber = (*cIt).first;
802  previousPfsIndex = (*cIt).second;
803 
804  pfsIndicesPerLs = 1;
805  }
806 
807  }
808 
809 }
810 
811 
812 
813 
814 // static class members
815 // maximum difference in orbit number
816 const int L1TGT::MaxOrbitNrDiffTcsFdlEvm = 24;
817 
818 // maximum difference in luminosity segment number
819 const int L1TGT::MaxLsNrDiffTcsFdlEvm = 24;
820 
821 
MonitorElement * m_monL1PrescaleFactorSet
Definition: L1TGT.h:156
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * gpsfreqwide
Definition: L1TGT.h:153
const cms_uint16_t bxNr() const
get/set bunch cross number of the actual bx
Definition: L1GtPsbWord.h:108
int i
Definition: DBlmapReader.cc:9
bool m_runInEndRun
Definition: L1TGT.h:116
int m_nrEvRun
Definition: L1TGT.h:184
boost::uint64_t preGps_
Definition: L1TGT.h:189
virtual void endJob()
Definition: L1TGT.cc:468
const cms_uint64_t orbitNr() const
get/set orbit number since start of run
Definition: L1TcsWord.h:266
DQMStore * m_dbe
internal members
Definition: L1TGT.h:180
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:3101
MonitorElement * m_monLsNrDiffTcsFdlEvmLs
Definition: L1TGT.h:172
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::vector< std::pair< int, int > >::const_iterator CItVecPair
Definition: L1TGT.h:194
const cms_uint64_t gpsTime() const
LHC-BOB-ES-0001 (EDMS 638899)
std::vector< std::pair< int, int > > m_pairLsNumberPfIndex
Definition: L1TGT.h:193
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)
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:59
const cms_uint16_t luminositySegmentNr() const
get/set luminosity segment number
Definition: L1TcsWord.h:166
MonitorElement * BST_intensityBeam1
Definition: L1TGT.h:150
static const int MaxOrbitNrDiffTcsFdlEvm
Definition: L1TGT.h:168
MonitorElement * algo_bits_corr
Definition: L1TGT.h:126
MonitorElement * tt_bits
Definition: L1TGT.h:127
bool verbose_
verbosity switch
Definition: L1TGT.h:121
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const cms_uint16_t bstMasterStatus() const
MonitorElement * gtfe_bx
Definition: L1TGT.h:142
const cms_uint32_t partTrigNr() const
get/set total number of L1A sent since start of the run to this DAQ partition
Definition: L1TcsWord.h:226
MonitorElement * BST_beamMode
Definition: L1TGT.h:148
void Fill(long long x)
MonitorElement * BST_MasterStatus
Definition: L1TGT.h:145
const cms_uint16_t beamMomentum() const
const cms_uint16_t bxNr() const
get/set BxNr - bunch cross number of the actual bx
Definition: L1GtFdlWord.h:110
MonitorElement * BST_intensityBeam2
Definition: L1TGT.h:151
const cms_uint16_t bxNr() const
get/set bunch cross number as counted in the TCS chip
Definition: L1TcsWord.h:87
void bookHistograms()
book all histograms for the module
Definition: L1TGT.cc:483
int iEvent
Definition: GenABIO.cc:230
MonitorElement * event_number
Definition: L1TGT.h:134
std::vector< bool > DecisionWord
typedefs
static const int MaxLsNrDiffTcsFdlEvm
Definition: L1TGT.h:169
edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > gtEvmSource_
input tag for L1 GT EVM readout record
Definition: L1TGT.h:111
MonitorElement * orbit_lumi
Definition: L1TGT.h:139
int j
Definition: DBlmapReader.cc:9
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1268
int orbitNumber() const
Definition: EventBase.h:63
std::string m_histFolder
histogram folder for L1 GT plots
Definition: L1TGT.h:187
const cms_uint16_t localBxNr() const
get/set local bunch cross number of the actual bx
Definition: L1GtPsbWord.h:178
bool isValid() const
Definition: HandleBase.h:76
MonitorElement * algo_bits_lumi
Definition: L1TGT.h:130
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
Definition: L1TGT.cc:92
const cms_uint16_t activeBoards() const
get/set boards contributing to EVM respectively DAQ record
Definition: L1GtfeWord.h:163
MonitorElement * m_monLsNrDiffTcsFdlEvm
Definition: L1TGT.h:160
MonitorElement * gpsfreq
Definition: L1TGT.h:152
const cms_uint16_t bxNr() const
get/set bunch cross number as counted in the GTFE board
Definition: L1GtfeWord.h:122
bool dirExists(const std::string &path) const
true if directory exists
Definition: DQMStore.cc:732
const cms_uint32_t totalIntensityBeam2() const
const cms_uint32_t totalIntensityBeam1() const
MonitorElement * algo_bits
Definition: L1TGT.h:125
MonitorElement * event_type
Definition: L1TGT.h:132
const cms_uint16_t gtPrescaleFactorIndexAlgo() const
Definition: L1GtFdlWord.h:267
MonitorElement * m_monOrbitNrDiffTcsFdlEvmLs
Definition: L1TGT.h:171
const cms_uint16_t lumiSegmentNr() const
get/set luminosity segment number of the actual bx
Definition: L1GtFdlWord.h:352
MonitorElement * dbx_module
Definition: L1TGT.h:143
bool m_runInEndLumi
Definition: L1TGT.h:115
unsigned long long uint64_t
Definition: Time.h:15
virtual void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
end section
Definition: L1TGT.cc:451
const cms_uint32_t lhcFillNumber() const
MonitorElement * tt_bits_corr
Definition: L1TGT.h:128
virtual void endRun(const edm::Run &, const edm::EventSetup &)
Definition: L1TGT.cc:459
bool isActive(int word, int bit)
Definition: L1TGT.cc:747
MonitorElement * gpsfreqlum
Definition: L1TGT.h:154
int m_nrEvJob
number of events processed
Definition: L1TGT.h:183
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > gtSource_L1GT_
input parameters
Definition: L1TGT.h:107
void countPfsIndicesPerLs()
Definition: L1TGT.cc:754
const cms_uint16_t triggerType() const
get/set trigger type, identical with event type in CMS header
Definition: L1TcsWord.h:127
MonitorElement * m_monL1PfIndicesPerLs
Definition: L1TGT.h:157
virtual void beginJob()
Definition: L1TGT.cc:55
const cms_uint32_t eventNr() const
get/set event number since last L1 reset generated in TCS chip
Definition: L1TcsWord.h:246
const cms_uint32_t setupVersion() const
get/set setup version
Definition: L1GtfeWord.h:140
MonitorElement * trigger_number
Definition: L1TGT.h:136
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
Definition: L1TGT.cc:64
MonitorElement * BST_beamMomentum
Definition: L1TGT.h:149
MonitorElement * BST_lhcFillNumber
Definition: L1TGT.h:147
volatile std::atomic< bool > shutdown_flag false
MonitorElement * setupversion_lumi
Definition: L1TGT.h:140
virtual void analyze(const edm::Event &, const edm::EventSetup &)
Definition: L1TGT.cc:101
const cms_uint32_t turnCountNumber() const
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1082
MonitorElement * BST_turnCountNumber
Definition: L1TGT.h:146
boost::uint64_t preOrb_
Definition: L1TGT.h:190
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void Reset(void)
reset ME (ie. contents, errors, etc)
MonitorElement * event_lumi
Definition: L1TGT.h:135
const cms_uint16_t beamMode() const
MonitorElement * tt_bits_lumi
Definition: L1TGT.h:131
MonitorElement * trigger_lumi
Definition: L1TGT.h:137
MonitorElement * evnum_trignum_lumi
Definition: L1TGT.h:138
const cms_uint32_t orbitNr() const
get/set orbit number
Definition: L1GtFdlWord.h:332
MonitorElement * algo_tt_bits_corr
Definition: L1TGT.h:129
bool m_runInEndJob
Definition: L1TGT.h:117
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
const cms_uint16_t localBxNr() const
get/set local bunch cross number of the actual bx
Definition: L1GtFdlWord.h:372
Definition: Run.h:41
MonitorElement * m_monOrbitNrDiffTcsFdlEvm
Definition: L1TGT.h:159
L1TGT(const edm::ParameterSet &ps)
Definition: L1TGT.cc:18
virtual ~L1TGT()
Definition: L1TGT.cc:50
edm::EDGetTokenT< L1MuGMTReadoutCollection > gtSource_L1MuGMT_
Definition: L1TGT.h:108