CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
LaserTask.cc
Go to the documentation of this file.
2 
3 using namespace hcaldqm;
4 using namespace hcaldqm::constants;
5 using namespace hcaldqm::filter;
7  : DQTask(ps), hcalDbServiceToken_(esConsumes<HcalDbService, HcalDbRecord, edm::Transition::BeginRun>()) {
8  _nevents = ps.getUntrackedParameter<int>("nevents", 2000);
9 
10  // tags
11  _tagQIE11 = ps.getUntrackedParameter<edm::InputTag>("tagHE", edm::InputTag("hcalDigis"));
12  _tagHO = ps.getUntrackedParameter<edm::InputTag>("tagHO", edm::InputTag("hcalDigis"));
13  _tagQIE10 = ps.getUntrackedParameter<edm::InputTag>("tagHF", edm::InputTag("hcalDigis"));
14  _taguMN = ps.getUntrackedParameter<edm::InputTag>("taguMN", edm::InputTag("hcalDigis"));
15  _tagLaserMon = ps.getUntrackedParameter<edm::InputTag>("tagLaserMon", edm::InputTag("LASERMON"));
16  _tokQIE11 = consumes<QIE11DigiCollection>(_tagQIE11);
17  _tokHO = consumes<HODigiCollection>(_tagHO);
18  _tokQIE10 = consumes<QIE10DigiCollection>(_tagQIE10);
19  _tokuMN = consumes<HcalUMNioDigi>(_taguMN);
20  _tokLaserMon = consumes<QIE10DigiCollection>(_tagLaserMon);
21 
22  _vflags.resize(nLaserFlag);
23  _vflags[fBadTiming] = hcaldqm::flag::Flag("BadTiming");
24  _vflags[fMissingLaserMon] = hcaldqm::flag::Flag("MissingLaserMon");
25 
26  // constants
27  _lowHBHE = ps.getUntrackedParameter<double>("lowHBHE", 50);
28  _lowHO = ps.getUntrackedParameter<double>("lowHO", 100);
29  _lowHF = ps.getUntrackedParameter<double>("lowHF", 50);
30  _laserType = (uint32_t)ps.getUntrackedParameter<uint32_t>("laserType");
31 
32  // Laser mon digi ordering list
33  _vLaserMonIPhi = ps.getUntrackedParameter<std::vector<int>>("vLaserMonIPhi");
34  _laserMonIEta = ps.getUntrackedParameter<int>("laserMonIEta");
35  _laserMonCBox = ps.getUntrackedParameter<int>("laserMonCBox");
36  _laserMonDigiOverlap = ps.getUntrackedParameter<int>("laserMonDigiOverlap");
37  _laserMonTS0 = ps.getUntrackedParameter<int>("laserMonTS0");
38  _laserMonThreshold = ps.getUntrackedParameter<double>("laserMonThreshold", 1.e5);
39  _thresh_frac_timingreflm = ps.getUntrackedParameter<double>("_thresh_frac_timingreflm", 0.01);
40  _thresh_min_lmsumq = ps.getUntrackedParameter<double>("thresh_min_lmsumq", 50000.);
41 
42  std::vector<double> vTimingRangeHB =
43  ps.getUntrackedParameter<std::vector<double>>("thresh_timingreflm_HB", std::vector<double>({-70, -10.}));
44  std::vector<double> vTimingRangeHE =
45  ps.getUntrackedParameter<std::vector<double>>("thresh_timingreflm_HE", std::vector<double>({-60., 0.}));
46  std::vector<double> vTimingRangeHO =
47  ps.getUntrackedParameter<std::vector<double>>("thresh_timingreflm_HO", std::vector<double>({-50., 20.}));
48  std::vector<double> vTimingRangeHF =
49  ps.getUntrackedParameter<std::vector<double>>("thresh_timingreflm_HF", std::vector<double>({-50., 20.}));
50  _thresh_timingreflm[HcalBarrel] = std::make_pair(vTimingRangeHB[0], vTimingRangeHB[1]);
51  _thresh_timingreflm[HcalEndcap] = std::make_pair(vTimingRangeHE[0], vTimingRangeHE[1]);
52  _thresh_timingreflm[HcalOuter] = std::make_pair(vTimingRangeHO[0], vTimingRangeHO[1]);
53  _thresh_timingreflm[HcalForward] = std::make_pair(vTimingRangeHF[0], vTimingRangeHF[1]);
54 }
55 
56 /* virtual */ void LaserTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
57  if (_ptype == fLocal)
58  if (r.runAuxiliary().run() == 1)
59  return;
60 
61  DQTask::bookHistograms(ib, r, es);
62 
64  _emap = dbService->getHcalMapping();
65 
66  std::vector<uint32_t> vhashVME;
67  std::vector<uint32_t> vhashuTCA;
68  std::vector<uint32_t> vhashC36;
69  vhashVME.push_back(
71  vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
74 
75  // INITIALIZE
77  "SignalMean",
81  0);
83  "SignalRMS",
87  0);
89  "TimingMean",
93  0);
95  "TimingRMS",
99  0);
100 
102  "ADC",
106  0);
107 
108  if (_ptype == fLocal) { // hidefed2crate
110  "SignalMean",
115  0);
117  "SignalRMS",
122  0);
124  "TimingMean",
129  0);
131  "TimingRMS",
136  0);
138  "Missing",
143  0);
144 
146  "Shape",
150  0);
151  }
153  "TimingvsEvent",
157  0);
159  "SignalvsEvent",
163  0);
165  "TimingvsLS",
169  0);
171  "SignalvsLS",
175  0);
177  "TimingvsBX",
181  0);
183  "SignalvsBX",
187  0);
188 
190  "SignalMean",
195  0);
197  "SignalRMS",
202  0);
204  "TimingMean",
209  0);
211  "TimingRMS",
216  0);
217 
219  "Missing",
224  0);
225 
226  // initialize compact containers
232 
233  // LaserMon containers
234  if (_ptype == fOnline || _ptype == fLocal) {
236  "LaserMonSumQ",
239  0);
241 
243  "LaserMonTiming",
246  0);
248 
249  if (_ptype == fOnline) {
251  "LaserMonSumQ_LS",
255  "LaserMonTiming_LS",
259  "TimingDiff_DigiMinusLaserMon",
264  0);
266  } else if (_ptype == fLocal) {
268  "LaserMonSumQ_Event",
272  "LaserMonTiming_Event",
276  "TimingDiff_DigiMinusLaserMon",
281  0);
283  }
285  _name,
286  "Timing_DigivsLaserMon",
291  0);
294 
299  _xMissingLaserMon = 0;
300 
301  std::vector<int> vFEDs = hcaldqm::utilities::getFEDList(_emap);
302  std::vector<int> vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap);
303  std::vector<int> vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap);
304  for (std::vector<int>::const_iterator it = vFEDsVME.begin(); it != vFEDsVME.end(); ++it)
305  _vhashFEDs.push_back(
307  for (std::vector<int>::const_iterator it = vFEDsuTCA.begin(); it != vFEDsuTCA.end(); ++it) {
308  std::pair<uint16_t, uint16_t> cspair = utilities::fed2crate(*it);
309  _vhashFEDs.push_back(HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
310  }
311 
313  "SummaryvsLS",
318  0);
320  "SummaryvsLS",
324  0);
325  } // End if (_ptype == fOnline || _ptype == fLocal) {
326 
327  // BOOK
332 
337 
338  if (_ptype == fLocal) {
341  } else {
346  }
347 
348  if (_ptype == fLocal) { // hidefed2crate
355  }
357 
359 
365 
366  if (_ptype == fOnline || _ptype == fLocal) {
369  if (_ptype == fOnline) {
373  } else if (_ptype == fLocal) {
377  }
382  _xNChs.book(_emap);
385  }
386 
388 }
389 
390 /* virtual */ void LaserTask::_resetMonitors(hcaldqm::UpdateFreq uf) { DQTask::_resetMonitors(uf); }
391 
392 /* virtual */ void LaserTask::_dump() {
401 
402  if (_ptype == fLocal) { // hidefed2crate
407  }
408  if (_ptype != fOffline) {
409  _xNChs.reset();
410  }
411 
412  std::vector<HcalGenericDetId> dids = _emap->allPrecisionId();
413  for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
414  if (!it->isHcalDetId())
415  continue;
416  HcalDetId did = HcalDetId(it->rawId());
418  int n = _xEntries.get(did);
419  // channels missing or low signal
420  if (n == 0) {
421  _cMissing_depth.fill(did);
422  if (_ptype == fLocal) { // hidefed2crate
423  if (!eid.isVMEid())
425  }
426  continue;
427  }
428 
429  _xNChs.get(eid)++;
430 
431  double msig = _xSignalSum.get(did) / n;
432  double mtim = _xTimingSum.get(did) / n;
433  double rsig = sqrt(_xSignalSum2.get(did) / n - msig * msig);
434  double rtim = sqrt(_xTimingSum2.get(did) / n - mtim * mtim);
435 
436  _cSignalMean_Subdet.fill(did, msig);
437  _cSignalMean_depth.fill(did, msig);
438  _cSignalRMS_Subdet.fill(did, rsig);
439  _cSignalRMS_depth.fill(did, rsig);
440  _cTimingMean_Subdet.fill(did, mtim);
441  _cTimingMean_depth.fill(did, mtim);
442  _cTimingRMS_Subdet.fill(did, rtim);
443  _cTimingRMS_depth.fill(did, rtim);
444  if (_ptype == fLocal) { // hidefed2crate
445  if (!eid.isVMEid()) {
450  }
451  }
452 
453  // Bad timing
454 
455  double timingreflm_mean = _xTimingRefLMSum.get(did) / n;
456  //double timingreflm_rms = sqrt(_xTimingRefLMSum2.get(did) / n - timingreflm_mean * timingreflm_mean);
457 
458  if ((timingreflm_mean < _thresh_timingreflm[did.subdet()].first) ||
459  (timingreflm_mean > _thresh_timingreflm[did.subdet()].second)) {
461  }
462  }
463  if (_ptype != fOffline) { // hidefed2crate
464  for (std::vector<uint32_t>::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) {
465  hcaldqm::flag::Flag fSum("LASER");
467  std::vector<uint32_t>::const_iterator jt = std::find(_vcdaqEids.begin(), _vcdaqEids.end(), (*it));
468  if (jt == _vcdaqEids.end()) {
469  // not @cDAQ
470  for (uint32_t iflag = 0; iflag < _vflags.size(); iflag++)
473  continue;
474  }
475  // @cDAQ
477  int min_nchs = 10;
478  if (_xNChs.get(eid) < min_nchs) {
480  } else {
481  double frbadtimingreflm = double(_xNBadTimingRefLM.get(eid)) / double(_xNChs.get(eid));
482  if (frbadtimingreflm > _thresh_frac_timingreflm) {
484  } else {
486  }
487  }
488  if (_xMissingLaserMon) {
490  } else {
492  }
493  }
494 
495  // Set SummaryVsLS bins
496  int iflag = 0;
497  for (std::vector<hcaldqm::flag::Flag>::iterator ft = _vflags.begin(); ft != _vflags.end(); ++ft) {
498  _cSummaryvsLS_FED.setBinContent(eid, _currentLS, iflag, int(ft->_state));
499  fSum += (*ft);
500  iflag++;
501  ft->reset();
502  }
504  } // End loop over FEDs
505 
506  // Reset per-LS containers
508  _xMissingLaserMon = 0;
509  } // End if _ptype != fOffline
510 }
511 
512 /* virtual */ void LaserTask::_process(edm::Event const& e, edm::EventSetup const& es) {
516 
517  if (!e.getByToken(_tokQIE11, c_QIE11))
518  _logger.dqmthrow("Collection QIE11DigiCollection isn't available " + _tagQIE11.label() + " " +
519  _tagQIE11.instance());
520  if (!e.getByToken(_tokHO, c_ho))
521  _logger.dqmthrow("Collection HODigiCollection isn't available " + _tagHO.label() + " " + _tagHO.instance());
522  if (!e.getByToken(_tokQIE10, c_QIE10))
523  _logger.dqmthrow("Collection QIE10DigiCollection isn't available " + _tagQIE10.label() + " " +
524  _tagQIE10.instance());
525 
526  // int currentEvent = e.eventAuxiliary().id().event();
527  int bx = e.bunchCrossing();
528 
529  // LASERMON
531  if (!e.getByToken(_tokLaserMon, cLaserMon)) {
532  _logger.dqmthrow("QIE10DigiCollection for laserMonDigis isn't available.");
533  }
534  std::vector<int> laserMonADC;
535  processLaserMon(cLaserMon, laserMonADC);
536 
537  // SumQ = peak +/- 3 TSes
538  // Timing = fC-weighted average (TS-TS0) * 25 ns, also in peak +/- 3 TSes
539  int peakTS = -1;
540  double peakLaserMonADC = -1;
541  for (unsigned int iTS = 0; iTS < laserMonADC.size(); ++iTS) {
542  if (laserMonADC[iTS] > peakLaserMonADC) {
543  peakLaserMonADC = laserMonADC[iTS];
544  peakTS = iTS;
545  }
546  }
547 
548  double laserMonSumQ = 0;
549  double laserMonTiming = 0.;
550 
551  if (peakTS >= 0) {
552  int minTS = std::max(0, peakTS - 3);
553  int maxTS = std::min(int(laserMonADC.size() - 1), peakTS + 3);
554  for (int iTS = minTS; iTS <= maxTS; ++iTS) {
555  double this_fC = hcaldqm::constants::adc2fC[laserMonADC[iTS]];
556  laserMonSumQ += this_fC;
557  laserMonTiming += 25. * (iTS - _laserMonTS0) * this_fC;
558  }
559  }
560  if (laserMonSumQ > 0.) {
561  laserMonTiming = laserMonTiming / laserMonSumQ;
562  } else {
564  }
565 
566  if (laserMonSumQ > _laserMonThreshold) {
567  _cLaserMonSumQ.fill(laserMonSumQ);
568  _cLaserMonTiming.fill(laserMonTiming);
569  if (_ptype == fOnline) {
570  _cLaserMonSumQ_LS.fill(_currentLS, laserMonSumQ);
571  _cLaserMonTiming_LS.fill(_currentLS, laserMonTiming);
572  } else if (_ptype == fLocal) {
573  int currentEvent = e.eventAuxiliary().id().event();
574  _cLaserMonSumQ_Event.fill(currentEvent, laserMonSumQ);
575  _cLaserMonTiming_Event.fill(currentEvent, laserMonTiming);
576  }
577  }
578 
579  for (QIE11DigiCollection::const_iterator it = c_QIE11->begin(); it != c_QIE11->end(); ++it) {
580  const QIE11DataFrame digi = static_cast<const QIE11DataFrame>(*it);
581  HcalDetId const& did = digi.detid();
582  if ((did.subdet() != HcalBarrel) && (did.subdet() != HcalEndcap)) {
583  continue;
584  }
585  uint32_t rawid = _ehashmap.lookup(did);
586  HcalElectronicsId const& eid(rawid);
587 
588  CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<QIE11DataFrame>(_dbService, did, digi);
589  //double sumQ = hcaldqm::utilities::sumQ_v10<QIE11DataFrame>(digi, 2.5, 0, digi.samples()-1);
590  double sumQ = hcaldqm::utilities::sumQDB<QIE11DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples() - 1);
591  if (sumQ < _lowHBHE)
592  continue;
593 
594  //double aveTS = hcaldqm::utilities::aveTS_v10<QIE11DataFrame>(digi, 2.5, 0,digi.samples()-1);
595  double aveTS = hcaldqm::utilities::aveTSDB<QIE11DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples() - 1);
596  _xSignalSum.get(did) += sumQ;
597  _xSignalSum2.get(did) += sumQ * sumQ;
598  _xTimingSum.get(did) += aveTS;
599  _xTimingSum2.get(did) += aveTS * aveTS;
600  _xEntries.get(did)++;
601 
602  for (int i = 0; i < digi.samples(); i++) {
603  if (_ptype == fLocal) {
605  eid, i, hcaldqm::utilities::adc2fCDBMinusPedestal<QIE11DataFrame>(_dbService, digi_fC, did, digi, i));
606  }
607  _cADC_SubdetPM.fill(did, digi[i].adc());
608  }
609 
610  // select based on local global
611  double digiTimingSOI = (aveTS - digi.presamples()) * 25.;
612  double deltaTiming = digiTimingSOI - laserMonTiming;
613  _cTiming_DigivsLaserMon_SubdetPM.fill(did, laserMonTiming, digiTimingSOI);
614  _xTimingRefLMSum.get(did) += deltaTiming;
615  _xTimingRefLMSum2.get(did) += deltaTiming * deltaTiming;
616  if (_ptype == fLocal) {
617  int currentEvent = e.eventAuxiliary().id().event();
618  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
619  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
620  _cTimingDiffEvent_SubdetPM.fill(did, currentEvent, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming);
621  } else {
624  _cTimingvsBX_SubdetPM.fill(did, bx, aveTS);
625  _cSignalvsBX_SubdetPM.fill(did, bx, sumQ);
626  _cTimingDiffLS_SubdetPM.fill(did, _currentLS, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming);
627  }
628  }
629  for (HODigiCollection::const_iterator it = c_ho->begin(); it != c_ho->end(); ++it) {
630  const HODataFrame digi = (const HODataFrame)(*it);
631  double sumQ = hcaldqm::utilities::sumQ<HODataFrame>(digi, 8.5, 0, digi.size() - 1);
632  if (sumQ < _lowHO)
633  continue;
634  HcalDetId did = digi.id();
635  HcalElectronicsId eid = digi.elecId();
636 
637  double aveTS = hcaldqm::utilities::aveTS<HODataFrame>(digi, 8.5, 0, digi.size() - 1);
638  _xSignalSum.get(did) += sumQ;
639  _xSignalSum2.get(did) += sumQ * sumQ;
640  _xTimingSum.get(did) += aveTS;
641  _xTimingSum2.get(did) += aveTS * aveTS;
642  _xEntries.get(did)++;
643 
644  for (int i = 0; i < digi.size(); i++) {
645  if (_ptype == fLocal) { // hidefed2crate
646  _cShapeCut_FEDSlot.fill(eid, i, digi.sample(i).nominal_fC() - 8.5);
647  }
648  _cADC_SubdetPM.fill(did, digi.sample(i).adc());
649  }
650 
651  // select based on local global
652  double digiTimingSOI = (aveTS - digi.presamples()) * 25.;
653  double deltaTiming = digiTimingSOI - laserMonTiming;
654  _cTiming_DigivsLaserMon_SubdetPM.fill(did, laserMonTiming, digiTimingSOI);
655  _xTimingRefLMSum.get(did) += deltaTiming;
656  _xTimingRefLMSum2.get(did) += deltaTiming * deltaTiming;
657  if (_ptype == fLocal) {
658  int currentEvent = e.eventAuxiliary().id().event();
659  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
660  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
661  _cTimingDiffEvent_SubdetPM.fill(did, currentEvent, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming);
662  } else {
665  _cTimingvsBX_SubdetPM.fill(did, bx, aveTS);
666  _cSignalvsBX_SubdetPM.fill(did, bx, sumQ);
668  }
669  }
670  for (QIE10DigiCollection::const_iterator it = c_QIE10->begin(); it != c_QIE10->end(); ++it) {
671  const QIE10DataFrame digi = (const QIE10DataFrame)(*it);
672  HcalDetId did = digi.detid();
673  if (did.subdet() != HcalForward) {
674  continue;
675  }
677 
678  CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<QIE10DataFrame>(_dbService, did, digi);
679  double sumQ = hcaldqm::utilities::sumQDB<QIE10DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples() - 1);
680  //double sumQ = hcaldqm::utilities::sumQ_v10<QIE10DataFrame>(digi, 2.5, 0, digi.samples()-1);
681  if (sumQ < _lowHF)
682  continue;
683 
684  //double aveTS = hcaldqm::utilities::aveTS_v10<QIE10DataFrame>(digi, 2.5, 0, digi.samples()-1);
685  double aveTS = hcaldqm::utilities::aveTSDB<QIE10DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples() - 1);
686 
687  _xSignalSum.get(did) += sumQ;
688  _xSignalSum2.get(did) += sumQ * sumQ;
689  _xTimingSum.get(did) += aveTS;
690  _xTimingSum2.get(did) += aveTS * aveTS;
691  _xEntries.get(did)++;
692 
693  for (int i = 0; i < digi.samples(); i++) {
694  if (_ptype == fLocal) { // hidefed2crate
696  eid, (int)i, hcaldqm::utilities::adc2fCDBMinusPedestal<QIE10DataFrame>(_dbService, digi_fC, did, digi, i));
697  }
698  _cADC_SubdetPM.fill(did, digi[i].adc());
699  }
700 
701  // select based on local global
702  double digiTimingSOI = (aveTS - digi.presamples()) * 25.;
703  double deltaTiming = digiTimingSOI - laserMonTiming;
704  _cTiming_DigivsLaserMon_SubdetPM.fill(did, laserMonTiming, digiTimingSOI);
705  _xTimingRefLMSum.get(did) += deltaTiming;
706  _xTimingRefLMSum2.get(did) += deltaTiming * deltaTiming;
707  if (_ptype == fLocal) {
708  int currentEvent = e.eventAuxiliary().id().event();
709  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
710  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
711  _cTimingDiffEvent_SubdetPM.fill(did, currentEvent, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming);
712  } else {
715  _cTimingvsBX_SubdetPM.fill(did, bx, aveTS);
716  _cSignalvsBX_SubdetPM.fill(did, bx, sumQ);
717  _cTimingDiffLS_SubdetPM.fill(did, _currentLS, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming);
718  }
719  }
720 }
721 
722 void LaserTask::processLaserMon(edm::Handle<QIE10DigiCollection>& col, std::vector<int>& iLaserMonADC) {
723  for (QIE10DigiCollection::const_iterator it = col->begin(); it != col->end(); ++it) {
724  const QIE10DataFrame digi = (const QIE10DataFrame)(*it);
725  HcalCalibDetId hcdid(digi.id());
726 
727  if ((hcdid.ieta() != _laserMonIEta) || (hcdid.cboxChannel() != _laserMonCBox)) {
728  continue;
729  }
730 
731  unsigned int digiIndex =
732  std::find(_vLaserMonIPhi.begin(), _vLaserMonIPhi.end(), hcdid.iphi()) - _vLaserMonIPhi.begin();
733  if (digiIndex == _vLaserMonIPhi.size()) {
734  continue;
735  }
736 
737  // First digi: initialize the vectors to -1 (need to know the length of the digi)
738  if (iLaserMonADC.empty()) {
739  int totalNSamples = (digi.samples() - _laserMonDigiOverlap) * _vLaserMonIPhi.size();
740  for (int i = 0; i < totalNSamples; ++i) {
741  iLaserMonADC.push_back(-1);
742  }
743  }
744 
745  for (int subindex = 0; subindex < digi.samples() - _laserMonDigiOverlap; ++subindex) {
746  int totalIndex = (digi.samples() - _laserMonDigiOverlap) * digiIndex + subindex;
747  iLaserMonADC[totalIndex] = (digi[subindex].ok() ? digi[subindex].adc() : -1);
748  }
749  }
750 }
751 
753  auto lumiCache = luminosityBlockCache(lb.index());
754  _currentLS = lumiCache->currentLS;
755 
756  if (_ptype == fLocal)
757  return;
758  this->_dump();
759 
760  DQTask::globalEndLuminosityBlock(lb, es);
761 }
762 
763 /* virtual */ bool LaserTask::_isApplicable(edm::Event const& e) {
764  if (_ptype != fOnline)
765  return true;
766  else {
767  // fOnline mode
769  if (!e.getByToken(_tokuMN, cumn))
770  return false;
771 
772  // event type check first
773  uint8_t eventType = cumn->eventType();
774  if (eventType != constants::EVENTTYPE_LASER)
775  return false;
776 
777  // check if this analysis task is of the right laser type
778  uint32_t laserType = cumn->valueUserWord(0);
779  if (laserType == _laserType)
780  return true;
781  }
782 
783  return false;
784 }
785 
void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *, int debug=0) override
constexpr uint32_t rawId() const
edm::InputTag _tagQIE11
Definition: LaserTask.h:49
EventNumber_t event() const
Definition: EventID.h:40
hcaldqm::ContainerProf1D _cShapeCut_FEDSlot
Definition: LaserTask.h:98
T getUntrackedParameter(std::string const &, T const &) const
double aveTS(DIGI const &digi, double ped=0, int i=0, int j=3)
Definition: Utilities.h:115
hcaldqm::ContainerProf1D _cSignalvsEvent_SubdetPM
Definition: LaserTask.h:100
bool _isApplicable(edm::Event const &) override
Definition: LaserTask.cc:763
hcaldqm::ContainerSingle1D _cLaserMonTiming
Definition: LaserTask.h:141
virtual void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *qy=new quantity::ValueQuantity(quantity::fN), int debug=0)
Definition: Container1D.cc:33
std::vector< hcaldqm::flag::Flag > _vflags
Definition: LaserTask.h:60
double _lowHF
Definition: LaserTask.h:73
constexpr int size() const
total number of samples in the digi
Definition: HODataFrame.h:27
int const CRATE_VME_MIN
Definition: Constants.h:95
int ib
Definition: cuy.py:661
int maxTS(DIGI const &digi, double ped=0)
Definition: Utilities.h:103
hcaldqm::ContainerProf2D _cTimingMean_FEDuTCA
Definition: LaserTask.h:117
hcaldqm::ContainerXXX< int > _xNBadTimingRefLM
Definition: LaserTask.h:84
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
hcaldqm::ContainerXXX< double > _xSignalSum2
Definition: LaserTask.h:78
void fill(HcalDetId const &) override
std::pair< uint16_t, uint16_t > fed2crate(int fed)
Definition: Utilities.cc:10
std::vector< uint32_t > _vhashFEDs
Definition: LaserTask.h:66
LuminosityBlockIndex index() const
hcaldqm::ContainerXXX< double > _xTimingRefLMSum
Definition: LaserTask.h:82
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
constexpr edm::DataFrame::id_type id() const
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
hcaldqm::ContainerXXX< int > _xEntries
Definition: LaserTask.h:79
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
hcaldqm::Container1D _cTimingRMS_Subdet
Definition: LaserTask.h:93
double _lowHBHE
Definition: LaserTask.h:70
uint32_t _laserType
Definition: LaserTask.h:74
UpdateFreq
Definition: DQTask.h:32
double _laserMonThreshold
Definition: LaserTask.h:134
virtual void _dump()
Definition: LaserTask.cc:392
State _state
Definition: Flag.h:62
std::vector< T >::const_iterator const_iterator
hcaldqm::ContainerProf1D _cTimingvsEvent_SubdetPM
Definition: LaserTask.h:99
double _thresh_frac_timingreflm
Definition: LaserTask.h:136
int bunchCrossing() const
Definition: EventBase.h:64
virtual void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fN), int debug=0)
int const SPIGOT_MIN
Definition: Constants.h:120
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
virtual void reset()
Definition: ContainerXXX.h:292
EventAuxiliary const & eventAuxiliary() const override
Definition: Event.h:95
void _resetMonitors(hcaldqm::UpdateFreq) override
Definition: LaserTask.cc:390
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
int const FIBER_VME_MIN
Definition: Constants.h:125
hcaldqm::ContainerXXX< double > _xSignalSum
Definition: LaserTask.h:77
hcaldqm::ContainerXXX< double > _xTimingSum
Definition: LaserTask.h:80
hcaldqm::Container2D _cMissing_depth
Definition: LaserTask.h:122
void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *qy=new quantity::ValueQuantity(quantity::fN), int debug=0) override
hcaldqm::ContainerProf2D _cSignalMean_depth
Definition: LaserTask.h:109
hcaldqm::ContainerSingleProf1D _cLaserMonTiming_LS
Definition: LaserTask.h:143
int const FIBERCH_MIN
Definition: Constants.h:134
int _laserMonTS0
Definition: LaserTask.h:133
edm::InputTag _tagHO
Definition: LaserTask.h:50
hcaldqm::Container1D _cADC_SubdetPM
Definition: LaserTask.h:95
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
example_stream void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::vector< int > getFEDVMEList(HcalElectronicsMap const *)
Definition: Utilities.cc:115
hcaldqm::Container2D _cSummaryvsLS_FED
Definition: LaserTask.h:151
RunAuxiliary const & runAuxiliary() const override
Definition: Run.h:62
hcaldqm::ContainerProf2D _cTimingDiffLS_SubdetPM
Definition: LaserTask.h:147
constexpr DetId detid() const
Get the detector id.
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
hcaldqm::Container1D _cTimingMean_Subdet
Definition: LaserTask.h:92
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: LaserTask.cc:56
int _laserMonDigiOverlap
Definition: LaserTask.h:132
ProcessingType _ptype
Definition: DQModule.h:44
virtual void fill(uint32_t)
Definition: Container1D.cc:73
virtual void reset()
Definition: Container1D.cc:60
hcaldqm::ContainerProf2D _cTimingRMS_FEDuTCA
Definition: LaserTask.h:119
hcaldqm::ContainerProf2D _cSignalRMS_FEDuTCA
Definition: LaserTask.h:118
edm::EDGetTokenT< QIE10DigiCollection > _tokLaserMon
Definition: LaserTask.h:127
std::map< HcalSubdetector, std::pair< double, double > > _thresh_timingreflm
Definition: LaserTask.h:135
virtual void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *qy=new quantity::ValueQuantity(quantity::fN), int debug=0)
void reset()
Definition: Flag.h:59
void processLaserMon(edm::Handle< QIE10DigiCollection > &col, std::vector< int > &iLaserMonADC)
Definition: LaserTask.cc:722
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
virtual void setBinContent(int, int, int)
hcaldqm::ContainerProf2D _cTimingDiffEvent_SubdetPM
Definition: LaserTask.h:148
hcaldqm::ContainerSingleProf1D _cLaserMonSumQ_LS
Definition: LaserTask.h:142
void dqmthrow(std::string const &msg) const
Definition: Logger.h:12
hcaldqm::filter::HashFilter _filter_uTCA
Definition: LaserTask.h:64
hcaldqm::ContainerXXX< int > _xNChs
Definition: LaserTask.h:85
int const FED_VME_MIN
Definition: Constants.h:82
edm::ESGetToken< HcalDbService, HcalDbRecord > hcalDbServiceToken_
Definition: LaserTask.h:57
T sqrt(T t)
Definition: SSEVec.h:19
edm::EDGetTokenT< QIE11DigiCollection > _tokQIE11
Definition: LaserTask.h:53
hcaldqm::ContainerSingleProf1D _cLaserMonTiming_Event
Definition: LaserTask.h:145
int _nevents
Definition: LaserTask.h:69
virtual void showOverflowX(bool showOverflow)
Definition: Container1D.cc:769
hcaldqm::ContainerSingle1D _cLaserMonSumQ
Definition: LaserTask.h:140
int const FIBER_uTCA_MIN1
Definition: Constants.h:128
Transition
Definition: Transition.h:12
edm::EDGetTokenT< HODigiCollection > _tokHO
Definition: LaserTask.h:54
std::vector< HcalGenericDetId > allPrecisionId() const
Logger _logger
Definition: DQModule.h:55
double _thresh_min_lmsumq
Definition: LaserTask.h:137
virtual void showOverflowY(bool showOverflow)
Definition: Container1D.cc:771
T min(T a, T b)
Definition: MathUtil.h:58
hcaldqm::ContainerXXX< double > _xTimingRefLMSum2
Definition: LaserTask.h:83
virtual void showOverflowX(bool showOverflow)
std::string _name
Definition: DQModule.h:42
int _laserMonCBox
Definition: LaserTask.h:131
HcalElectronicsMap const * _emap
Definition: DQTask.h:81
hcaldqm::ContainerProf1D _cSignalvsBX_SubdetPM
Definition: LaserTask.h:105
hcaldqm::ContainerSingle2D _cSummaryvsLS
Definition: LaserTask.h:152
edm::EDGetTokenT< QIE10DigiCollection > _tokQIE10
Definition: LaserTask.h:55
double _lowHO
Definition: LaserTask.h:72
int const CRATE_uTCA_MIN
Definition: Constants.h:100
hcaldqm::Container2D _cMissing_FEDuTCA
Definition: LaserTask.h:123
void _process(edm::Event const &, edm::EventSetup const &) override
Definition: LaserTask.cc:512
hcaldqm::Container1D _cSignalMean_Subdet
Definition: LaserTask.h:88
double const adc2fC[256]
Definition: Constants.h:253
hcaldqm::ContainerProf1D _cSignalvsLS_SubdetPM
Definition: LaserTask.h:102
hcaldqm::ContainerProf1D _cTimingvsLS_SubdetPM
Definition: LaserTask.h:101
int _laserMonIEta
Definition: LaserTask.h:130
constexpr int samples() const
total number of samples in the digi
bool isFEDHBHE(HcalElectronicsId const &)
Definition: Utilities.cc:156
virtual void book(HcalElectronicsMap const *)
Definition: ContainerXXX.h:87
hcaldqm::ContainerProf2D _cSignalMean_FEDuTCA
Definition: LaserTask.h:116
hcaldqm::Container2D _cTiming_DigivsLaserMon_SubdetPM
Definition: LaserTask.h:146
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
Definition: Container1D.cc:592
uint8_t const EVENTTYPE_LASER
Definition: Constants.h:293
virtual void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fN), int debug=0)
Definition: Container2D.cc:25
hcaldqm::ContainerProf2D _cTimingMean_depth
Definition: LaserTask.h:113
void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="") override
hcaldqm::electronicsmap::ElectronicsMap _ehashmap
Definition: LaserTask.h:63
edm::InputTag _tagLaserMon
Definition: LaserTask.h:126
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
edm::InputTag _taguMN
Definition: LaserTask.h:52
constexpr int samples() const
total number of samples in the digi
void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fEnergy), int debug=0) override
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: LaserTask.cc:752
void setBinContent(HcalDetId const &, int) override
Definition: Container2D.cc:163
std::string const & label() const
Definition: InputTag.h:36
std::vector< int > _vLaserMonIPhi
Definition: LaserTask.h:129
EventID const & id() const
int _xMissingLaserMon
Definition: LaserTask.h:138
virtual STDTYPE & get(HcalDetId const &)
Definition: ContainerXXX.h:197
edm::ESHandle< HcalDbService > _dbService
Definition: DQTask.h:80
std::vector< int > getFEDList(HcalElectronicsMap const *)
Definition: Utilities.cc:97
edm::EDGetTokenT< HcalUMNioDigi > _tokuMN
Definition: LaserTask.h:56
std::vector< int > getFEDuTCAList(HcalElectronicsMap const *)
Definition: Utilities.cc:135
hcaldqm::Container1D _cSignalRMS_Subdet
Definition: LaserTask.h:89
void fill(HcalDetId const &) override
Definition: Container2D.cc:52
virtual void initialize(FilterType ftype, hashfunctions::HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:17
std::string _subsystem
Definition: DQModule.h:49
int getRBX(uint32_t iphi)
Definition: Utilities.cc:234
bool isFEDHO(HcalElectronicsId const &)
Definition: Utilities.cc:182
std::vector< uint32_t > _vcdaqEids
Definition: DQTask.h:69
hcaldqm::ContainerSingleProf1D _cLaserMonSumQ_Event
Definition: LaserTask.h:144
hcaldqm::ContainerXXX< double > _xTimingSum2
Definition: LaserTask.h:81
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:81
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:567
int col
Definition: cuy.py:1009
hcaldqm::ContainerProf2D _cSignalRMS_depth
Definition: LaserTask.h:110
hcaldqm::filter::HashFilter _filter_VME
Definition: LaserTask.h:65
Readout chain identification for Hcal.
std::string const & instance() const
Definition: InputTag.h:37
hcaldqm::ContainerProf1D _cTimingvsBX_SubdetPM
Definition: LaserTask.h:104
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
bool isFEDHF(HcalElectronicsId const &)
Definition: Utilities.cc:170
RunNumber_t run() const
Definition: RunAuxiliary.h:31
LaserTask(edm::ParameterSet const &)
Definition: LaserTask.cc:6
int const SLOT_uTCA_MIN
Definition: Constants.h:107
Definition: Run.h:45
uint16_t *__restrict__ uint16_t const *__restrict__ adc
hcaldqm::ContainerProf2D _cTimingRMS_depth
Definition: LaserTask.h:114
edm::InputTag _tagQIE10
Definition: LaserTask.h:51
constexpr DetId detid() const
Get the detector id.
double sumQ(DIGI const &digi, double ped, int i=0, int j=3)
Definition: Utilities.h:127