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  DQTask(ps)
8 {
9  _nevents = ps.getUntrackedParameter<int>("nevents", 2000);
10 
11  // tags
13  edm::InputTag("hcalDigis"));
15  edm::InputTag("hcalDigis"));
17  edm::InputTag("hcalDigis"));
19  edm::InputTag("hcalDigis"));
21  edm::InputTag("hcalDigis"));
23  edm::InputTag("LASERMON"));
24  _tokHBHE = consumes<HBHEDigiCollection>(_tagHBHE);
25  _tokHE = consumes<QIE11DigiCollection>(_tagHE);
26  _tokHO = consumes<HODigiCollection>(_tagHO);
27  _tokHF = consumes<QIE10DigiCollection>(_tagHF);
28  _tokuMN = consumes<HcalUMNioDigi>(_taguMN);
29  _tokLaserMon = consumes<QIE10DigiCollection>(_tagLaserMon);
30 
31  _vflags.resize(nLaserFlag);
33  _vflags[fMissingLaserMon]=hcaldqm::flag::Flag("MissingLaserMon");
34 
35  // constants
36  _lowHBHE = ps.getUntrackedParameter<double>("lowHBHE",
37  50);
38  _lowHE = ps.getUntrackedParameter<double>("lowHE",
39  150);
40  _lowHO = ps.getUntrackedParameter<double>("lowHO",
41  100);
42  _lowHF = ps.getUntrackedParameter<double>("lowHF",
43  50);
44  _laserType = (uint32_t)ps.getUntrackedParameter<uint32_t>("laserType");
45 
46  // Laser mon digi ordering list
47  _vLaserMonIPhi = ps.getUntrackedParameter<std::vector<int> >("vLaserMonIPhi");
48  _laserMonIEta = ps.getUntrackedParameter<int>("laserMonIEta");
49  _laserMonCBox = ps.getUntrackedParameter<int>("laserMonCBox");
50  _laserMonDigiOverlap = ps.getUntrackedParameter<int>("laserMonDigiOverlap");
51  _laserMonTS0 = ps.getUntrackedParameter<int>("laserMonTS0");
52  _laserMonThreshold = ps.getUntrackedParameter<double>("laserMonThreshold", 1.e5);
53  _thresh_frac_timingreflm = ps.getUntrackedParameter<double>("_thresh_frac_timingreflm", 0.01);
54  _thresh_min_lmsumq = ps.getUntrackedParameter<double>("thresh_min_lmsumq", 50000.);
55 
56  std::vector<double> vTimingRangeHB = ps.getUntrackedParameter<std::vector<double>>("thresh_timingreflm_HB", std::vector<double>({-70, -10.}));
57  std::vector<double> vTimingRangeHE = ps.getUntrackedParameter<std::vector<double>>("thresh_timingreflm_HE", std::vector<double>({-60., 0.}));
58  std::vector<double> vTimingRangeHO = ps.getUntrackedParameter<std::vector<double>>("thresh_timingreflm_HO", std::vector<double>({-50., 20.}));
59  std::vector<double> vTimingRangeHF = ps.getUntrackedParameter<std::vector<double>>("thresh_timingreflm_HF", std::vector<double>({-50., 20.}));
60  _thresh_timingreflm[HcalBarrel] = std::make_pair(vTimingRangeHB[0], vTimingRangeHB[1]);
61  _thresh_timingreflm[HcalEndcap] = std::make_pair(vTimingRangeHE[0], vTimingRangeHE[1]);
62  _thresh_timingreflm[HcalOuter] = std::make_pair(vTimingRangeHO[0], vTimingRangeHO[1]);
63  _thresh_timingreflm[HcalForward] = std::make_pair(vTimingRangeHF[0], vTimingRangeHF[1]);
64 }
65 
67  edm::Run const& r, edm::EventSetup const& es)
68 {
69  if (_ptype==fLocal)
70  if (r.runAuxiliary().run()==1)
71  return;
72 
73  DQTask::bookHistograms(ib, r, es);
74 
76  es.get<HcalDbRecord>().get(dbService);
77  _emap = dbService->getHcalMapping();
78 
79  std::vector<uint32_t> vhashVME;
80  std::vector<uint32_t> vhashuTCA;
81  std::vector<uint32_t> vhashC36;
82  vhashVME.push_back(HcalElectronicsId(constants::FIBERCH_MIN,
84  vhashuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN,
85  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
87  vhashVME);
89  vhashuTCA);
90 
91  // INITIALIZE
92  _cSignalMean_Subdet.initialize(_name, "SignalMean",
96  _cSignalRMS_Subdet.initialize(_name, "SignalRMS",
100  _cTimingMean_Subdet.initialize(_name, "TimingMean",
104  _cTimingRMS_Subdet.initialize(_name, "TimingRMS",
108 
113 
114  if (_ptype == fLocal) { // hidefed2crate
115  _cSignalMean_FEDVME.initialize(_name, "SignalMean",
120  _cSignalMean_FEDuTCA.initialize(_name, "SignalMean",
125  _cSignalRMS_FEDVME.initialize(_name, "SignalRMS",
130  _cSignalRMS_FEDuTCA.initialize(_name, "SignalRMS",
135  _cTimingMean_FEDVME.initialize(_name, "TimingMean",
140  _cTimingMean_FEDuTCA.initialize(_name, "TimingMean",
145  _cTimingRMS_FEDVME.initialize(_name, "TimingRMS",
150  _cTimingRMS_FEDuTCA.initialize(_name, "TimingRMS",
155  _cMissing_FEDVME.initialize(_name, "Missing",
165 
170  }
171  _cTimingvsEvent_SubdetPM.initialize(_name, "TimingvsEvent",
175  _cSignalvsEvent_SubdetPM.initialize(_name, "SignalvsEvent",
179  _cTimingvsLS_SubdetPM.initialize(_name, "TimingvsLS",
183  _cSignalvsLS_SubdetPM.initialize(_name, "SignalvsLS",
187  _cTimingvsBX_SubdetPM.initialize(_name, "TimingvsBX",
191  _cSignalvsBX_SubdetPM.initialize(_name, "SignalvsBX",
195 
196  _cSignalMean_depth.initialize(_name, "SignalMean",
201  _cSignalRMS_depth.initialize(_name, "SignalRMS",
206  _cTimingMean_depth.initialize(_name, "TimingMean",
211  _cTimingRMS_depth.initialize(_name, "TimingRMS",
216 
217  _cMissing_depth.initialize(_name, "Missing",
222 
223 
224  // initialize compact containers
230 
231  // LaserMon containers
232  if (_ptype == fOnline || _ptype == fLocal) {
234  "LaserMonSumQ",
238 
240  "LaserMonTiming",
244 
245  if (_ptype == fOnline) {
247  "LaserMonSumQ_LS",
250  );
252  "LaserMonTiming_LS",
255  );
256  _cTimingDiffLS_SubdetPM.initialize(_name, "TimingDiff_DigiMinusLaserMon",
262  } else if (_ptype == fLocal) {
264  "LaserMonSumQ_Event",
267  );
269  "LaserMonTiming_Event",
272  );
273  _cTimingDiffEvent_SubdetPM.initialize(_name, "TimingDiff_DigiMinusLaserMon",
279  }
280  _cTiming_DigivsLaserMon_SubdetPM.initialize(_name, "Timing_DigivsLaserMon",
287 
292  _xMissingLaserMon = 0;
293 
294  std::vector<int> vFEDs = hcaldqm::utilities::getFEDList(_emap);
295  std::vector<int> vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap);
296  std::vector<int> vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap);
297  for (std::vector<int>::const_iterator it=vFEDsVME.begin();
298  it!=vFEDsVME.end(); ++it)
300  FIBER_VME_MIN, SPIGOT_MIN, (*it)-FED_VME_MIN).rawId());
301  for (std::vector<int>::const_iterator it=vFEDsuTCA.begin();
302  it!=vFEDsuTCA.end(); ++it)
303  {
304  std::pair<uint16_t, uint16_t> cspair = utilities::fed2crate(*it);
305  _vhashFEDs.push_back(HcalElectronicsId(
306  cspair.first, cspair.second, FIBER_uTCA_MIN1,
307  FIBERCH_MIN, false).rawId());
308  }
309 
310  _cSummaryvsLS_FED.initialize(_name, "SummaryvsLS",
315  _cSummaryvsLS.initialize(_name, "SummaryvsLS",
319  } // End if (_ptype == fOnline || _ptype == fLocal) {
320 
321 
322  // BOOK
327 
332 
333  if (_ptype==fLocal)
334  {
337  }
338  else
339  {
344  }
345 
346  if (_ptype == fLocal) { // hidefed2crate
358  }
360 
362 
368 
369  if (_ptype == fOnline || _ptype == fLocal) {
372  if (_ptype == fOnline) {
376  } else if (_ptype == fLocal) {
380  }
385  _xNChs.book(_emap);
388  }
389 
391 }
392 
394 {
395  DQTask::_resetMonitors(uf);
396 }
397 
398 /* virtual */ void LaserTask::_dump()
399 {
408 
409  if (_ptype == fLocal) { // hidefed2crate
418  }
419  if (_ptype != fOffline) {
420  _xNChs.reset();
421  }
422 
423  std::vector<HcalGenericDetId> dids = _emap->allPrecisionId();
424  for (std::vector<HcalGenericDetId>::const_iterator it=dids.begin();
425  it!=dids.end(); ++it)
426  {
427  if (!it->isHcalDetId())
428  continue;
429  HcalDetId did = HcalDetId(it->rawId());
431  int n = _xEntries.get(did);
432  // channels missing or low signal
433  if (n == 0) {
434  _cMissing_depth.fill(did);
435  if (_ptype == fLocal) { // hidefed2crate
436  if (eid.isVMEid())
438  else
440  }
441  continue;
442  }
443 
444  _xNChs.get(eid)++;
445 
446  double msig = _xSignalSum.get(did)/n;
447  double mtim = _xTimingSum.get(did)/n;
448  double rsig = sqrt(_xSignalSum2.get(did)/n-msig*msig);
449  double rtim = sqrt(_xTimingSum2.get(did)/n-mtim*mtim);
450 
451  _cSignalMean_Subdet.fill(did, msig);
452  _cSignalMean_depth.fill(did, msig);
453  _cSignalRMS_Subdet.fill(did, rsig);
454  _cSignalRMS_depth.fill(did, rsig);
455  _cTimingMean_Subdet.fill(did, mtim);
456  _cTimingMean_depth.fill(did, mtim);
457  _cTimingRMS_Subdet.fill(did, rtim);
458  _cTimingRMS_depth.fill(did, rtim);
459  if (_ptype == fLocal) { // hidefed2crate
460  if (eid.isVMEid())
461  {
463  _cSignalRMS_FEDVME.fill(eid, rsig);
465  _cTimingRMS_FEDVME.fill(eid, rtim);
466  }
467  else
468  {
473  }
474  }
475 
476  // Bad timing
477 
478  double timingreflm_mean = _xTimingRefLMSum.get(did) / n;
479  //double timingreflm_rms = sqrt(_xTimingRefLMSum2.get(did) / n - timingreflm_mean * timingreflm_mean);
480 
481  if ((timingreflm_mean < _thresh_timingreflm[did.subdet()].first) || (timingreflm_mean > _thresh_timingreflm[did.subdet()].second)) {
483  }
484  }
485  if (_ptype != fOffline) { // hidefed2crate
486  for (std::vector<uint32_t>::const_iterator it=_vhashFEDs.begin(); it!=_vhashFEDs.end(); ++it) {
487  hcaldqm::flag::Flag fSum("LASER");
489  std::vector<uint32_t>::const_iterator jt=
490  std::find(_vcdaqEids.begin(), _vcdaqEids.end(), (*it));
491  if (jt==_vcdaqEids.end())
492  {
493  // not @cDAQ
494  for (
495  uint32_t iflag=0; iflag<_vflags.size(); iflag++)
496  _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag),
497  int(hcaldqm::flag::fNCDAQ));
499  continue;
500  }
501  // @cDAQ
503  int min_nchs = 10;
504  if (_xNChs.get(eid) < min_nchs) {
506  } else {
507  double frbadtimingreflm = double(_xNBadTimingRefLM.get(eid))/double(_xNChs.get(eid));
508  if (frbadtimingreflm > _thresh_frac_timingreflm) {
510  } else {
512  }
513  }
514  if (_xMissingLaserMon) {
516  } else {
518  }
519  }
520 
521  // Set SummaryVsLS bins
522  int iflag=0;
523  for (std::vector<hcaldqm::flag::Flag>::iterator ft=_vflags.begin();
524  ft!=_vflags.end(); ++ft)
525  {
527  int(ft->_state));
528  fSum+=(*ft);
529  iflag++;
530  ft->reset();
531  }
533  } // End loop over FEDs
534 
535  // Reset per-LS containers
537  _xMissingLaserMon = 0;
538  } // End if _ptype != fOffline
539 }
540 
541 /* virtual */ void LaserTask::_process(edm::Event const& e,
542  edm::EventSetup const& es)
543 {
548 
549  if (!e.getByToken(_tokHBHE, chbhe))
550  _logger.dqmthrow("Collection HBHEDigiCollection isn't available "
551  + _tagHBHE.label() + " " + _tagHBHE.instance());
552  if (!e.getByToken(_tokHE, cHE))
553  _logger.dqmthrow("Collection QIE11DigiCollection isn't available "
554  + _tagHE.label() + " " + _tagHE.instance());
555  if (!e.getByToken(_tokHO, cho))
556  _logger.dqmthrow("Collection HODigiCollection isn't available "
557  + _tagHO.label() + " " + _tagHO.instance());
558  if (!e.getByToken(_tokHF, chf))
559  _logger.dqmthrow("Collection QIE10DigiCollection isn't available "
560  + _tagHF.label() + " " + _tagHF.instance());
561 
562 // int currentEvent = e.eventAuxiliary().id().event();
563  int bx = e.bunchCrossing();
564 
565 
566  // LASERMON
568  if (!e.getByToken(_tokLaserMon, cLaserMon)) {
569  _logger.dqmthrow("QIE10DigiCollection for laserMonDigis isn't available.");
570  }
571  std::vector<int> laserMonADC;
572  processLaserMon(cLaserMon, laserMonADC);
573 
574  // SumQ = peak +/- 3 TSes
575  // Timing = fC-weighted average (TS-TS0) * 25 ns, also in peak +/- 3 TSes
576  int peakTS = -1;
577  double peakLaserMonADC = -1;
578  for (unsigned int iTS = 0; iTS < laserMonADC.size(); ++iTS) {
579  if (laserMonADC[iTS] > peakLaserMonADC) {
580  peakLaserMonADC = laserMonADC[iTS];
581  peakTS = iTS;
582  }
583  }
584 
585  double laserMonSumQ = 0;
586  double laserMonTiming = 0.;
587 
588  if (peakTS >= 0) {
589  int minTS = std::max(0, peakTS - 3);
590  int maxTS = std::min(int(laserMonADC.size()-1), peakTS + 3);
591  for (int iTS = minTS; iTS <= maxTS; ++iTS) {
592  double this_fC = hcaldqm::constants::adc2fC[laserMonADC[iTS]];
593  laserMonSumQ += this_fC;
594  laserMonTiming += 25. * (iTS - _laserMonTS0) * this_fC;
595  }
596  }
597  if (laserMonSumQ > 0.) {
598  laserMonTiming = laserMonTiming / laserMonSumQ;
599  } else {
601  }
602 
603  if (laserMonSumQ > _laserMonThreshold) {
604  _cLaserMonSumQ.fill(laserMonSumQ);
605  _cLaserMonTiming.fill(laserMonTiming);
606  if (_ptype == fOnline) {
607  _cLaserMonSumQ_LS.fill(_currentLS, laserMonSumQ);
608  _cLaserMonTiming_LS.fill(_currentLS, laserMonTiming);
609  } else if (_ptype == fLocal) {
610  int currentEvent = e.eventAuxiliary().id().event();
611  _cLaserMonSumQ_Event.fill(currentEvent, laserMonSumQ);
612  _cLaserMonTiming_Event.fill(currentEvent, laserMonTiming);
613  }
614  }
615 
616  for (HBHEDigiCollection::const_iterator it=chbhe->begin();
617  it!=chbhe->end(); ++it)
618  {
619  const HBHEDataFrame digi = (const HBHEDataFrame)(*it);
620  double sumQ = hcaldqm::utilities::sumQ<HBHEDataFrame>(digi, 2.5, 0,
621  digi.size()-1);
622  if (sumQ<_lowHBHE)
623  continue;
624  HcalDetId did = digi.id();
625  HcalElectronicsId eid = digi.elecId();
626 
627  double aveTS = hcaldqm::utilities::aveTS<HBHEDataFrame>(digi, 2.5, 0,
628  digi.size()-1);
629  _xSignalSum.get(did)+=sumQ;
630  _xSignalSum2.get(did)+=sumQ*sumQ;
631  _xTimingSum.get(did)+=aveTS;
632  _xTimingSum2.get(did)+=aveTS*aveTS;
633  _xEntries.get(did)++;
634 
635  for (int i=0; i<digi.size(); i++)
636  {
637  if (_ptype == fLocal) { // hidefed2crate
638  _cShapeCut_FEDSlot.fill(eid, i,
639  digi.sample(i).nominal_fC()-2.5);
640  }
641  _cADC_SubdetPM.fill(did, digi.sample(i).adc());
642  }
643 
644  // select based on local global
645  double digiTimingSOI = (aveTS - digi.presamples()) * 25.;
646  double deltaTiming = digiTimingSOI - laserMonTiming;
647  _cTiming_DigivsLaserMon_SubdetPM.fill(did, laserMonTiming, digiTimingSOI);
648  _xTimingRefLMSum.get(did) += deltaTiming;
649  _xTimingRefLMSum2.get(did) += deltaTiming * deltaTiming;
650  if (_ptype==fLocal) {
651  int currentEvent = e.eventAuxiliary().id().event();
652  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
653  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
654  _cTimingDiffLS_SubdetPM.fill(did, currentEvent, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming);
655  }
656  else {
659  _cTimingvsBX_SubdetPM.fill(did, bx, aveTS);
660  _cSignalvsBX_SubdetPM.fill(did, bx, sumQ);
662  }
663  }
664  for (QIE11DigiCollection::const_iterator it=cHE->begin(); it!=cHE->end();
665  ++it)
666  {
667  const QIE11DataFrame digi = static_cast<const QIE11DataFrame>(*it);
668  HcalDetId const& did = digi.detid();
669  if (did.subdet() != HcalEndcap) {
670  continue;
671  }
672  uint32_t rawid = _ehashmap.lookup(did);
673  HcalElectronicsId const& eid(rawid);
674 
675  CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<QIE11DataFrame>(_dbService, did, digi);
676  //double sumQ = hcaldqm::utilities::sumQ_v10<QIE11DataFrame>(digi, 2.5, 0, digi.samples()-1);
677  double sumQ = hcaldqm::utilities::sumQDB<QIE11DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples()-1);
678  if (sumQ<_lowHE)
679  continue;
680 
681 
682  //double aveTS = hcaldqm::utilities::aveTS_v10<QIE11DataFrame>(digi, 2.5, 0,digi.samples()-1);
683  double aveTS = hcaldqm::utilities::aveTSDB<QIE11DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples()-1);
684  _xSignalSum.get(did)+=sumQ;
685  _xSignalSum2.get(did)+=sumQ*sumQ;
686  _xTimingSum.get(did)+=aveTS;
687  _xTimingSum2.get(did)+=aveTS*aveTS;
688  _xEntries.get(did)++;
689 
690  for (int i=0; i<digi.samples(); i++)
691  {
692  if (_ptype == fLocal) {
693  _cShapeCut_FEDSlot.fill(eid, i, hcaldqm::utilities::adc2fCDBMinusPedestal<QIE11DataFrame>(_dbService, digi_fC, did, digi, i));
694  }
695  _cADC_SubdetPM.fill(did, digi[i].adc());
696  }
697 
698  // select based on local global
699  double digiTimingSOI = (aveTS - digi.presamples()) * 25.;
700  double deltaTiming = digiTimingSOI - laserMonTiming;
701  _cTiming_DigivsLaserMon_SubdetPM.fill(did, laserMonTiming, digiTimingSOI);
702  _xTimingRefLMSum.get(did) += deltaTiming;
703  _xTimingRefLMSum2.get(did) += deltaTiming * deltaTiming;
704  if (_ptype==fLocal)
705  {
706  int currentEvent = e.eventAuxiliary().id().event();
707  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
708  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
709  _cTimingDiffEvent_SubdetPM.fill(did, currentEvent, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming);
710  }
711  else
712  {
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  }
721  it!=cho->end(); ++it)
722  {
723  const HODataFrame digi = (const HODataFrame)(*it);
724  double sumQ = hcaldqm::utilities::sumQ<HODataFrame>(digi, 8.5, 0,
725  digi.size()-1);
726  if (sumQ<_lowHO)
727  continue;
728  HcalDetId did = digi.id();
729  HcalElectronicsId eid = digi.elecId();
730 
731  double aveTS = hcaldqm::utilities::aveTS<HODataFrame>(digi, 8.5, 0,
732  digi.size()-1);
733  _xSignalSum.get(did)+=sumQ;
734  _xSignalSum2.get(did)+=sumQ*sumQ;
735  _xTimingSum.get(did)+=aveTS;
736  _xTimingSum2.get(did)+=aveTS*aveTS;
737  _xEntries.get(did)++;
738 
739  for (int i=0; i<digi.size(); i++)
740  {
741  if (_ptype == fLocal) { // hidefed2crate
742  _cShapeCut_FEDSlot.fill(eid, i,
743  digi.sample(i).nominal_fC()-8.5);
744  }
745  _cADC_SubdetPM.fill(did, digi.sample(i).adc());
746  }
747 
748  // select based on local global
749  double digiTimingSOI = (aveTS - digi.presamples()) * 25.;
750  double deltaTiming = digiTimingSOI - laserMonTiming;
751  _cTiming_DigivsLaserMon_SubdetPM.fill(did, laserMonTiming, digiTimingSOI);
752  _xTimingRefLMSum.get(did) += deltaTiming;
753  _xTimingRefLMSum2.get(did) += deltaTiming * deltaTiming;
754  if (_ptype==fLocal)
755  {
756  int currentEvent = e.eventAuxiliary().id().event();
757  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
758  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
759  _cTimingDiffEvent_SubdetPM.fill(did, currentEvent, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming);
760  }
761  else
762  {
765  _cTimingvsBX_SubdetPM.fill(did, bx, aveTS);
766  _cSignalvsBX_SubdetPM.fill(did, bx, sumQ);
768  }
769  }
771  it!=chf->end(); ++it)
772  {
773  const QIE10DataFrame digi = (const QIE10DataFrame)(*it);
774  HcalDetId did = digi.detid();
775  if (did.subdet() != HcalForward) {
776  continue;
777  }
779 
780  CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<QIE10DataFrame>(_dbService, did, digi);
781  double sumQ = hcaldqm::utilities::sumQDB<QIE10DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples()-1);
782  //double sumQ = hcaldqm::utilities::sumQ_v10<QIE10DataFrame>(digi, 2.5, 0, digi.samples()-1);
783  if (sumQ<_lowHF)
784  continue;
785 
786  //double aveTS = hcaldqm::utilities::aveTS_v10<QIE10DataFrame>(digi, 2.5, 0, digi.samples()-1);
787  double aveTS = hcaldqm::utilities::aveTSDB<QIE10DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples()-1);
788 
789  _xSignalSum.get(did)+=sumQ;
790  _xSignalSum2.get(did)+=sumQ*sumQ;
791  _xTimingSum.get(did)+=aveTS;
792  _xTimingSum2.get(did)+=aveTS*aveTS;
793  _xEntries.get(did)++;
794 
795  for (int i=0; i<digi.samples(); i++)
796  {
797  if (_ptype == fLocal) { // hidefed2crate
798  _cShapeCut_FEDSlot.fill(eid, (int)i, hcaldqm::utilities::adc2fCDBMinusPedestal<QIE10DataFrame>(_dbService, digi_fC, did, digi, i));
799  }
800  _cADC_SubdetPM.fill(did, digi[i].adc());
801  }
802 
803  // select based on local global
804  double digiTimingSOI = (aveTS - digi.presamples()) * 25.;
805  double deltaTiming = digiTimingSOI - laserMonTiming;
806  _cTiming_DigivsLaserMon_SubdetPM.fill(did, laserMonTiming, digiTimingSOI);
807  _xTimingRefLMSum.get(did) += deltaTiming;
808  _xTimingRefLMSum2.get(did) += deltaTiming * deltaTiming;
809  if (_ptype==fLocal)
810  {
811  int currentEvent = e.eventAuxiliary().id().event();
812  _cTimingvsEvent_SubdetPM.fill(did, currentEvent, aveTS);
813  _cSignalvsEvent_SubdetPM.fill(did, currentEvent, sumQ);
814  _cTimingDiffEvent_SubdetPM.fill(did, currentEvent, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming);
815  }
816  else
817  {
820  _cTimingvsBX_SubdetPM.fill(did, bx, aveTS);
821  _cSignalvsBX_SubdetPM.fill(did, bx, sumQ);
822  _cTimingDiffLS_SubdetPM.fill(did, _currentLS, hcaldqm::utilities::getRBX(did.iphi()), deltaTiming);
823  }
824  }
825 }
826 
827 void LaserTask::processLaserMon(edm::Handle<QIE10DigiCollection> &col, std::vector<int> &iLaserMonADC) {
828  for (QIE10DigiCollection::const_iterator it=col->begin(); it!=col->end(); ++it) {
829  const QIE10DataFrame digi = (const QIE10DataFrame)(*it);
830  HcalCalibDetId hcdid(digi.id());
831 
832  if ((hcdid.ieta() != _laserMonIEta) || (hcdid.cboxChannel() != _laserMonCBox)) {
833  continue;
834  }
835 
836  unsigned int digiIndex = std::find(_vLaserMonIPhi.begin(), _vLaserMonIPhi.end(), hcdid.iphi()) - _vLaserMonIPhi.begin();
837  if (digiIndex == _vLaserMonIPhi.size()) {
838  continue;
839  }
840 
841  // First digi: initialize the vectors to -1 (need to know the length of the digi)
842  if (iLaserMonADC.empty()) {
843  int totalNSamples = (digi.samples() - _laserMonDigiOverlap) * _vLaserMonIPhi.size();
844  for (int i = 0; i < totalNSamples; ++i) {
845  iLaserMonADC.push_back(-1);
846  }
847  }
848 
849  for (int subindex = 0; subindex < digi.samples() - _laserMonDigiOverlap; ++subindex) {
850  int totalIndex = (digi.samples() - _laserMonDigiOverlap) * digiIndex + subindex;
851  iLaserMonADC[totalIndex] = (digi[subindex].ok() ? digi[subindex].adc() : -1);
852  }
853  }
854 }
855 
857  edm::EventSetup const& es)
858 {
859  if (_ptype==fLocal)
860  return;
861  this->_dump();
862 
863  DQTask::endLuminosityBlock(lb, es);
864 }
865 
866 /* virtual */ bool LaserTask::_isApplicable(edm::Event const& e)
867 {
868  if (_ptype!=fOnline)
869  return true;
870  else
871  {
872  // fOnline mode
874  if (!e.getByToken(_tokuMN, cumn))
875  return false;
876 
877  // event type check first
878  uint8_t eventType = cumn->eventType();
879  if (eventType!=constants::EVENTTYPE_LASER)
880  return false;
881 
882  // check if this analysis task is of the right laser type
883  uint32_t laserType = cumn->valueUserWord(0);
884  if (laserType==_laserType) return true;
885  }
886 
887  return false;
888 }
889 
int adc(sample_type sample)
get the ADC sample (12 bits)
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
EventNumber_t event() const
Definition: EventID.h:41
hcaldqm::ContainerProf1D _cShapeCut_FEDSlot
Definition: LaserTask.h:112
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:107
hcaldqm::ContainerProf1D _cSignalvsEvent_SubdetPM
Definition: LaserTask.h:114
bool _isApplicable(edm::Event const &) override
Definition: LaserTask.cc:866
hcaldqm::ContainerSingle1D _cLaserMonTiming
Definition: LaserTask.h:160
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:41
EventAuxiliary const & eventAuxiliary() const override
Definition: Event.h:93
edm::InputTag _tagHE
Definition: LaserTask.h:57
std::vector< hcaldqm::flag::Flag > _vflags
Definition: LaserTask.h:73
double _lowHF
Definition: LaserTask.h:86
int const CRATE_VME_MIN
Definition: Constants.h:111
int maxTS(DIGI const &digi, double ped=0)
Definition: Utilities.h:93
edm::EDGetTokenT< QIE11DigiCollection > _tokHE
Definition: LaserTask.h:62
hcaldqm::ContainerProf2D _cTimingMean_FEDuTCA
Definition: LaserTask.h:133
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
hcaldqm::ContainerXXX< int > _xNBadTimingRefLM
Definition: LaserTask.h:97
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:142
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
hcaldqm::ContainerXXX< double > _xSignalSum2
Definition: LaserTask.h:91
void fill(HcalDetId const &) override
std::pair< uint16_t, uint16_t > fed2crate(int fed)
Definition: Utilities.cc:12
std::vector< uint32_t > _vhashFEDs
Definition: LaserTask.h:79
hcaldqm::ContainerXXX< double > _xTimingRefLMSum
Definition: LaserTask.h:95
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
hcaldqm::ContainerXXX< int > _xEntries
Definition: LaserTask.h:92
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
hcaldqm::Container1D _cTimingRMS_Subdet
Definition: LaserTask.h:107
int size() const
total number of samples in the digi
Definition: HBHEDataFrame.h:31
double _lowHBHE
Definition: LaserTask.h:83
double _lowHE
Definition: LaserTask.h:84
uint32_t _laserType
Definition: LaserTask.h:87
UpdateFreq
Definition: DQTask.h:17
double _laserMonThreshold
Definition: LaserTask.h:153
virtual void _dump()
Definition: LaserTask.cc:398
State _state
Definition: Flag.h:79
std::vector< HBHEDataFrame >::const_iterator const_iterator
hcaldqm::ContainerProf1D _cTimingvsEvent_SubdetPM
Definition: LaserTask.h:113
hcaldqm::ContainerProf2D _cSignalRMS_FEDVME
Definition: LaserTask.h:134
double _thresh_frac_timingreflm
Definition: LaserTask.h:155
int bunchCrossing() const
Definition: EventBase.h:66
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:136
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
const_iterator begin() const
virtual void reset()
Definition: ContainerXXX.h:364
void _resetMonitors(hcaldqm::UpdateFreq) override
Definition: LaserTask.cc:393
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:141
hcaldqm::ContainerXXX< double > _xSignalSum
Definition: LaserTask.h:90
hcaldqm::ContainerXXX< double > _xTimingSum
Definition: LaserTask.h:93
hcaldqm::Container2D _cMissing_depth
Definition: LaserTask.h:140
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:141
hcaldqm::ContainerProf2D _cSignalMean_depth
Definition: LaserTask.h:123
hcaldqm::ContainerSingleProf1D _cLaserMonTiming_LS
Definition: LaserTask.h:162
int const FIBERCH_MIN
Definition: Constants.h:151
int _laserMonTS0
Definition: LaserTask.h:152
edm::InputTag _tagHO
Definition: LaserTask.h:58
hcaldqm::Container1D _cADC_SubdetPM
Definition: LaserTask.h:109
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
std::vector< int > getFEDVMEList(HcalElectronicsMap const *)
Definition: Utilities.cc:119
hcaldqm::Container2D _cSummaryvsLS_FED
Definition: LaserTask.h:170
hcaldqm::ContainerProf2D _cTimingRMS_FEDVME
Definition: LaserTask.h:136
hcaldqm::ContainerProf2D _cTimingDiffLS_SubdetPM
Definition: LaserTask.h:166
hcaldqm::ContainerProf2D _cSignalMean_FEDVME
Definition: LaserTask.h:130
edm::InputTag _tagHF
Definition: LaserTask.h:59
hcaldqm::Container1D _cTimingMean_Subdet
Definition: LaserTask.h:106
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: LaserTask.cc:66
int _laserMonDigiOverlap
Definition: LaserTask.h:151
ProcessingType _ptype
Definition: DQModule.h:59
virtual void fill(uint32_t)
Definition: Container1D.cc:83
virtual void reset()
Definition: Container1D.cc:66
hcaldqm::ContainerProf2D _cTimingRMS_FEDuTCA
Definition: LaserTask.h:137
hcaldqm::ContainerProf2D _cSignalRMS_FEDuTCA
Definition: LaserTask.h:135
edm::EDGetTokenT< QIE10DigiCollection > _tokLaserMon
Definition: LaserTask.h:146
std::map< HcalSubdetector, std::pair< double, double > > _thresh_timingreflm
Definition: LaserTask.h:154
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:76
void processLaserMon(edm::Handle< QIE10DigiCollection > &col, std::vector< int > &iLaserMonADC)
Definition: LaserTask.cc:827
virtual void setBinContent(int, int, int)
hcaldqm::ContainerProf2D _cTimingDiffEvent_SubdetPM
Definition: LaserTask.h:167
hcaldqm::ContainerSingleProf1D _cLaserMonSumQ_LS
Definition: LaserTask.h:161
void dqmthrow(std::string const &msg) const
Definition: Logger.h:15
uint32_t valueUserWord(int iword) const
hcaldqm::filter::HashFilter _filter_uTCA
Definition: LaserTask.h:77
hcaldqm::ContainerXXX< int > _xNChs
Definition: LaserTask.h:98
int const FED_VME_MIN
Definition: Constants.h:98
T sqrt(T t)
Definition: SSEVec.h:18
hcaldqm::ContainerSingleProf1D _cLaserMonTiming_Event
Definition: LaserTask.h:164
hcaldqm::ContainerProf2D _cTimingMean_FEDVME
Definition: LaserTask.h:132
int _nevents
Definition: LaserTask.h:82
virtual void showOverflowX(bool showOverflow)
int size() const
total number of samples in the digi
Definition: HODataFrame.h:31
hcaldqm::ContainerSingle1D _cLaserMonSumQ
Definition: LaserTask.h:159
virtual example_stream void bookHistograms(DQMStore::IBooker &,@example_stream edm::Run const &,@example_stream edm::EventSetup const &) override
uint8_t eventType() const
int const FIBER_uTCA_MIN1
Definition: Constants.h:144
edm::EDGetTokenT< HODigiCollection > _tokHO
Definition: LaserTask.h:63
DetId detid() const
Get the detector id.
std::vector< HcalGenericDetId > allPrecisionId() const
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: LaserTask.cc:856
Logger _logger
Definition: DQModule.h:70
double _thresh_min_lmsumq
Definition: LaserTask.h:156
virtual void showOverflowY(bool showOverflow)
T min(T a, T b)
Definition: MathUtil.h:58
RunAuxiliary const & runAuxiliary() const override
Definition: Run.h:63
hcaldqm::ContainerXXX< double > _xTimingRefLMSum2
Definition: LaserTask.h:96
virtual void showOverflowX(bool showOverflow)
std::string _name
Definition: DQModule.h:57
int _laserMonCBox
Definition: LaserTask.h:150
HcalElectronicsMap const * _emap
Definition: DQTask.h:73
hcaldqm::ContainerProf1D _cSignalvsBX_SubdetPM
Definition: LaserTask.h:119
hcaldqm::ContainerSingle2D _cSummaryvsLS
Definition: LaserTask.h:171
double _lowHO
Definition: LaserTask.h:85
int const CRATE_uTCA_MIN
Definition: Constants.h:116
hcaldqm::Container2D _cMissing_FEDuTCA
Definition: LaserTask.h:142
void _process(edm::Event const &, edm::EventSetup const &) override
Definition: LaserTask.cc:541
const_iterator end() const
hcaldqm::Container1D _cSignalMean_Subdet
Definition: LaserTask.h:102
double const adc2fC[256]
Definition: Constants.h:271
edm::EDGetTokenT< HBHEDigiCollection > _tokHBHE
Definition: LaserTask.h:61
int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
hcaldqm::ContainerProf1D _cSignalvsLS_SubdetPM
Definition: LaserTask.h:116
hcaldqm::ContainerProf1D _cTimingvsLS_SubdetPM
Definition: LaserTask.h:115
int _laserMonIEta
Definition: LaserTask.h:149
bool isFEDHBHE(HcalElectronicsId const &)
Definition: Utilities.cc:172
edm::InputTag _tagHBHE
Definition: LaserTask.h:56
virtual void book(HcalElectronicsMap const *)
Definition: ContainerXXX.h:97
hcaldqm::ContainerProf2D _cSignalMean_FEDuTCA
Definition: LaserTask.h:131
hcaldqm::Container2D _cTiming_DigivsLaserMon_SubdetPM
Definition: LaserTask.h:165
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
Definition: Container1D.cc:958
uint8_t const EVENTTYPE_LASER
Definition: Constants.h:324
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:32
hcaldqm::ContainerProf2D _cTimingMean_depth
Definition: LaserTask.h:127
void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="") override
hcaldqm::electronicsmap::ElectronicsMap _ehashmap
Definition: LaserTask.h:76
edm::InputTag _tagLaserMon
Definition: LaserTask.h:145
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
edm::InputTag _taguMN
Definition: LaserTask.h:60
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:235
std::string const & label() const
Definition: InputTag.h:36
const_iterator end() const
std::vector< int > _vLaserMonIPhi
Definition: LaserTask.h:148
EventID const & id() const
int _xMissingLaserMon
Definition: LaserTask.h:157
virtual STDTYPE & get(HcalDetId const &)
Definition: ContainerXXX.h:247
edm::ESHandle< HcalDbService > _dbService
Definition: DQTask.h:72
std::vector< int > getFEDList(HcalElectronicsMap const *)
Definition: Utilities.cc:95
T get() const
Definition: EventSetup.h:63
edm::EDGetTokenT< HcalUMNioDigi > _tokuMN
Definition: LaserTask.h:65
std::vector< int > getFEDuTCAList(HcalElectronicsMap const *)
Definition: Utilities.cc:145
hcaldqm::Container1D _cSignalRMS_Subdet
Definition: LaserTask.h:103
col
Definition: cuy.py:1009
void fill(HcalDetId const &) override
Definition: Container2D.cc:59
const HcalElectronicsMap * getHcalMapping() const
virtual void initialize(FilterType ftype, hashfunctions::HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:28
std::string _subsystem
Definition: DQModule.h:64
int getRBX(uint32_t iphi)
Definition: Utilities.cc:252
bool isFEDHO(HcalElectronicsId const &)
Definition: Utilities.cc:212
std::vector< uint32_t > _vcdaqEids
Definition: DQTask.h:65
hcaldqm::ContainerSingleProf1D _cLaserMonSumQ_Event
Definition: LaserTask.h:163
hcaldqm::ContainerXXX< double > _xTimingSum2
Definition: LaserTask.h:94
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:89
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:895
edm::EDGetTokenT< QIE10DigiCollection > _tokHF
Definition: LaserTask.h:64
int samples() const
total number of samples in the digi
hcaldqm::ContainerProf2D _cSignalRMS_depth
Definition: LaserTask.h:124
hcaldqm::filter::HashFilter _filter_VME
Definition: LaserTask.h:78
Readout chain identification for Hcal.
std::string const & instance() const
Definition: InputTag.h:37
hcaldqm::ContainerProf1D _cTimingvsBX_SubdetPM
Definition: LaserTask.h:118
bool isFEDHF(HcalElectronicsId const &)
Definition: Utilities.cc:187
RunNumber_t run() const
Definition: RunAuxiliary.h:41
LaserTask(edm::ParameterSet const &)
Definition: LaserTask.cc:6
int const SLOT_uTCA_MIN
Definition: Constants.h:123
const_iterator begin() const
Definition: Run.h:44
ib
Definition: cuy.py:661
hcaldqm::ContainerProf2D _cTimingRMS_depth
Definition: LaserTask.h:128
double sumQ(DIGI const &digi, double ped, int i=0, int j=3)
Definition: Utilities.h:121