CMS 3D CMS Logo

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  _nevents = ps.getUntrackedParameter<int>("nevents", 2000);
8 
9  // tags
10  _tagQIE11 = ps.getUntrackedParameter<edm::InputTag>("tagHE", edm::InputTag("hcalDigis"));
11  _tagHO = ps.getUntrackedParameter<edm::InputTag>("tagHO", edm::InputTag("hcalDigis"));
12  _tagQIE10 = ps.getUntrackedParameter<edm::InputTag>("tagHF", edm::InputTag("hcalDigis"));
13  _taguMN = ps.getUntrackedParameter<edm::InputTag>("taguMN", edm::InputTag("hcalDigis"));
14  _tagLaserMon = ps.getUntrackedParameter<edm::InputTag>("tagLaserMon", edm::InputTag("LASERMON"));
15  _tokQIE11 = consumes<QIE11DigiCollection>(_tagQIE11);
16  _tokHO = consumes<HODigiCollection>(_tagHO);
17  _tokQIE10 = consumes<QIE10DigiCollection>(_tagQIE10);
18  _tokuMN = consumes<HcalUMNioDigi>(_taguMN);
19  _tokLaserMon = consumes<QIE10DigiCollection>(_tagLaserMon);
20 
21  _vflags.resize(nLaserFlag);
22  _vflags[fBadTiming] = hcaldqm::flag::Flag("BadTiming");
23  _vflags[fMissingLaserMon] = hcaldqm::flag::Flag("MissingLaserMon");
24 
25  // constants
26  _lowHBHE = ps.getUntrackedParameter<double>("lowHBHE", 50);
27  _lowHO = ps.getUntrackedParameter<double>("lowHO", 100);
28  _lowHF = ps.getUntrackedParameter<double>("lowHF", 50);
29  _laserType = (uint32_t)ps.getUntrackedParameter<uint32_t>("laserType");
30 
31  // Laser mon digi ordering list
32  _vLaserMonIPhi = ps.getUntrackedParameter<std::vector<int>>("vLaserMonIPhi");
33  _laserMonIEta = ps.getUntrackedParameter<int>("laserMonIEta");
34  _laserMonCBox = ps.getUntrackedParameter<int>("laserMonCBox");
35  _laserMonDigiOverlap = ps.getUntrackedParameter<int>("laserMonDigiOverlap");
36  _laserMonTS0 = ps.getUntrackedParameter<int>("laserMonTS0");
37  _laserMonThreshold = ps.getUntrackedParameter<double>("laserMonThreshold", 1.e5);
38  _thresh_frac_timingreflm = ps.getUntrackedParameter<double>("_thresh_frac_timingreflm", 0.01);
39  _thresh_min_lmsumq = ps.getUntrackedParameter<double>("thresh_min_lmsumq", 50000.);
40 
41  std::vector<double> vTimingRangeHB =
42  ps.getUntrackedParameter<std::vector<double>>("thresh_timingreflm_HB", std::vector<double>({-70, -10.}));
43  std::vector<double> vTimingRangeHE =
44  ps.getUntrackedParameter<std::vector<double>>("thresh_timingreflm_HE", std::vector<double>({-60., 0.}));
45  std::vector<double> vTimingRangeHO =
46  ps.getUntrackedParameter<std::vector<double>>("thresh_timingreflm_HO", std::vector<double>({-50., 20.}));
47  std::vector<double> vTimingRangeHF =
48  ps.getUntrackedParameter<std::vector<double>>("thresh_timingreflm_HF", std::vector<double>({-50., 20.}));
49  _thresh_timingreflm[HcalBarrel] = std::make_pair(vTimingRangeHB[0], vTimingRangeHB[1]);
50  _thresh_timingreflm[HcalEndcap] = std::make_pair(vTimingRangeHE[0], vTimingRangeHE[1]);
51  _thresh_timingreflm[HcalOuter] = std::make_pair(vTimingRangeHO[0], vTimingRangeHO[1]);
52  _thresh_timingreflm[HcalForward] = std::make_pair(vTimingRangeHF[0], vTimingRangeHF[1]);
53 }
54 
55 /* virtual */ void LaserTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
56  if (_ptype == fLocal)
57  if (r.runAuxiliary().run() == 1)
58  return;
59 
60  DQTask::bookHistograms(ib, r, es);
61 
63  es.get<HcalDbRecord>().get(dbService);
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  "SignalMean",
122  0);
124  "SignalRMS",
129  0);
131  "SignalRMS",
136  0);
138  "TimingMean",
143  0);
145  "TimingMean",
150  0);
152  "TimingRMS",
157  0);
159  "TimingRMS",
164  0);
166  "Missing",
171  0);
173  "Missing",
178  0);
179 
181  "Shape",
185  0);
186  }
188  "TimingvsEvent",
192  0);
194  "SignalvsEvent",
198  0);
200  "TimingvsLS",
204  0);
206  "SignalvsLS",
210  0);
212  "TimingvsBX",
216  0);
218  "SignalvsBX",
222  0);
223 
225  "SignalMean",
230  0);
232  "SignalRMS",
237  0);
239  "TimingMean",
244  0);
246  "TimingRMS",
251  0);
252 
254  "Missing",
259  0);
260 
261  // initialize compact containers
267 
268  // LaserMon containers
269  if (_ptype == fOnline || _ptype == fLocal) {
271  "LaserMonSumQ",
274  0);
276 
278  "LaserMonTiming",
281  0);
283 
284  if (_ptype == fOnline) {
286  "LaserMonSumQ_LS",
290  "LaserMonTiming_LS",
294  "TimingDiff_DigiMinusLaserMon",
299  0);
301  } else if (_ptype == fLocal) {
303  "LaserMonSumQ_Event",
307  "LaserMonTiming_Event",
311  "TimingDiff_DigiMinusLaserMon",
316  0);
318  }
320  _name,
321  "Timing_DigivsLaserMon",
326  0);
329 
334  _xMissingLaserMon = 0;
335 
336  std::vector<int> vFEDs = hcaldqm::utilities::getFEDList(_emap);
337  std::vector<int> vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap);
338  std::vector<int> vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap);
339  for (std::vector<int>::const_iterator it = vFEDsVME.begin(); it != vFEDsVME.end(); ++it)
340  _vhashFEDs.push_back(
342  for (std::vector<int>::const_iterator it = vFEDsuTCA.begin(); it != vFEDsuTCA.end(); ++it) {
343  std::pair<uint16_t, uint16_t> cspair = utilities::fed2crate(*it);
344  _vhashFEDs.push_back(HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
345  }
346 
348  "SummaryvsLS",
353  0);
355  "SummaryvsLS",
359  0);
360  } // End if (_ptype == fOnline || _ptype == fLocal) {
361 
362  // BOOK
367 
372 
373  if (_ptype == fLocal) {
376  } else {
381  }
382 
383  if (_ptype == fLocal) { // hidefed2crate
395  }
397 
399 
405 
406  if (_ptype == fOnline || _ptype == fLocal) {
409  if (_ptype == fOnline) {
413  } else if (_ptype == fLocal) {
417  }
422  _xNChs.book(_emap);
425  }
426 
428 }
429 
430 /* virtual */ void LaserTask::_resetMonitors(hcaldqm::UpdateFreq uf) { DQTask::_resetMonitors(uf); }
431 
432 /* virtual */ void LaserTask::_dump() {
441 
442  if (_ptype == fLocal) { // hidefed2crate
451  }
452  if (_ptype != fOffline) {
453  _xNChs.reset();
454  }
455 
456  std::vector<HcalGenericDetId> dids = _emap->allPrecisionId();
457  for (std::vector<HcalGenericDetId>::const_iterator it = dids.begin(); it != dids.end(); ++it) {
458  if (!it->isHcalDetId())
459  continue;
460  HcalDetId did = HcalDetId(it->rawId());
462  int n = _xEntries.get(did);
463  // channels missing or low signal
464  if (n == 0) {
465  _cMissing_depth.fill(did);
466  if (_ptype == fLocal) { // hidefed2crate
467  if (eid.isVMEid())
469  else
471  }
472  continue;
473  }
474 
475  _xNChs.get(eid)++;
476 
477  double msig = _xSignalSum.get(did) / n;
478  double mtim = _xTimingSum.get(did) / n;
479  double rsig = sqrt(_xSignalSum2.get(did) / n - msig * msig);
480  double rtim = sqrt(_xTimingSum2.get(did) / n - mtim * mtim);
481 
482  _cSignalMean_Subdet.fill(did, msig);
483  _cSignalMean_depth.fill(did, msig);
484  _cSignalRMS_Subdet.fill(did, rsig);
485  _cSignalRMS_depth.fill(did, rsig);
486  _cTimingMean_Subdet.fill(did, mtim);
487  _cTimingMean_depth.fill(did, mtim);
488  _cTimingRMS_Subdet.fill(did, rtim);
489  _cTimingRMS_depth.fill(did, rtim);
490  if (_ptype == fLocal) { // hidefed2crate
491  if (eid.isVMEid()) {
493  _cSignalRMS_FEDVME.fill(eid, rsig);
495  _cTimingRMS_FEDVME.fill(eid, rtim);
496  } else {
501  }
502  }
503 
504  // Bad timing
505 
506  double timingreflm_mean = _xTimingRefLMSum.get(did) / n;
507  //double timingreflm_rms = sqrt(_xTimingRefLMSum2.get(did) / n - timingreflm_mean * timingreflm_mean);
508 
509  if ((timingreflm_mean < _thresh_timingreflm[did.subdet()].first) ||
510  (timingreflm_mean > _thresh_timingreflm[did.subdet()].second)) {
512  }
513  }
514  if (_ptype != fOffline) { // hidefed2crate
515  for (std::vector<uint32_t>::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) {
516  hcaldqm::flag::Flag fSum("LASER");
518  std::vector<uint32_t>::const_iterator jt = std::find(_vcdaqEids.begin(), _vcdaqEids.end(), (*it));
519  if (jt == _vcdaqEids.end()) {
520  // not @cDAQ
521  for (uint32_t iflag = 0; iflag < _vflags.size(); iflag++)
524  continue;
525  }
526  // @cDAQ
528  int min_nchs = 10;
529  if (_xNChs.get(eid) < min_nchs) {
531  } else {
532  double frbadtimingreflm = double(_xNBadTimingRefLM.get(eid)) / double(_xNChs.get(eid));
533  if (frbadtimingreflm > _thresh_frac_timingreflm) {
535  } else {
537  }
538  }
539  if (_xMissingLaserMon) {
541  } else {
543  }
544  }
545 
546  // Set SummaryVsLS bins
547  int iflag = 0;
548  for (std::vector<hcaldqm::flag::Flag>::iterator ft = _vflags.begin(); ft != _vflags.end(); ++ft) {
549  _cSummaryvsLS_FED.setBinContent(eid, _currentLS, iflag, int(ft->_state));
550  fSum += (*ft);
551  iflag++;
552  ft->reset();
553  }
555  } // End loop over FEDs
556 
557  // Reset per-LS containers
559  _xMissingLaserMon = 0;
560  } // End if _ptype != fOffline
561 }
562 
563 /* virtual */ void LaserTask::_process(edm::Event const& e, edm::EventSetup const& es) {
567 
568  if (!e.getByToken(_tokQIE11, c_QIE11))
569  _logger.dqmthrow("Collection QIE11DigiCollection isn't available " + _tagQIE11.label() + " " + _tagQIE11.instance());
570  if (!e.getByToken(_tokHO, c_ho))
571  _logger.dqmthrow("Collection HODigiCollection isn't available " + _tagHO.label() + " " + _tagHO.instance());
572  if (!e.getByToken(_tokQIE10, c_QIE10))
573  _logger.dqmthrow("Collection QIE10DigiCollection isn't available " + _tagQIE10.label() + " " + _tagQIE10.instance());
574 
575  // int currentEvent = e.eventAuxiliary().id().event();
576  int bx = e.bunchCrossing();
577 
578  // LASERMON
580  if (!e.getByToken(_tokLaserMon, cLaserMon)) {
581  _logger.dqmthrow("QIE10DigiCollection for laserMonDigis isn't available.");
582  }
583  std::vector<int> laserMonADC;
584  processLaserMon(cLaserMon, laserMonADC);
585 
586  // SumQ = peak +/- 3 TSes
587  // Timing = fC-weighted average (TS-TS0) * 25 ns, also in peak +/- 3 TSes
588  int peakTS = -1;
589  double peakLaserMonADC = -1;
590  for (unsigned int iTS = 0; iTS < laserMonADC.size(); ++iTS) {
591  if (laserMonADC[iTS] > peakLaserMonADC) {
592  peakLaserMonADC = laserMonADC[iTS];
593  peakTS = iTS;
594  }
595  }
596 
597  double laserMonSumQ = 0;
598  double laserMonTiming = 0.;
599 
600  if (peakTS >= 0) {
601  int minTS = std::max(0, peakTS - 3);
602  int maxTS = std::min(int(laserMonADC.size() - 1), peakTS + 3);
603  for (int iTS = minTS; iTS <= maxTS; ++iTS) {
604  double this_fC = hcaldqm::constants::adc2fC[laserMonADC[iTS]];
605  laserMonSumQ += this_fC;
606  laserMonTiming += 25. * (iTS - _laserMonTS0) * this_fC;
607  }
608  }
609  if (laserMonSumQ > 0.) {
610  laserMonTiming = laserMonTiming / laserMonSumQ;
611  } else {
613  }
614 
615  if (laserMonSumQ > _laserMonThreshold) {
616  _cLaserMonSumQ.fill(laserMonSumQ);
617  _cLaserMonTiming.fill(laserMonTiming);
618  if (_ptype == fOnline) {
619  _cLaserMonSumQ_LS.fill(_currentLS, laserMonSumQ);
620  _cLaserMonTiming_LS.fill(_currentLS, laserMonTiming);
621  } else if (_ptype == fLocal) {
622  int currentEvent = e.eventAuxiliary().id().event();
623  _cLaserMonSumQ_Event.fill(currentEvent, laserMonSumQ);
624  _cLaserMonTiming_Event.fill(currentEvent, laserMonTiming);
625  }
626  }
627 
628  for (QIE11DigiCollection::const_iterator it = c_QIE11->begin(); it != c_QIE11->end(); ++it) {
629  const QIE11DataFrame digi = static_cast<const QIE11DataFrame>(*it);
630  HcalDetId const& did = digi.detid();
631  if ((did.subdet() != HcalBarrel) && (did.subdet() != HcalEndcap)) {
632  continue;
633  }
634  uint32_t rawid = _ehashmap.lookup(did);
635  HcalElectronicsId const& eid(rawid);
636 
637  CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<QIE11DataFrame>(_dbService, did, digi);
638  //double sumQ = hcaldqm::utilities::sumQ_v10<QIE11DataFrame>(digi, 2.5, 0, digi.samples()-1);
639  double sumQ = hcaldqm::utilities::sumQDB<QIE11DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples() - 1);
640  if (sumQ < _lowHBHE)
641  continue;
642 
643  //double aveTS = hcaldqm::utilities::aveTS_v10<QIE11DataFrame>(digi, 2.5, 0,digi.samples()-1);
644  double aveTS = hcaldqm::utilities::aveTSDB<QIE11DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples() - 1);
645  _xSignalSum.get(did) += sumQ;
646  _xSignalSum2.get(did) += sumQ * sumQ;
647  _xTimingSum.get(did) += aveTS;
648  _xTimingSum2.get(did) += aveTS * aveTS;
649  _xEntries.get(did)++;
650 
651  for (int i = 0; i < digi.samples(); i++) {
652  if (_ptype == fLocal) {
654  eid, i, hcaldqm::utilities::adc2fCDBMinusPedestal<QIE11DataFrame>(_dbService, digi_fC, did, digi, i));
655  }
656  _cADC_SubdetPM.fill(did, digi[i].adc());
657  }
658 
659  // select based on local global
660  double digiTimingSOI = (aveTS - digi.presamples()) * 25.;
661  double deltaTiming = digiTimingSOI - laserMonTiming;
662  _cTiming_DigivsLaserMon_SubdetPM.fill(did, laserMonTiming, digiTimingSOI);
663  _xTimingRefLMSum.get(did) += deltaTiming;
664  _xTimingRefLMSum2.get(did) += deltaTiming * deltaTiming;
665  if (_ptype == fLocal) {
666  int currentEvent = e.eventAuxiliary().id().event();
667  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
668  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
669  _cTimingDiffEvent_SubdetPM.fill(did, currentEvent, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming);
670  } else {
673  _cTimingvsBX_SubdetPM.fill(did, bx, aveTS);
674  _cSignalvsBX_SubdetPM.fill(did, bx, sumQ);
675  _cTimingDiffLS_SubdetPM.fill(did, _currentLS, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming);
676  }
677  }
678  for (HODigiCollection::const_iterator it = c_ho->begin(); it != c_ho->end(); ++it) {
679  const HODataFrame digi = (const HODataFrame)(*it);
680  double sumQ = hcaldqm::utilities::sumQ<HODataFrame>(digi, 8.5, 0, digi.size() - 1);
681  if (sumQ < _lowHO)
682  continue;
683  HcalDetId did = digi.id();
684  HcalElectronicsId eid = digi.elecId();
685 
686  double aveTS = hcaldqm::utilities::aveTS<HODataFrame>(digi, 8.5, 0, digi.size() - 1);
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.size(); i++) {
694  if (_ptype == fLocal) { // hidefed2crate
695  _cShapeCut_FEDSlot.fill(eid, i, digi.sample(i).nominal_fC() - 8.5);
696  }
697  _cADC_SubdetPM.fill(did, digi.sample(i).adc());
698  }
699 
700  // select based on local global
701  double digiTimingSOI = (aveTS - digi.presamples()) * 25.;
702  double deltaTiming = digiTimingSOI - laserMonTiming;
703  _cTiming_DigivsLaserMon_SubdetPM.fill(did, laserMonTiming, digiTimingSOI);
704  _xTimingRefLMSum.get(did) += deltaTiming;
705  _xTimingRefLMSum2.get(did) += deltaTiming * deltaTiming;
706  if (_ptype == fLocal) {
707  int currentEvent = e.eventAuxiliary().id().event();
708  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
709  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
710  _cTimingDiffEvent_SubdetPM.fill(did, currentEvent, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming);
711  } else {
714  _cTimingvsBX_SubdetPM.fill(did, bx, aveTS);
715  _cSignalvsBX_SubdetPM.fill(did, bx, sumQ);
717  }
718  }
719  for (QIE10DigiCollection::const_iterator it = c_QIE10->begin(); it != c_QIE10->end(); ++it) {
720  const QIE10DataFrame digi = (const QIE10DataFrame)(*it);
721  HcalDetId did = digi.detid();
722  if (did.subdet() != HcalForward) {
723  continue;
724  }
726 
727  CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<QIE10DataFrame>(_dbService, did, digi);
728  double sumQ = hcaldqm::utilities::sumQDB<QIE10DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples() - 1);
729  //double sumQ = hcaldqm::utilities::sumQ_v10<QIE10DataFrame>(digi, 2.5, 0, digi.samples()-1);
730  if (sumQ < _lowHF)
731  continue;
732 
733  //double aveTS = hcaldqm::utilities::aveTS_v10<QIE10DataFrame>(digi, 2.5, 0, digi.samples()-1);
734  double aveTS = hcaldqm::utilities::aveTSDB<QIE10DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples() - 1);
735 
736  _xSignalSum.get(did) += sumQ;
737  _xSignalSum2.get(did) += sumQ * sumQ;
738  _xTimingSum.get(did) += aveTS;
739  _xTimingSum2.get(did) += aveTS * aveTS;
740  _xEntries.get(did)++;
741 
742  for (int i = 0; i < digi.samples(); i++) {
743  if (_ptype == fLocal) { // hidefed2crate
745  eid, (int)i, hcaldqm::utilities::adc2fCDBMinusPedestal<QIE10DataFrame>(_dbService, digi_fC, did, digi, i));
746  }
747  _cADC_SubdetPM.fill(did, digi[i].adc());
748  }
749 
750  // select based on local global
751  double digiTimingSOI = (aveTS - digi.presamples()) * 25.;
752  double deltaTiming = digiTimingSOI - laserMonTiming;
753  _cTiming_DigivsLaserMon_SubdetPM.fill(did, laserMonTiming, digiTimingSOI);
754  _xTimingRefLMSum.get(did) += deltaTiming;
755  _xTimingRefLMSum2.get(did) += deltaTiming * deltaTiming;
756  if (_ptype == fLocal) {
757  int currentEvent = e.eventAuxiliary().id().event();
758  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
759  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
760  _cTimingDiffEvent_SubdetPM.fill(did, currentEvent, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming);
761  } else {
764  _cTimingvsBX_SubdetPM.fill(did, bx, aveTS);
765  _cSignalvsBX_SubdetPM.fill(did, bx, sumQ);
766  _cTimingDiffLS_SubdetPM.fill(did, _currentLS, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming);
767  }
768  }
769 }
770 
771 void LaserTask::processLaserMon(edm::Handle<QIE10DigiCollection>& col, std::vector<int>& iLaserMonADC) {
772  for (QIE10DigiCollection::const_iterator it = col->begin(); it != col->end(); ++it) {
773  const QIE10DataFrame digi = (const QIE10DataFrame)(*it);
774  HcalCalibDetId hcdid(digi.id());
775 
776  if ((hcdid.ieta() != _laserMonIEta) || (hcdid.cboxChannel() != _laserMonCBox)) {
777  continue;
778  }
779 
780  unsigned int digiIndex =
781  std::find(_vLaserMonIPhi.begin(), _vLaserMonIPhi.end(), hcdid.iphi()) - _vLaserMonIPhi.begin();
782  if (digiIndex == _vLaserMonIPhi.size()) {
783  continue;
784  }
785 
786  // First digi: initialize the vectors to -1 (need to know the length of the digi)
787  if (iLaserMonADC.empty()) {
788  int totalNSamples = (digi.samples() - _laserMonDigiOverlap) * _vLaserMonIPhi.size();
789  for (int i = 0; i < totalNSamples; ++i) {
790  iLaserMonADC.push_back(-1);
791  }
792  }
793 
794  for (int subindex = 0; subindex < digi.samples() - _laserMonDigiOverlap; ++subindex) {
795  int totalIndex = (digi.samples() - _laserMonDigiOverlap) * digiIndex + subindex;
796  iLaserMonADC[totalIndex] = (digi[subindex].ok() ? digi[subindex].adc() : -1);
797  }
798  }
799 }
800 
801 /* virtual */ void LaserTask::endLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) {
802  if (_ptype == fLocal)
803  return;
804  this->_dump();
805 
806  DQTask::endLuminosityBlock(lb, es);
807 }
808 
809 /* virtual */ bool LaserTask::_isApplicable(edm::Event const& e) {
810  if (_ptype != fOnline)
811  return true;
812  else {
813  // fOnline mode
815  if (!e.getByToken(_tokuMN, cumn))
816  return false;
817 
818  // event type check first
819  uint8_t eventType = cumn->eventType();
820  if (eventType != constants::EVENTTYPE_LASER)
821  return false;
822 
823  // check if this analysis task is of the right laser type
824  uint32_t laserType = cumn->valueUserWord(0);
825  if (laserType == _laserType)
826  return true;
827  }
828 
829  return false;
830 }
831 
int samples() const
total number of samples in the digi
void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *, int debug=0) override
DetId detid() const
Get the detector id.
constexpr uint32_t rawId() const
edm::InputTag _tagQIE11
Definition: LaserTask.h:49
EventNumber_t event() const
Definition: EventID.h:41
hcaldqm::ContainerProf1D _cShapeCut_FEDSlot
Definition: LaserTask.h:97
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:114
hcaldqm::ContainerProf1D _cSignalvsEvent_SubdetPM
Definition: LaserTask.h:99
bool _isApplicable(edm::Event const &) override
Definition: LaserTask.cc:809
hcaldqm::ContainerSingle1D _cLaserMonTiming
Definition: LaserTask.h:145
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
EventAuxiliary const & eventAuxiliary() const override
Definition: Event.h:92
std::vector< hcaldqm::flag::Flag > _vflags
Definition: LaserTask.h:59
double _lowHF
Definition: LaserTask.h:72
int const CRATE_VME_MIN
Definition: Constants.h:91
int maxTS(DIGI const &digi, double ped=0)
Definition: Utilities.h:102
hcaldqm::ContainerProf2D _cTimingMean_FEDuTCA
Definition: LaserTask.h:118
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
hcaldqm::ContainerXXX< int > _xNBadTimingRefLM
Definition: LaserTask.h:83
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:146
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
hcaldqm::ContainerXXX< double > _xSignalSum2
Definition: LaserTask.h:77
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:65
hcaldqm::ContainerXXX< double > _xTimingRefLMSum
Definition: LaserTask.h:81
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
hcaldqm::ContainerXXX< int > _xEntries
Definition: LaserTask.h:78
hcaldqm::Container1D _cTimingRMS_Subdet
Definition: LaserTask.h:92
double _lowHBHE
Definition: LaserTask.h:69
uint32_t _laserType
Definition: LaserTask.h:73
UpdateFreq
Definition: DQTask.h:16
double _laserMonThreshold
Definition: LaserTask.h:138
virtual void _dump()
Definition: LaserTask.cc:432
State _state
Definition: Flag.h:62
std::vector< T >::const_iterator const_iterator
hcaldqm::ContainerProf1D _cTimingvsEvent_SubdetPM
Definition: LaserTask.h:98
hcaldqm::ContainerProf2D _cSignalRMS_FEDVME
Definition: LaserTask.h:119
double _thresh_frac_timingreflm
Definition: LaserTask.h:140
int bunchCrossing() const
Definition: EventBase.h:64
edm::DataFrame::id_type id() const
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:116
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
const_iterator begin() const
virtual void reset()
Definition: ContainerXXX.h:292
void _resetMonitors(hcaldqm::UpdateFreq) override
Definition: LaserTask.cc:430
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
int const FIBER_VME_MIN
Definition: Constants.h:121
hcaldqm::ContainerXXX< double > _xSignalSum
Definition: LaserTask.h:76
hcaldqm::ContainerXXX< double > _xTimingSum
Definition: LaserTask.h:79
hcaldqm::Container2D _cMissing_depth
Definition: LaserTask.h:125
void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *qy=new quantity::ValueQuantity(quantity::fN), int debug=0) override
hcaldqm::Container2D _cMissing_FEDVME
Definition: LaserTask.h:126
hcaldqm::ContainerProf2D _cSignalMean_depth
Definition: LaserTask.h:108
hcaldqm::ContainerSingleProf1D _cLaserMonTiming_LS
Definition: LaserTask.h:147
int const FIBERCH_MIN
Definition: Constants.h:130
int _laserMonTS0
Definition: LaserTask.h:137
edm::InputTag _tagHO
Definition: LaserTask.h:50
hcaldqm::Container1D _cADC_SubdetPM
Definition: LaserTask.h:94
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
std::vector< int > getFEDVMEList(HcalElectronicsMap const *)
Definition: Utilities.cc:101
hcaldqm::Container2D _cSummaryvsLS_FED
Definition: LaserTask.h:155
hcaldqm::ContainerProf2D _cTimingRMS_FEDVME
Definition: LaserTask.h:121
hcaldqm::ContainerProf2D _cTimingDiffLS_SubdetPM
Definition: LaserTask.h:151
hcaldqm::ContainerProf2D _cSignalMean_FEDVME
Definition: LaserTask.h:115
hcaldqm::Container1D _cTimingMean_Subdet
Definition: LaserTask.h:91
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: LaserTask.cc:55
int _laserMonDigiOverlap
Definition: LaserTask.h:136
ProcessingType _ptype
Definition: DQModule.h:43
virtual void fill(uint32_t)
Definition: Container1D.cc:73
virtual void reset()
Definition: Container1D.cc:60
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
hcaldqm::ContainerProf2D _cTimingRMS_FEDuTCA
Definition: LaserTask.h:122
hcaldqm::ContainerProf2D _cSignalRMS_FEDuTCA
Definition: LaserTask.h:120
edm::EDGetTokenT< QIE10DigiCollection > _tokLaserMon
Definition: LaserTask.h:131
std::map< HcalSubdetector, std::pair< double, double > > _thresh_timingreflm
Definition: LaserTask.h:139
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:771
virtual void setBinContent(int, int, int)
hcaldqm::ContainerProf2D _cTimingDiffEvent_SubdetPM
Definition: LaserTask.h:152
hcaldqm::ContainerSingleProf1D _cLaserMonSumQ_LS
Definition: LaserTask.h:146
void dqmthrow(std::string const &msg) const
Definition: Logger.h:12
uint32_t valueUserWord(int iword) const
hcaldqm::filter::HashFilter _filter_uTCA
Definition: LaserTask.h:63
hcaldqm::ContainerXXX< int > _xNChs
Definition: LaserTask.h:84
int const FED_VME_MIN
Definition: Constants.h:78
T sqrt(T t)
Definition: SSEVec.h:18
edm::EDGetTokenT< QIE11DigiCollection > _tokQIE11
Definition: LaserTask.h:53
hcaldqm::ContainerSingleProf1D _cLaserMonTiming_Event
Definition: LaserTask.h:149
hcaldqm::ContainerProf2D _cTimingMean_FEDVME
Definition: LaserTask.h:117
int _nevents
Definition: LaserTask.h:68
virtual void showOverflowX(bool showOverflow)
Definition: Container1D.cc:775
int size() const
total number of samples in the digi
Definition: HODataFrame.h:31
hcaldqm::ContainerSingle1D _cLaserMonSumQ
Definition: LaserTask.h:144
uint8_t eventType() const
int const FIBER_uTCA_MIN1
Definition: Constants.h:124
edm::EDGetTokenT< HODigiCollection > _tokHO
Definition: LaserTask.h:54
DetId detid() const
Get the detector id.
std::vector< HcalGenericDetId > allPrecisionId() const
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: LaserTask.cc:801
Logger _logger
Definition: DQModule.h:54
double _thresh_min_lmsumq
Definition: LaserTask.h:141
virtual void showOverflowY(bool showOverflow)
Definition: Container1D.cc:777
T min(T a, T b)
Definition: MathUtil.h:58
constexpr int adc(sample_type sample)
get the ADC sample (12 bits)
RunAuxiliary const & runAuxiliary() const override
Definition: Run.h:61
hcaldqm::ContainerXXX< double > _xTimingRefLMSum2
Definition: LaserTask.h:82
virtual void showOverflowX(bool showOverflow)
std::string _name
Definition: DQModule.h:41
int _laserMonCBox
Definition: LaserTask.h:135
HcalElectronicsMap const * _emap
Definition: DQTask.h:59
hcaldqm::ContainerProf1D _cSignalvsBX_SubdetPM
Definition: LaserTask.h:104
hcaldqm::ContainerSingle2D _cSummaryvsLS
Definition: LaserTask.h:156
edm::EDGetTokenT< QIE10DigiCollection > _tokQIE10
Definition: LaserTask.h:55
double _lowHO
Definition: LaserTask.h:71
int const CRATE_uTCA_MIN
Definition: Constants.h:96
hcaldqm::Container2D _cMissing_FEDuTCA
Definition: LaserTask.h:127
void _process(edm::Event const &, edm::EventSetup const &) override
Definition: LaserTask.cc:563
const_iterator end() const
hcaldqm::Container1D _cSignalMean_Subdet
Definition: LaserTask.h:87
double const adc2fC[256]
Definition: Constants.h:248
int iphi() const
get the cell iphi
Definition: HcalDetId.h:161
hcaldqm::ContainerProf1D _cSignalvsLS_SubdetPM
Definition: LaserTask.h:101
hcaldqm::ContainerProf1D _cTimingvsLS_SubdetPM
Definition: LaserTask.h:100
int _laserMonIEta
Definition: LaserTask.h:134
bool isFEDHBHE(HcalElectronicsId const &)
Definition: Utilities.cc:142
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:150
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:288
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:112
void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="") override
hcaldqm::electronicsmap::ElectronicsMap _ehashmap
Definition: LaserTask.h:62
edm::InputTag _tagLaserMon
Definition: LaserTask.h:130
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
edm::InputTag _taguMN
Definition: LaserTask.h:52
void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fEnergy), int debug=0) override
void setBinContent(HcalDetId const &, int) override
Definition: Container2D.cc:163
std::string const & label() const
Definition: InputTag.h:36
const_iterator end() const
std::vector< int > _vLaserMonIPhi
Definition: LaserTask.h:133
EventID const & id() const
int _xMissingLaserMon
Definition: LaserTask.h:142
virtual STDTYPE & get(HcalDetId const &)
Definition: ContainerXXX.h:197
edm::ESHandle< HcalDbService > _dbService
Definition: DQTask.h:58
std::vector< int > getFEDList(HcalElectronicsMap const *)
Definition: Utilities.cc:83
T get() const
Definition: EventSetup.h:71
edm::EDGetTokenT< HcalUMNioDigi > _tokuMN
Definition: LaserTask.h:56
std::vector< int > getFEDuTCAList(HcalElectronicsMap const *)
Definition: Utilities.cc:121
hcaldqm::Container1D _cSignalRMS_Subdet
Definition: LaserTask.h:88
col
Definition: cuy.py:1010
void fill(HcalDetId const &) override
Definition: Container2D.cc:52
const HcalElectronicsMap * getHcalMapping() const
virtual void initialize(FilterType ftype, hashfunctions::HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:17
std::string _subsystem
Definition: DQModule.h:48
int getRBX(uint32_t iphi)
Definition: Utilities.cc:233
bool isFEDHO(HcalElectronicsId const &)
Definition: Utilities.cc:180
std::vector< uint32_t > _vcdaqEids
Definition: DQTask.h:51
hcaldqm::ContainerSingleProf1D _cLaserMonSumQ_Event
Definition: LaserTask.h:148
hcaldqm::ContainerXXX< double > _xTimingSum2
Definition: LaserTask.h:80
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:81
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:558
int samples() const
total number of samples in the digi
hcaldqm::ContainerProf2D _cSignalRMS_depth
Definition: LaserTask.h:109
hcaldqm::filter::HashFilter _filter_VME
Definition: LaserTask.h:64
Readout chain identification for Hcal.
std::string const & instance() const
Definition: InputTag.h:37
hcaldqm::ContainerProf1D _cTimingvsBX_SubdetPM
Definition: LaserTask.h:103
bool isFEDHF(HcalElectronicsId const &)
Definition: Utilities.cc:156
RunNumber_t run() const
Definition: RunAuxiliary.h:41
LaserTask(edm::ParameterSet const &)
Definition: LaserTask.cc:6
int const SLOT_uTCA_MIN
Definition: Constants.h:103
const_iterator begin() const
Definition: Run.h:45
ib
Definition: cuy.py:662
hcaldqm::ContainerProf2D _cTimingRMS_depth
Definition: LaserTask.h:113
edm::InputTag _tagQIE10
Definition: LaserTask.h:51
double sumQ(DIGI const &digi, double ped, int i=0, int j=3)
Definition: Utilities.h:126