Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-01-28 00:19:49

0001 #include <string>
0002 
0003 #include "DQM/L1TMonitor/interface/L1TdeCSCTPGShower.h"
0004 #include "DataFormats/MuonDetId/interface/CSCTriggerNumbering.h"
0005 
0006 L1TdeCSCTPGShower::L1TdeCSCTPGShower(const edm::ParameterSet& ps)
0007     : dataALCTShower_token_(consumes<CSCShowerDigiCollection>(ps.getParameter<edm::InputTag>("dataALCTShower"))),
0008       emulALCTShower_token_(consumes<CSCShowerDigiCollection>(ps.getParameter<edm::InputTag>("emulALCTShower"))),
0009       dataCLCTShower_token_(consumes<CSCShowerDigiCollection>(ps.getParameter<edm::InputTag>("dataCLCTShower"))),
0010       emulCLCTShower_token_(consumes<CSCShowerDigiCollection>(ps.getParameter<edm::InputTag>("emulCLCTShower"))),
0011       dataLCTShower_token_(consumes<CSCShowerDigiCollection>(ps.getParameter<edm::InputTag>("dataLCTShower"))),
0012       emulLCTShower_token_(consumes<CSCShowerDigiCollection>(ps.getParameter<edm::InputTag>("emulLCTShower"))),
0013       monitorDir_(ps.getUntrackedParameter<std::string>("monitorDir")) {}
0014 
0015 L1TdeCSCTPGShower::~L1TdeCSCTPGShower() {}
0016 
0017 void L1TdeCSCTPGShower::bookHistograms(DQMStore::IBooker& iBooker, const edm::Run&, const edm::EventSetup&) {
0018   iBooker.setCurrentFolder(monitorDir_);
0019 
0020   // 2D summary plots
0021   lctShowerDataNomSummary_denom_ =
0022       iBooker.book2D("lct_cscshower_data_nom_summary_denom", "Data LCT Nominal Shower All", 36, 1, 37, 18, 0, 18);
0023   lctShowerDataNomSummary_num_ = iBooker.book2D(
0024       "lct_cscshower_data_nom_summary_num", "Data LCT Nominal Shower Emul Matched", 36, 1, 37, 18, 0, 18);
0025   alctShowerDataNomSummary_denom_ =
0026       iBooker.book2D("alct_cscshower_data_nom_summary_denom", "Data ALCT Nominal Shower All", 36, 1, 37, 18, 0, 18);
0027   alctShowerDataNomSummary_num_ = iBooker.book2D(
0028       "alct_cscshower_data_nom_summary_num", "Data ALCT Nominal Shower Emul Matched", 36, 1, 37, 18, 0, 18);
0029   clctShowerDataNomSummary_denom_ =
0030       iBooker.book2D("clct_cscshower_data_nom_summary_denom", "Data CLCT Nominal Shower All", 36, 1, 37, 18, 0, 18);
0031   clctShowerDataNomSummary_num_ = iBooker.book2D(
0032       "clct_cscshower_data_nom_summary_num", "Data CLCT Nominal Shower Emul Matched", 36, 1, 37, 18, 0, 18);
0033 
0034   lctShowerEmulNomSummary_denom_ =
0035       iBooker.book2D("lct_cscshower_emul_nom_summary_denom", "Emul LCT Nominal Shower All", 36, 1, 37, 18, 0, 18);
0036   lctShowerEmulNomSummary_num_ = iBooker.book2D(
0037       "lct_cscshower_emul_nom_summary_num", "Emul LCT Nominal Shower Not Matched to Data", 36, 1, 37, 18, 0, 18);
0038   alctShowerEmulNomSummary_denom_ =
0039       iBooker.book2D("alct_cscshower_emul_nom_summary_denom", "Emul ALCT Nominal Shower All", 36, 1, 37, 18, 0, 18);
0040   alctShowerEmulNomSummary_num_ = iBooker.book2D(
0041       "alct_cscshower_emul_nom_summary_num", "Emul ALCT Nominal Shower Not Matched to Data", 36, 1, 37, 18, 0, 18);
0042   clctShowerEmulNomSummary_denom_ =
0043       iBooker.book2D("clct_cscshower_emul_nom_summary_denom", "Emul CLCT Nominal Shower All", 36, 1, 37, 18, 0, 18);
0044   clctShowerEmulNomSummary_num_ = iBooker.book2D(
0045       "clct_cscshower_emul_nom_summary_num", "Emul CLCT Nominal Shower Not Matched to Data", 36, 1, 37, 18, 0, 18);
0046 
0047   lctShowerDataTightSummary_denom_ =
0048       iBooker.book2D("lct_cscshower_data_tight_summary_denom", "Data LCT Tight Shower All", 36, 1, 37, 18, 0, 18);
0049   lctShowerDataTightSummary_num_ = iBooker.book2D(
0050       "lct_cscshower_data_tight_summary_num", "Data LCT Tight Shower Emul Matched", 36, 1, 37, 18, 0, 18);
0051   alctShowerDataTightSummary_denom_ =
0052       iBooker.book2D("alct_cscshower_data_tight_summary_denom", "Data ALCT Tight Shower All", 36, 1, 37, 18, 0, 18);
0053   alctShowerDataTightSummary_num_ = iBooker.book2D(
0054       "alct_cscshower_data_tight_summary_num", "Data ALCT Tight Shower Emul Matched", 36, 1, 37, 18, 0, 18);
0055   clctShowerDataTightSummary_denom_ =
0056       iBooker.book2D("clct_cscshower_data_tight_summary_denom", "Data CLCT Tight Shower All", 36, 1, 37, 18, 0, 18);
0057   clctShowerDataTightSummary_num_ = iBooker.book2D(
0058       "clct_cscshower_data_tight_summary_num", "Data CLCT Tight Shower Emul Matched", 36, 1, 37, 18, 0, 18);
0059 
0060   lctShowerEmulTightSummary_denom_ =
0061       iBooker.book2D("lct_cscshower_emul_tight_summary_denom", "Emul LCT Tight Shower All", 36, 1, 37, 18, 0, 18);
0062   lctShowerEmulTightSummary_num_ = iBooker.book2D(
0063       "lct_cscshower_emul_tight_summary_num", "Emul LCT Tight Shower Not Matched to Data", 36, 1, 37, 18, 0, 18);
0064   alctShowerEmulTightSummary_denom_ =
0065       iBooker.book2D("alct_cscshower_emul_tight_summary_denom", "Emul ALCT Tight Shower All", 36, 1, 37, 18, 0, 18);
0066   alctShowerEmulTightSummary_num_ = iBooker.book2D(
0067       "alct_cscshower_emul_tight_summary_num", "Emul ALCT Tight Shower Not Matched to Data", 36, 1, 37, 18, 0, 18);
0068   clctShowerEmulTightSummary_denom_ =
0069       iBooker.book2D("clct_cscshower_emul_tight_summary_denom", "Emul CLCT Tight Shower All", 36, 1, 37, 18, 0, 18);
0070   clctShowerEmulTightSummary_num_ = iBooker.book2D(
0071       "clct_cscshower_emul_tight_summary_num", "Emul CLCT Tight Shower Not Matched to Data", 36, 1, 37, 18, 0, 18);
0072 
0073   // x labels
0074   lctShowerDataNomSummary_denom_->setAxisTitle("Chamber", 1);
0075   lctShowerDataNomSummary_num_->setAxisTitle("Chamber", 1);
0076   alctShowerDataNomSummary_denom_->setAxisTitle("Chamber", 1);
0077   alctShowerDataNomSummary_num_->setAxisTitle("Chamber", 1);
0078   clctShowerDataNomSummary_denom_->setAxisTitle("Chamber", 1);
0079   clctShowerDataNomSummary_num_->setAxisTitle("Chamber", 1);
0080 
0081   lctShowerEmulNomSummary_denom_->setAxisTitle("Chamber", 1);
0082   lctShowerEmulNomSummary_num_->setAxisTitle("Chamber", 1);
0083   alctShowerEmulNomSummary_denom_->setAxisTitle("Chamber", 1);
0084   alctShowerEmulNomSummary_num_->setAxisTitle("Chamber", 1);
0085   clctShowerEmulNomSummary_denom_->setAxisTitle("Chamber", 1);
0086   clctShowerEmulNomSummary_num_->setAxisTitle("Chamber", 1);
0087 
0088   lctShowerDataTightSummary_denom_->setAxisTitle("Chamber", 1);
0089   lctShowerDataTightSummary_num_->setAxisTitle("Chamber", 1);
0090   alctShowerDataTightSummary_denom_->setAxisTitle("Chamber", 1);
0091   alctShowerDataTightSummary_num_->setAxisTitle("Chamber", 1);
0092   clctShowerDataTightSummary_denom_->setAxisTitle("Chamber", 1);
0093   clctShowerDataTightSummary_num_->setAxisTitle("Chamber", 1);
0094 
0095   lctShowerEmulTightSummary_denom_->setAxisTitle("Chamber", 1);
0096   lctShowerEmulTightSummary_num_->setAxisTitle("Chamber", 1);
0097   alctShowerEmulTightSummary_denom_->setAxisTitle("Chamber", 1);
0098   alctShowerEmulTightSummary_num_->setAxisTitle("Chamber", 1);
0099   clctShowerEmulTightSummary_denom_->setAxisTitle("Chamber", 1);
0100   clctShowerEmulTightSummary_num_->setAxisTitle("Chamber", 1);
0101 
0102   // plotting option
0103   lctShowerDataNomSummary_denom_->setOption("colz");
0104   lctShowerDataNomSummary_num_->setOption("colz");
0105   alctShowerDataNomSummary_denom_->setOption("colz");
0106   alctShowerDataNomSummary_num_->setOption("colz");
0107   clctShowerDataNomSummary_denom_->setOption("colz");
0108   clctShowerDataNomSummary_num_->setOption("colz");
0109 
0110   lctShowerEmulNomSummary_denom_->setOption("colz");
0111   lctShowerEmulNomSummary_num_->setOption("colz");
0112   alctShowerEmulNomSummary_denom_->setOption("colz");
0113   alctShowerEmulNomSummary_num_->setOption("colz");
0114   clctShowerEmulNomSummary_denom_->setOption("colz");
0115   clctShowerEmulNomSummary_num_->setOption("colz");
0116 
0117   lctShowerDataTightSummary_denom_->setOption("colz");
0118   lctShowerDataTightSummary_num_->setOption("colz");
0119   alctShowerDataTightSummary_denom_->setOption("colz");
0120   alctShowerDataTightSummary_num_->setOption("colz");
0121   clctShowerDataTightSummary_denom_->setOption("colz");
0122   clctShowerDataTightSummary_num_->setOption("colz");
0123 
0124   lctShowerEmulTightSummary_denom_->setOption("colz");
0125   lctShowerEmulTightSummary_num_->setOption("colz");
0126   alctShowerEmulTightSummary_denom_->setOption("colz");
0127   alctShowerEmulTightSummary_num_->setOption("colz");
0128   clctShowerEmulTightSummary_denom_->setOption("colz");
0129   clctShowerEmulTightSummary_num_->setOption("colz");
0130 
0131   const std::array<std::string, 9> suffix_label{{"4/2", "4/1", "3/2", "3/1", " 2/2", "2/1", "1/3", "1/2", "1/1"}};
0132 
0133   // y labels
0134   for (int ybin = 1; ybin <= 9; ++ybin) {
0135     lctShowerDataNomSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0136     lctShowerDataNomSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0137     alctShowerDataNomSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0138     alctShowerDataNomSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0139     clctShowerDataNomSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0140     clctShowerDataNomSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0141 
0142     lctShowerEmulNomSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0143     lctShowerEmulNomSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0144     alctShowerEmulNomSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0145     alctShowerEmulNomSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0146     clctShowerEmulNomSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0147     clctShowerEmulNomSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0148 
0149     lctShowerDataNomSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0150     lctShowerDataNomSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0151     alctShowerDataNomSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0152     alctShowerDataNomSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0153     clctShowerDataNomSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0154     clctShowerDataNomSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0155 
0156     lctShowerEmulNomSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0157     lctShowerEmulNomSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0158     alctShowerEmulNomSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0159     alctShowerEmulNomSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0160     clctShowerEmulNomSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0161     clctShowerEmulNomSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0162 
0163     lctShowerDataTightSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0164     lctShowerDataTightSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0165     alctShowerDataTightSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0166     alctShowerDataTightSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0167     clctShowerDataTightSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0168     clctShowerDataTightSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0169 
0170     lctShowerEmulTightSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0171     lctShowerEmulTightSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0172     alctShowerEmulTightSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0173     alctShowerEmulTightSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0174     clctShowerEmulTightSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0175     clctShowerEmulTightSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0176 
0177     lctShowerDataTightSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0178     lctShowerDataTightSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0179     alctShowerDataTightSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0180     alctShowerDataTightSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0181     clctShowerDataTightSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0182     clctShowerDataTightSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0183 
0184     lctShowerEmulTightSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0185     lctShowerEmulTightSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0186     alctShowerEmulTightSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0187     alctShowerEmulTightSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0188     clctShowerEmulTightSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0189     clctShowerEmulTightSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0190   }
0191 }
0192 
0193 void L1TdeCSCTPGShower::analyze(const edm::Event& e, const edm::EventSetup& c) {
0194   // handles
0195   edm::Handle<CSCShowerDigiCollection> dataALCTshs;
0196   edm::Handle<CSCShowerDigiCollection> emulALCTshs;
0197   edm::Handle<CSCShowerDigiCollection> dataCLCTshs;
0198   edm::Handle<CSCShowerDigiCollection> emulCLCTshs;
0199   edm::Handle<CSCShowerDigiCollection> dataLCTshs;
0200   edm::Handle<CSCShowerDigiCollection> emulLCTshs;
0201 
0202   e.getByToken(dataALCTShower_token_, dataALCTshs);
0203   e.getByToken(emulALCTShower_token_, emulALCTshs);
0204   e.getByToken(dataCLCTShower_token_, dataCLCTshs);
0205   e.getByToken(emulCLCTShower_token_, emulCLCTshs);
0206   e.getByToken(dataLCTShower_token_, dataLCTshs);
0207   e.getByToken(emulLCTShower_token_, emulLCTshs);
0208 
0209   const std::map<std::pair<int, int>, int> histIndexCSC = {{{1, 1}, 8},
0210                                                            {{1, 2}, 7},
0211                                                            {{1, 3}, 6},
0212                                                            {{2, 1}, 5},
0213                                                            {{2, 2}, 4},
0214                                                            {{3, 1}, 3},
0215                                                            {{3, 2}, 2},
0216                                                            {{4, 1}, 1},
0217                                                            {{4, 2}, 0}};
0218 
0219   const int min_endcap = CSCDetId::minEndcapId();
0220   const int max_endcap = CSCDetId::maxEndcapId();
0221   const int min_station = CSCDetId::minStationId();
0222   const int max_station = CSCDetId::maxStationId();
0223   const int min_sector = CSCTriggerNumbering::minTriggerSectorId();
0224   const int max_sector = CSCTriggerNumbering::maxTriggerSectorId();
0225   const int min_subsector = CSCTriggerNumbering::minTriggerSubSectorId();
0226   const int max_subsector = CSCTriggerNumbering::maxTriggerSubSectorId();
0227   const int min_chamber = CSCTriggerNumbering::minTriggerCscId();
0228   const int max_chamber = CSCTriggerNumbering::maxTriggerCscId();
0229 
0230   for (int endc = min_endcap; endc <= max_endcap; endc++) {
0231     // loop on all stations
0232     for (int stat = min_station; stat <= max_station; stat++) {
0233       int numsubs = ((stat == 1) ? max_subsector : 1);
0234       // loop on sectors and subsectors
0235       for (int sect = min_sector; sect <= max_sector; sect++) {
0236         for (int subs = min_subsector; subs <= numsubs; subs++) {
0237           // loop on all chambers
0238           for (int cham = min_chamber; cham <= max_chamber; cham++) {
0239             // extract the ring number
0240             int ring = CSCTriggerNumbering::ringFromTriggerLabels(stat, cham);
0241 
0242             // actual chamber number =/= trigger chamber number
0243             int chid = CSCTriggerNumbering::chamberFromTriggerLabels(sect, subs, stat, cham);
0244 
0245             // 0th layer means whole chamber.
0246             CSCDetId detid(endc, stat, ring, chid, 0);
0247 
0248             int chamber = detid.chamber();
0249 
0250             int sr = histIndexCSC.at({stat, ring});
0251             if (endc == 1)
0252               sr = 17 - sr;
0253             bool chamber20 = (sr == 1 or sr == 3 or sr == 5 or sr == 12 or sr == 14 or sr == 16);
0254 
0255             // ALCT analysis
0256             auto range_dataALCT = dataALCTshs->get(detid);
0257             auto range_emulALCT = emulALCTshs->get(detid);
0258 
0259             for (auto dalct = range_dataALCT.first; dalct != range_dataALCT.second; dalct++) {
0260               if (dalct->isValid() and dalct->isNominalInTime()) {
0261                 if (dalct->isTightInTime()) {
0262                   if (chamber20) {
0263                     alctShowerDataTightSummary_denom_->Fill(chamber * 2 - 1, sr, 0.5);
0264                     alctShowerDataTightSummary_denom_->Fill(chamber * 2, sr, 0.5);
0265                   } else
0266                     alctShowerDataTightSummary_denom_->Fill(chamber, sr);
0267                 }
0268                 if (chamber20) {
0269                   alctShowerDataNomSummary_denom_->Fill(chamber * 2 - 1, sr, 0.5);
0270                   alctShowerDataNomSummary_denom_->Fill(chamber * 2, sr, 0.5);
0271                 } else
0272                   alctShowerDataNomSummary_denom_->Fill(chamber, sr);
0273                 // check for least one matching ALCT
0274                 for (auto ealct = range_emulALCT.first; ealct != range_emulALCT.second; ealct++) {
0275                   if (ealct->isValid() and areSameShowers(*dalct, *ealct)) {
0276                     if (dalct->isTightInTime()) {
0277                       if (chamber20) {
0278                         alctShowerDataTightSummary_num_->Fill(chamber * 2 - 1, sr, 0.5);
0279                         alctShowerDataTightSummary_num_->Fill(chamber * 2, sr, 0.5);
0280                       } else
0281                         alctShowerDataTightSummary_num_->Fill(chamber, sr);
0282                     }
0283                     if (chamber20) {
0284                       alctShowerDataNomSummary_num_->Fill(chamber * 2 - 1, sr, 0.5);
0285                       alctShowerDataNomSummary_num_->Fill(chamber * 2, sr, 0.5);
0286                     } else
0287                       alctShowerDataNomSummary_num_->Fill(chamber, sr);
0288                   }
0289                 }
0290               }
0291             }  // End of for (auto dalct = range_dataALCT.first; dalct != range_dataALCT.second; dalct++)
0292 
0293             for (auto ealct = range_emulALCT.first; ealct != range_emulALCT.second; ealct++) {
0294               bool isMatched = false;
0295               if (ealct->isValid() and ealct->isNominalInTime()) {
0296                 if (ealct->isTightInTime()) {
0297                   if (chamber20) {
0298                     alctShowerEmulTightSummary_denom_->Fill(chamber * 2 - 1, sr, 0.5);
0299                     alctShowerEmulTightSummary_denom_->Fill(chamber * 2, sr, 0.5);
0300                   } else
0301                     alctShowerEmulTightSummary_denom_->Fill(chamber, sr);
0302                 }
0303                 if (chamber20) {
0304                   alctShowerEmulNomSummary_denom_->Fill(chamber * 2 - 1, sr, 0.5);
0305                   alctShowerEmulNomSummary_denom_->Fill(chamber * 2, sr, 0.5);
0306                 } else
0307                   alctShowerEmulNomSummary_denom_->Fill(chamber, sr);
0308                 // check for least one matching ALCT
0309                 for (auto dalct = range_dataALCT.first; dalct != range_dataALCT.second; dalct++) {
0310                   if (areSameShowers(*dalct, *ealct))
0311                     isMatched = true;
0312                 }
0313                 // only fill when it is not matched to an ALCT
0314                 // to understand if the emulator is producing too many ALCTs
0315                 if (!isMatched) {
0316                   if (ealct->isTightInTime()) {
0317                     if (chamber20) {
0318                       alctShowerEmulTightSummary_num_->Fill(chamber * 2 - 1, sr, 0.5);
0319                       alctShowerEmulTightSummary_num_->Fill(chamber * 2, sr, 0.5);
0320                     } else
0321                       alctShowerEmulTightSummary_num_->Fill(chamber, sr);
0322                   }
0323                   if (chamber20) {
0324                     alctShowerEmulNomSummary_num_->Fill(chamber * 2 - 1, sr, 0.5);
0325                     alctShowerEmulNomSummary_num_->Fill(chamber * 2, sr, 0.5);
0326                   } else
0327                     alctShowerEmulNomSummary_num_->Fill(chamber, sr);
0328                 }
0329               }
0330             }  // End of for (auto ealct = range_emulALCT.first; ealct != range_emulALCT.second; ealct++)
0331 
0332             // CLCT analysis
0333             auto range_dataCLCT = dataCLCTshs->get(detid);
0334             auto range_emulCLCT = emulCLCTshs->get(detid);
0335 
0336             for (auto dclct = range_dataCLCT.first; dclct != range_dataCLCT.second; dclct++) {
0337               if (dclct->isValid() and dclct->isNominalInTime()) {
0338                 if (dclct->isTightInTime()) {
0339                   if (chamber20) {
0340                     clctShowerDataTightSummary_denom_->Fill(chamber * 2 - 1, sr, 0.5);
0341                     clctShowerDataTightSummary_denom_->Fill(chamber * 2, sr, 0.5);
0342                   } else
0343                     clctShowerDataTightSummary_denom_->Fill(chamber, sr);
0344                 }
0345                 if (chamber20) {
0346                   clctShowerDataNomSummary_denom_->Fill(chamber * 2 - 1, sr, 0.5);
0347                   clctShowerDataNomSummary_denom_->Fill(chamber * 2, sr, 0.5);
0348                 } else
0349                   clctShowerDataNomSummary_denom_->Fill(chamber, sr);
0350                 // check for least one matching CLCT
0351                 for (auto eclct = range_emulCLCT.first; eclct != range_emulCLCT.second; eclct++) {
0352                   if (eclct->isValid() and areSameShowers(*dclct, *eclct)) {
0353                     if (dclct->isTightInTime()) {
0354                       if (chamber20) {
0355                         clctShowerDataTightSummary_num_->Fill(chamber * 2 - 1, sr, 0.5);
0356                         clctShowerDataTightSummary_num_->Fill(chamber * 2, sr, 0.5);
0357                       } else
0358                         clctShowerDataTightSummary_num_->Fill(chamber, sr);
0359                     }
0360                     if (chamber20) {
0361                       clctShowerDataNomSummary_num_->Fill(chamber * 2 - 1, sr, 0.5);
0362                       clctShowerDataNomSummary_num_->Fill(chamber * 2, sr, 0.5);
0363                     } else
0364                       clctShowerDataNomSummary_num_->Fill(chamber, sr);
0365                   }
0366                 }
0367               }
0368             }  // End of for (auto dclct = range_dataCLCT.first; dclct != range_dataCLCT.second; dclct++)
0369 
0370             for (auto eclct = range_emulCLCT.first; eclct != range_emulCLCT.second; eclct++) {
0371               bool isMatched = false;
0372               if (eclct->isValid() and eclct->isNominalInTime()) {
0373                 if (eclct->isTightInTime()) {
0374                   if (chamber20) {
0375                     clctShowerEmulTightSummary_denom_->Fill(chamber * 2 - 1, sr, 0.5);
0376                     clctShowerEmulTightSummary_denom_->Fill(chamber * 2, sr, 0.5);
0377                   } else
0378                     clctShowerEmulTightSummary_denom_->Fill(chamber, sr);
0379                 }
0380                 if (chamber20) {
0381                   clctShowerEmulNomSummary_denom_->Fill(chamber * 2 - 1, sr, 0.5);
0382                   clctShowerEmulNomSummary_denom_->Fill(chamber * 2, sr, 0.5);
0383                 } else
0384                   clctShowerEmulNomSummary_denom_->Fill(chamber, sr);
0385                 // check for least one matching CLCT
0386                 for (auto dclct = range_dataCLCT.first; dclct != range_dataCLCT.second; dclct++) {
0387                   if (areSameShowers(*dclct, *eclct))
0388                     isMatched = true;
0389                 }
0390                 // only fill when it is not matched to an CLCT
0391                 // to understand if the emulator is producing too many CLCTs
0392                 if (!isMatched) {
0393                   if (eclct->isTightInTime()) {
0394                     if (chamber20) {
0395                       clctShowerEmulTightSummary_num_->Fill(chamber * 2 - 1, sr, 0.5);
0396                       clctShowerEmulTightSummary_num_->Fill(chamber * 2, sr, 0.5);
0397                     } else
0398                       clctShowerEmulTightSummary_num_->Fill(chamber, sr);
0399                   }
0400                   if (chamber20) {
0401                     clctShowerEmulNomSummary_num_->Fill(chamber * 2 - 1, sr, 0.5);
0402                     clctShowerEmulNomSummary_num_->Fill(chamber * 2, sr, 0.5);
0403                   } else
0404                     clctShowerEmulNomSummary_num_->Fill(chamber, sr);
0405                 }
0406               }
0407             }  // End of for (auto eclct = range_emulCLCT.first; eclct != range_emulCLCT.second; eclct++)
0408 
0409             // LCT analysis
0410             auto range_dataLCT = dataLCTshs->get(detid);
0411             auto range_emulLCT = emulLCTshs->get(detid);
0412 
0413             for (auto dlct = range_dataLCT.first; dlct != range_dataLCT.second; dlct++) {
0414               if (dlct->isValid() and dlct->isNominalInTime()) {
0415                 if (dlct->isTightInTime()) {
0416                   if (chamber20) {
0417                     lctShowerDataTightSummary_denom_->Fill(chamber * 2 - 1, sr, 0.5);
0418                     lctShowerDataTightSummary_denom_->Fill(chamber * 2, sr, 0.5);
0419                   } else
0420                     lctShowerDataTightSummary_denom_->Fill(chamber, sr);
0421                 }
0422                 if (chamber20) {
0423                   lctShowerDataNomSummary_denom_->Fill(chamber * 2 - 1, sr, 0.5);
0424                   lctShowerDataNomSummary_denom_->Fill(chamber * 2, sr, 0.5);
0425                 } else
0426                   lctShowerDataNomSummary_denom_->Fill(chamber, sr);
0427                 // check for least one matching LCT
0428                 for (auto elct = range_emulLCT.first; elct != range_emulLCT.second; elct++) {
0429                   if (elct->isValid() and areSameShowers(*dlct, *elct)) {
0430                     if (dlct->isTightInTime()) {
0431                       if (chamber20) {
0432                         lctShowerDataTightSummary_num_->Fill(chamber * 2 - 1, sr, 0.5);
0433                         lctShowerDataTightSummary_num_->Fill(chamber * 2, sr, 0.5);
0434                       } else
0435                         lctShowerDataTightSummary_num_->Fill(chamber, sr);
0436                     }
0437                     if (chamber20) {
0438                       lctShowerDataNomSummary_num_->Fill(chamber * 2 - 1, sr, 0.5);
0439                       lctShowerDataNomSummary_num_->Fill(chamber * 2, sr, 0.5);
0440                     } else
0441                       lctShowerDataNomSummary_num_->Fill(chamber, sr);
0442                   }
0443                 }
0444               }
0445             }  // End of for (auto dlct = range_dataLCT.first; dlct != range_dataLCT.second; dlct++)
0446 
0447             for (auto elct = range_emulLCT.first; elct != range_emulLCT.second; elct++) {
0448               bool isMatched = false;
0449               if (elct->isValid() and elct->isNominalInTime()) {
0450                 if (elct->isTightInTime()) {
0451                   if (chamber20) {
0452                     lctShowerEmulTightSummary_denom_->Fill(chamber * 2 - 1, sr, 0.5);
0453                     lctShowerEmulTightSummary_denom_->Fill(chamber * 2, sr, 0.5);
0454                   } else
0455                     lctShowerEmulTightSummary_denom_->Fill(chamber, sr);
0456                 }
0457                 if (chamber20) {
0458                   lctShowerEmulNomSummary_denom_->Fill(chamber * 2 - 1, sr, 0.5);
0459                   lctShowerEmulNomSummary_denom_->Fill(chamber * 2, sr, 0.5);
0460                 } else
0461                   lctShowerEmulNomSummary_denom_->Fill(chamber, sr);
0462                 // check for least one matching LCT
0463                 for (auto dlct = range_dataLCT.first; dlct != range_dataLCT.second; dlct++) {
0464                   if (areSameShowers(*dlct, *elct))
0465                     isMatched = true;
0466                 }
0467                 // only fill when it is not matched to an LCT
0468                 // to understand if the emulator is producing too many LCTs
0469                 if (!isMatched) {
0470                   if (elct->isTightInTime()) {
0471                     if (chamber20) {
0472                       lctShowerEmulTightSummary_num_->Fill(chamber * 2 - 1, sr, 0.5);
0473                       lctShowerEmulTightSummary_num_->Fill(chamber * 2, sr, 0.5);
0474                     } else
0475                       lctShowerEmulTightSummary_num_->Fill(chamber, sr);
0476                   }
0477                   if (chamber20) {
0478                     lctShowerEmulNomSummary_num_->Fill(chamber * 2 - 1, sr, 0.5);
0479                     lctShowerEmulNomSummary_num_->Fill(chamber * 2, sr, 0.5);
0480                   } else
0481                     lctShowerEmulNomSummary_num_->Fill(chamber, sr);
0482                 }
0483               }
0484             }  // End of for (auto elct = range_emulLCT.first; elct != range_emulLCT.second; elct++) {
0485           }
0486         }
0487       }
0488     }
0489   }
0490 }
0491 
0492 bool L1TdeCSCTPGShower::areSameShowers(const CSCShowerDigi& lhs, const CSCShowerDigi& rhs) const {
0493   bool returnValue = false;
0494   if (lhs.isValid() == rhs.isValid() && lhs.getCSCID() == rhs.getCSCID() && lhs.bitsInTime() == rhs.bitsInTime() &&
0495       lhs.bitsOutOfTime() == rhs.bitsOutOfTime()) {
0496     returnValue = true;
0497   }
0498   return returnValue;
0499 }