Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:35

0001 #include "DQM/HcalTasks/interface/TPTask.h"
0002 #include "DQM/L1TMonitor/interface/L1TStage2CaloLayer1.h"  // For ComparisonHelper::zip
0003 
0004 using namespace hcaldqm;
0005 using namespace hcaldqm::constants;
0006 TPTask::TPTask(edm::ParameterSet const& ps)
0007     : DQTask(ps), hcalDbServiceToken_(esConsumes<HcalDbService, HcalDbRecord, edm::Transition::BeginRun>()) {
0008   _tagData = ps.getUntrackedParameter<edm::InputTag>("tagData", edm::InputTag("hcalDigis"));
0009   _tagDataL1Rec = ps.getUntrackedParameter<edm::InputTag>("tagDataL1Rec", edm::InputTag("caloLayer1Digis"));
0010   _tagEmul = ps.getUntrackedParameter<edm::InputTag>("tagEmul", edm::InputTag("emulDigis"));
0011   _tagEmulNoTDCCut = ps.getUntrackedParameter<edm::InputTag>("tagEmulNoTDCCut", edm::InputTag("emulTPDigisNoTDCCut"));
0012 
0013   _tokData = consumes<HcalTrigPrimDigiCollection>(_tagData);
0014   _tokDataL1Rec = consumes<HcalTrigPrimDigiCollection>(_tagDataL1Rec);
0015   _tokEmul = consumes<HcalTrigPrimDigiCollection>(_tagEmul);
0016   _tokEmulNoTDCCut = consumes<HcalTrigPrimDigiCollection>(_tagEmulNoTDCCut);
0017 
0018   _skip1x1 = ps.getUntrackedParameter<bool>("skip1x1", true);
0019   _cutEt = ps.getUntrackedParameter<int>("cutEt", 3);
0020   _thresh_EtMsmRate_high = ps.getUntrackedParameter<double>("thresh_EtMsmRate_high", 0.2);
0021   _thresh_EtMsmRate_low = ps.getUntrackedParameter<double>("thresh_EtMsmRate_low", 0.05);
0022   _thresh_FGMsmRate_high = ps.getUntrackedParameter<double>("thresh_FGMsmRate", 0.2);
0023   _thresh_FGMsmRate_low = ps.getUntrackedParameter<double>("thresh_FGMsmRate_low", 0.05);
0024   _thresh_DataMsn = ps.getUntrackedParameter<double>("thresh_DataMsn", 0.1);
0025   _thresh_EmulMsn = ps.getUntrackedParameter<double>("thresh_EmulMsn");
0026   std::vector<int> tmp = ps.getUntrackedParameter<std::vector<int> >("vFGBitsReady");
0027   for (uint32_t iii = 0; iii < constants::NUM_FGBITS; iii++)
0028     _vFGBitsReady.push_back(tmp[iii]);
0029 
0030   _vflags.resize(nTPFlag);
0031   _vflags[fEtMsm] = flag::Flag("EtMsm");
0032   _vflags[fDataMsn] = flag::Flag("DataMsn");
0033   _vflags[fEmulMsn] = flag::Flag("EmulMsn");
0034   _vflags[fUnknownIds] = flag::Flag("UnknownIds");
0035   if (_ptype == fOnline) {
0036     _vflags[fSentRecL1Msm] = flag::Flag("uHTR-L1TMsm");
0037   }
0038 }
0039 
0040 /* virtual */ void TPTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) {
0041   DQTask::bookHistograms(ib, r, es);
0042 
0043   //    GET WHAT YOU NEED
0044   edm::ESHandle<HcalDbService> dbs = es.getHandle(hcalDbServiceToken_);
0045   _emap = dbs->getHcalMapping();
0046   std::vector<uint32_t> vVME;
0047   std::vector<uint32_t> vuTCA;
0048   std::vector<uint32_t> depth0;
0049   vVME.push_back(HcalElectronicsId(FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, CRATE_VME_MIN).rawId());
0050   vuTCA.push_back(HcalElectronicsId(CRATE_uTCA_MIN, SLOT_uTCA_MIN, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0051   _filter_VME.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vVME);
0052   _filter_uTCA.initialize(filter::fFilter, hcaldqm::hashfunctions::fElectronics, vuTCA);
0053   depth0.push_back(HcalTrigTowerDetId(1, 1, 0).rawId());
0054   _filter_depth0.initialize(filter::fPreserver, hcaldqm::hashfunctions::fTTdepth, depth0);
0055 
0056   //    INITIALIZE FIRST
0057   //    Et/FG
0058   _cEtData_TTSubdet.initialize(_name,
0059                                "EtData",
0060                                hcaldqm::hashfunctions::fTTSubdet,
0061                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_128),
0062                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0063                                0);
0064   _cEtEmul_TTSubdet.initialize(_name,
0065                                "EtEmul",
0066                                hcaldqm::hashfunctions::fTTSubdet,
0067                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_128),
0068                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0069                                0);
0070   _cEtCorr_TTSubdet.initialize(_name,
0071                                "EtCorr_xTS",
0072                                hcaldqm::hashfunctions::fTTSubdetFW,
0073                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_data),
0074                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_emul),
0075                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0076                                0);
0077   _cSOIEtCorr_TTSubdet.initialize(_name,
0078                                   "EtCorr_EmulvsData",
0079                                   hcaldqm::hashfunctions::fTTSubdetFW,
0080                                   new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256),
0081                                   new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256),
0082                                   new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0083                                   0);
0084   _cSOIEtCorrEmulL1_TTSubdet.initialize(_name,
0085                                         "EtCorr_EmulvsL1",
0086                                         hcaldqm::hashfunctions::fTTSubdetFW,
0087                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256),
0088                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256),
0089                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0090                                         0);
0091   for (uint8_t iii = 0; iii < constants::NUM_FGBITS; iii++) {
0092     _cFGCorr_TTSubdet[iii].initialize(_name,
0093                                       "FGCorr",
0094                                       hcaldqm::hashfunctions::fTTSubdet,
0095                                       new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fFG),
0096                                       new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fFG),
0097                                       new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0098                                       0);
0099   }
0100 
0101   _cEtData_depthlike.initialize(_name,
0102                                 "EtData",
0103                                 new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0104                                 new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0105                                 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256),
0106                                 0);
0107   _cEtEmul_depthlike.initialize(_name,
0108                                 "EtEmul",
0109                                 new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0110                                 new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0111                                 new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256),
0112                                 0);
0113   _cEtCutData_depthlike.initialize(_name,
0114                                    "EtCutData",
0115                                    new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0116                                    new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0117                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256),
0118                                    0);
0119   _cEtCutEmul_depthlike.initialize(_name,
0120                                    "EtCutEmul",
0121                                    new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0122                                    new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0123                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256),
0124                                    0);
0125 
0126   // Occupancy
0127   _cOccupancyData_depthlike.initialize(_name,
0128                                        "OccupancyData",
0129                                        new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0130                                        new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0131                                        new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0132                                        0);
0133   _cOccupancyEmul_depthlike.initialize(_name,
0134                                        "OccupancyEmul",
0135                                        new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0136                                        new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0137                                        new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0138                                        0);
0139   _cOccupancyCutData_depthlike.initialize(_name,
0140                                           "OccupancyCutData",
0141                                           new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0142                                           new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0143                                           new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0144                                           0);
0145   _cOccupancyCutEmul_depthlike.initialize(_name,
0146                                           "OccupancyCutEmul",
0147                                           new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0148                                           new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0149                                           new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0150                                           0);
0151 
0152   //    Mismatches
0153   _cEtMsm_depthlike.initialize(_name,
0154                                "EtMsm",
0155                                new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0156                                new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0157                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0158                                0);
0159   _cFGMsm_depthlike.initialize(_name,
0160                                "FGMsm",
0161                                new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0162                                new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0163                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0164                                0);
0165 
0166   if (_ptype == fOnline) {
0167     // Mismatches: sent vs received
0168     _cEtMsm_uHTR_L1T_depthlike.initialize(_name,
0169                                           "EtMsm_uHTR_L1T",
0170                                           new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0171                                           new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0172                                           new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0173                                           0);
0174     _cEtMsm_uHTR_L1T_LS.initialize(_name,
0175                                    "EtMsm_uHTR_L1T_LS",
0176                                    new hcaldqm::quantity::LumiSection(_maxLS),
0177                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0178                                    0);
0179   }
0180 
0181   //    Missing Data w.r.t. Emulator
0182   _cMsnData_depthlike.initialize(_name,
0183                                  "MsnData",
0184                                  new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0185                                  new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0186                                  new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0187                                  0);
0188   _cMsnEmul_depthlike.initialize(_name,
0189                                  "MsnEmul",
0190                                  new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0191                                  new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0192                                  new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0193                                  0);
0194 
0195   _cEtCorrRatio_depthlike.initialize(_name,
0196                                      "EtCorrRatio",
0197                                      new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0198                                      new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0199                                      new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio_0to2),
0200                                      0);
0201 
0202   _cOccupancyDatavsBX_TTSubdet.initialize(_name,
0203                                           "OccupancyDatavsBX",
0204                                           hcaldqm::hashfunctions::fTTSubdet,
0205                                           new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0206                                           new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0207                                           0);
0208   _cOccupancyEmulvsBX_TTSubdet.initialize(_name,
0209                                           "OccupancyEmulvsBX",
0210                                           hcaldqm::hashfunctions::fTTSubdet,
0211                                           new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0212                                           new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0213                                           0);
0214   _cOccupancyCutDatavsBX_TTSubdet.initialize(_name,
0215                                              "OccupancyCutDatavsBX",
0216                                              hcaldqm::hashfunctions::fTTSubdet,
0217                                              new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0218                                              new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0219                                              0);
0220   _cOccupancyCutEmulvsBX_TTSubdet.initialize(_name,
0221                                              "OccupancyCutEmulvsBX",
0222                                              hcaldqm::hashfunctions::fTTSubdet,
0223                                              new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0224                                              new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0225                                              0);
0226 
0227   //    INITIALIZE HISTOGRAMS to be used in Online only!
0228   if (_ptype == fOnline) {
0229     _cEtCorr2x3_TTSubdet.initialize(_name,
0230                                     "EtCorr2x3",
0231                                     hcaldqm::hashfunctions::fTTSubdet,
0232                                     new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256),
0233                                     new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256),
0234                                     new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0235                                     0);
0236     _cOccupancyData2x3_depthlike.initialize(_name,
0237                                             "OccupancyData2x3",
0238                                             new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta2x3),
0239                                             new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0240                                             new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0241                                             0);
0242     _cOccupancyEmul2x3_depthlike.initialize(_name,
0243                                             "OccupancyEmul2x3",
0244                                             new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta2x3),
0245                                             new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0246                                             new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0247                                             0);
0248     _cEtCutDatavsLS_TTSubdet.initialize(_name,
0249                                         "EtCutDatavsLS",
0250                                         hcaldqm::hashfunctions::fTTSubdet,
0251                                         new hcaldqm::quantity::LumiSection(_maxLS),
0252                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256),
0253                                         0);
0254     _cEtCutEmulvsLS_TTSubdet.initialize(_name,
0255                                         "EtCutEmulvsLS",
0256                                         hcaldqm::hashfunctions::fTTSubdet,
0257                                         new hcaldqm::quantity::LumiSection(_maxLS),
0258                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256),
0259                                         0);
0260     _cEtCutDatavsBX_TTSubdet.initialize(_name,
0261                                         "EtCutDatavsBX",
0262                                         hcaldqm::hashfunctions::fTTSubdet,
0263                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0264                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtlog2),
0265                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0266                                         0);
0267     _cEtCutEmulvsBX_TTSubdet.initialize(_name,
0268                                         "EtCutEmulvsBX",
0269                                         hcaldqm::hashfunctions::fTTSubdet,
0270                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0271                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEtCorr_256),
0272                                         0);
0273     _cEtCorrRatiovsLS_TTSubdet.initialize(_name,
0274                                           "EtCorrRatiovsLS",
0275                                           hcaldqm::hashfunctions::fTTSubdet,
0276                                           new hcaldqm::quantity::LumiSection(_maxLS),
0277                                           new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio_0to2),
0278                                           0);
0279     _cEtCorrRatiovsBX_TTSubdet.initialize(_name,
0280                                           "EtCorrRatiovsBX",
0281                                           hcaldqm::hashfunctions::fTTSubdet,
0282                                           new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0283                                           new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio_0to2),
0284                                           0);
0285     _cEtMsmRatiovsLS_TTSubdet.initialize(_name,
0286                                          "EtMsmRatiovsLS",
0287                                          hcaldqm::hashfunctions::fTTSubdet,
0288                                          new hcaldqm::quantity::LumiSection(_maxLS),
0289                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio),
0290                                          0);
0291     _cEtMsmRatiovsBX_TTSubdet.initialize(_name,
0292                                          "EtMsmRatiovsBX",
0293                                          hcaldqm::hashfunctions::fTTSubdet,
0294                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0295                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio),
0296                                          0);
0297     _cEtMsmvsLS_TTSubdet.initialize(_name,
0298                                     "EtMsmvsLS",
0299                                     hcaldqm::hashfunctions::fTTSubdet,
0300                                     new hcaldqm::quantity::LumiSection(_maxLS),
0301                                     new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0302                                     0);
0303     _cEtMsmvsBX_TTSubdet.initialize(_name,
0304                                     "EtMsmvsBX",
0305                                     hcaldqm::hashfunctions::fTTSubdet,
0306                                     new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0307                                     new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0308                                     0);
0309     _cMsnDatavsLS_TTSubdet.initialize(_name,
0310                                       "MsnDatavsLS",
0311                                       hcaldqm::hashfunctions::fTTSubdet,
0312                                       new hcaldqm::quantity::LumiSection(_maxLS),
0313                                       new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0314                                       0);
0315     _cMsnCutDatavsLS_TTSubdet.initialize(_name,
0316                                          "MsnCutDatavsLS",
0317                                          hcaldqm::hashfunctions::fTTSubdet,
0318                                          new hcaldqm::quantity::LumiSection(_maxLS),
0319                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0320                                          0);
0321     _cMsnDatavsBX_TTSubdet.initialize(_name,
0322                                       "MsnDatavsBX",
0323                                       hcaldqm::hashfunctions::fTTSubdet,
0324                                       new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0325                                       new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0326                                       0);
0327     _cMsnCutDatavsBX_TTSubdet.initialize(_name,
0328                                          "MsnCutDatavsBX",
0329                                          hcaldqm::hashfunctions::fTTSubdet,
0330                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0331                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0332                                          0);
0333     _cMsnEmulvsLS_TTSubdet.initialize(_name,
0334                                       "MsnEmulvsLS",
0335                                       hcaldqm::hashfunctions::fTTSubdet,
0336                                       new hcaldqm::quantity::LumiSection(_maxLS),
0337                                       new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0338                                       0);
0339     _cMsnCutEmulvsLS_TTSubdet.initialize(_name,
0340                                          "MsnCutEmulvsLS",
0341                                          hcaldqm::hashfunctions::fTTSubdet,
0342                                          new hcaldqm::quantity::LumiSection(_maxLS),
0343                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0344                                          0);
0345     _cMsnEmulvsBX_TTSubdet.initialize(_name,
0346                                       "MsnEmulvsBX",
0347                                       hcaldqm::hashfunctions::fTTSubdet,
0348                                       new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0349                                       new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0350                                       0);
0351     _cMsnCutEmulvsBX_TTSubdet.initialize(_name,
0352                                          "MsnCutEmulvsBX",
0353                                          hcaldqm::hashfunctions::fTTSubdet,
0354                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0355                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0356                                          0);
0357     _cOccupancyDatavsLS_TTSubdet.initialize(_name,
0358                                             "OccupancyDatavsLS",
0359                                             hcaldqm::hashfunctions::fTTSubdet,
0360                                             new hcaldqm::quantity::LumiSection(_maxLS),
0361                                             new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0362                                             0);
0363     _cOccupancyCutDatavsLS_TTSubdet.initialize(_name,
0364                                                "OccupancyCutDatavsLS",
0365                                                hcaldqm::hashfunctions::fTTSubdet,
0366                                                new hcaldqm::quantity::LumiSection(_maxLS),
0367                                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0368                                                0);
0369     _cOccupancyDatavsBX_TTSubdet.initialize(_name,
0370                                             "OccupancyDatavsBX",
0371                                             hcaldqm::hashfunctions::fTTSubdet,
0372                                             new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0373                                             new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0374                                             0);
0375     _cOccupancyCutDatavsBX_TTSubdet.initialize(_name,
0376                                                "OccupancyCutDatavsBX",
0377                                                hcaldqm::hashfunctions::fTTSubdet,
0378                                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0379                                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0380                                                0);
0381     _cOccupancyEmulvsLS_TTSubdet.initialize(_name,
0382                                             "OccupancyEmulvsLS",
0383                                             hcaldqm::hashfunctions::fTTSubdet,
0384                                             new hcaldqm::quantity::LumiSection(_maxLS),
0385                                             new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0386                                             0);
0387     _cOccupancyCutEmulvsLS_TTSubdet.initialize(_name,
0388                                                "OccupancyCutEmulvsLS",
0389                                                hcaldqm::hashfunctions::fTTSubdet,
0390                                                new hcaldqm::quantity::LumiSection(_maxLS),
0391                                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0392                                                0);
0393     _cOccupancyEmulvsBX_TTSubdet.initialize(_name,
0394                                             "OccupancyEmulvsBX",
0395                                             hcaldqm::hashfunctions::fTTSubdet,
0396                                             new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0397                                             new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0398                                             0);
0399     _cOccupancyCutEmulvsBX_TTSubdet.initialize(_name,
0400                                                "OccupancyCutEmulvsBX",
0401                                                hcaldqm::hashfunctions::fTTSubdet,
0402                                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fBX),
0403                                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0404                                                0);
0405 
0406     _cOccupancy_HF_depth.initialize(_name,
0407                                     "OccupancyDataHF_depth",
0408                                     new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0409                                     new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0410                                     new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0411                                     0);
0412     _cOccupancyNoTDC_HF_depth.initialize(_name,
0413                                          "OccupancyEmulHFNoTDC_depth",
0414                                          new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0415                                          new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTiphi),
0416                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0417                                          0);
0418     _cOccupancy_HF_ieta.initialize(_name,
0419                                    "OccupancyDataHF_ieta",
0420                                    new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0421                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0422                                    0),
0423         _cOccupancyNoTDC_HF_ieta.initialize(_name,
0424                                             "OccupancyEmulHFNoTDC_ieta",
0425                                             new hcaldqm::quantity::TrigTowerQuantity(hcaldqm::quantity::fTTieta),
0426                                             new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0427                                             0);
0428   }
0429 
0430   // FED-based containers
0431   if (_ptype != fOffline) {  // hidefed2crate
0432     std::vector<int> vFEDs = hcaldqm::utilities::getFEDList(_emap);
0433     std::vector<int> vFEDsVME = hcaldqm::utilities::getFEDVMEList(_emap);
0434     std::vector<int> vFEDsuTCA = hcaldqm::utilities::getFEDuTCAList(_emap);
0435     //  push the rawIds of each fed into the vector
0436     //  this vector is used at endlumi for online state generation
0437     for (std::vector<int>::const_iterator it = vFEDsVME.begin(); it != vFEDsVME.end(); ++it) {
0438       _vhashFEDs.push_back(HcalElectronicsId(FIBERCH_MIN, FIBER_VME_MIN, SPIGOT_MIN, (*it) - FED_VME_MIN).rawId());
0439     }
0440     for (std::vector<int>::const_iterator it = vFEDsuTCA.begin(); it != vFEDsuTCA.end(); ++it) {
0441       std::pair<uint16_t, uint16_t> cspair = hcaldqm::utilities::fed2crate(*it);
0442       _vhashFEDs.push_back(HcalElectronicsId(cspair.first, cspair.second, FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
0443     }
0444     _cEtData_ElectronicsuTCA.initialize(_name,
0445                                         "EtData",
0446                                         hcaldqm::hashfunctions::fElectronics,
0447                                         new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
0448                                         new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0449                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256),
0450                                         0);
0451     _cEtEmul_ElectronicsuTCA.initialize(_name,
0452                                         "EtEmul",
0453                                         hcaldqm::hashfunctions::fElectronics,
0454                                         new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
0455                                         new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0456                                         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fEt_256),
0457                                         0);
0458     //  Occupancies
0459     _cOccupancyData_ElectronicsuTCA.initialize(_name,
0460                                                "OccupancyData",
0461                                                hcaldqm::hashfunctions::fElectronics,
0462                                                new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
0463                                                new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0464                                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0465                                                0);
0466     _cOccupancyEmul_ElectronicsuTCA.initialize(_name,
0467                                                "OccupancyEmul",
0468                                                hcaldqm::hashfunctions::fElectronics,
0469                                                new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
0470                                                new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0471                                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0472                                                0);
0473 
0474     _cOccupancyCutData_ElectronicsuTCA.initialize(
0475         _name,
0476         "OccupancyCutData",
0477         hcaldqm::hashfunctions::fElectronics,
0478         new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
0479         new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0480         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0481         0);
0482     _cOccupancyCutEmul_ElectronicsuTCA.initialize(
0483         _name,
0484         "OccupancyCutEmul",
0485         hcaldqm::hashfunctions::fElectronics,
0486         new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
0487         new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0488         new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true),
0489         0);
0490     //  Mismatches
0491     _cEtMsm_ElectronicsuTCA.initialize(_name,
0492                                        "EtMsm",
0493                                        hcaldqm::hashfunctions::fElectronics,
0494                                        new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
0495                                        new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0496                                        new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0497                                        0);
0498     _cFGMsm_ElectronicsuTCA.initialize(_name,
0499                                        "FGMsm",
0500                                        hcaldqm::hashfunctions::fElectronics,
0501                                        new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
0502                                        new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0503                                        new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0504                                        0);
0505 
0506     //  Missing Data w.r.t. Emulator
0507     _cMsnData_ElectronicsuTCA.initialize(_name,
0508                                          "MsnData",
0509                                          hcaldqm::hashfunctions::fElectronics,
0510                                          new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
0511                                          new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0512                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0513                                          0);
0514     _cMsnEmul_ElectronicsuTCA.initialize(_name,
0515                                          "MsnEmul",
0516                                          hcaldqm::hashfunctions::fElectronics,
0517                                          new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
0518                                          new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0519                                          new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN),
0520                                          0);
0521     _cEtCorrRatio_ElectronicsuTCA.initialize(_name,
0522                                              "EtCorrRatio",
0523                                              hcaldqm::hashfunctions::fElectronics,
0524                                              new hcaldqm::quantity::FEDQuantity(vFEDsuTCA),
0525                                              new hcaldqm::quantity::ElectronicsQuantity(hcaldqm::quantity::fSlotuTCA),
0526                                              new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fRatio_0to2),
0527                                              0);
0528     if (_ptype == fOnline) {
0529       _cSummaryvsLS_FED.initialize(_name,
0530                                    "SummaryvsLS",
0531                                    hcaldqm::hashfunctions::fFED,
0532                                    new hcaldqm::quantity::LumiSection(_maxLS),
0533                                    new hcaldqm::quantity::FlagQuantity(_vflags),
0534                                    new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),
0535                                    0);
0536       _cSummaryvsLS.initialize(_name,
0537                                "SummaryvsLS",
0538                                new hcaldqm::quantity::LumiSection(_maxLS),
0539                                new hcaldqm::quantity::FEDQuantity(vFEDs),
0540                                new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState),
0541                                0);
0542 
0543       _xEtMsm.initialize(hcaldqm::hashfunctions::fFED);
0544       _xFGMsm.initialize(hcaldqm::hashfunctions::fFED);
0545       _xNumCorr.initialize(hcaldqm::hashfunctions::fFED);
0546       _xDataMsn.initialize(hcaldqm::hashfunctions::fFED);
0547       _xDataTotal.initialize(hcaldqm::hashfunctions::fFED);
0548       _xEmulMsn.initialize(hcaldqm::hashfunctions::fFED);
0549       _xEmulTotal.initialize(hcaldqm::hashfunctions::fFED);
0550       _xSentRecL1Msm.initialize(hcaldqm::hashfunctions::fFED);
0551     }
0552   }
0553 
0554   //    BOOK HISTOGRAMS
0555   char aux[20];
0556   for (unsigned int iii = 0; iii < constants::NUM_FGBITS; iii++) {
0557     sprintf(aux, "BIT%d", iii);
0558     _cFGCorr_TTSubdet[iii].book(ib, _emap, _subsystem, aux);
0559   }
0560   _cEtData_TTSubdet.book(ib, _emap, _subsystem);
0561   _cEtEmul_TTSubdet.book(ib, _emap, _subsystem);
0562   _cEtCorr_TTSubdet.book(ib, _emap, _subsystem);
0563   _cSOIEtCorr_TTSubdet.book(ib, _emap, _subsystem);
0564   _cSOIEtCorrEmulL1_TTSubdet.book(ib, _emap, _subsystem);
0565   if (_ptype != fOffline) {  // hidefed2crate
0566     _cEtData_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem);
0567     _cEtEmul_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem);
0568   }
0569   _cEtData_depthlike.book(ib, _subsystem);
0570   _cEtEmul_depthlike.book(ib, _subsystem);
0571   _cEtCutData_depthlike.book(ib, _subsystem);
0572   _cEtCutEmul_depthlike.book(ib, _subsystem);
0573   if (_ptype != fOffline) {  // hidefed2crate
0574     _cOccupancyData_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem);
0575     _cOccupancyEmul_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem);
0576     _cOccupancyCutData_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem);
0577     _cOccupancyCutEmul_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem);
0578   }
0579   _cOccupancyData_depthlike.book(ib, _subsystem);
0580   _cOccupancyEmul_depthlike.book(ib, _subsystem);
0581   _cOccupancyCutData_depthlike.book(ib, _subsystem);
0582   _cOccupancyCutEmul_depthlike.book(ib, _subsystem);
0583 
0584   _cEtCorrRatio_depthlike.book(ib, _subsystem);
0585   _cEtMsm_depthlike.book(ib, _subsystem);
0586   _cFGMsm_depthlike.book(ib, _subsystem);
0587   _cMsnData_depthlike.book(ib, _subsystem);
0588   _cMsnEmul_depthlike.book(ib, _subsystem);
0589 
0590   if (_ptype == fOnline) {
0591     _cEtMsm_uHTR_L1T_depthlike.book(ib, _subsystem);
0592     _cEtMsm_uHTR_L1T_LS.book(ib, _subsystem);
0593   }
0594 
0595   if (_ptype != fOffline) {  // hidefed2crate
0596     _cEtMsm_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem);
0597     _cFGMsm_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem);
0598     _cMsnData_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem);
0599     _cMsnEmul_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem);
0600     _cEtCorrRatio_ElectronicsuTCA.book(ib, _emap, _filter_VME, _subsystem);
0601   }
0602 
0603   //    whatever has to go online only goes here
0604   if (_ptype == fOnline) {
0605     _cEtCorr2x3_TTSubdet.book(ib, _emap, _subsystem);
0606     _cOccupancyData2x3_depthlike.book(ib, _subsystem);
0607     _cOccupancyEmul2x3_depthlike.book(ib, _subsystem);
0608     _cEtCutDatavsLS_TTSubdet.book(ib, _emap, _subsystem);
0609     _cEtCutEmulvsLS_TTSubdet.book(ib, _emap, _subsystem);
0610     _cEtCutDatavsBX_TTSubdet.book(ib, _emap, _subsystem);
0611     _cEtCutEmulvsBX_TTSubdet.book(ib, _emap, _subsystem);
0612     _cEtCorrRatiovsLS_TTSubdet.book(ib, _emap, _subsystem);
0613     _cEtCorrRatiovsBX_TTSubdet.book(ib, _emap, _subsystem);
0614     _cEtMsmvsLS_TTSubdet.book(ib, _emap, _subsystem);
0615     _cEtMsmvsBX_TTSubdet.book(ib, _emap, _subsystem);
0616     _cEtMsmRatiovsLS_TTSubdet.book(ib, _emap, _subsystem);
0617     _cEtMsmRatiovsBX_TTSubdet.book(ib, _emap, _subsystem);
0618     _cMsnDatavsLS_TTSubdet.book(ib, _emap, _subsystem);
0619     _cMsnCutDatavsLS_TTSubdet.book(ib, _emap, _subsystem);
0620     _cMsnDatavsBX_TTSubdet.book(ib, _emap, _subsystem);
0621     _cMsnCutDatavsBX_TTSubdet.book(ib, _emap, _subsystem);
0622     _cMsnEmulvsLS_TTSubdet.book(ib, _emap, _subsystem);
0623     _cMsnCutEmulvsLS_TTSubdet.book(ib, _emap, _subsystem);
0624     _cMsnEmulvsBX_TTSubdet.book(ib, _emap, _subsystem);
0625     _cMsnCutEmulvsBX_TTSubdet.book(ib, _emap, _subsystem);
0626     _cOccupancyDatavsBX_TTSubdet.book(ib, _emap, _subsystem);
0627     _cOccupancyEmulvsBX_TTSubdet.book(ib, _emap, _subsystem);
0628     _cOccupancyCutDatavsBX_TTSubdet.book(ib, _emap, _subsystem);
0629     _cOccupancyCutEmulvsBX_TTSubdet.book(ib, _emap, _subsystem);
0630     _cOccupancyDatavsLS_TTSubdet.book(ib, _emap, _subsystem);
0631     _cOccupancyEmulvsLS_TTSubdet.book(ib, _emap, _subsystem);
0632     _cOccupancyCutDatavsLS_TTSubdet.book(ib, _emap, _subsystem);
0633     _cOccupancyCutEmulvsLS_TTSubdet.book(ib, _emap, _subsystem);
0634     _cSummaryvsLS_FED.book(ib, _emap, _subsystem);
0635     _cSummaryvsLS.book(ib, _subsystem);
0636 
0637     _xEtMsm.book(_emap);
0638     _xFGMsm.book(_emap);
0639     _xNumCorr.book(_emap);
0640     _xDataMsn.book(_emap);
0641     _xDataTotal.book(_emap);
0642     _xEmulMsn.book(_emap);
0643     _xEmulTotal.book(_emap);
0644     _xSentRecL1Msm.book(_emap);
0645 
0646     _cOccupancy_HF_depth.book(ib, _subsystem);
0647     _cOccupancyNoTDC_HF_depth.book(ib, _subsystem);
0648     _cOccupancy_HF_ieta.book(ib, _subsystem);
0649     _cOccupancyNoTDC_HF_ieta.book(ib, _subsystem);
0650   }
0651 
0652   //    initialize the hash map
0653   _ehashmap.initialize(_emap, hcaldqm::electronicsmap::fT2EHashMap);
0654 
0655   //    book the flag for unknown ids and the online guy as well
0656   ib.setCurrentFolder(_subsystem + "/" + _name);
0657   auto scope = DQMStore::IBooker::UseLumiScope(ib);
0658   meUnknownIds1LS = ib.book1DD("UnknownIds", "UnknownIds", 1, 0, 1);
0659   _unknownIdsPresent = false;
0660 }
0661 
0662 /* virtual */ void TPTask::_resetMonitors(hcaldqm::UpdateFreq uf) {
0663   DQTask::_resetMonitors(uf);
0664   switch (uf) {
0665     case hcaldqm::f1LS:
0666       _unknownIdsPresent = false;
0667       break;
0668     default:
0669       break;
0670   }
0671 }
0672 
0673 /* virtual */ void TPTask::_process(edm::Event const& e, edm::EventSetup const&) {
0674   edm::Handle<HcalTrigPrimDigiCollection> cdata;
0675   edm::Handle<HcalTrigPrimDigiCollection> cdataL1Rec;
0676   edm::Handle<HcalTrigPrimDigiCollection> cemul;
0677   edm::Handle<HcalTrigPrimDigiCollection> cemul_noTDCCut;
0678   if (!e.getByToken(_tokData, cdata))
0679     _logger.dqmthrow("Collection HcalTrigPrimDigiCollection isn't available: " + _tagData.label() + " " +
0680                      _tagData.instance());
0681   if (_ptype == fOnline) {
0682     if (!e.getByToken(_tokDataL1Rec, cdataL1Rec))
0683       _logger.dqmthrow("Collection HcalTrigPrimDigiCollection isn't available: " + _tagDataL1Rec.label() + " " +
0684                        _tagDataL1Rec.instance());
0685   }
0686   if (!e.getByToken(_tokEmul, cemul))
0687     _logger.dqmthrow("Collection HcalTrigPrimDigiCollection isn't available: " + _tagEmul.label() + " " +
0688                      _tagEmul.instance());
0689   if (_ptype == fOnline) {
0690     if (!e.getByToken(_tokEmulNoTDCCut, cemul_noTDCCut)) {
0691       _logger.dqmthrow("Collection HcalTrigPrimDigiCollection isn't available: " + _tagEmulNoTDCCut.label() + " " +
0692                        _tagEmulNoTDCCut.instance());
0693     }
0694   }
0695 
0696   //    extract some info per event
0697   int bx = e.bunchCrossing();
0698 
0699   auto lumiCache = luminosityBlockCache(e.getLuminosityBlock().index());
0700   _currentLS = lumiCache->currentLS;
0701 
0702   //    some summaries... per event
0703   int numHBHE(0), numHF(0), numCutHBHE(0), numCutHF(0);
0704   int numCorrHBHE(0), numCorrHF(0);
0705   int numMsmHBHE(0), numMsmHF(0);
0706   int numMsnHBHE(0), numMsnHF(0), numMsnCutHBHE(0), numMsnCutHF(0);
0707 
0708   //    for explanation see RecHit or Digi Tasks
0709   uint32_t rawidHBHEValid = 0;
0710   uint32_t rawidHFValid = 0;
0711 
0712   /*
0713      * STEP1: 
0714      * Loop over the data digis and 
0715      * - do ... for all the data digis
0716      * - find the emulator digi
0717      * --- compare soi Et
0718      * --- compare soi FG
0719      * --- Do not fill anything for emulator Et!!!
0720      */
0721   for (HcalTrigPrimDigiCollection::const_iterator it = cdata->begin(); it != cdata->end(); ++it) {
0722     //  Explicit check on the DetIds present in the Collection
0723     HcalTrigTowerDetId tid = it->id();
0724     uint32_t rawid = _ehashmap.lookup(tid);
0725     if (rawid == 0) {
0726       meUnknownIds1LS->Fill(1);
0727       _unknownIdsPresent = true;
0728       continue;
0729     }
0730     HcalElectronicsId const& eid(rawid);
0731     if (tid.ietaAbs() >= 29)
0732       rawidHFValid = tid.rawId();
0733     else
0734       rawidHBHEValid = tid.rawId();
0735 
0736     //
0737     //  HF 2x3 TPs Treat theam separately and only for ONLINE!
0738     //
0739     if (tid.version() == 0 && tid.ietaAbs() >= 29) {
0740       //    do this only for online processing
0741       if (_ptype == fOnline) {
0742         _cOccupancyData2x3_depthlike.fill(tid);
0743         HcalTrigPrimDigiCollection::const_iterator jt = cemul->find(tid);
0744         if (jt != cemul->end())
0745           _cEtCorr2x3_TTSubdet.fill(tid, it->SOI_compressedEt(), jt->SOI_compressedEt());
0746       }
0747 
0748       //    skip to the next tp digi
0749       continue;
0750     }
0751 
0752     //  FROM THIS POINT, HBHE + 1x1 HF TPs
0753     int soiEt_d = it->t0().compressedEt();
0754     int soiFG_d[constants::NUM_FGBITS];
0755     for (uint32_t ibit = 0; ibit < constants::NUM_FGBITS; ibit++)
0756       soiFG_d[ibit] = it->t0().fineGrain(ibit) ? 1 : 0;
0757     tid.ietaAbs() >= 29 ? numHF++ : numHBHE++;
0758 
0759     //   fill w/o a cut
0760     _cEtData_TTSubdet.fill(tid, soiEt_d);
0761     _cEtData_depthlike.fill(tid, soiEt_d);
0762     _cOccupancyData_depthlike.fill(tid);
0763 
0764     if (_ptype == fOnline) {
0765       if (tid.ietaAbs() >= 29) {
0766         if (soiEt_d > 0) {
0767           _cOccupancy_HF_depth.fill(tid);
0768           _cOccupancy_HF_ieta.fill(tid);
0769         }
0770       }
0771     }
0772     if (_ptype != fOffline) {  // hidefed2crate
0773       if (!eid.isVMEid()) {
0774         _cOccupancyData_ElectronicsuTCA.fill(eid);
0775         _cEtData_ElectronicsuTCA.fill(eid, soiEt_d);
0776       }
0777     }
0778 
0779     //  FILL w/a CUT
0780     if (soiEt_d > _cutEt) {
0781       tid.ietaAbs() >= 29 ? numCutHF++ : numCutHBHE++;
0782       _cOccupancyCutData_depthlike.fill(tid);
0783       _cEtCutData_depthlike.fill(tid, soiEt_d);
0784 
0785       //    ONLINE ONLY!
0786       if (_ptype == fOnline) {
0787         _cEtCutDatavsLS_TTSubdet.fill(tid, _currentLS, soiEt_d);
0788         _cEtCutDatavsBX_TTSubdet.fill(tid, bx, log2(soiEt_d + 1.));
0789         _xDataTotal.get(eid)++;
0790       }
0791       //    ^^^ONLINE ONLY!
0792       if (_ptype != fOffline) {  // hidefed2crate
0793         if (!eid.isVMEid())
0794           _cOccupancyCutData_ElectronicsuTCA.fill(eid);
0795       }
0796     }
0797 
0798     //  FIND the EMULATOR DIGI
0799     HcalTrigPrimDigiCollection::const_iterator jt = cemul->find(tid);
0800     if (jt != cemul->end()) {
0801       //    if PRESENT!
0802       int soiEt_e = jt->SOI_compressedEt();
0803       int soiFG_e[constants::NUM_FGBITS];
0804       for (uint32_t ibit = 0; ibit < constants::NUM_FGBITS; ibit++)
0805         soiFG_e[ibit] = jt->t0().fineGrain(ibit) ? 1 : 0;
0806       //    if both are zeroes => set 1
0807       double rEt =
0808           soiEt_d == 0 && soiEt_e == 0 ? 1 : double(std::min(soiEt_d, soiEt_e)) / double(std::max(soiEt_e, soiEt_d));
0809 
0810       //    ONLINE ONLY!
0811       if (_ptype == fOnline) {
0812         _xNumCorr.get(eid)++;
0813         tid.ietaAbs() >= 29 ? numCorrHF++ : numCorrHBHE++;
0814         _cEtCorrRatiovsLS_TTSubdet.fill(tid, _currentLS, rEt);
0815         _cEtCorrRatiovsBX_TTSubdet.fill(tid, bx, rEt);
0816       }
0817       //    ^^^ONLINE ONLY!
0818 
0819       _cEtCorrRatio_depthlike.fill(tid, rEt);
0820       _cSOIEtCorr_TTSubdet.fill(tid, eid, soiEt_d, soiEt_e);
0821       for (int ci = 0; ci < 4; ci++) {
0822         for (int cj = 0; cj < 4; cj++) {
0823           if (ci < it->size() && cj < jt->size()) {
0824             if ((ci == cj) || (it->sample(ci).compressedEt() > 0 && jt->sample(cj).compressedEt() > 0)) {
0825               _cEtCorr_TTSubdet.fill(
0826                   tid, eid, 256 * ci + it->sample(ci).compressedEt(), 256 * cj + jt->sample(cj).compressedEt());
0827             }
0828           }
0829         }
0830       }
0831       for (uint32_t ibit = 0; ibit < constants::NUM_FGBITS; ibit++)
0832         _cFGCorr_TTSubdet[ibit].fill(tid, soiFG_d[ibit], soiFG_e[ibit]);
0833       //    FILL w/o a CUT
0834       if (_ptype != fOffline) {  // hidefed2crate
0835         if (!eid.isVMEid())
0836           _cEtCorrRatio_ElectronicsuTCA.fill(eid, rEt);
0837       }
0838 
0839       //    if SOI Et are not equal
0840       //    fill mismatched
0841       if (soiEt_d != soiEt_e) {
0842         tid.ietaAbs() >= 29 ? numMsmHF++ : numMsmHBHE++;
0843         _cEtMsm_depthlike.fill(tid);
0844         if (_ptype != fOffline) {  // hidefed2crate
0845           if (!eid.isVMEid())
0846             _cEtMsm_ElectronicsuTCA.fill(eid);
0847         }
0848         if (_ptype == fOnline)
0849           _xEtMsm.get(eid)++;
0850       }
0851       //     if SOI FG are not equal
0852       //     fill mismatched.
0853       //     Do this comparison only for FG Bits that are commissioned
0854       for (uint32_t ibit = 0; ibit < constants::NUM_FGBITS; ibit++)
0855         if (soiFG_d[ibit] != soiFG_e[ibit] && _vFGBitsReady[ibit]) {
0856           _cFGMsm_depthlike.fill(tid);
0857           if (_ptype != fOffline) {  // hidefed2crate
0858             if (!eid.isVMEid())
0859               _cFGMsm_ElectronicsuTCA.fill(eid);
0860           }
0861           if (_ptype == fOnline)
0862             _xFGMsm.get(eid)++;
0863         }
0864     } else {
0865       //    IF MISSING
0866       _cEtCorr_TTSubdet.fill(tid, eid, soiEt_d, -1);
0867       _cSOIEtCorr_TTSubdet.fill(tid, eid, soiEt_d, -1);
0868       _cMsnEmul_depthlike.fill(tid);
0869       tid.ietaAbs() >= 29 ? numMsnHF++ : numMsnHBHE++;
0870       if (_ptype != fOffline) {  // hidefed2crate
0871         if (!eid.isVMEid())
0872           _cMsnEmul_ElectronicsuTCA.fill(eid);
0873       }
0874 
0875       if (soiEt_d > _cutEt) {
0876         tid.ietaAbs() >= 29 ? numMsnCutHF++ : numMsnCutHBHE++;
0877         if (_ptype == fOnline)
0878           _xEmulMsn.get(eid)++;
0879       }
0880     }
0881   }
0882 
0883   if (_ptype == fOnline) {
0884     for (HcalTrigPrimDigiCollection::const_iterator it = cemul_noTDCCut->begin(); it != cemul_noTDCCut->end(); ++it) {
0885       //    Explicit check on the DetIds present in the Collection
0886       HcalTrigTowerDetId tid = it->id();
0887       uint32_t rawid = _ehashmap.lookup(tid);
0888       if (rawid == 0) {
0889         continue;
0890       }
0891       if (tid.version() == 0 && tid.ietaAbs() >= 29) {
0892         continue;
0893       }
0894       int soiEt_e = it->SOI_compressedEt();
0895       if (tid.ietaAbs() >= 29) {
0896         if (soiEt_e > 0) {
0897           _cOccupancyNoTDC_HF_depth.fill(tid);
0898           _cOccupancyNoTDC_HF_ieta.fill(tid);
0899         }
0900       }
0901     }
0902   }
0903 
0904   if (rawidHFValid != 0 && rawidHBHEValid != 0) {
0905     //  ONLINE ONLY!
0906     if (_ptype == fOnline) {
0907       _cOccupancyDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numHBHE);
0908       _cOccupancyDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numHF);
0909       _cOccupancyCutDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numCutHBHE);
0910       _cOccupancyCutDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numCutHF);
0911       _cOccupancyDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numHBHE);
0912       _cOccupancyDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numHF);
0913       _cOccupancyCutDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numCutHBHE);
0914       _cOccupancyCutDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numCutHF);
0915 
0916       _cEtMsmvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numMsmHBHE);
0917       _cEtMsmvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numMsmHF);
0918       _cEtMsmvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numMsmHBHE);
0919       _cEtMsmvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numMsmHF);
0920 
0921       _cEtMsmRatiovsLS_TTSubdet.fill(
0922           HcalTrigTowerDetId(rawidHBHEValid), _currentLS, double(numMsmHBHE) / double(numCorrHBHE));
0923       _cEtMsmRatiovsLS_TTSubdet.fill(
0924           HcalTrigTowerDetId(rawidHFValid), _currentLS, double(numMsmHF) / double(numCorrHF));
0925       _cEtMsmRatiovsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, double(numMsmHBHE) / double(numCorrHBHE));
0926       _cEtMsmRatiovsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, double(numMsmHF) / double(numCorrHF));
0927 
0928       _cMsnEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numMsnHBHE);
0929       _cMsnEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numMsnHF);
0930       _cMsnCutEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numMsnCutHBHE);
0931       _cMsnCutEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numMsnCutHF);
0932 
0933       _cMsnEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numMsnHBHE);
0934       _cMsnEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numMsnHF);
0935       _cMsnCutEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numMsnCutHBHE);
0936       _cMsnCutEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numMsnCutHF);
0937     }
0938   }
0939 
0940   numHBHE = 0;
0941   numHF = 0;
0942   numMsnHBHE = 0;
0943   numMsnHF = 0;
0944   numCutHBHE = 0;
0945   numCutHF = 0;
0946 
0947   //    reset
0948   rawidHBHEValid = 0;
0949   rawidHFValid = 0;
0950 
0951   /*
0952      *  STEP2:
0953      *  Loop over the emulator digis and 
0954      *  - do ... for all the emulator digis
0955      *  - find data digi and 
0956      *  --- if found skip
0957      *  --- if not found - fill the missing Data plot
0958      */
0959   for (HcalTrigPrimDigiCollection::const_iterator it = cemul->begin(); it != cemul->end(); ++it) {
0960     //  Explicit check on the DetIds present in the Collection
0961     HcalTrigTowerDetId tid = it->id();
0962     uint32_t rawid = _ehashmap.lookup(tid);
0963     if (rawid == 0) {
0964       meUnknownIds1LS->Fill(1);
0965       _unknownIdsPresent = true;
0966       continue;
0967     }
0968     HcalElectronicsId const& eid(rawid);
0969     if (tid.ietaAbs() >= 29)
0970       rawidHFValid = tid.rawId();
0971     else
0972       rawidHBHEValid = tid.rawId();
0973 
0974     //  HF 2x3 TPs. Only do it for Online!!!
0975     if (tid.version() == 0 && tid.ietaAbs() >= 29) {
0976       //    only do this for online processing
0977       if (_ptype == fOnline)
0978         _cOccupancyEmul2x3_depthlike.fill(tid);
0979       continue;
0980     }
0981     int soiEt = it->SOI_compressedEt();
0982 
0983     //  FILL/INCREMENT w/o a CUT
0984     tid.ietaAbs() >= 29 ? numHF++ : numHBHE++;
0985     _cEtEmul_TTSubdet.fill(tid, soiEt);
0986     _cEtEmul_depthlike.fill(tid, soiEt);
0987     _cOccupancyEmul_depthlike.fill(tid);
0988     if (_ptype != fOffline) {  // hidefed2crate
0989       if (!eid.isVMEid()) {
0990         _cOccupancyEmul_ElectronicsuTCA.fill(eid);
0991         _cEtEmul_ElectronicsuTCA.fill(eid, soiEt);
0992       }
0993     }
0994 
0995     //  FILL w/ a CUT
0996     if (soiEt > _cutEt) {
0997       tid.ietaAbs() >= 29 ? numCutHF++ : numCutHBHE++;
0998       _cOccupancyCutEmul_depthlike.fill(tid);
0999       _cEtCutEmul_depthlike.fill(tid, soiEt);
1000       if (_ptype != fOffline) {  // hidefed2crate
1001         if (!eid.isVMEid())
1002           _cOccupancyCutEmul_ElectronicsuTCA.fill(eid);
1003       }
1004 
1005       //    ONLINE ONLY!
1006       if (_ptype == fOnline) {
1007         _cEtCutEmulvsLS_TTSubdet.fill(tid, _currentLS, soiEt);
1008         _cEtCutEmulvsBX_TTSubdet.fill(tid, bx, soiEt);
1009         _xEmulTotal.get(eid)++;
1010       }
1011       //    ^^^ONLINE ONLY!
1012     }
1013 
1014     // Look for a data digi.
1015     // Do not perform if the emulated digi is zero suppressed.
1016     if (!(it->zsMarkAndPass())) {
1017       HcalTrigPrimDigiCollection::const_iterator jt = cdata->find(tid);
1018       if (jt == cdata->end()) {
1019         tid.ietaAbs() >= 29 ? numMsnHF++ : numMsnHBHE++;
1020         _cEtCorr_TTSubdet.fill(tid, eid, -1, soiEt);
1021         _cSOIEtCorr_TTSubdet.fill(tid, eid, -1, soiEt);
1022         _cMsnData_depthlike.fill(tid);
1023         if (_ptype != fOffline) {  // hidefed2crate
1024           if (!eid.isVMEid())
1025             _cMsnData_ElectronicsuTCA.fill(eid);
1026         }
1027         if (soiEt > _cutEt) {
1028           tid.ietaAbs() >= 29 ? numMsnCutHF++ : numMsnCutHBHE++;
1029           if (_ptype == fOnline)
1030             _xDataMsn.get(eid)++;
1031         }
1032       }
1033     }
1034   }
1035 
1036   //    ONLINE ONLY!
1037   if (_ptype == fOnline) {
1038     if (rawidHBHEValid != 0) {
1039       _cOccupancyEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numHBHE);
1040       _cOccupancyCutEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numCutHBHE);
1041       _cOccupancyEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numHBHE);
1042       _cOccupancyCutEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numCutHBHE);
1043       _cMsnDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numMsnHBHE);
1044       _cMsnCutDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), _currentLS, numMsnCutHBHE);
1045       _cMsnDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numMsnHBHE);
1046       _cMsnCutDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHBHEValid), bx, numMsnCutHBHE);
1047     }
1048     if (rawidHFValid != 0) {
1049       _cOccupancyEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numHF);
1050       _cOccupancyCutEmulvsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numCutHF);
1051       _cOccupancyEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numHF);
1052       _cOccupancyCutEmulvsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numCutHF);
1053       _cMsnDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numMsnHF);
1054       _cMsnCutDatavsLS_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), _currentLS, numMsnCutHF);
1055       _cMsnDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numMsnHF);
1056       _cMsnCutDatavsBX_TTSubdet.fill(HcalTrigTowerDetId(rawidHFValid), bx, numMsnCutHF);
1057     }
1058     //  ^^^ONLINE ONLY!
1059   }
1060 
1061   if (_ptype == fOnline) {
1062     // Compare the sent ("uHTR") and received (L1T "layer1") TPs
1063     // This algorithm is copied from DQM/L1TMonitor/src/L1TStage2CaloLayer1.cc
1064     // ...but it turns out to be extremely useful for detecting uHTR problems
1065 
1066     _vEmulTPDigis_SentRec.clear();
1067     ComparisonHelper::zip(cemul->begin(),
1068                           cemul->end(),
1069                           cdataL1Rec->begin(),
1070                           cdataL1Rec->end(),
1071                           std::inserter(_vEmulTPDigis_SentRec, _vEmulTPDigis_SentRec.begin()),
1072                           HcalTrigPrimDigiCollection::key_compare());
1073 
1074     // comparison between emulation TP and L1 TP
1075     for (const auto& tpPair : _vEmulTPDigis_SentRec) {
1076       const auto& sentTp = tpPair.first;
1077       const auto& recdTp = tpPair.second;
1078       const int ieta = sentTp.id().ieta();
1079       if (abs(ieta) > 28 && sentTp.id().version() != 1)
1080         continue;
1081 
1082       const bool towerMasked = recdTp.sample(0).raw() & (1 << 13);
1083       const bool linkError = recdTp.sample(0).raw() & (1 << 15);
1084       if (towerMasked || linkError)
1085         continue;
1086 
1087       HcalTrigTowerDetId tid = sentTp.id();
1088       uint32_t rawid = _ehashmap.lookup(tid);
1089       if (rawid == 0) {
1090         continue;
1091       }
1092       HcalElectronicsId const& eid(rawid);
1093 
1094       _cSOIEtCorrEmulL1_TTSubdet.fill(tid, eid, recdTp.SOI_compressedEt(), sentTp.SOI_compressedEt());
1095     }
1096 
1097     // comparison between sent data TP and L1 TP
1098     _vTPDigis_SentRec.clear();
1099     ComparisonHelper::zip(cdata->begin(),
1100                           cdata->end(),
1101                           cdataL1Rec->begin(),
1102                           cdataL1Rec->end(),
1103                           std::inserter(_vTPDigis_SentRec, _vTPDigis_SentRec.begin()),
1104                           HcalTrigPrimDigiCollection::key_compare());
1105 
1106     for (const auto& tpPair : _vTPDigis_SentRec) {
1107       // From here, literal copy pasta from L1T
1108       const auto& sentTp = tpPair.first;
1109       const auto& recdTp = tpPair.second;
1110       const int ieta = sentTp.id().ieta();
1111       if (abs(ieta) > 28 && sentTp.id().version() != 1)
1112         continue;
1113       //const int iphi = sentTp.id().iphi();
1114       const bool towerMasked = recdTp.sample(0).raw() & (1 << 13);
1115       //const bool linkMasked  = recdTp.sample(0).raw() & (1<<14);
1116       const bool linkError = recdTp.sample(0).raw() & (1 << 15);
1117 
1118       if (towerMasked || linkError) {
1119         // Do not compare if known to be bad
1120         continue;
1121       }
1122 
1123       HcalTrigTowerDetId tid = sentTp.id();
1124       uint32_t rawid = _ehashmap.lookup(tid);
1125       if (rawid == 0) {
1126         continue;
1127       }
1128       HcalElectronicsId const& eid(rawid);
1129 
1130       const bool HetAgreement = sentTp.SOI_compressedEt() == recdTp.SOI_compressedEt();
1131       const bool Hfb1Agreement =
1132           (abs(ieta) < 29) ? true
1133                            : (recdTp.SOI_compressedEt() == 0 || (sentTp.SOI_fineGrain() == recdTp.SOI_fineGrain()));
1134       // Ignore minBias (FB2) bit if we receieve 0 ET, which means it is likely zero-suppressed on HCal readout side
1135       const bool Hfb2Agreement =
1136           (abs(ieta) < 29) ? true
1137                            : (recdTp.SOI_compressedEt() == 0 || (sentTp.SOI_fineGrain(1) == recdTp.SOI_fineGrain(1)));
1138       if (!(HetAgreement && Hfb1Agreement && Hfb2Agreement)) {
1139         _cEtMsm_uHTR_L1T_depthlike.fill(tid);
1140         _cEtMsm_uHTR_L1T_LS.fill(_currentLS);
1141         _xSentRecL1Msm.get(eid)++;
1142       }
1143     }
1144   }
1145 }
1146 
1147 std::shared_ptr<hcaldqm::Cache> TPTask::globalBeginLuminosityBlock(edm::LuminosityBlock const& lb,
1148                                                                    edm::EventSetup const& es) const {
1149   return DQTask::globalBeginLuminosityBlock(lb, es);
1150 }
1151 
1152 /* virtual */ void TPTask::globalEndLuminosityBlock(edm::LuminosityBlock const& lb, edm::EventSetup const& es) {
1153   if (_ptype != fOnline)
1154     return;
1155 
1156   auto lumiCache = luminosityBlockCache(lb.index());
1157   _currentLS = lumiCache->currentLS;
1158 
1159   //
1160   //    GENERATE STATUS ONLY FOR ONLINE!
1161   //
1162   for (std::vector<uint32_t>::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) {
1163     flag::Flag fSum("TP");
1164     HcalElectronicsId eid = HcalElectronicsId(*it);
1165 
1166     std::vector<uint32_t>::const_iterator cit = std::find(_vcdaqEids.begin(), _vcdaqEids.end(), *it);
1167     if (cit == _vcdaqEids.end()) {
1168       //    not @cDAQ
1169       for (uint32_t iflag = 0; iflag < _vflags.size(); iflag++)
1170         _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), int(flag::fNCDAQ));
1171       _cSummaryvsLS.setBinContent(eid, _currentLS, int(flag::fNCDAQ));
1172       continue;
1173     }
1174 
1175     if (hcaldqm::utilities::isFEDHBHE(eid) || hcaldqm::utilities::isFEDHF(eid)) {
1176       //    FED is @cDAQ
1177       double etmsm = _xNumCorr.get(eid) > 0 ? double(_xEtMsm.get(eid)) / double(_xNumCorr.get(eid)) : 0;
1178       /*    
1179              * UNUSED VARS
1180              * double dmsm = _xDataTotal.get(eid)>0?
1181                 double(_xDataMsn.get(eid))/double(_xDataTotal.get(eid)):0;
1182             double emsm = _xEmulTotal.get(eid)>0?
1183                 double(_xEmulMsn.get(eid))/double(_xEmulTotal.get(eid)):0;
1184             double fgmsm = _xNumCorr.get(eid)>0?
1185                 double(_xFGMsm.get(eid))/double(_xNumCorr.get(eid)):0;              
1186                 */
1187       if (etmsm >= _thresh_EtMsmRate_high)
1188         _vflags[fEtMsm]._state = flag::fBAD;
1189       else if (etmsm >= _thresh_EtMsmRate_low)
1190         _vflags[fEtMsm]._state = flag::fPROBLEMATIC;
1191       else
1192         _vflags[fEtMsm]._state = flag::fGOOD;
1193       /*
1194              *  DISABLE THESE FLAGS FOR ONLINE FOR NOW!
1195             if (dmsm>=_thresh_DataMsn)
1196                 _vflags[fDataMsn]._state = flag::fBAD;
1197             else
1198                 _vflags[fDataMsn]._state = flag::fGOOD;
1199             if (emsm>=_thresh_EmulMsn)
1200                 _vflags[fEmulMsn]._state = flag::fBAD;
1201             else
1202                 _vflags[fEmulMsn]._state = flag::fGOOD;
1203                 */
1204 
1205       if (_ptype == fOnline) {
1206         if (_xSentRecL1Msm.get(eid) >= 1) {
1207           _vflags[fSentRecL1Msm]._state = flag::fBAD;
1208         } else {
1209           _vflags[fSentRecL1Msm]._state = flag::fGOOD;
1210         }
1211       }
1212     }
1213 
1214     if (_unknownIdsPresent)
1215       _vflags[fUnknownIds]._state = flag::fBAD;
1216     else
1217       _vflags[fUnknownIds]._state = flag::fGOOD;
1218 
1219     int iflag = 0;
1220     for (std::vector<flag::Flag>::iterator ft = _vflags.begin(); ft != _vflags.end(); ++ft) {
1221       _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), ft->_state);
1222       fSum += (*ft);
1223       iflag++;
1224 
1225       //    this is the MUST!
1226       //    reset after using this flag
1227       ft->reset();
1228     }
1229     _cSummaryvsLS.setBinContent(eid, _currentLS, int(fSum._state));
1230   }
1231 
1232   //    reset...
1233   _xEtMsm.reset();
1234   _xFGMsm.reset();
1235   _xNumCorr.reset();
1236   _xDataMsn.reset();
1237   _xDataTotal.reset();
1238   _xEmulMsn.reset();
1239   _xEmulTotal.reset();
1240 
1241   //    in the end always do the DQTask::endLumi
1242   DQTask::globalEndLuminosityBlock(lb, es);
1243 }
1244 
1245 DEFINE_FWK_MODULE(TPTask);