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