CMS 3D CMS Logo

DigiTask.cc
Go to the documentation of this file.
2 
3 using namespace hcaldqm;
4 using namespace hcaldqm::constants;
5 using namespace hcaldqm::filter;
6 
8  DQTask(ps)
9 {
11  edm::InputTag("hcalDigis"));
13  edm::InputTag("hcalDigis"));
15  edm::InputTag("hcalDigis"));
17  edm::InputTag("hcalDigis"));
18 
19  _tokHBHE = consumes<HBHEDigiCollection>(_tagHBHE);
20  _tokHEP17 = consumes<QIE11DigiCollection>(_tagHEP17);
21  _tokHO = consumes<HODigiCollection>(_tagHO);
22  _tokHF = consumes<QIE10DigiCollection>(_tagHF);
23 
24  _cutSumQ_HBHE = ps.getUntrackedParameter<double>("cutSumQ_HBHE", 20);
25  _cutSumQ_HEP17 = ps.getUntrackedParameter<double>("cutSumQ_HEP17", 20);
26  _cutSumQ_HO = ps.getUntrackedParameter<double>("cutSumQ_HO", 20);
27  _cutSumQ_HF = ps.getUntrackedParameter<double>("cutSumQ_HF", 20);
28  _thresh_unihf = ps.getUntrackedParameter<double>("thresh_unihf", 0.2);
29 
30  _vflags.resize(nDigiFlag);
31  _vflags[fUni]=hcaldqm::flag::Flag("UniSlotHF");
35 }
36 
38  edm::Run const& r, edm::EventSetup const& es)
39 {
40  DQTask::bookHistograms(ib,r,es);
41 
42  // GET WHAT YOU NEED
44  es.get<HcalDbRecord>().get(dbs);
45  _emap = dbs->getHcalMapping();
46  std::vector<uint32_t> vVME;
47  std::vector<uint32_t> vuTCA;
51  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
53  vVME);
55  vuTCA);
56 
57  // INITIALIZE FIRST
79  _cTimingCut_depth.initialize(_name, "TimingCut",
88 
89  // Occupancy w/o a cut
90  _cOccupancyvsLS_Subdet.initialize(_name, "OccupancyvsLS",
94  _cOccupancy_depth.initialize(_name, "Occupancy",
99 
100  // Occupancy w/ a cut
101  _cOccupancyCutvsLS_Subdet.initialize(_name, "OccupancyCutvsLS",
105  _cOccupancyCut_depth.initialize(_name, "OccupancyCut",
110 
111  // Digi size
112  _cDigiSize_Crate.initialize(_name, "DigiSize",
116 
117  _cLETDCvsADC.initialize(_name, "LETDCvsADC",
121  _cLETDCvsTS.initialize(_name, "LETDCvsTS",
124  _cLETDCTime.initialize(_name, "LETDCTime",
127 
128 
129  // INITIALIZE HISTOGRAMS that are only for Online
130  if (_ptype==fOnline)
131  {
132  std::vector<uint32_t> vhashHF;
133  vhashHF.push_back(HcalDetId(HcalForward, 31,1,1).rawId());
135  vhashHF);
136 
137  // Charge sharing
146  _cDigiSizevsLS_FED.initialize(_name, "DigiSizevsLS",
150  _cTimingCutvsiphi_SubdetPM.initialize(_name, "TimingCutvsiphi",
154  _cTimingCutvsieta_Subdet.initialize(_name, "TimingCutvsieta",
158  _cOccupancyvsiphi_SubdetPM.initialize(_name, "Occupancyvsiphi",
162  _cOccupancyvsieta_Subdet.initialize(_name, "Occupancyvsieta",
166  _cOccupancyCutvsiphi_SubdetPM.initialize(_name, "OccupancyCutvsiphi",
170  _cOccupancyCutvsieta_Subdet.initialize(_name, "OccupancyCutvsieta",
174  _cOccupancyCutvsLS_Subdet.initialize(_name, "OccupancyCutvsLS",
178  _cOccupancyCutvsBX_Subdet.initialize(_name, "OccupancyCutvsBX",
182 // _cOccupancyCutvsSlotvsLS_HFPM.initialize(_name,
183 // "OccupancyCutvsSlotvsLS", hcaldqm::hashfunctions::fSubdetPM,
184 // new hcaldqm::quantity::LumiSection(_maxLS),
185 // new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
186 // new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0);
188  "OccupancyCutvsiphivsLS", hcaldqm::hashfunctions::fSubdetPM,
192  }
193  if (_ptype != fOffline) { // hidefed2crate
194  std::vector<int> vFEDs = hcaldqm::utilities::getFEDList(_emap);
195  std::vector<int> vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap);
196  std::vector<int> vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap);
197 
198  std::vector<uint32_t> vFEDHF;
199  vFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN,
200  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
201  vFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN+6,
202  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
203  vFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN,
204  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
205  vFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN+6,
206  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
207  vFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN,
208  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
209  vFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN+6,
210  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
211 
212  // initialize filters
214  vFEDHF);
215 
216  // push the rawIds of each fed into the vector...
217  for (std::vector<int>::const_iterator it=vFEDsVME.begin();
218  it!=vFEDsVME.end(); ++it)
219  _vhashFEDs.push_back(HcalElectronicsId(
221  (*it)-FED_VME_MIN).rawId());
222  for (std::vector<int>::const_iterator it=vFEDsuTCA.begin();
223  it!=vFEDsuTCA.end(); ++it)
224  {
225  std::pair<uint16_t, uint16_t> cspair = utilities::fed2crate(*it);
226  _vhashFEDs.push_back(HcalElectronicsId(
227  cspair.first, cspair.second, FIBER_uTCA_MIN1,
228  FIBERCH_MIN, false).rawId());
229  }
230 
235 
236  _cTimingCut_FEDVME.initialize(_name, "TimingCut",
241  _cTimingCut_FEDuTCA.initialize(_name, "TimingCut",
248  new hcaldqm::quantity::FEDQuantity(vFEDsVME),
253  new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
256  _cTimingCutvsLS_FED.initialize(_name, "TimingvsLS",
260 
261  _cOccupancy_FEDVME.initialize(_name, "Occupancy",
266  _cOccupancy_FEDuTCA.initialize(_name, "Occupancy",
273  new hcaldqm::quantity::FEDQuantity(vFEDsVME),
278  new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
281 
282  _cOccupancyCut_FEDVME.initialize(_name, "OccupancyCut",
287  _cOccupancyCut_FEDuTCA.initialize(_name, "OccupancyCut",
294  new hcaldqm::quantity::FEDQuantity(vFEDsVME),
299  new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
302 
303  _cDigiSize_FED.initialize(_name, "DigiSize",
307 
308  if (_ptype == fOnline) {
309  _cSummaryvsLS_FED.initialize(_name, "SummaryvsLS",
314  _cSummaryvsLS.initialize(_name, "SummaryvsLS",
318 
324  }
325  }
326 
327  // BOOK HISTOGRAMS
328  char cutstr[200];
329  sprintf(cutstr, "_SumQHBHE%dHO%dHF%d", int(_cutSumQ_HBHE),
330  int(_cutSumQ_HO), int(_cutSumQ_HF));
331  char cutstr2[200];
332  sprintf(cutstr2, "_SumQHF%d", int(_cutSumQ_HF));
333 
335 
341 
342  if (_ptype != fOffline) { // hidefed2crate
358  }
359 
363 
367 
368 
372 
373  // BOOK HISTOGRAMS that are only for Online
376  if (_ptype==fOnline)
377  {
389 // _cOccupancyCutvsSlotvsLS_HFPM.book(ib, _emap, _filter_HF, _subsystem);
393 
395  _xNChs.book(_emap);
397  _xUni.book(_emap);
399 
400  // just PER HF FED RECORD THE #CHANNELS
401  // ONLY WAY TO DO THAT AUTOMATICALLY AND W/O HARDCODING 1728
402  // or ANY OTHER VALUES LIKE 2592, 2192
403  std::vector<HcalGenericDetId> gids = _emap->allPrecisionId();
404  for (std::vector<HcalGenericDetId>::const_iterator it=gids.begin();
405  it!=gids.end(); ++it)
406  {
407  if (!it->isHcalDetId())
408  continue;
409  HcalDetId did(it->rawId());
410  if (_xQuality.exists(did))
411  {
412  HcalChannelStatus cs(it->rawId(), _xQuality.get(
413  HcalDetId(*it)));
414  if (
417  continue;
418  }
420  _xNChsNominal.get(eid)++; // he will know the nominal #channels per FED
421  }
422  }
423 
424  // MARK THESE HISTOGRAMS AS LUMI BASED FOR OFFLINE PROCESSING
425  if (_ptype==fOffline)
426  {
428  //_cDigiSize_FED.setLumiFlag();
430  }
431 
432  // book Number of Events vs LS histogram
433  ib.setCurrentFolder(_subsystem+"/RunInfo");
434  meNumEvents1LS = ib.book1D("NumberOfEvents", "NumberOfEvents",
435  1, 0, 1);
437 
438  // book the flag for unknown ids and the online guy as well
440  meUnknownIds1LS = ib.book1D("UnknownIds", "UnknownIds",
441  1, 0, 1);
442  _unknownIdsPresent = false;
444 }
445 
447 {
448  DQTask::_resetMonitors(uf);
449 
450  switch(uf)
451  {
452  case hcaldqm::f1LS:
453  _unknownIdsPresent = false;
454  break;
455  case hcaldqm::f50LS:
456  // ^^^ONLINE ONLY!
457  if (_ptype==fOnline)
459  // ^^^
460  break;
461  default:
462  break;
463  }
464 }
465 
466 /* virtual */ void DigiTask::_process(edm::Event const& e,
467  edm::EventSetup const&)
468 {
473 
474  if (!e.getByToken(_tokHBHE, chbhe))
475  _logger.dqmthrow("Collection HBHEDigiCollection isn't available"
476  + _tagHBHE.label() + " " + _tagHBHE.instance());
477  if (!e.getByToken(_tokHEP17, chep17))
478  _logger.dqmthrow("Collection HEP17DigiCollection isn't available"
479  + _tagHEP17.label() + " " + _tagHEP17.instance());
480  if (!e.getByToken(_tokHO, cho))
481  _logger.dqmthrow("Collection HODigiCollection isn't available"
482  + _tagHO.label() + " " + _tagHO.instance());
483  if (!e.getByToken(_tokHF, chf))
484  _logger.dqmthrow("Collection QIE10DigiCollection isn't available"
485  + _tagHF.label() + " " + _tagHF.instance());
486 
487  // extract some info per event
488  int bx = e.bunchCrossing();
489  meNumEvents1LS->Fill(0.5); // just increment
490 
491  // To fill histograms outside of the loop, you need to determine if there were
492  // any valid det ids first
493  uint32_t rawidValid = 0;
494  uint32_t rawidHBValid = 0;
495  uint32_t rawidHEValid = 0;
496 
497  // HB collection
498  int numChs = 0;
499  int numChsCut = 0;
500  int numChsHE = 0;
501  int numChsCutHE = 0;
502  for (HBHEDigiCollection::const_iterator it=chbhe->begin(); it!=chbhe->end();
503  ++it)
504  {
505  double sumQ = hcaldqm::utilities::sumQ<HBHEDataFrame>(*it, 2.5, 0, it->size()-1);
506 
507  // Explicit check on the DetIds present in the Collection
508  HcalDetId const& did = it->id();
509  uint32_t rawid = _ehashmap.lookup(did);
510  if (rawid==0)
511  {meUnknownIds1LS->Fill(1); _unknownIdsPresent=true;continue;}
512  HcalElectronicsId const& eid(rawid);
513  if (did.subdet()==HcalBarrel)
514  rawidHBValid = did.rawId();
515  else if (did.subdet()==HcalEndcap)
516  rawidHEValid = did.rawId();
517 
518  // filter out channels that are masked out
519  if (_xQuality.exists(did))
520  {
521  HcalChannelStatus cs(did.rawId(), _xQuality.get(did));
522  if (
525  continue;
526  }
527 
528  _cSumQ_SubdetPM.fill(did, sumQ);
529  _cOccupancy_depth.fill(did);
530  if (_ptype==fOnline)
531  {
532  _cDigiSizevsLS_FED.fill(eid, _currentLS, it->size());
533  it->size()!=constants::DIGISIZE[did.subdet()-1]?
534  _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0;
537  }
538  _cDigiSize_Crate.fill(eid, it->size());
539  if (_ptype != fOffline) { // hidefed2crate
540  _cDigiSize_FED.fill(eid, it->size());
541  if (eid.isVMEid())
542  {
545  }
546  else
547  {
550  /*
551  if (!it->validate(0, it->size()))
552  {
553  _cCapIdRots_depth.fill(did);
554  _cCapIdRots_FEDuTCA.fill(eid, 1);
555  }*/
556  }
557  }
558 
559  for (int i=0; i<it->size(); i++)
560  {
561  _cADC_SubdetPM.fill(did, it->sample(i).adc());
562  _cfC_SubdetPM.fill(did, it->sample(i).nominal_fC());
563  if (_ptype != fOffline) { // hidefed2crate
564  if (sumQ>_cutSumQ_HBHE)
565  _cShapeCut_FED.fill(eid, i, it->sample(i).nominal_fC());
566  }
567  }
568 
569  if (sumQ>_cutSumQ_HBHE)
570  {
571  double timing = hcaldqm::utilities::aveTS<HBHEDataFrame>(*it, 2.5, 0,
572  it->size()-1);
573  _cTimingCut_SubdetPM.fill(did, timing);
574  _cTimingCut_depth.fill(did, timing);
577  if (_ptype != fOffline) { // hidefed2crate
578  _cTimingCutvsLS_FED.fill(eid, _currentLS, timing);
579  }
580  _cSumQ_depth.fill(did, sumQ);
581  _cSumQvsLS_SubdetPM.fill(did, _currentLS, sumQ);
582  if (_ptype==fOnline)
583  {
584  _cSumQvsBX_SubdetPM.fill(did, bx, sumQ);
585  _cTimingCutvsiphi_SubdetPM.fill(did, timing);
586  _cTimingCutvsieta_Subdet.fill(did, timing);
590  }
591  if (_ptype != fOffline) { // hidefed2crate
592  if (eid.isVMEid())
593  {
594  _cTimingCut_FEDVME.fill(eid, timing);
595  _cTimingCut_ElectronicsVME.fill(eid, timing);
598  }
599  else
600  {
601  _cTimingCut_FEDuTCA.fill(eid, timing);
602  _cTimingCut_ElectronicsuTCA.fill(eid, timing);
605  }
606  }
607  did.subdet()==HcalBarrel?numChsCut++:numChsCutHE++;
608  }
609  did.subdet()==HcalBarrel?numChs++:numChsHE++;
610  }
611 
612  // HEP17 collection
613  // The following are filled w.r.t. HBHE digis
614  // - All eta-phi maps
615  // - Occupancy in electronics coordinates
616  // - Digi size
617  //
618  // The following are not filled:
619  // - ADC, fC, sumQ, timing. These are different for QIE11 vs. QIE8. Find them in QIE11Task instead.
620  for (QIE11DigiCollection::const_iterator it=chep17->begin(); it!=chep17->end();
621  ++it)
622  {
623  const QIE11DataFrame digi = static_cast<const QIE11DataFrame>(*it);
624 
625  double sumQ = hcaldqm::utilities::sumQ_v10<QIE11DataFrame>(digi, 2.5, 0, digi.samples()-1);
626 
627  // Explicit check on the DetIds present in the Collection
628  HcalDetId const& did = digi.detid();
629  uint32_t rawid = _ehashmap.lookup(did);
630  if (rawid==0)
631  {meUnknownIds1LS->Fill(1); _unknownIdsPresent=true;continue;}
632  HcalElectronicsId const& eid(rawid);
633  if (did.subdet()==HcalBarrel) // Note: since this is HEP17, we obviously expect did.subdet() always to be HcalEndcap, but QIE11DigiCollection may someday expand.
634  rawidHBValid = did.rawId();
635  else if (did.subdet()==HcalEndcap)
636  rawidHEValid = did.rawId();
637 
638  // filter out channels that are masked out
639  if (_xQuality.exists(did))
640  {
641  HcalChannelStatus cs(did.rawId(), _xQuality.get(did));
642  if (
645  continue;
646  }
647 
648  _cOccupancy_depth.fill(did);
649  if (_ptype==fOnline)
650  {
651  _cDigiSizevsLS_FED.fill(eid, _currentLS, digi.samples());
652  digi.samples()!=constants::DIGISIZE[did.subdet()-1]?
653  _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0;
656  }
657  _cDigiSize_Crate.fill(eid, digi.samples());
658  if (_ptype != fOffline) { // hidefed2crate
659  _cDigiSize_FED.fill(eid, digi.samples());
660  if (eid.isVMEid())
661  {
664  }
665  else
666  {
669  /*
670  if (!digi.validate(0, digi.size()))
671  {
672  _cCapIdRots_depth.fill(did);
673  _cCapIdRots_FEDuTCA.fill(eid, 1);
674  }*/
675  }
676  }
677 
678  if (sumQ>_cutSumQ_HEP17)
679  {
680  double timing = hcaldqm::utilities::aveTS_v10<QIE11DataFrame>(digi, 2.5, 0,
681  digi.samples()-1);
683  _cTimingCut_depth.fill(did, timing);
684  _cSumQ_depth.fill(did, sumQ);
685  if (_ptype==fOnline)
686  {
690  }
691  if (_ptype != fOffline) { // hidefed2crate
692  if (eid.isVMEid())
693  {
696  }
697  else
698  {
701  }
702  }
703  did.subdet()==HcalBarrel?numChsCut++:numChsCutHE++;
704  }
705  did.subdet()==HcalBarrel?numChs++:numChsHE++;
706  }
707 
708  if (rawidHBValid!=0 && rawidHEValid!=0)
709  {
711  numChs);
713  numChsHE);
714  // ONLINE ONLY!
715  if (_ptype==fOnline)
716  {
718  _currentLS, numChsCut);
719  _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidHBValid), bx,
720  numChsCut);
722  _currentLS, numChsCutHE);
723  _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidHEValid), bx,
724  numChsCutHE);
725  }
726  // ^^^ONLINE ONLY!
727  }
728  numChs=0;
729  numChsCut = 0;
730 
731  // reset
732  rawidValid = 0;
733 
734 
735  // HO collection
736  for (HODigiCollection::const_iterator it=cho->begin(); it!=cho->end();
737  ++it)
738  {
739  double sumQ = hcaldqm::utilities::sumQ<HODataFrame>(*it, 8.5, 0, it->size()-1);
740 
741  // Explicit check on the DetIds present in the Collection
742  HcalDetId const& did = it->id();
743  uint32_t rawid = _ehashmap.lookup(did);
744  if (rawid==0)
745  {meUnknownIds1LS->Fill(1); _unknownIdsPresent=true;continue;}
746  HcalElectronicsId const& eid(rawid);
747  if (did.subdet()==HcalOuter)
748  rawidValid = did.rawId();
749 
750  // filter out channels that are masked out
751  if (_xQuality.exists(did))
752  {
753  HcalChannelStatus cs(did.rawId(), _xQuality.get(did));
754  if (
757  continue;
758  }
759 
760  _cSumQ_SubdetPM.fill(did, sumQ);
761  _cOccupancy_depth.fill(did);
762  if (_ptype==fOnline)
763  {
764  _cDigiSizevsLS_FED.fill(eid, _currentLS, it->size());
765  it->size()!=constants::DIGISIZE[did.subdet()-1]?
766  _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0;
769  }
770  _cDigiSize_Crate.fill(eid, it->size());
771  if (_ptype != fOffline) { // hidefed2crate
772  _cDigiSize_FED.fill(eid, it->size());
773  if (eid.isVMEid())
774  {
777  /*
778  if (!it->validate(0, it->size()))
779  _cCapIdRots_FEDVME.fill(eid, 1);
780  */
781  }
782  else
783  {
786  /*
787  if (!it->validate(0, it->size()))
788  _cCapIdRots_FEDuTCA.fill(eid, 1);*/
789  }
790  }
791 
792  for (int i=0; i<it->size(); i++)
793  {
794  _cADC_SubdetPM.fill(did, it->sample(i).adc());
795  _cfC_SubdetPM.fill(did, it->sample(i).nominal_fC());
796  if (_ptype != fOffline) { // hidefed2crate
797  if (sumQ>_cutSumQ_HO)
798  _cShapeCut_FED.fill(eid, i, it->sample(i).nominal_fC());
799  }
800  }
801 
802  if (sumQ>_cutSumQ_HO)
803  {
804  double timing = hcaldqm::utilities::aveTS<HODataFrame>(*it, 8.5, 0,
805  it->size()-1);
806  _cSumQ_depth.fill(did, sumQ);
807  _cSumQvsLS_SubdetPM.fill(did, _currentLS, sumQ);
809  _cTimingCut_SubdetPM.fill(did, timing);
810  _cTimingCut_depth.fill(did, timing);
812  if (_ptype != fOffline) { // hidefed2crate
813  _cTimingCutvsLS_FED.fill(eid, _currentLS, timing);
814  }
815  if (_ptype==fOnline)
816  {
817  _cSumQvsBX_SubdetPM.fill(did, bx, sumQ);
818  _cTimingCutvsiphi_SubdetPM.fill(did, timing);
819  _cTimingCutvsieta_Subdet.fill(did, timing);
823  }
824  if (_ptype != fOffline) { // hidefed2crate
825  if (eid.isVMEid())
826  {
827  _cTimingCut_FEDVME.fill(eid, timing);
828  _cTimingCut_ElectronicsVME.fill(eid, timing);
831  }
832  else
833  {
834  _cTimingCut_FEDuTCA.fill(eid, timing);
835  _cTimingCut_ElectronicsuTCA.fill(eid, timing);
838  }
839  }
840  numChsCut++;
841  }
842  numChs++;
843  }
844 
845  if (rawidValid!=0)
846  {
848  numChs);
849 
850  if (_ptype==fOnline)
851  {
853  _currentLS, numChsCut);
854  _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidValid), bx,
855  numChsCut);
856  }
857  }
858  numChs=0; numChsCut=0;
859 
860  // reset
861  rawidValid = 0;
862 
863  // HF collection
864  for (QIE10DigiCollection::const_iterator it=chf->begin(); it!=chf->end();
865  ++it)
866  {
867  const QIE10DataFrame digi = static_cast<const QIE10DataFrame>(*it);
868  double sumQ = hcaldqm::utilities::sumQ_v10<QIE10DataFrame>(digi, 2.5, 0, digi.samples()-1);
869 
870  // Explicit check on the DetIds present in the Collection
871  HcalDetId const& did = digi.detid();
872  uint32_t rawid = _ehashmap.lookup(did);
873  if (rawid==0) {
874  meUnknownIds1LS->Fill(1);
875  _unknownIdsPresent=true;
876  continue;
877  }
878  HcalElectronicsId const& eid(rawid);
879  if (did.subdet()==HcalForward)
880  rawidValid = did.rawId();
881 
882  // filter out channels that are masked out
883  if (_xQuality.exists(did))
884  {
885  HcalChannelStatus cs(did.rawId(), _xQuality.get(did));
886  if (
889  continue;
890  }
891 
892  _cSumQ_SubdetPM.fill(did, sumQ);
893  _cOccupancy_depth.fill(did);
894  if (_ptype==fOnline)
895  {
896  _xNChs.get(eid)++;
897  _cDigiSizevsLS_FED.fill(eid, _currentLS, digi.samples());
898  digi.samples()!=constants::DIGISIZE[did.subdet()-1]?
899  _xDigiSize.get(eid)++:_xDigiSize.get(eid)+=0;
902  }
903  _cDigiSize_Crate.fill(eid, digi.samples());
904  if (_ptype != fOffline) { // hidefed2crate
905  _cDigiSize_FED.fill(eid, digi.samples());
906  if (eid.isVMEid())
907  {
910  /*
911  if (!it->validate(0, it->size()))
912  _cCapIdRots_FEDVME.fill(eid, 1);*/
913  }
914  else
915  {
918  /*
919  if (!it->validate(0, it->size()))
920  _cCapIdRots_FEDuTCA.fill(eid, 1);*/
921  }
922  }
923 
924  for (int i=0; i<digi.samples(); i++)
925  {
926  _cADC_SubdetPM.fill(did, digi[i].adc());
927  _cfC_SubdetPM.fill(did, constants::adc2fC[digi[i].adc()] - 2.5);
928  _cLETDCvsADC.fill(digi[i].adc(), digi[i].le_tdc());
929  _cLETDCvsTS.fill((int)i, digi[i].le_tdc());
930  if (digi[i].le_tdc() <50) {
931  _cLETDCTime.fill(i*25. + (digi[i].le_tdc() / 2.));
932  }
933 
934  if (_ptype != fOffline) { // hidefed2crate
935  if (sumQ>_cutSumQ_HF)
936  _cShapeCut_FED.fill(eid, (int)i, constants::adc2fC[digi[i].adc()] - 2.5);
937  }
938  }
939 
940  if (sumQ>_cutSumQ_HF)
941  {
942  double timing = hcaldqm::utilities::aveTS_v10<QIE10DataFrame>(digi, 2.5, 0,
943  digi.samples()-1);
944  double q1 = constants::adc2fC[digi[1].adc()]-2.5;
945  double q2 = constants::adc2fC[digi[2].adc()]-2.5;
946  double q2q12 = q2/(q1+q2);
947  _cSumQ_depth.fill(did, sumQ);
948  _cSumQvsLS_SubdetPM.fill(did, _currentLS, sumQ);
949  if (_ptype==fOnline)
950  {
951  _cSumQvsBX_SubdetPM.fill(did, bx, sumQ);
952  _cTimingCutvsiphi_SubdetPM.fill(did, timing);
953  _cTimingCutvsieta_Subdet.fill(did, timing);
957 // _cOccupancyCutvsSlotvsLS_HFPM.fill(did, _currentLS);
958  _xUniHF.get(eid)++;
959  }
960  _cTimingCut_SubdetPM.fill(did, timing);
961  _cTimingCut_depth.fill(did, timing);
963  if (_ptype != fOffline) { // hidefed2crate
964  _cTimingCutvsLS_FED.fill(eid, _currentLS, timing);
965  }
967  if (!eid.isVMEid())
968  if (_ptype==fOnline)
969  _cQ2Q12CutvsLS_FEDHF.fill(eid, _currentLS, q2q12);
970  if (_ptype != fOffline) { // hidefed2crate
971  if (eid.isVMEid())
972  {
973  _cTimingCut_FEDVME.fill(eid, timing);
974  _cTimingCut_ElectronicsVME.fill(eid, timing);
977  }
978  else
979  {
980  _cTimingCut_FEDuTCA.fill(eid, timing);
981  _cTimingCut_ElectronicsuTCA.fill(eid, timing);
984  }
985  }
986  numChsCut++;
987  }
988  numChs++;
989  }
990 
991  if (rawidValid!=0)
992  {
994  numChs);
995 
996  if (_ptype==fOnline)
997  {
999  _currentLS, numChsCut);
1000  _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidValid), bx,
1001  numChsCut);
1002  }
1003  }
1004 }
1005 
1007  edm::LuminosityBlock const& lb, edm::EventSetup const& es)
1008 {
1009  DQTask::beginLuminosityBlock(lb, es);
1010 }
1011 
1013  edm::EventSetup const& es)
1014 {
1015  if (_ptype!=fOnline)
1016  return;
1017 
1018  for (uintCompactMap::const_iterator it=_xUniHF.begin();
1019  it!=_xUniHF.end(); ++it)
1020  {
1021  uint32_t hash1 = it->first;
1022  HcalElectronicsId eid1(hash1);
1023  double x1 = it->second;
1024 
1025  for (uintCompactMap::const_iterator jt=_xUniHF.begin();
1026  jt!=_xUniHF.end(); ++jt)
1027  {
1028  if (jt==it)
1029  continue;
1030  double x2 = jt->second;
1031  if (x2==0)
1032  continue;
1033  if (x1/x2<_thresh_unihf)
1034  _xUni.get(eid1)++;
1035  }
1036  }
1037 
1038  if (_ptype != fOffline) { // hidefed2crate
1039  for (std::vector<uint32_t>::const_iterator it=_vhashFEDs.begin();
1040  it!=_vhashFEDs.end(); ++it)
1041  {
1042  hcaldqm::flag::Flag fSum("DIGI");
1044 
1045  std::vector<uint32_t>::const_iterator cit=std::find(
1046  _vcdaqEids.begin(), _vcdaqEids.end(), *it);
1047  if (cit==_vcdaqEids.end())
1048  {
1049  // not @cDAQ
1050  for (uint32_t iflag=0; iflag<_vflags.size(); iflag++)
1051  _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag),
1052  int(hcaldqm::flag::fNCDAQ));
1054  continue;
1055  }
1056 
1057  // FED is @cDAQ
1060  {
1061  if (_xDigiSize.get(eid)>0)
1063  else
1065  if (hcaldqm::utilities::isFEDHF(eid))
1066  {
1067  double fr = double(_xNChs.get(eid))/double(
1068  _xNChsNominal.get(eid)*_evsPerLS);
1069  if (_runkeyVal==0 || _runkeyVal==4)
1070  {
1071  // only for pp or hi
1072  if (_xUni.get(eid)>0)
1074  else
1075  _vflags[fUni]._state = hcaldqm::flag::fGOOD;
1076  }
1077  if (fr<0.95)
1079  else if (fr<1.0)
1081  else
1083  }
1084  }
1085  if (_unknownIdsPresent)
1087  else
1089 
1090  int iflag=0;
1091  for (std::vector<hcaldqm::flag::Flag>::iterator ft=_vflags.begin();
1092  ft!=_vflags.end(); ++ft)
1093  {
1095  int(ft->_state));
1096  fSum+=(*ft);
1097  iflag++;
1098 
1099  // reset!
1100  ft->reset();
1101  }
1103  }
1104  }
1105 
1107  _xNChs.reset();
1108 
1109  // in the end always do the DQTask::endLumi
1110  DQTask::endLuminosityBlock(lb, es);
1111 }
1112 
1114 
int adc(sample_type sample)
get the ADC sample (12 bits)
int samples() const
total number of samples in the digi
hcaldqm::ContainerProf1D _cTimingCutvsiphi_SubdetPM
Definition: DigiTask.h:105
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meNumEvents1LS
Definition: DigiTask.h:155
hcaldqm::ContainerSingle2D _cLETDCvsADC
Definition: DigiTask.h:149
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *qy=new ValueQuantity(quantity::fN), int debug=0)
Definition: Container1D.cc:40
hcaldqm::Container1D _cADC_SubdetPM
Definition: DigiTask.h:85
hcaldqm::Container1D _cOccupancyCutvsieta_Subdet
Definition: DigiTask.h:130
auto_ptr< ClusterSequence > cs
hcaldqm::ContainerProf1D _cSumQvsBX_SubdetPM
Definition: DigiTask.h:90
virtual bool exists(HcalDetId const &)
Definition: ContainerXXX.h:267
int const CRATE_VME_MIN
Definition: Constants.h:68
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
edm::InputTag _tagHO
Definition: DigiTask.h:48
std::pair< uint16_t, uint16_t > fed2crate(int fed)
Definition: Utilities.cc:13
uint32_t rawId() const
hcaldqm::ContainerProf1D _cQ2Q12CutvsLS_FEDHF
Definition: DigiTask.h:109
MonitorElement * meUnknownIds1LS
Definition: DigiTask.h:156
edm::EDGetTokenT< HBHEDigiCollection > _tokHBHE
Definition: DigiTask.h:50
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
virtual void initialize(std::string const &folder, Quantity *, Quantity *qy=new ValueQuantity(quantity::fN), int debug=0)
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
double _cutSumQ_HO
Definition: DigiTask.h:55
virtual CompactMap::const_iterator begin()
Definition: ContainerXXX.h:75
double _thresh_unihf
Definition: DigiTask.h:56
UpdateFreq
Definition: DQTask.h:17
State _state
Definition: Flag.h:79
std::vector< HBHEDataFrame >::const_iterator const_iterator
int bunchCrossing() const
Definition: EventBase.h:64
int const SPIGOT_MIN
Definition: Constants.h:93
hcaldqm::ContainerProf2D _cSumQ_depth
Definition: DigiTask.h:88
edm::EDGetTokenT< HODigiCollection > _tokHO
Definition: DigiTask.h:52
hcaldqm::Container1D _cOccupancyCutvsiphi_SubdetPM
Definition: DigiTask.h:129
const_iterator begin() const
virtual void reset()
Definition: ContainerXXX.h:366
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
hcaldqm::ContainerSingle2D _cSummaryvsLS
Definition: DigiTask.h:160
hcaldqm::ContainerProf2D _cTimingCut_FEDVME
Definition: DigiTask.h:98
int const FIBER_VME_MIN
Definition: Constants.h:98
hcaldqm::Container2D _cOccupancyCutvsiphivsLS_SubdetPM
Definition: DigiTask.h:132
hcaldqm::ContainerXXX< uint32_t > _xDigiSize
Definition: DigiTask.h:143
hcaldqm::ContainerProf2D _cTimingCut_FEDuTCA
Definition: DigiTask.h:99
void bookHistograms(fwlite::EventContainer &eventCont)
double q2[4]
Definition: TauolaWrapper.h:88
int const FIBERCH_MIN
Definition: Constants.h:108
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DigiTask.cc:1006
hcaldqm::ContainerSingle2D _cLETDCvsTS
Definition: DigiTask.h:150
void Fill(long long x)
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
std::vector< int > getFEDVMEList(HcalElectronicsMap const *)
Definition: Utilities.cc:110
hcaldqm::filter::HashFilter _filter_VME
Definition: DigiTask.h:78
virtual CompactMap::const_iterator end()
Definition: ContainerXXX.h:77
ProcessingType _ptype
Definition: DQModule.h:59
virtual void fill(uint32_t)
Definition: Container1D.cc:82
virtual void reset()
Definition: Container1D.cc:65
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *, int debug=0)
edm::InputTag _tagHBHE
Definition: DigiTask.h:46
void reset()
Definition: Flag.h:76
virtual void setBinContent(int, int, int)
void dqmthrow(std::string const &msg) const
Definition: Logger.h:15
ContainerXXX< uint32_t > _xQuality
Definition: DQTask.h:62
int const FED_VME_MIN
Definition: Constants.h:55
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *, Quantity *qz=new ValueQuantity(quantity::fEnergy), int debug=0)
hcaldqm::Container2D _cOccupancyCut_ElectronicsVME
Definition: DigiTask.h:126
hcaldqm::Container1D _cDigiSize_Crate
Definition: DigiTask.h:140
hcaldqm::Container1D _cShapeCut_FED
Definition: DigiTask.h:93
edm::InputTag _tagHEP17
Definition: DigiTask.h:47
hcaldqm::Container2D _cOccupancyCut_depth
Definition: DigiTask.h:128
hcaldqm::ContainerProf1D _cOccupancyCutvsBX_Subdet
Definition: DigiTask.h:137
double _cutSumQ_HF
Definition: DigiTask.h:55
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *, Quantity *qz=new ValueQuantity(quantity::fN), int debug=0)
Definition: Container2D.cc:32
int const FIBER_uTCA_MIN1
Definition: Constants.h:101
virtual void _resetMonitors(hcaldqm::UpdateFreq)
Definition: DigiTask.cc:446
double _cutSumQ_HBHE
Definition: DigiTask.h:55
hcaldqm::ContainerProf2D _cTimingCut_depth
Definition: DigiTask.h:104
std::vector< HcalGenericDetId > allPrecisionId() const
Logger _logger
Definition: DQModule.h:70
hcaldqm::Container2D _cOccupancy_FEDVME
Definition: DigiTask.h:113
hcaldqm::ContainerProf1D _cTimingCutvsLS_SubdetPM
Definition: DigiTask.h:103
hcaldqm::Container2D _cOccupancyCut_FEDVME
Definition: DigiTask.h:124
hcaldqm::Container2D _cOccupancy_depth
Definition: DigiTask.h:117
std::string _name
Definition: DQModule.h:57
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
hcaldqm::Container2D _cSummaryvsLS_FED
Definition: DigiTask.h:159
edm::EDGetTokenT< QIE11DigiCollection > _tokHEP17
Definition: DigiTask.h:51
hcaldqm::filter::HashFilter _filter_FEDHF
Definition: DigiTask.h:80
int const CRATE_uTCA_MIN
Definition: Constants.h:73
hcaldqm::ContainerSingle1D _cLETDCTime
Definition: DigiTask.h:151
const_iterator end() const
edm::EDGetTokenT< QIE10DigiCollection > _tokHF
Definition: DigiTask.h:53
double const adc2fC[256]
Definition: Constants.h:229
DigiTask(edm::ParameterSet const &)
Definition: DigiTask.cc:7
hcaldqm::ContainerProf1D _cOccupancyvsLS_Subdet
Definition: DigiTask.h:135
hcaldqm::ContainerProf1D _cSumQvsLS_SubdetPM
Definition: DigiTask.h:89
hcaldqm::ContainerXXX< uint32_t > _xUni
Definition: DigiTask.h:144
hcaldqm::ContainerProf1D _cTimingCutvsLS_FED
Definition: DigiTask.h:102
bool isVMEid() const
hcaldqm::Container2D _cOccupancyCut_FEDuTCA
Definition: DigiTask.h:125
hcaldqm::Container2D _cOccupancy_ElectronicsVME
Definition: DigiTask.h:115
edm::InputTag _tagHF
Definition: DigiTask.h:49
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
bool isFEDHBHE(HcalElectronicsId const &)
Definition: Utilities.cc:163
virtual void book(HcalElectronicsMap const *)
Definition: ContainerXXX.h:99
hcaldqm::Container1D _cDigiSize_FED
Definition: DigiTask.h:141
virtual void initialize(std::string const &folder, Quantity *, Quantity *, Quantity *qz=new ValueQuantity(quantity::fN), int debug=0)
double q1[4]
Definition: TauolaWrapper.h:87
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
Definition: Container1D.cc:957
hcaldqm::ContainerXXX< uint32_t > _xNChsNominal
Definition: DigiTask.h:146
hcaldqm::Container1D _cSumQ_SubdetPM
Definition: DigiTask.h:87
const T & get() const
Definition: EventSetup.h:56
hcaldqm::Container1D _cOccupancyvsiphi_SubdetPM
Definition: DigiTask.h:118
int const DIGISIZE[SUBDET_NUM]
Definition: Constants.h:140
hcaldqm::ContainerProf1D _cTimingCutvsieta_Subdet
Definition: DigiTask.h:106
hcaldqm::electronicsmap::ElectronicsMap _dhashmap
Definition: DigiTask.h:75
std::vector< hcaldqm::flag::Flag > _vflags
Definition: DigiTask.h:59
virtual void setBinContent(HcalDetId const &, int) override
Definition: Container2D.cc:235
std::string const & label() const
Definition: InputTag.h:36
const_iterator end() const
hcaldqm::Container2D _cOccupancyCut_ElectronicsuTCA
Definition: DigiTask.h:127
hcaldqm::ContainerProf2D _cTimingCut_ElectronicsVME
Definition: DigiTask.h:100
virtual STDTYPE & get(HcalDetId const &)
Definition: ContainerXXX.h:249
virtual void setLumiFlag()
std::vector< int > getFEDList(HcalElectronicsMap const *)
Definition: Utilities.cc:86
std::vector< int > getFEDuTCAList(HcalElectronicsMap const *)
Definition: Utilities.cc:136
virtual void fill(HcalDetId const &) override
Definition: Container2D.cc:59
const HcalElectronicsMap * getHcalMapping() const
std::string _subsystem
Definition: DQModule.h:64
hcaldqm::filter::HashFilter _filter_uTCA
Definition: DigiTask.h:79
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DigiTask.cc:1012
bool isFEDHO(HcalElectronicsId const &)
Definition: Utilities.cc:210
std::vector< uint32_t > _vcdaqEids
Definition: DQTask.h:65
hcaldqm::ContainerProf1D _cDigiSizevsLS_FED
Definition: DigiTask.h:142
hcaldqm::ContainerXXX< uint32_t > _xNChs
Definition: DigiTask.h:145
virtual void fill(int, int)
hcaldqm::electronicsmap::ElectronicsMap _ehashmap
Definition: DigiTask.h:74
hcaldqm::ContainerProf1D _cOccupancyCutvsLS_Subdet
Definition: DigiTask.h:136
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:91
virtual void initialize(FilterType ftype, HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:26
void setLumiFlag(void)
this ME is meant to be stored for each luminosity section
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:895
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
HcalElectronicsMap const * _emap
Definition: DigiTask.h:73
std::vector< uint32_t > _vhashFEDs
Definition: DigiTask.h:70
hcaldqm::filter::HashFilter _filter_HF
Definition: DigiTask.h:81
int samples() const
total number of samples in the digi
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
Definition: DigiTask.cc:37
virtual void _process(edm::Event const &, edm::EventSetup const &)
Definition: DigiTask.cc:466
hcaldqm::Container1D _cOccupancyvsieta_Subdet
Definition: DigiTask.h:119
Readout chain identification for Hcal.
std::string const & instance() const
Definition: InputTag.h:37
bool isFEDHF(HcalElectronicsId const &)
Definition: Utilities.cc:185
hcaldqm::ContainerProf2D _cTimingCut_ElectronicsuTCA
Definition: DigiTask.h:101
int const SLOT_uTCA_MIN
Definition: Constants.h:80
const_iterator begin() const
hcaldqm::Container1D _cTimingCut_SubdetPM
Definition: DigiTask.h:97
Definition: Run.h:42
bool _unknownIdsPresent
Definition: DigiTask.h:157
hcaldqm::Container2D _cOccupancy_FEDuTCA
Definition: DigiTask.h:114
ib
Definition: cuy.py:660
hcaldqm::ContainerXXX< uint32_t > _xUniHF
Definition: DigiTask.h:144
double _cutSumQ_HEP17
Definition: DigiTask.h:55
double sumQ(DIGI const &digi, double ped, int i=0, int j=3)
Definition: Utilities.h:79
hcaldqm::Container1D _cfC_SubdetPM
Definition: DigiTask.h:86
hcaldqm::Container2D _cOccupancy_ElectronicsuTCA
Definition: DigiTask.h:116