Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-06-20 01:53:12

0001 #include "DQM/HcalTasks/interface/DigiTask.h"
0002 
0003 using namespace hcaldqm;
0004 using namespace hcaldqm::constants;
0005 using namespace hcaldqm::filter;
0006 
0007 DigiTask::DigiTask(edm::ParameterSet const& ps)
0008     : DQTask(ps),
0009       hcalDbServiceToken_(esConsumes<HcalDbService, HcalDbRecord, edm::Transition::BeginRun>()),
0010       _tokHcalChannelQuality(esConsumes<HcalChannelQuality, HcalChannelQualityRcd, edm::Transition::BeginRun>(
0011           edm::ESInputTag("", "withTopo"))) {
0012   _tagQIE11 = ps.getUntrackedParameter<edm::InputTag>("tagHE", edm::InputTag("hcalDigis"));
0013   _tagHO = ps.getUntrackedParameter<edm::InputTag>("tagHO", edm::InputTag("hcalDigis"));
0014   _tagQIE10 = ps.getUntrackedParameter<edm::InputTag>("tagHF", edm::InputTag("hcalDigis"));
0015 
0016   _tokQIE11 = consumes<QIE11DigiCollection>(_tagQIE11);
0017   _tokHO = consumes<HODigiCollection>(_tagHO);
0018   _tokQIE10 = consumes<QIE10DigiCollection>(_tagQIE10);
0019 
0020   _cutSumQ_HBHE = ps.getUntrackedParameter<double>("cutSumQ_HBHE", 20);
0021   _cutSumQ_HO = ps.getUntrackedParameter<double>("cutSumQ_HO", 20);
0022   _cutSumQ_HF = ps.getUntrackedParameter<double>("cutSumQ_HF", 20);
0023   _thresh_unihf = ps.getUntrackedParameter<double>("thresh_unihf", 0.2);
0024   _thresh_led = ps.getUntrackedParameter<double>("thresh_led", 20);
0025 
0026   _vflags.resize(nDigiFlag);
0027   _vflags[fUni] = hcaldqm::flag::Flag("UniSlotHF");
0028   _vflags[fDigiSize] = hcaldqm::flag::Flag("DigiSize");
0029   _vflags[fNChsHF] = hcaldqm::flag::Flag("NChsHF");
0030   _vflags[fUnknownIds] = hcaldqm::flag::Flag("UnknownIds");
0031   _vflags[fLED] = hcaldqm::flag::Flag("LEDMisfire");
0032   _vflags[fCapId] = hcaldqm::flag::Flag("BadCapId");
0033 
0034   _qie10InConditions = ps.getUntrackedParameter<bool>("qie10InConditions", true);
0035 
0036   // Get reference digi sizes. Convert from unsigned to signed int, because <digi>::size()/samples() return ints for some reason.
0037   std::vector<uint32_t> vrefDigiSize = ps.getUntrackedParameter<std::vector<uint32_t>>("refDigiSize");
0038   _refDigiSize[HcalBarrel] = (int)vrefDigiSize[0];
0039   _refDigiSize[HcalEndcap] = (int)vrefDigiSize[1];
0040   _refDigiSize[HcalOuter] = (int)vrefDigiSize[2];
0041   _refDigiSize[HcalForward] = (int)vrefDigiSize[3];
0042 
0043   // (capid - BX) % 4 to 1
0044   _capidmbx[HcalBarrel] = 1;
0045   _capidmbx[HcalEndcap] = 1;
0046   _capidmbx[HcalOuter] = 1;
0047   _capidmbx[HcalForward] = 1;
0048 }
0049 
0050 /* virtual */ void DigiTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
0051   DQTask::bookHistograms(ib, r, es);
0052 
0053   //    GET WHAT YOU NEED
0054   edm::ESHandle<HcalDbService> dbs = es.getHandle(hcalDbServiceToken_);
0055   _emap = dbs->getHcalMapping();
0056 
0057   //    FILL _xQuality
0058   _xQuality.reset();
0059   const HcalChannelQuality* cq = &es.getData(_tokHcalChannelQuality);
0060   auto _xQuality = cq;
0061 
0062   // Book LED calibration channels from emap
0063   std::vector<HcalElectronicsId> eids = _emap->allElectronicsId();
0064   for (unsigned i = 0; i < eids.size(); i++) {
0065     HcalElectronicsId eid = eids[i];
0066     DetId id = _emap->lookup(eid);
0067     if (HcalGenericDetId(id.rawId()).isHcalCalibDetId()) {
0068       HcalCalibDetId calibId(id);
0069       if (calibId.calibFlavor() == HcalCalibDetId::CalibrationBox) {
0070         HcalSubdetector this_subdet = HcalEmpty;
0071         switch (calibId.hcalSubdet()) {
0072           case HcalBarrel:
0073             this_subdet = HcalBarrel;
0074             break;
0075           case HcalEndcap:
0076             this_subdet = HcalEndcap;
0077             break;
0078           case HcalOuter:
0079             this_subdet = HcalOuter;
0080             break;
0081           case HcalForward:
0082             this_subdet = HcalForward;
0083             break;
0084           default:
0085             this_subdet = HcalEmpty;
0086             break;
0087         }
0088         _ledCalibrationChannels[this_subdet].push_back(
0089             HcalDetId(HcalOther, calibId.ieta(), calibId.iphi(), calibId.cboxChannel()));
0090       }
0091     }
0092   }
0093 
0094   std::vector<uint32_t> vVME;
0095   std::vector<uint32_t> vuTCA;
0096   vVME.push_back(
0097       HcalElectronicsId(constants::FIBERCH_MIN, constants::FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId());
0098   vuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0099   _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vVME);
0100   _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vuTCA);
0101 
0102   // Filters for QIE8 vs QIE10/11
0103   std::vector<uint32_t> vhashQIE8;
0104   vhashQIE8.push_back(hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdet](HcalDetId(HcalOuter, 1, 1, 4)));
0105   _filter_QIE8.initialize(filter::fPreserver, hcaldqm::hashfunctions::fSubdet, vhashQIE8);
0106 
0107   std::vector<uint32_t> vhashQIE1011;
0108   vhashQIE1011.push_back(
0109       hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdet](HcalDetId(HcalBarrel, 1, 1, 1)));
0110   vhashQIE1011.push_back(
0111       hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdet](HcalDetId(HcalEndcap, 20, 1, 1)));
0112   vhashQIE1011.push_back(
0113       hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdet](HcalDetId(HcalForward, 29, 1, 1)));
0114   _filter_QIE1011.initialize(filter::fPreserver, hcaldqm::hashfunctions::fSubdet, vhashQIE1011);
0115 
0116   std::vector<uint32_t> vhash_TDC2bit;
0117   vhash_TDC2bit.push_back(
0118       hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdetPM](HcalDetId(HcalBarrel, 1, 1, 1)));
0119   vhash_TDC2bit.push_back(
0120       hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdetPM](HcalDetId(HcalBarrel, -11, 1, 1)));
0121   _filter_TDC2bit.initialize(filter::fPreserver, hcaldqm::hashfunctions::fSubdetPM, vhash_TDC2bit);
0122 
0123   std::vector<uint32_t> vhash_TDC6bit;
0124   vhash_TDC6bit.push_back(
0125       hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdetPM](HcalDetId(HcalEndcap, 20, 1, 1)));
0126   vhash_TDC6bit.push_back(
0127       hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdetPM](HcalDetId(HcalEndcap, -20, 1, 1)));
0128   vhash_TDC6bit.push_back(
0129       hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdetPM](HcalDetId(HcalForward, 29, 1, 1)));
0130   vhash_TDC6bit.push_back(
0131       hcaldqm::hashfunctions::hash_did[hcaldqm::hashfunctions::fSubdetPM](HcalDetId(HcalForward, -29, 1, 1)));
0132   _filter_TDC6bit.initialize(filter::fPreserver, hcaldqm::hashfunctions::fSubdetPM, vhash_TDC6bit);
0133   std::vector<int> vFEDs = hcaldqm::utilities::getFEDList(_emap);
0134   //    INITIALIZE FIRST
0135   _cADC_SubdetPM.initialize(_name,
0136                             "ADC",
0137                             hcaldqm::hashfunctions::fSubdetPM,
0138                             new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_128),
0139                             new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0140                             0);
0141   _cfC_SubdetPM.initialize(_name,
0142                            "fC",
0143                            hcaldqm::hashfunctions::fSubdetPM,
0144                            new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000),
0145                            new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0146                            0);
0147   _cSumQ_SubdetPM.initialize(_name,
0148                              "SumQ",
0149                              hcaldqm::hashfunctions::fSubdetPM,
0150                              new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000),
0151                              new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0152                              0);
0153   _cSumQ_depth.initialize(_name,
0154                           "SumQ",
0155                           hcaldqm::hashfunctions::fdepth,
0156                           new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0157                           new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0158                           new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_generic_400000, true),
0159                           0);
0160   _cSumQvsLS_SubdetPM.initialize(_name,
0161                                  "SumQvsLS",
0162                                  hcaldqm::hashfunctions::fSubdetPM,
0163                                  new hcaldqm::quantity::LumiSection(_maxLS),
0164                                  new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000),
0165                                  0);
0166   //
0167   _cSumQ_Subdet.initialize(_name,
0168                            "SumQ",
0169                            hcaldqm::hashfunctions::fSubdet,
0170                            new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000),
0171                            new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0172                            0);
0173   _cAveragedSumQvsLS_Subdet.initialize(_name,
0174                                        "AveragedSumQvsLS",
0175                                        hcaldqm::hashfunctions::fSubdet,
0176                                        new hcaldqm::quantity::LumiSection(_maxLS),
0177                                        new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000),
0178                                        0);
0179   //
0180   _cADC_SubdetPM_QIE1011.initialize(_name,
0181                                     "ADC",
0182                                     hcaldqm::hashfunctions::fSubdetPM,
0183                                     new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256),
0184                                     new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0185                                     0);
0186   _cfC_SubdetPM_QIE1011.initialize(_name,
0187                                    "fC",
0188                                    hcaldqm::hashfunctions::fSubdetPM,
0189                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000),
0190                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0191                                    0);
0192   _cSumQ_SubdetPM_QIE1011.initialize(_name,
0193                                      "SumQ",
0194                                      hcaldqm::hashfunctions::fSubdetPM,
0195                                      new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000),
0196                                      new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0197                                      0);
0198   _cSumQvsLS_SubdetPM_QIE1011.initialize(_name,
0199                                          "SumQvsLS",
0200                                          hcaldqm::hashfunctions::fSubdetPM,
0201                                          new hcaldqm::quantity::LumiSection(_maxLS),
0202                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000),
0203                                          0);
0204   //
0205   _cSumQ_Subdet_QIE1011.initialize(_name,
0206                                    "SumQ",
0207                                    hcaldqm::hashfunctions::fSubdet,
0208                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000),
0209                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0210                                    0);
0211   _cAveragedSumQvsLS_Subdet_QIE1011.initialize(_name,
0212                                                "AveragedSumQvsLS",
0213                                                hcaldqm::hashfunctions::fSubdet,
0214                                                new hcaldqm::quantity::LumiSection(_maxLS),
0215                                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_400000),
0216                                                0);
0217   //
0218   _cTimingCut_SubdetPM.initialize(_name,
0219                                   "TimingCut",
0220                                   hcaldqm::hashfunctions::fSubdetPM,
0221                                   new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),
0222                                   new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0223                                   0);
0224   _cTimingCutHTH_SubdetPM.initialize(_name,
0225                                      "TimingHighCut",
0226                                      hcaldqm::hashfunctions::fSubdetPM,
0227                                      new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),
0228                                      new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0229                                      0);
0230   _cTimingCut_depth.initialize(_name,
0231                                "TimingCut",
0232                                hcaldqm::hashfunctions::fdepth,
0233                                new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0234                                new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0235                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),
0236                                0);
0237   _cTimingCutvsLS_SubdetPM.initialize(_name,
0238                                       "TimingvsLS",
0239                                       hcaldqm::hashfunctions::fSubdetPM,
0240                                       new hcaldqm::quantity::LumiSection(_maxLS),
0241                                       new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),
0242                                       0);
0243 
0244   _cTimingCutvsLS_depth.initialize(_name,
0245                                    "TimingvsLS",
0246                                    hcaldqm::hashfunctions::fdepth,
0247                                    new hcaldqm::quantity::LumiSection(_maxLS),
0248                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),
0249                                    0);
0250 
0251   //    Occupancy w/o a cut
0252   _cOccupancyvsLS_Subdet.initialize(_name,
0253                                     "OccupancyvsLS",
0254                                     hcaldqm::hashfunctions::fSubdet,
0255                                     new hcaldqm::quantity::LumiSection(_maxLS),
0256                                     new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000),
0257                                     0);
0258   _cOccupancy_depth.initialize(_name,
0259                                "Occupancy",
0260                                hcaldqm::hashfunctions::fdepth,
0261                                new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0262                                new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0263                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0264                                0);
0265 
0266   //    Occupancy w/ a cut
0267   _cOccupancyCutvsLS_Subdet.initialize(_name,
0268                                        "OccupancyCutvsLS",
0269                                        hcaldqm::hashfunctions::fSubdet,
0270                                        new hcaldqm::quantity::LumiSection(_maxLS),
0271                                        new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000),
0272                                        0);
0273   _cOccupancyCut_depth.initialize(_name,
0274                                   "OccupancyCut",
0275                                   hcaldqm::hashfunctions::fdepth,
0276                                   new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0277                                   new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0278                                   new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0279                                   0);
0280 
0281   // Digi size
0282   _cDigiSize_Crate.initialize(_name,
0283                               "DigiSize",
0284                               hcaldqm::hashfunctions::fCrate,
0285                               new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDigiSize),
0286                               new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0287                               0);
0288   _cADCvsTS_SubdetPM.initialize(_name,
0289                                 "ADCvsTS",
0290                                 hcaldqm::hashfunctions::fSubdetPM,
0291                                 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS),
0292                                 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_128),
0293                                 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0294                                 0);
0295   _cADCvsTS_SubdetPM_QIE1011.initialize(_name,
0296                                         "ADCvsTS",
0297                                         hcaldqm::hashfunctions::fSubdetPM,
0298                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS),
0299                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256),
0300                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0301                                         0);
0302 
0303   _cLETDCTimevsADC_SubdetPM.initialize(_name,
0304                                        "LETDCTimevsADC",
0305                                        hcaldqm::hashfunctions::fSubdetPM,
0306                                        new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256),
0307                                        new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250_coarse),
0308                                        new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
0309   _cLETDCvsADC_2bit_SubdetPM.initialize(_name,
0310                                         "LETDCvsADC",
0311                                         hcaldqm::hashfunctions::fSubdetPM,
0312                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256),
0313                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_4),
0314                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
0315   _cLETDCvsADC_6bit_SubdetPM.initialize(_name,
0316                                         "LETDCvsADC",
0317                                         hcaldqm::hashfunctions::fSubdetPM,
0318                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10ADC_256),
0319                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64),
0320                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
0321   _cLETDCvsTS_2bit_SubdetPM.initialize(_name,
0322                                        "LETDCvsTS",
0323                                        hcaldqm::hashfunctions::fSubdetPM,
0324                                        new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS),
0325                                        new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_4),
0326                                        new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
0327   _cLETDCvsTS_6bit_SubdetPM.initialize(_name,
0328                                        "LETDCvsTS",
0329                                        hcaldqm::hashfunctions::fSubdetPM,
0330                                        new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS),
0331                                        new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10TDC_64),
0332                                        new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
0333 
0334   _cLETDCTime_SubdetPM.initialize(_name,
0335                                   "LETDCTime",
0336                                   hcaldqm::hashfunctions::fSubdetPM,
0337                                   new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTime_ns_250_coarse),
0338                                   new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
0339   _cLETDCTime_depth.initialize(_name,
0340                                "LETDCTime",
0341                                hcaldqm::hashfunctions::fdepth,
0342                                new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0343                                new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0344                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0345                                0);
0346 
0347   _cBadTDCValues_SubdetPM.initialize(_name,
0348                                      "BadTDCValues",
0349                                      hcaldqm::hashfunctions::fSubdetPM,
0350                                      new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBadTDC),
0351                                      new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
0352   _cBadTDCvsBX_SubdetPM.initialize(_name,
0353                                    "BadTDCvsBX",
0354                                    hcaldqm::hashfunctions::fSubdetPM,
0355                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0356                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
0357   _cBadTDCvsLS_SubdetPM.initialize(_name,
0358                                    "BadTDCvsLS",
0359                                    hcaldqm::hashfunctions::fSubdetPM,
0360                                    new hcaldqm::quantity::LumiSection(_maxLS),
0361                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
0362   _cBadTDCCount_depth.initialize(_name,
0363                                  "BadTDCCount",
0364                                  hcaldqm::hashfunctions::fdepth,
0365                                  new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0366                                  new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0367                                  new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0368                                  0);
0369 
0370   if (_ptype == fOnline || _ptype == fLocal) {
0371     _cOccupancy_Crate.initialize(_name,
0372                                  "Occupancy",
0373                                  hashfunctions::fCrate,
0374                                  new quantity::ElectronicsQuantity(quantity::fSlotuTCA),
0375                                  new quantity::ElectronicsQuantity(quantity::fFiberuTCAFiberCh),
0376                                  new quantity::ValueQuantity(quantity::fN),
0377                                  0);
0378     _cOccupancy_CrateSlot.initialize(_name,
0379                                      "Occupancy",
0380                                      hashfunctions::fCrateSlot,
0381                                      new quantity::ElectronicsQuantity(quantity::fFiberuTCA),
0382                                      new quantity::ElectronicsQuantity(quantity::fFiberCh),
0383                                      new quantity::ValueQuantity(quantity::fN),
0384                                      0);
0385   }
0386 
0387   if (_ptype == fOnline || _ptype == fOffline) {
0388     _cTimingCutvsiphi_SubdetPM.initialize(_name,
0389                                           "TimingCutvsiphi",
0390                                           hcaldqm::hashfunctions::fSubdetPM,
0391                                           new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0392                                           new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),
0393                                           0);
0394     _cOccupancyCutvsiphi_SubdetPM.initialize(_name,
0395                                              "OccupancyCutvsiphi",
0396                                              hcaldqm::hashfunctions::fSubdetPM,
0397                                              new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0398                                              new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0399                                              0);
0400     _cOccupancyCutvsiphivsLS_SubdetPM.initialize(_name,
0401                                                  "OccupancyCutvsiphivsLS",
0402                                                  hcaldqm::hashfunctions::fSubdetPM,
0403                                                  new hcaldqm::quantity::LumiSection(_maxLS),
0404                                                  new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0405                                                  new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0406                                                  0);
0407     _cOccupancyCutvsLS_Subdet.initialize(_name,
0408                                          "OccupancyCutvsLS",
0409                                          hcaldqm::hashfunctions::fSubdet,
0410                                          new hcaldqm::quantity::LumiSection(_maxLS),
0411                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000),
0412                                          0);
0413     _cOccupancyCutvsBX_Subdet.initialize(_name,
0414                                          "OccupancyCutvsBX",
0415                                          hcaldqm::hashfunctions::fSubdet,
0416                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0417                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN_to8000),
0418                                          0);
0419     _xBadCapid.initialize(hcaldqm::hashfunctions::fFED);
0420   }
0421   //    INITIALIZE HISTOGRAMS that are only for Online
0422   if (_ptype == fOnline) {
0423     //  Charge sharing
0424     _cQ2Q12CutvsLS_FEDHF.initialize(_name,
0425                                     "Q2Q12vsLS",
0426                                     hcaldqm::hashfunctions::fFED,
0427                                     new hcaldqm::quantity::LumiSection(_maxLS),
0428                                     new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio_0to2),
0429                                     0);
0430     _cSumQvsBX_SubdetPM.initialize(_name,
0431                                    "SumQvsBX",
0432                                    hcaldqm::hashfunctions::fSubdetPM,
0433                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0434                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000),
0435                                    0);
0436     _cSumQvsBX_SubdetPM_QIE1011.initialize(_name,
0437                                            "SumQvsBX",
0438                                            hcaldqm::hashfunctions::fSubdetPM,
0439                                            new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0440                                            new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fQIE10fC_10000),
0441                                            0);
0442     _cDigiSizevsLS_FED.initialize(_name,
0443                                   "DigiSizevsLS",
0444                                   hcaldqm::hashfunctions::fFED,
0445                                   new hcaldqm::quantity::LumiSection(_maxLS),
0446                                   new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDigiSize),
0447                                   0);
0448     _cOccupancyvsieta_Subdet.initialize(_name,
0449                                         "Occupancyvsieta",
0450                                         hcaldqm::hashfunctions::fSubdet,
0451                                         new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0452                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0453                                         0);
0454     _cOccupancyvsiphi_SubdetPM.initialize(_name,
0455                                           "Occupancyvsiphi",
0456                                           hcaldqm::hashfunctions::fSubdetPM,
0457                                           new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0458                                           new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0459                                           0);
0460     _cTimingCutvsieta_Subdet.initialize(_name,
0461                                         "TimingCutvsieta",
0462                                         hcaldqm::hashfunctions::fSubdet,
0463                                         new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0464                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),
0465                                         0);
0466     _cOccupancyCutvsieta_Subdet.initialize(_name,
0467                                            "OccupancyCutvsieta",
0468                                            hcaldqm::hashfunctions::fSubdet,
0469                                            new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0470                                            new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0471                                            0);
0472     //      _cOccupancyCutvsSlotvsLS_HFPM.initialize(_name,
0473     //          "OccupancyCutvsSlotvsLS", hcaldqm::hashfunctions::fSubdetPM,
0474     //          new hcaldqm::quantity::LumiSection(_maxLS),
0475     //          new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0476     //          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),0);
0477   }
0478   _cCapidMinusBXmod4_SubdetPM.initialize(_name,
0479                                          "CapID",
0480                                          hcaldqm::hashfunctions::fSubdetPM,
0481                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fCapidMinusBXmod4),
0482                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true));
0483 
0484   for (int i = 0; i < 4; ++i) {
0485     _cCapidMinusBXmod4_CrateSlotuTCA[i].initialize(_name,
0486                                                    "CapID",
0487                                                    new quantity::ElectronicsQuantity(quantity::fCrateuTCA),
0488                                                    new quantity::ElectronicsQuantity(quantity::fSlotuTCA),
0489                                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0490                                                    0);
0491   }
0492   if (_ptype == fOnline || _ptype == fOffline) {
0493     _cOccupancyBadCapidvsLS_Subdet.initialize(_name,
0494                                               "CapID",
0495                                               hcaldqm::hashfunctions::fSubdet,
0496                                               new hcaldqm::quantity::LumiSection(_maxLS),
0497                                               new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0498                                               0);
0499     _cOccupancyBadCapidvsLS_depth.initialize(_name,
0500                                              "CapID",
0501                                              hcaldqm::hashfunctions::fdepth,
0502                                              new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fieta),
0503                                              new hcaldqm::quantity::DetectorQuantity(hcaldqm::quantity::fiphi),
0504                                              new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0505                                              0);
0506     _cCapid_BadvsFEDvsLS.initialize(_name,
0507                                     "CapID",
0508                                     new hcaldqm::quantity::LumiSectionCoarse(_maxLS, 10),
0509                                     new hcaldqm::quantity::FEDQuantity(vFEDs),
0510                                     new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0511                                     0);
0512 
0513     _cCapid_BadvsFEDvsLSmod10.initialize(_name,
0514                                          "CapID",
0515                                          new hcaldqm::quantity::LumiSection(10),
0516                                          new hcaldqm::quantity::FEDQuantity(vFEDs),
0517                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0518                                          0);
0519   }
0520   if (_ptype != fOffline) {  // hidefed2crate
0521     //std::vector<int> vFEDs = hcaldqm::utilities::getFEDList(_emap);
0522     std::vector<int> vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap);
0523     std::vector<int> vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap);
0524     std::vector<uint32_t> vFEDHF;
0525     vFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0526     vFEDHF.push_back(HcalElectronicsId(22, SLOT_uTCA_MIN + 6, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0527     vFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0528     vFEDHF.push_back(HcalElectronicsId(29, SLOT_uTCA_MIN + 6, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0529     vFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0530     vFEDHF.push_back(HcalElectronicsId(32, SLOT_uTCA_MIN + 6, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0531 
0532     //  initialize filters
0533     _filter_FEDHF.initialize(filter::fPreserver, hcaldqm::hashfunctions::fFED, vFEDHF);
0534 
0535     //  push the rawIds of each fed into the vector...
0536     for (std::vector<int>::const_iterator it = vFEDsVME.begin(); it != vFEDsVME.end(); ++it)
0537       _vhashFEDs.push_back(
0538           HcalElectronicsId(constants::FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, (*it) - FED_VME_MIN).rawId());
0539     for (std::vector<int>::const_iterator it = vFEDsuTCA.begin(); it != vFEDsuTCA.end(); ++it) {
0540       std::pair<uint16_t, uint16_t> cspair = utilities::fed2crate(*it);
0541       _vhashFEDs.push_back(HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0542     }
0543 
0544     _cShapeCut_FED.initialize(_name,
0545                               "ShapeCut",
0546                               hcaldqm::hashfunctions::fFED,
0547                               new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS),
0548                               new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::ffC_10000),
0549                               0);
0550 
0551     _cTimingCut_FEDuTCA.initialize(_name,
0552                                    "TimingCut",
0553                                    hcaldqm::hashfunctions::fFED,
0554                                    new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0555                                    new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh),
0556                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),
0557                                    0);
0558     _cTimingCut_ElectronicsuTCA.initialize(_name,
0559                                            "TimingCut",
0560                                            hcaldqm::hashfunctions::fElectronics,
0561                                            new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
0562                                            new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0563                                            new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),
0564                                            0);
0565     _cTimingCutvsLS_FED.initialize(_name,
0566                                    "TimingvsLS",
0567                                    hcaldqm::hashfunctions::fFED,
0568                                    new hcaldqm::quantity::LumiSection(_maxLS),
0569                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fTiming_TS200),
0570                                    0);
0571 
0572     _cOccupancy_FEDuTCA.initialize(_name,
0573                                    "Occupancy",
0574                                    hcaldqm::hashfunctions::fFED,
0575                                    new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0576                                    new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh),
0577                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0578                                    0);
0579     _cOccupancy_ElectronicsuTCA.initialize(_name,
0580                                            "Occupancy",
0581                                            hcaldqm::hashfunctions::fElectronics,
0582                                            new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
0583                                            new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0584                                            new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0585                                            0);
0586 
0587     _cOccupancyCut_FEDuTCA.initialize(_name,
0588                                       "OccupancyCut",
0589                                       hcaldqm::hashfunctions::fFED,
0590                                       new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0591                                       new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fFiberuTCAFiberCh),
0592                                       new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0593                                       0);
0594     _cOccupancyCut_ElectronicsuTCA.initialize(_name,
0595                                               "OccupancyCut",
0596                                               hcaldqm::hashfunctions::fElectronics,
0597                                               new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
0598                                               new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0599                                               new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0600                                               0);
0601 
0602     _cDigiSize_FED.initialize(_name,
0603                               "DigiSize",
0604                               hcaldqm::hashfunctions::fFED,
0605                               new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fDigiSize),
0606                               new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0607                               0);
0608 
0609     if (_ptype == fOnline) {
0610       _cSummaryvsLS_FED.initialize(_name,
0611                                    "SummaryvsLS",
0612                                    hcaldqm::hashfunctions::fFED,
0613                                    new hcaldqm::quantity::LumiSection(_maxLS),
0614                                    new hcaldqm::quantity::FlagQuantity(_vflags),
0615                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),
0616                                    0);
0617       _cSummaryvsLS.initialize(_name,
0618                                "SummaryvsLS",
0619                                new hcaldqm::quantity::LumiSection(_maxLS),
0620                                new hcaldqm::quantity::FEDQuantity(vFEDs),
0621                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),
0622                                0);
0623 
0624       _xUniHF.initialize(hcaldqm::hashfunctions::fFEDSlot);
0625       _xUni.initialize(hcaldqm::hashfunctions::fFED);
0626       _xDigiSize.initialize(hcaldqm::hashfunctions::fFED);
0627       _xNChs.initialize(hcaldqm::hashfunctions::fFED);
0628       _xNChsNominal.initialize(hcaldqm::hashfunctions::fFED);
0629       //_xBadCapid.initialize(hcaldqm::hashfunctions::fFED);
0630     }
0631   }
0632   if (_ptype != fLocal) {
0633     _LED_ADCvsBX_Subdet.initialize(_name,
0634                                    "LED_ADCvsBX",
0635                                    hcaldqm::hashfunctions::fSubdet,
0636                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX_36),
0637                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fADC_256_4),
0638                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0639                                    0);
0640 
0641     _LED_CUCountvsLS_Subdet.initialize(_name,
0642                                        "LED_CUCountvsLS",
0643                                        hcaldqm::hashfunctions::fSubdet,
0644                                        new hcaldqm::quantity::LumiSection(_maxLS),
0645                                        new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0646                                        0);
0647     if (_ptype == fOnline) {
0648       _LED_CUCountvsLSmod60_Subdet.initialize(_name,
0649                                               "LED_CUCountvsLSmod60",
0650                                               hcaldqm::hashfunctions::fSubdet,
0651                                               new hcaldqm::quantity::LumiSection(60),
0652                                               new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0653                                               0);
0654     }
0655   }
0656 
0657   //    BOOK HISTOGRAMS
0658   char cutstr[200];
0659   sprintf(cutstr, "_SumQHBHE%dHO%dHF%d", int(_cutSumQ_HBHE), int(_cutSumQ_HO), int(_cutSumQ_HF));
0660   char cutstr2[200];
0661   sprintf(cutstr2, "_SumQHF%d", int(_cutSumQ_HF));
0662 
0663   _cADC_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem);
0664   _cADC_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem);
0665   _cfC_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem);
0666   _cfC_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem);
0667   _cSumQ_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem);
0668   _cSumQ_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem);
0669 
0670   _cSumQ_Subdet.book(ib, _emap, _subsystem);
0671   _cSumQ_Subdet_QIE1011.book(ib, _emap, _subsystem);
0672 
0673   _cSumQ_depth.book(ib, _emap, _subsystem);
0674 
0675   _cSumQvsLS_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem);
0676   _cSumQvsLS_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem);
0677 
0678   _cAveragedSumQvsLS_Subdet.book(ib, _emap, _subsystem);
0679   _cAveragedSumQvsLS_Subdet_QIE1011.book(ib, _emap, _subsystem);
0680 
0681   _cADCvsTS_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem);
0682   _cADCvsTS_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem);
0683 
0684   if (_ptype != fOffline) {  // hidefed2crate
0685     _cShapeCut_FED.book(ib, _emap, _subsystem);
0686     _cTimingCut_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem);
0687     _cTimingCut_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem);
0688     _cTimingCutvsLS_FED.book(ib, _emap, _subsystem);
0689     _cOccupancy_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem);
0690     _cOccupancy_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem);
0691     _cOccupancyCut_FEDuTCA.book(ib, _emap, _filter_VME, _subsystem);
0692     _cOccupancyCut_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem);
0693     _cDigiSize_FED.book(ib, _emap, _subsystem);
0694   }
0695   if (_ptype != fOffline) {  // else book per-lumi later.
0696     _cDigiSize_Crate.book(ib, _emap, _subsystem);
0697     _cOccupancy_depth.book(ib, _emap, _subsystem);
0698   }
0699 
0700   _cTimingCut_SubdetPM.book(ib, _emap, _subsystem);
0701   _cTimingCutHTH_SubdetPM.book(ib, _emap, _subsystem);
0702   _cTimingCut_depth.book(ib, _emap, _subsystem);
0703 
0704   _cTimingCutvsLS_SubdetPM.book(ib, _emap, _subsystem);
0705   _cTimingCutvsLS_depth.book(ib, _emap, _subsystem);
0706 
0707   _cOccupancyvsLS_Subdet.book(ib, _emap, _subsystem);
0708   _cOccupancyCut_depth.book(ib, _emap, _subsystem);
0709   _cOccupancyCutvsLS_Subdet.book(ib, _emap, _subsystem);
0710 
0711   _cLETDCTimevsADC_SubdetPM.book(ib, _emap, _subsystem);
0712   _cLETDCvsADC_2bit_SubdetPM.book(ib, _emap, _filter_TDC2bit, _subsystem);
0713   _cLETDCvsADC_6bit_SubdetPM.book(ib, _emap, _filter_TDC6bit, _subsystem);
0714   _cLETDCvsTS_2bit_SubdetPM.book(ib, _emap, _filter_TDC2bit, _subsystem);
0715   _cLETDCvsTS_6bit_SubdetPM.book(ib, _emap, _filter_TDC6bit, _subsystem);
0716   _cLETDCTime_SubdetPM.book(ib, _emap, _subsystem);
0717   _cLETDCTime_depth.book(ib, _emap, _subsystem);
0718 
0719   _cBadTDCValues_SubdetPM.book(ib, _emap, _subsystem);
0720   _cBadTDCvsBX_SubdetPM.book(ib, _emap, _subsystem);
0721   _cBadTDCvsLS_SubdetPM.book(ib, _emap, _subsystem);
0722   _cBadTDCCount_depth.book(ib, _emap, _subsystem);
0723 
0724   _cCapidMinusBXmod4_SubdetPM.book(ib, _emap, _subsystem);
0725 
0726   for (int i = 0; i < 4; ++i) {
0727     constexpr unsigned int kSize = 32;
0728     char aux[kSize];
0729     snprintf(aux, kSize, "%d_uTCA", i);
0730     _cCapidMinusBXmod4_CrateSlotuTCA[i].book(ib, _subsystem, aux);
0731   }
0732 
0733   if (_ptype != fLocal) {
0734     _LED_ADCvsBX_Subdet.book(ib, _emap, _subsystem);
0735     _LED_CUCountvsLS_Subdet.book(ib, _emap, _subsystem);
0736     if (_ptype == fOnline) {
0737       _LED_CUCountvsLSmod60_Subdet.book(ib, _emap, _subsystem);
0738     }
0739   }
0740 
0741   //    BOOK HISTOGRAMS that are only for Online
0742   _ehashmap.initialize(_emap, electronicsmap::fD2EHashMap);
0743   _dhashmap.initialize(_emap, electronicsmap::fE2DHashMap);
0744 
0745   if (_ptype == fOnline || _ptype == fLocal) {
0746     _cOccupancy_Crate.book(ib, _emap, _subsystem);
0747     _cOccupancy_CrateSlot.book(ib, _emap, _subsystem);
0748   }
0749 
0750   if (_ptype == fOnline || _ptype == fOffline) {
0751     _cOccupancyCutvsiphi_SubdetPM.book(ib, _emap, _subsystem);
0752     _cOccupancyCutvsLS_Subdet.book(ib, _emap, _subsystem);
0753     _cOccupancyCutvsiphivsLS_SubdetPM.book(ib, _emap, _subsystem);
0754     _cOccupancyCutvsBX_Subdet.book(ib, _emap, _subsystem);
0755     _cTimingCutvsiphi_SubdetPM.book(ib, _emap, _subsystem);
0756     _cOccupancyBadCapidvsLS_Subdet.book(ib, _emap, _subsystem);
0757     _cOccupancyBadCapidvsLS_depth.book(ib, _emap, _subsystem);
0758     _xBadCapid.book(_emap);
0759     _cCapid_BadvsFEDvsLS.book(ib, _subsystem, "BadvsLS");
0760     _cCapid_BadvsFEDvsLSmod10.book(ib, _subsystem, "BadvsLSmod10");
0761   }
0762   if (_ptype == fOnline) {
0763     _cQ2Q12CutvsLS_FEDHF.book(ib, _emap, _filter_FEDHF, _subsystem);
0764     _cSumQvsBX_SubdetPM.book(ib, _emap, _filter_QIE8, _subsystem);
0765     _cSumQvsBX_SubdetPM_QIE1011.book(ib, _emap, _filter_QIE1011, _subsystem);
0766     _cDigiSizevsLS_FED.book(ib, _emap, _subsystem);
0767     _cOccupancyvsiphi_SubdetPM.book(ib, _emap, _subsystem);
0768     _cOccupancyvsieta_Subdet.book(ib, _emap, _subsystem);
0769     _cSummaryvsLS_FED.book(ib, _emap, _subsystem);
0770     _cSummaryvsLS.book(ib, _subsystem);
0771     _cOccupancyCutvsieta_Subdet.book(ib, _emap, _subsystem);
0772     _cTimingCutvsieta_Subdet.book(ib, _emap, _subsystem);
0773     _xUniHF.book(_emap, _filter_FEDHF);
0774     _xNChs.book(_emap);
0775     _xNChsNominal.book(_emap);
0776     _xUni.book(_emap);
0777     _xDigiSize.book(_emap);
0778     // _xBadCapid.book(_emap);
0779 
0780     // just PER HF FED RECORD THE #CHANNELS
0781     // ONLY WAY TO DO THAT AUTOMATICALLY AND W/O HARDCODING 1728
0782     // or ANY OTHER VALUES LIKE 2592, 2192
0783     std::vector<HcalGenericDetId> gids = _emap->allPrecisionId();
0784     for (std::vector<HcalGenericDetId>::const_iterator it = gids.begin(); it != gids.end(); ++it) {
0785       if (!it->isHcalDetId())
0786         continue;
0787       HcalDetId did(it->rawId());
0788       if (_xQuality->exists(did)) {
0789         HcalChannelStatus cs(it->rawId(), _xQuality->getValues(HcalDetId(*it))->getValue());
0790         if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || cs.isBitSet(HcalChannelStatus::HcalCellDead))
0791 
0792           continue;
0793       }
0794       HcalElectronicsId eid = HcalElectronicsId(_ehashmap.lookup(did));
0795       _xNChsNominal.get(eid)++;  // he will know the nominal #channels per FED
0796     }
0797   }
0798 
0799   {
0800     //  MARK THESE HISTOGRAMS AS LUMI BASED FOR OFFLINE PROCESSING
0801     auto scope = DQMStore::IBooker::UseLumiScope(ib);
0802     if (_ptype == fOffline) {
0803       //_cDigiSize_FED.setLumiFlag();
0804       _cDigiSize_Crate.book(ib, _emap, _subsystem);
0805       _cOccupancy_depth.book(ib, _emap, _subsystem);
0806     }
0807 
0808     //  book Number of Events vs LS histogram
0809     ib.setCurrentFolder(_subsystem + "/RunInfo");
0810     meNumEvents1LS = ib.book1DD("NumberOfEvents", "NumberOfEvents", 1, 0, 1);
0811 
0812     //  book the flag for unknown ids and the online guy as well
0813     ib.setCurrentFolder(_subsystem + "/" + _name);
0814     meUnknownIds1LS = ib.book1DD("UnknownIds", "UnknownIds", 1, 0, 1);
0815     _unknownIdsPresent = false;
0816   }
0817 }
0818 
0819 /* virtual */ void DigiTask::_resetMonitors(hcaldqm::UpdateFreq uf) {
0820   DQTask::_resetMonitors(uf);
0821 
0822   switch (uf) {
0823     case hcaldqm::f1LS:
0824       _unknownIdsPresent = false;
0825       break;
0826     case hcaldqm::f50LS:
0827       //    ^^^ONLINE ONLY!
0828       if (_ptype == fOnline)
0829         _cOccupancyvsiphi_SubdetPM.reset();
0830       //    ^^^
0831       break;
0832     default:
0833       break;
0834   }
0835 }
0836 
0837 /* virtual */ void DigiTask::_process(edm::Event const& e, edm::EventSetup const&) {
0838   edm::Handle<QIE11DigiCollection> c_QIE11;
0839   edm::Handle<HODigiCollection> c_ho;
0840   edm::Handle<QIE10DigiCollection> c_QIE10;
0841 
0842   if (!e.getByToken(_tokQIE11, c_QIE11))
0843     _logger.dqmthrow("Collection QIE11DigiCollection isn't available" + _tagQIE11.label() + " " + _tagQIE11.instance());
0844   if (!e.getByToken(_tokHO, c_ho))
0845     _logger.dqmthrow("Collection HODigiCollection isn't available" + _tagHO.label() + " " + _tagHO.instance());
0846   if (!e.getByToken(_tokQIE10, c_QIE10))
0847     _logger.dqmthrow("Collection QIE10DigiCollection isn't available" + _tagQIE10.label() + " " + _tagQIE10.instance());
0848 
0849   //    extract some info per event
0850   int bx = e.bunchCrossing();
0851   meNumEvents1LS->Fill(0.5);  // just increment
0852 
0853   auto lumiCache = luminosityBlockCache(e.getLuminosityBlock().index());
0854   _currentLS = lumiCache->currentLS;
0855   _xQuality.reset();
0856   _xQuality = lumiCache->xQuality;
0857 
0858   if (_ptype == fOnline &&
0859       lumiCache->EvtCntLS == 1) {  // Reset the bin for _cCapid_BadvsFEDvsLSmod10 at the beginning of each new LS
0860     for (std::vector<uint32_t>::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) {
0861       HcalElectronicsId eid = HcalElectronicsId(*it);
0862       _cCapid_BadvsFEDvsLSmod10.setBinContent(eid, _currentLS % 10, 0);
0863     }
0864   }
0865 
0866   //    To fill histograms outside of the loop, you need to determine if there were
0867   //    any valid det ids first
0868   uint32_t rawidValid = 0;
0869   uint32_t rawidHBValid = 0;
0870   uint32_t rawidHEValid = 0;
0871 
0872   // Reset at the beginning of each new LS
0873   if (lumiCache->EvtCntLS == 1) {
0874     _HBSumMeanofSumQForEachEvent = 0;
0875     _HESumMeanofSumQForEachEvent = 0;
0876     _HOSumMeanofSumQForEachEvent = 0;
0877     _HFSumMeanofSumQForEachEvent = 0;
0878   }
0879 
0880   //    HB collection
0881   int numChs = 0;
0882   int numChsCut = 0;
0883   int numChsHE = 0;
0884   int numChsCutHE = 0;
0885   int numChsHBBadCapid = 0;
0886   int numChsHEBadCapid = 0;
0887   // HB+HE QIE11 collection
0888   for (QIE11DigiCollection::const_iterator it = c_QIE11->begin(); it != c_QIE11->end(); ++it) {
0889     const QIE11DataFrame digi = static_cast<const QIE11DataFrame>(*it);
0890 
0891     //  Explicit check on the DetIds present in the Collection
0892     HcalDetId const& did = digi.detid();
0893     if ((did.subdet() != HcalBarrel) && (did.subdet() != HcalEndcap)) {
0894       // LED monitoring from calibration channels
0895       if (_ptype != fLocal) {
0896         if (did.subdet() == HcalOther) {
0897           HcalOtherDetId hodid(digi.detid());
0898           if (hodid.subdet() == HcalCalibration) {
0899             if (std::find(_ledCalibrationChannels[HcalEndcap].begin(),
0900                           _ledCalibrationChannels[HcalEndcap].end(),
0901                           did) != _ledCalibrationChannels[HcalEndcap].end()) {
0902               bool channelLEDSignalPresent = false;
0903               for (int i = 0; i < digi.samples(); i++) {
0904                 _LED_ADCvsBX_Subdet.fill(HcalDetId(HcalEndcap, 16, 1, 1), bx, digi[i].adc());
0905 
0906                 if (digi[i].adc() > _thresh_led) {
0907                   channelLEDSignalPresent = true;
0908                 }
0909               }
0910               if (channelLEDSignalPresent) {
0911                 _LED_CUCountvsLS_Subdet.fill(HcalDetId(HcalEndcap, 16, 1, 1), _currentLS);
0912                 if (_ptype == fOnline) {
0913                   _LED_CUCountvsLSmod60_Subdet.fill(HcalDetId(HcalEndcap, 16, 1, 1), _currentLS % 60);
0914                 }
0915               }
0916             } else if (std::find(_ledCalibrationChannels[HcalBarrel].begin(),
0917                                  _ledCalibrationChannels[HcalBarrel].end(),
0918                                  did) != _ledCalibrationChannels[HcalBarrel].end()) {
0919               bool channelLEDSignalPresent = false;
0920               for (int i = 0; i < digi.samples(); i++) {
0921                 _LED_ADCvsBX_Subdet.fill(HcalDetId(HcalBarrel, 1, 1, 1), bx, digi[i].adc());
0922 
0923                 if (digi[i].adc() > _thresh_led) {
0924                   channelLEDSignalPresent = true;
0925                 }
0926               }
0927               if (channelLEDSignalPresent) {
0928                 _LED_CUCountvsLS_Subdet.fill(HcalDetId(HcalBarrel, 1, 1, 1), _currentLS);
0929                 if (_ptype == fOnline) {
0930                   _LED_CUCountvsLSmod60_Subdet.fill(HcalDetId(HcalBarrel, 1, 1, 1), _currentLS % 60);
0931                 }
0932               }
0933             }
0934           }
0935         }
0936       }
0937       continue;
0938     }
0939 
0940     uint32_t rawid = _ehashmap.lookup(did);
0941     if (rawid == 0) {
0942       meUnknownIds1LS->Fill(1);
0943       _unknownIdsPresent = true;
0944       continue;
0945     } else {
0946       if (did.subdet() == HcalBarrel) {
0947         rawidHBValid = did.rawId();
0948       } else if (did.subdet() == HcalEndcap) {
0949         rawidHEValid = did.rawId();
0950       }
0951     }
0952     HcalElectronicsId const& eid(rawid);
0953 
0954     //  filter out channels that are masked out
0955     if (_xQuality.exists(did)) {
0956       HcalChannelStatus cs(did.rawId(), _xQuality.get(did));
0957       if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || cs.isBitSet(HcalChannelStatus::HcalCellDead))
0958         continue;
0959     }
0960 
0961     // (capid - BX) % 4
0962     if (_ptype == fOnline || _ptype == fOffline) {
0963       short soi = -1;
0964       for (int i = 0; i < digi.samples(); i++) {
0965         if (digi[i].soi()) {
0966           soi = i;
0967           break;
0968         }
0969       }
0970       short this_capidmbx = (digi[soi].capid() - bx) % 4;
0971       if (this_capidmbx < 0) {
0972         this_capidmbx += 4;
0973       }
0974       _cCapidMinusBXmod4_SubdetPM.fill(did, this_capidmbx);
0975       bool good_capidmbx = (_capidmbx[did.subdet()] == this_capidmbx);
0976       if (!good_capidmbx) {
0977         _xBadCapid.get(eid)++;
0978         did.subdet() == HcalBarrel ? numChsHBBadCapid++ : numChsHEBadCapid++;
0979         if (numChsHBBadCapid != 0 || numChsHEBadCapid != 0)
0980           _cOccupancyBadCapidvsLS_depth.fill(did);
0981         _cCapid_BadvsFEDvsLS.fill(eid, _currentLS);
0982         _cCapid_BadvsFEDvsLSmod10.fill(eid, _currentLS % 10);
0983       }
0984       if (!eid.isVMEid()) {
0985         _cCapidMinusBXmod4_CrateSlotuTCA[this_capidmbx].fill(eid);
0986       }
0987     }
0988 
0989     CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<QIE11DataFrame>(_dbService, did, digi);
0990     double sumQ = hcaldqm::utilities::sumQDB<QIE11DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples() - 1);
0991 
0992     _cSumQ_SubdetPM_QIE1011.fill(did, sumQ);
0993     // from CMT plot
0994     if (did.subdet() == HcalBarrel) {
0995       if (sumQ > _cutSumQ_HBHE)
0996         _cSumQ_Subdet_QIE1011.fill(did, sumQ);
0997     }
0998     if (did.subdet() == HcalEndcap) {
0999       if (sumQ > _cutSumQ_HBHE)
1000         _cSumQ_Subdet_QIE1011.fill(did, sumQ);
1001     }
1002     //
1003     _cOccupancy_depth.fill(did);
1004     if (_ptype == fOnline || _ptype == fLocal) {
1005       _cOccupancy_Crate.fill(eid);
1006       _cOccupancy_CrateSlot.fill(eid);
1007     }
1008     if (_ptype == fOnline) {
1009       _cDigiSizevsLS_FED.fill(eid, _currentLS, digi.samples());
1010       digi.samples() != _refDigiSize[did.subdet()] ? _xDigiSize.get(eid)++ : _xDigiSize.get(eid) += 0;
1011       _cOccupancyvsiphi_SubdetPM.fill(did);
1012       _cOccupancyvsieta_Subdet.fill(did);
1013     }
1014     _cDigiSize_Crate.fill(eid, digi.samples());
1015     if (_ptype != fOffline) {  // hidefed2crate
1016       _cDigiSize_FED.fill(eid, digi.samples());
1017       if (!eid.isVMEid()) {
1018         _cOccupancy_FEDuTCA.fill(eid);
1019         _cOccupancy_ElectronicsuTCA.fill(eid);
1020         /*
1021                 if (!digi.validate(0, digi.size()))
1022                 {
1023                     _cCapIdRots_depth.fill(did);
1024                     _cCapIdRots_FEDuTCA.fill(eid, 1);
1025                 }*/
1026       }
1027     }
1028     for (int i = 0; i < digi.samples(); i++) {
1029       double q = hcaldqm::utilities::adc2fCDBMinusPedestal<QIE11DataFrame>(_dbService, digi_fC, did, digi, i);
1030       _cADC_SubdetPM_QIE1011.fill(did, digi[i].adc());
1031       _cfC_SubdetPM_QIE1011.fill(did, q);
1032 
1033       if (did.subdet() == HcalBarrel) {
1034         _cLETDCvsADC_2bit_SubdetPM.fill(did, digi[i].adc(), digi[i].tdc());
1035         _cLETDCvsTS_2bit_SubdetPM.fill(did, (int)i, digi[i].tdc());
1036 
1037         if (digi[i].tdc() < 2) {
1038           double time = i * 25. + (digi[i].tdc() * 12.5);
1039           _cLETDCTime_SubdetPM.fill(did, time);
1040           _cLETDCTime_depth.fill(did, time);
1041           _cLETDCTimevsADC_SubdetPM.fill(did, digi[i].adc(), time);
1042         }
1043       } else if (did.subdet() == HcalEndcap) {
1044         _cLETDCvsADC_6bit_SubdetPM.fill(did, digi[i].adc(), digi[i].tdc());
1045         _cLETDCvsTS_6bit_SubdetPM.fill(did, (int)i, digi[i].tdc());
1046         if (digi[i].tdc() < 50) {
1047           double time = i * 25. + (digi[i].tdc() / 2.);
1048           _cLETDCTime_SubdetPM.fill(did, time);
1049           _cLETDCTime_depth.fill(did, time);
1050           _cLETDCTimevsADC_SubdetPM.fill(did, digi[i].adc(), time);
1051         }
1052         // Bad TDC values: 50-61 should never happen in QIE10 or QIE11, but we saw some in 2017 data.
1053         if ((50 <= digi[i].tdc()) && (digi[i].tdc() <= 61)) {
1054           _cBadTDCValues_SubdetPM.fill(did, digi[i].tdc());
1055           _cBadTDCvsBX_SubdetPM.fill(did, bx);
1056           _cBadTDCvsLS_SubdetPM.fill(did, _currentLS);
1057           _cBadTDCCount_depth.fill(did);
1058         }
1059       }
1060       if (_ptype != fOffline) {  // hidefed2crate
1061         _cADCvsTS_SubdetPM_QIE1011.fill(did, i, digi[i].adc());
1062         if (sumQ > _cutSumQ_HBHE) {
1063           _cShapeCut_FED.fill(eid, i, q);
1064         }
1065       }
1066     }
1067 
1068     if (sumQ > _cutSumQ_HBHE) {
1069       //double timing = hcaldqm::utilities::aveTS_v10<QIE11DataFrame>(digi, 2.5, 0,digi.samples()-1);
1070       // without pedestal substraction, request from https://gitlab.cern.ch/cmshcal/docs/-/issues/106
1071       double timing =
1072           hcaldqm::utilities::aveTSDB<QIE11DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples() - 1, false);
1073       _cTimingCut_SubdetPM.fill(did, timing);
1074       // with pedestal substraction for energetic hits
1075       if (sumQ > 100. * _cutSumQ_HBHE)
1076         _cTimingCutHTH_SubdetPM.fill(
1077             did, hcaldqm::utilities::aveTSDB<QIE11DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples() - 1));
1078       _cTimingCut_depth.fill(did, timing);
1079       _cOccupancyCut_depth.fill(did);
1080       _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing);
1081       _cTimingCutvsLS_depth.fill(did, _currentLS, timing);
1082       if (_ptype != fOffline) {  // hidefed2crate
1083         _cTimingCutvsLS_FED.fill(eid, _currentLS, timing);
1084       }
1085       _cSumQ_depth.fill(did, sumQ);
1086       _cSumQvsLS_SubdetPM_QIE1011.fill(did, _currentLS, sumQ);
1087       if (_ptype == fOnline) {
1088         _cOccupancyCutvsieta_Subdet.fill(did);
1089         _cTimingCutvsieta_Subdet.fill(did, timing);
1090         _cSumQvsBX_SubdetPM_QIE1011.fill(did, bx, sumQ);
1091       }
1092       if (_ptype == fOnline || _ptype == fOffline) {
1093         _cTimingCutvsiphi_SubdetPM.fill(did, timing);
1094         _cOccupancyCutvsiphi_SubdetPM.fill(did);
1095         _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS);
1096       }
1097       if (_ptype != fOffline) {  // hidefed2crate
1098         if (!eid.isVMEid()) {
1099           _cTimingCut_FEDuTCA.fill(eid, timing);
1100           _cTimingCut_ElectronicsuTCA.fill(eid, timing);
1101           _cOccupancyCut_FEDuTCA.fill(eid);
1102           _cOccupancyCut_ElectronicsuTCA.fill(eid);
1103         }
1104       }
1105       did.subdet() == HcalBarrel ? numChsCut++ : numChsCutHE++;
1106     }
1107     did.subdet() == HcalBarrel ? numChs++ : numChsHE++;
1108   }
1109 
1110   if (rawidHBValid != 0 && rawidHEValid != 0) {
1111     _HBSumMeanofSumQForEachEvent += _cSumQ_Subdet_QIE1011.getMean(HcalDetId(rawidHBValid));
1112     _HESumMeanofSumQForEachEvent += _cSumQ_Subdet_QIE1011.getMean(HcalDetId(rawidHEValid));
1113 
1114     _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidHBValid), _currentLS, numChs);
1115     _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidHEValid), _currentLS, numChsHE);
1116 
1117     //ONLINE & OFFLINE ONLY!
1118     if (_ptype == fOnline || _ptype == fOffline) {
1119       _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidHBValid), bx, numChsCut);
1120       _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidHEValid), bx, numChsCutHE);
1121       _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidHBValid), _currentLS, numChsCut);
1122       _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidHEValid), _currentLS, numChsCutHE);
1123       if (numChsHBBadCapid != 0)
1124         _cOccupancyBadCapidvsLS_Subdet.fill(HcalDetId(rawidHBValid), _currentLS, numChsHBBadCapid);
1125       if (numChsHEBadCapid != 0)
1126         _cOccupancyBadCapidvsLS_Subdet.fill(HcalDetId(rawidHEValid), _currentLS, numChsHEBadCapid);
1127     }
1128     //  ^^^ONLINE & OFFLINE ONLY!
1129   }
1130   numChs = 0;
1131   numChsCut = 0;
1132   int numChsHOBadCapid = 0;
1133   //    reset
1134   rawidValid = 0;
1135 
1136   //    HO collection
1137   for (HODigiCollection::const_iterator it = c_ho->begin(); it != c_ho->end(); ++it) {
1138     const HODataFrame digi = (const HODataFrame)(*it);
1139     //  Explicit check on the DetIds present in the Collection
1140     HcalDetId const& did = it->id();
1141     if (did.subdet() != HcalOuter) {
1142       // LED monitoring from calibration channels
1143       if (_ptype != fLocal) {
1144         if (did.subdet() == HcalOther) {
1145           HcalOtherDetId hodid(did);
1146           if (hodid.subdet() == HcalCalibration) {
1147             if (std::find(_ledCalibrationChannels[HcalOuter].begin(), _ledCalibrationChannels[HcalOuter].end(), did) !=
1148                 _ledCalibrationChannels[HcalOuter].end()) {
1149               bool channelLEDSignalPresent = false;
1150               for (int i = 0; i < digi.size(); i++) {
1151                 _LED_ADCvsBX_Subdet.fill(HcalDetId(HcalOuter, 1, 1, 4), bx, digi[i].adc());
1152 
1153                 if (digi[i].adc() > _thresh_led) {
1154                   channelLEDSignalPresent = true;
1155                 }
1156               }
1157               if (channelLEDSignalPresent) {
1158                 _LED_CUCountvsLS_Subdet.fill(HcalDetId(HcalOuter, 1, 1, 4), _currentLS);
1159                 if (_ptype == fOnline) {
1160                   _LED_CUCountvsLSmod60_Subdet.fill(HcalDetId(HcalOuter, 1, 1, 4), _currentLS % 60);
1161                 }
1162               }
1163             }
1164           }
1165         }
1166       }
1167       continue;
1168     }
1169     uint32_t rawid = _ehashmap.lookup(did);
1170     if (rawid == 0) {
1171       meUnknownIds1LS->Fill(1);
1172       _unknownIdsPresent = true;
1173       continue;
1174     } else {
1175       rawidValid = did.rawId();
1176     }
1177     HcalElectronicsId const& eid(rawid);
1178 
1179     //  filter out channels that are masked out
1180     if (_xQuality.exists(did)) {
1181       HcalChannelStatus cs(did.rawId(), _xQuality.get(did));
1182       if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || cs.isBitSet(HcalChannelStatus::HcalCellDead))
1183         continue;
1184     }
1185 
1186     if (_ptype == fOnline || _ptype == fOffline) {
1187       short this_capidmbx = (it->sample(it->presamples()).capid() - bx) % 4;
1188       if (this_capidmbx < 0) {
1189         this_capidmbx += 4;
1190       }
1191       _cCapidMinusBXmod4_SubdetPM.fill(did, this_capidmbx);
1192       bool good_capidmbx = (_capidmbx[did.subdet()] == this_capidmbx);
1193       if (!good_capidmbx) {
1194         _xBadCapid.get(eid)++;
1195         if (did.subdet() == HcalOuter)
1196           numChsHOBadCapid++;
1197         if (numChsHOBadCapid != 0)
1198           _cOccupancyBadCapidvsLS_depth.fill(did);
1199         _cCapid_BadvsFEDvsLS.fill(eid, _currentLS);
1200         _cCapid_BadvsFEDvsLSmod10.fill(eid, _currentLS % 10);
1201       }
1202 
1203       if (!eid.isVMEid()) {
1204         _cCapidMinusBXmod4_CrateSlotuTCA[this_capidmbx].fill(eid);
1205       }
1206     }
1207 
1208     //double sumQ = hcaldqm::utilities::sumQ<HODataFrame>(*it, 8.5, 0, it->size()-1);
1209     CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<HODataFrame>(_dbService, did, *it);
1210     double sumQ = hcaldqm::utilities::sumQDB<HODataFrame>(_dbService, digi_fC, did, *it, 0, it->size() - 1);
1211 
1212     _cSumQ_SubdetPM.fill(did, sumQ);
1213 
1214     // from CMT plot
1215 
1216     if (sumQ > _cutSumQ_HO)
1217       _cSumQ_Subdet.fill(did, sumQ);
1218 
1219     //
1220     _cOccupancy_depth.fill(did);
1221     if (_ptype == fOnline) {
1222       _cDigiSizevsLS_FED.fill(eid, _currentLS, it->size());
1223       it->size() != _refDigiSize[did.subdet()] ? _xDigiSize.get(eid)++ : _xDigiSize.get(eid) += 0;
1224       _cOccupancyvsiphi_SubdetPM.fill(did);
1225       _cOccupancyvsieta_Subdet.fill(did);
1226     }
1227     _cDigiSize_Crate.fill(eid, it->size());
1228     if (_ptype != fOffline) {  // hidefed2crate
1229       _cDigiSize_FED.fill(eid, it->size());
1230       if (!eid.isVMEid()) {
1231         _cOccupancy_FEDuTCA.fill(eid);
1232         _cOccupancy_ElectronicsuTCA.fill(eid);
1233         /*
1234       if (!it->validate(0, it->size()))
1235       _cCapIdRots_FEDuTCA.fill(eid, 1);*/
1236       }
1237     }
1238 
1239     for (int i = 0; i < it->size(); i++) {
1240       _cADC_SubdetPM.fill(did, it->sample(i).adc());
1241       _cfC_SubdetPM.fill(did, it->sample(i).nominal_fC());
1242       if (_ptype != fOffline) {  // hidefed2crate
1243         _cADCvsTS_SubdetPM.fill(did, i, it->sample(i).adc());
1244         if (sumQ > _cutSumQ_HO)
1245           _cShapeCut_FED.fill(eid, i, it->sample(i).nominal_fC());
1246       }
1247     }
1248 
1249     if (sumQ > _cutSumQ_HO) {
1250       //double timing = hcaldqm::utilities::aveTS<HODataFrame>(*it, 8.5, 0,it->size()-1);
1251       // without pedestal substraction, request from https://gitlab.cern.ch/cmshcal/docs/-/issues/106
1252       double timing = hcaldqm::utilities::aveTSDB<HODataFrame>(_dbService, digi_fC, did, *it, 0, it->size() - 1, false);
1253       _cSumQ_depth.fill(did, sumQ);
1254       _cSumQvsLS_SubdetPM.fill(did, _currentLS, sumQ);
1255       _cOccupancyCut_depth.fill(did);
1256       _cTimingCut_SubdetPM.fill(did, timing);
1257       // with pedestal substraction for energetic hits
1258       if (sumQ > 100. * _cutSumQ_HO)
1259         _cTimingCutHTH_SubdetPM.fill(
1260             did, hcaldqm::utilities::aveTSDB<HODataFrame>(_dbService, digi_fC, did, *it, 0, it->size() - 1));
1261       _cTimingCut_depth.fill(did, timing);
1262       _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing);
1263       _cTimingCutvsLS_depth.fill(did, _currentLS, timing);
1264       if (_ptype != fOffline) {  // hidefed2crate
1265         _cTimingCutvsLS_FED.fill(eid, _currentLS, timing);
1266       }
1267       if (_ptype == fOnline) {
1268         _cSumQvsBX_SubdetPM.fill(did, bx, sumQ);
1269         _cTimingCutvsieta_Subdet.fill(did, timing);
1270         _cOccupancyCutvsieta_Subdet.fill(did);
1271       }
1272       if (_ptype == fOnline || _ptype == fOffline) {
1273         _cTimingCutvsiphi_SubdetPM.fill(did, timing);
1274         _cOccupancyCutvsiphi_SubdetPM.fill(did);
1275         _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS);
1276       }
1277       if (_ptype != fOffline) {  // hidefed2crate
1278         if (!eid.isVMEid()) {
1279           _cTimingCut_FEDuTCA.fill(eid, timing);
1280           _cTimingCut_ElectronicsuTCA.fill(eid, timing);
1281           _cOccupancyCut_FEDuTCA.fill(eid);
1282           _cOccupancyCut_ElectronicsuTCA.fill(eid);
1283         }
1284       }
1285       numChsCut++;
1286     }
1287     numChs++;
1288   }
1289 
1290   if (rawidValid != 0) {
1291     _HOSumMeanofSumQForEachEvent += _cSumQ_Subdet.getMean(HcalDetId(rawidValid));
1292 
1293     _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, numChs);
1294     if (_ptype == fOnline || _ptype == fOffline) {
1295       _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, numChsCut);
1296       _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidValid), bx, numChsCut);
1297       if (numChsHOBadCapid != 0)
1298         _cOccupancyBadCapidvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, numChsHOBadCapid);
1299     }
1300   }
1301   numChs = 0;
1302   numChsCut = 0;
1303   int numChsHFBadCapid = 0;
1304   //    reset
1305   rawidValid = 0;
1306 
1307   //    HF collection
1308   if (_qie10InConditions) {
1309     for (QIE10DigiCollection::const_iterator it = c_QIE10->begin(); it != c_QIE10->end(); ++it) {
1310       const QIE10DataFrame digi = static_cast<const QIE10DataFrame>(*it);
1311 
1312       //    Explicit check on the DetIds present in the Collection
1313       HcalDetId const& did = digi.detid();
1314       if (did.subdet() != HcalForward) {
1315         // LED monitoring from calibration channels
1316         if (_ptype != fLocal) {
1317           if (did.subdet() == HcalOther) {
1318             HcalOtherDetId hodid(digi.detid());
1319             if (hodid.subdet() == HcalCalibration) {
1320               if (std::find(_ledCalibrationChannels[HcalForward].begin(),
1321                             _ledCalibrationChannels[HcalForward].end(),
1322                             did) != _ledCalibrationChannels[HcalForward].end()) {
1323                 bool channelLEDSignalPresent = false;
1324                 for (int i = 0; i < digi.samples(); i++) {
1325                   _LED_ADCvsBX_Subdet.fill(HcalDetId(HcalForward, 29, 1, 1), bx, digi[i].adc());
1326 
1327                   if (digi[i].adc() > _thresh_led) {
1328                     channelLEDSignalPresent = true;
1329                   }
1330                 }
1331                 if (channelLEDSignalPresent) {
1332                   _LED_CUCountvsLS_Subdet.fill(HcalDetId(HcalForward, 29, 1, 1), _currentLS);
1333                   if (_ptype == fOnline) {
1334                     _LED_CUCountvsLSmod60_Subdet.fill(HcalDetId(HcalForward, 29, 1, 1), _currentLS % 60);
1335                   }
1336                 }
1337               }
1338             }
1339           }
1340         }
1341         continue;
1342       }
1343 
1344       uint32_t rawid = _ehashmap.lookup(did);
1345       if (rawid == 0) {
1346         meUnknownIds1LS->Fill(1);
1347         _unknownIdsPresent = true;
1348         continue;
1349       } else {
1350         rawidValid = did.rawId();
1351       }
1352       HcalElectronicsId const& eid(rawid);
1353 
1354       //    filter out channels that are masked out
1355       if (_xQuality.exists(did)) {
1356         HcalChannelStatus cs(did.rawId(), _xQuality.get(did));
1357         if (cs.isBitSet(HcalChannelStatus::HcalCellMask) || cs.isBitSet(HcalChannelStatus::HcalCellDead))
1358           continue;
1359       }
1360 
1361       // (capid - BX) % 4
1362       if (_ptype == fOnline || _ptype == fOffline) {
1363         short soi = -1;
1364         for (int i = 0; i < digi.samples(); i++) {
1365           if (digi[i].soi()) {
1366             soi = i;
1367             break;
1368           }
1369         }
1370         short this_capidmbx = (digi[soi].capid() - bx) % 4;
1371         if (this_capidmbx < 0) {
1372           this_capidmbx += 4;
1373         }
1374         _cCapidMinusBXmod4_SubdetPM.fill(did, this_capidmbx);
1375         bool good_capidmbx = (_capidmbx[did.subdet()] == this_capidmbx);
1376         if (!good_capidmbx) {
1377           _xBadCapid.get(eid)++;
1378           if (did.subdet() == HcalForward)
1379             numChsHFBadCapid++;
1380           if (numChsHFBadCapid != 0)
1381             _cOccupancyBadCapidvsLS_depth.fill(did);
1382           _cCapid_BadvsFEDvsLS.fill(eid, _currentLS);
1383           _cCapid_BadvsFEDvsLSmod10.fill(eid, _currentLS % 10);
1384         }
1385         if (!eid.isVMEid()) {
1386           _cCapidMinusBXmod4_CrateSlotuTCA[this_capidmbx].fill(eid);
1387         }
1388       }
1389 
1390       CaloSamples digi_fC = hcaldqm::utilities::loadADC2fCDB<QIE10DataFrame>(_dbService, did, digi);
1391       double sumQ = hcaldqm::utilities::sumQDB<QIE10DataFrame>(_dbService, digi_fC, did, digi, 0, digi.samples() - 1);
1392       //double sumQ = hcaldqm::utilities::sumQ_v10<QIE10DataFrame>(digi, 2.5, 0, digi.samples()-1);
1393 
1394       //if (!_filter_QIE1011.filter(did)) {
1395       _cSumQ_SubdetPM_QIE1011.fill(did, sumQ);
1396 
1397       // from CMT plot
1398       if (did.subdet() == HcalForward) {
1399         if (sumQ > _cutSumQ_HF)
1400           _cSumQ_Subdet_QIE1011.fill(did, sumQ);
1401       }
1402       //}
1403 
1404       _cOccupancy_depth.fill(did);
1405       if (_ptype == fOnline) {
1406         _xNChs.get(eid)++;
1407         _cDigiSizevsLS_FED.fill(eid, _currentLS, digi.samples());
1408         digi.samples() != _refDigiSize[did.subdet()] ? _xDigiSize.get(eid)++ : _xDigiSize.get(eid) += 0;
1409         _cOccupancyvsiphi_SubdetPM.fill(did);
1410         _cOccupancyvsieta_Subdet.fill(did);
1411       }
1412       _cDigiSize_Crate.fill(eid, digi.samples());
1413       if (_ptype != fOffline) {  // hidefed2crate
1414         _cDigiSize_FED.fill(eid, digi.samples());
1415         if (!eid.isVMEid()) {
1416           _cOccupancy_FEDuTCA.fill(eid);
1417           _cOccupancy_ElectronicsuTCA.fill(eid);
1418           /*
1419                 if (!it->validate(0, it->size()))
1420                     _cCapIdRots_FEDuTCA.fill(eid, 1);*/
1421         }
1422       }
1423 
1424       for (int i = 0; i < digi.samples(); i++) {
1425         double q = hcaldqm::utilities::adc2fCDBMinusPedestal<QIE10DataFrame>(_dbService, digi_fC, did, digi, i);
1426         //if (!_filter_QIE1011.filter(did)) {
1427         _cADC_SubdetPM_QIE1011.fill(did, digi[i].adc());
1428         _cfC_SubdetPM_QIE1011.fill(did, q);
1429         _cLETDCvsADC_6bit_SubdetPM.fill(did, digi[i].adc(), digi[i].le_tdc());
1430         _cLETDCvsTS_6bit_SubdetPM.fill(did, (int)i, digi[i].le_tdc());
1431         if (digi[i].le_tdc() < 50) {
1432           double time = i * 25. + (digi[i].le_tdc() / 2.);
1433           _cLETDCTime_SubdetPM.fill(did, time);
1434           _cLETDCTime_depth.fill(did, time);
1435           _cLETDCTimevsADC_SubdetPM.fill(did, digi[i].adc(), time);
1436         }
1437 
1438         // Bad TDC values: 50-61 should never happen in QIE10 or QIE11, but we are seeing some in 2017 data.
1439         if ((50 <= digi[i].le_tdc()) && (digi[i].le_tdc() <= 61)) {
1440           _cBadTDCValues_SubdetPM.fill(did, digi[i].le_tdc());
1441           _cBadTDCvsBX_SubdetPM.fill(did, bx);
1442           _cBadTDCvsLS_SubdetPM.fill(did, _currentLS);
1443           _cBadTDCCount_depth.fill(did);
1444         }
1445         if (_ptype != fOffline) {  // hidefed2crate
1446           _cADCvsTS_SubdetPM_QIE1011.fill(did, (int)i, digi[i].adc());
1447           if (sumQ > _cutSumQ_HF)
1448             _cShapeCut_FED.fill(eid, (int)i, q);
1449         }
1450         //}
1451       }
1452 
1453       if (sumQ > _cutSumQ_HF) {
1454         double timing = hcaldqm::utilities::aveTS_v10<QIE10DataFrame>(digi, 2.5, 0, digi.samples() - 1);
1455         double q1 = hcaldqm::utilities::adc2fCDBMinusPedestal<QIE10DataFrame>(_dbService, digi_fC, did, digi, 1);
1456         double q2 = hcaldqm::utilities::adc2fCDBMinusPedestal<QIE10DataFrame>(_dbService, digi_fC, did, digi, 2);
1457         double q2q12 = q2 / (q1 + q2);
1458         _cSumQ_depth.fill(did, sumQ);
1459         //if (!_filter_QIE1011.filter(did)) {
1460         _cSumQvsLS_SubdetPM_QIE1011.fill(did, _currentLS, sumQ);
1461         //}
1462         _cTimingCut_SubdetPM.fill(did, hcaldqm::utilities::aveTS_v10<QIE10DataFrame>(digi, 0., 0, digi.samples() - 1));
1463         if (sumQ > 100. * _cutSumQ_HF)
1464           _cTimingCutHTH_SubdetPM.fill(did, timing);
1465         _cTimingCut_depth.fill(did, timing);
1466         _cTimingCutvsLS_SubdetPM.fill(did, _currentLS, timing);
1467         _cTimingCutvsLS_depth.fill(did, _currentLS, timing);
1468         if (_ptype == fOnline) {
1469           //if (!_filter_QIE1011.filter(did)) {
1470           _cTimingCutvsieta_Subdet.fill(did, timing);
1471           _cOccupancyCutvsieta_Subdet.fill(did);
1472           _cSumQvsBX_SubdetPM_QIE1011.fill(did, bx, sumQ);
1473           //}
1474           _xUniHF.get(eid)++;
1475         }
1476         if (_ptype == fOnline || _ptype == fOffline) {
1477           _cTimingCutvsiphi_SubdetPM.fill(did, timing);
1478           _cOccupancyCutvsiphi_SubdetPM.fill(did);
1479           _cOccupancyCutvsiphivsLS_SubdetPM.fill(did, _currentLS);
1480         }
1481         if (_ptype != fOffline) {  // hidefed2crate
1482           _cTimingCutvsLS_FED.fill(eid, _currentLS, timing);
1483         }
1484         _cOccupancyCut_depth.fill(did);
1485         if (!eid.isVMEid())
1486           if (_ptype == fOnline)
1487             _cQ2Q12CutvsLS_FEDHF.fill(eid, _currentLS, q2q12);
1488         if (_ptype != fOffline) {  // hidefed2crate
1489           if (!eid.isVMEid()) {
1490             _cTimingCut_FEDuTCA.fill(eid, timing);
1491             _cTimingCut_ElectronicsuTCA.fill(eid, timing);
1492             _cOccupancyCut_FEDuTCA.fill(eid);
1493             _cOccupancyCut_ElectronicsuTCA.fill(eid);
1494           }
1495         }
1496         numChsCut++;
1497       }
1498       numChs++;
1499     }
1500   }
1501   if (rawidValid != 0) {
1502     _HFSumMeanofSumQForEachEvent += _cSumQ_Subdet_QIE1011.getMean(HcalDetId(rawidValid));
1503 
1504     _cOccupancyvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, numChs);
1505 
1506     if (_ptype == fOnline || _ptype == fOffline) {
1507       _cOccupancyCutvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, numChsCut);
1508       _cOccupancyCutvsBX_Subdet.fill(HcalDetId(rawidValid), bx, numChsCut);
1509       if (numChsHFBadCapid != 0)
1510         _cOccupancyBadCapidvsLS_Subdet.fill(HcalDetId(rawidValid), _currentLS, numChsHFBadCapid);
1511     }
1512   }
1513 }
1514 
1515 std::shared_ptr<hcaldqm::Cache> DigiTask::globalBeginLuminosityBlock(edm::LuminosityBlock const& lb,
1516                                                                      edm::EventSetup const& es) const {
1517   return DQTask::globalBeginLuminosityBlock(lb, es);
1518 }
1519 
1520 /* virtual */ void DigiTask::globalEndLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) {
1521   auto lumiCache = luminosityBlockCache(lb.index());
1522   _currentLS = lumiCache->currentLS;
1523   _evsPerLS = lumiCache->EvtCntLS;
1524 
1525   if (_ptype != fOnline)
1526     return;
1527 
1528   for (uintCompactMap::const_iterator it = _xUniHF.begin(); it != _xUniHF.end(); ++it) {
1529     uint32_t hash1 = it->first;
1530     HcalElectronicsId eid1(hash1);
1531     double x1 = it->second;
1532 
1533     for (uintCompactMap::const_iterator jt = _xUniHF.begin(); jt != _xUniHF.end(); ++jt) {
1534       if (jt == it)
1535         continue;
1536       double x2 = jt->second;
1537       if (x2 == 0)
1538         continue;
1539       if (x1 / x2 < _thresh_unihf)
1540         _xUni.get(eid1)++;
1541     }
1542   }
1543 
1544   if (_ptype == fOffline || _ptype == fOnline) {
1545     HcalDetId did_HB(hcaldqm::hashfunctions::hash_Subdet(HcalDetId(HcalBarrel, 1, 1, 1)));
1546     HcalDetId did_HE(hcaldqm::hashfunctions::hash_Subdet(HcalDetId(HcalEndcap, 16, 1, 1)));
1547     HcalDetId did_HF(hcaldqm::hashfunctions::hash_Subdet(HcalDetId(HcalForward, 30, 1, 1)));
1548     HcalDetId did_HO(hcaldqm::hashfunctions::hash_Subdet(HcalDetId(HcalOuter, 1, 1, 1)));
1549     _cAveragedSumQvsLS_Subdet_QIE1011.fill(did_HB, _currentLS, (_HBSumMeanofSumQForEachEvent / _evsPerLS));
1550     _cAveragedSumQvsLS_Subdet_QIE1011.fill(did_HE, _currentLS, (_HESumMeanofSumQForEachEvent / _evsPerLS));
1551     _cAveragedSumQvsLS_Subdet_QIE1011.fill(did_HF, _currentLS, (_HFSumMeanofSumQForEachEvent / _evsPerLS));
1552     _cAveragedSumQvsLS_Subdet.fill(did_HO, _currentLS, (_HOSumMeanofSumQForEachEvent / _evsPerLS));
1553   }
1554 
1555   if (_ptype != fOffline) {  // hidefed2crate
1556 
1557     for (std::vector<uint32_t>::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) {
1558       hcaldqm::flag::Flag fSum("DIGI");
1559       HcalElectronicsId eid = HcalElectronicsId(*it);
1560 
1561       std::vector<uint32_t>::const_iterator cit = std::find(_vcdaqEids.begin(), _vcdaqEids.end(), *it);
1562 
1563       if (cit == _vcdaqEids.end()) {
1564         //  not @cDAQ
1565         for (uint32_t iflag = 0; iflag < _vflags.size(); iflag++)
1566           _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), int(hcaldqm::flag::fNCDAQ));
1567         _cSummaryvsLS.setBinContent(eid, _currentLS, int(hcaldqm::flag::fNCDAQ));
1568         continue;
1569       }
1570 
1571       //    FED is @cDAQ
1572       if (hcaldqm::utilities::isFEDHBHE(eid) || hcaldqm::utilities::isFEDHF(eid) || hcaldqm::utilities::isFEDHO(eid)) {
1573         if (_xDigiSize.get(eid) > 0)
1574           _vflags[fDigiSize]._state = hcaldqm::flag::fBAD;
1575         else
1576           _vflags[fDigiSize]._state = hcaldqm::flag::fGOOD;
1577 
1578         if (_xBadCapid.get(eid) > 0) {
1579           _vflags[fCapId]._state = hcaldqm::flag::fBAD;
1580         } else {
1581           _vflags[fCapId]._state = hcaldqm::flag::fGOOD;
1582         }
1583 
1584         if (hcaldqm::utilities::isFEDHF(eid)) {
1585           double fr = double(_xNChs.get(eid)) / double(_xNChsNominal.get(eid) * _evsPerLS);
1586           if (_runkeyVal == 0 || _runkeyVal == 4) {
1587             //  only for pp or hi
1588             if (_xUni.get(eid) > 0)
1589               _vflags[fUni]._state = hcaldqm::flag::fPROBLEMATIC;
1590             else
1591               _vflags[fUni]._state = hcaldqm::flag::fGOOD;
1592           }
1593           if (fr < 0.95)
1594             _vflags[fNChsHF]._state = hcaldqm::flag::fBAD;
1595           else if (fr < 1.0)
1596             _vflags[fNChsHF]._state = hcaldqm::flag::fPROBLEMATIC;
1597           else
1598             _vflags[fNChsHF]._state = hcaldqm::flag::fGOOD;
1599         }
1600       }
1601       if (_unknownIdsPresent)
1602         _vflags[fUnknownIds]._state = hcaldqm::flag::fBAD;
1603       else
1604         _vflags[fUnknownIds]._state = hcaldqm::flag::fGOOD;
1605 
1606       // LED misfires
1607       if (_ptype != fLocal) {
1608         if (hcaldqm::utilities::isFEDHBHE(eid)) {
1609           HcalDetId did_hb(hcaldqm::hashfunctions::hash_Subdet(HcalDetId(HcalBarrel, 1, 1, 1)));
1610           HcalDetId did_he(hcaldqm::hashfunctions::hash_Subdet(HcalDetId(HcalEndcap, 16, 1, 1)));
1611 
1612           if (_LED_CUCountvsLS_Subdet.getBinContent(did_hb, _currentLS) > 0 ||
1613               _LED_CUCountvsLS_Subdet.getBinContent(did_he, _currentLS) > 0) {
1614             _vflags[fLED]._state = hcaldqm::flag::fBAD;
1615           } else {
1616             _vflags[fLED]._state = hcaldqm::flag::fGOOD;
1617           }
1618         } else if (hcaldqm::utilities::isFEDHF(eid)) {
1619           HcalDetId did_hf(hcaldqm::hashfunctions::hash_Subdet(HcalDetId(HcalForward, 29, 1, 1)));
1620           if (_LED_CUCountvsLS_Subdet.getBinContent(did_hf, _currentLS) > 0) {
1621             _vflags[fLED]._state = hcaldqm::flag::fBAD;
1622           } else {
1623             _vflags[fLED]._state = hcaldqm::flag::fGOOD;
1624           }
1625         } else if (hcaldqm::utilities::isFEDHO(eid)) {
1626           HcalDetId did_ho(hcaldqm::hashfunctions::hash_Subdet(HcalDetId(HcalOuter, 1, 1, 1)));
1627           if (_LED_CUCountvsLS_Subdet.getBinContent(did_ho, _currentLS) > 0) {
1628             _vflags[fLED]._state = hcaldqm::flag::fBAD;
1629           } else {
1630             _vflags[fLED]._state = hcaldqm::flag::fGOOD;
1631           }
1632         }
1633       }
1634 
1635       int iflag = 0;
1636       for (std::vector<hcaldqm::flag::Flag>::iterator ft = _vflags.begin(); ft != _vflags.end(); ++ft) {
1637         _cSummaryvsLS_FED.setBinContent(eid, _currentLS, iflag, int(ft->_state));
1638         fSum += (*ft);
1639         iflag++;
1640 
1641         //  reset!
1642         ft->reset();
1643       }
1644 
1645       _cSummaryvsLS.setBinContent(eid, _currentLS, fSum._state);
1646     }
1647   }
1648 
1649   _xDigiSize.reset();
1650   _xUniHF.reset();
1651   _xUni.reset();
1652   _xNChs.reset();
1653   _xBadCapid.reset();
1654 
1655   //    in the end always do the DQTask::endLumi
1656   DQTask::globalEndLuminosityBlock(lb, es);
1657 }
1658 
1659 DEFINE_FWK_MODULE(DigiTask);