File indexing completed on 2024-04-06 12:07:49
0001 #include <string>
0002
0003 #include "DQM/L1TMonitor/interface/L1TdeCSCTPG.h"
0004 #include "DataFormats/MuonDetId/interface/CSCTriggerNumbering.h"
0005
0006 L1TdeCSCTPG::L1TdeCSCTPG(const edm::ParameterSet& ps)
0007 : dataALCT_token_(consumes<CSCALCTDigiCollection>(ps.getParameter<edm::InputTag>("dataALCT"))),
0008 emulALCT_token_(consumes<CSCALCTDigiCollection>(ps.getParameter<edm::InputTag>("emulALCT"))),
0009 dataCLCT_token_(consumes<CSCCLCTDigiCollection>(ps.getParameter<edm::InputTag>("dataCLCT"))),
0010 emulCLCT_token_(consumes<CSCCLCTDigiCollection>(ps.getParameter<edm::InputTag>("emulCLCT"))),
0011 emulpreCLCT_token_(consumes<CSCCLCTPreTriggerDigiCollection>(ps.getParameter<edm::InputTag>("emulpreCLCT"))),
0012 dataLCT_token_(consumes<CSCCorrelatedLCTDigiCollection>(ps.getParameter<edm::InputTag>("dataLCT"))),
0013 emulLCT_token_(consumes<CSCCorrelatedLCTDigiCollection>(ps.getParameter<edm::InputTag>("emulLCT"))),
0014 monitorDir_(ps.getParameter<std::string>("monitorDir")),
0015
0016 chambers_(ps.getParameter<std::vector<std::string>>("chambers")),
0017 dataEmul_(ps.getParameter<std::vector<std::string>>("dataEmul")),
0018
0019
0020 alctVars_(ps.getParameter<std::vector<std::string>>("alctVars")),
0021 clctVars_(ps.getParameter<std::vector<std::string>>("clctVars")),
0022 lctVars_(ps.getParameter<std::vector<std::string>>("lctVars")),
0023
0024
0025 alctNBin_(ps.getParameter<std::vector<unsigned>>("alctNBin")),
0026 clctNBin_(ps.getParameter<std::vector<unsigned>>("clctNBin")),
0027 lctNBin_(ps.getParameter<std::vector<unsigned>>("lctNBin")),
0028 alctMinBin_(ps.getParameter<std::vector<double>>("alctMinBin")),
0029 clctMinBin_(ps.getParameter<std::vector<double>>("clctMinBin")),
0030 lctMinBin_(ps.getParameter<std::vector<double>>("lctMinBin")),
0031 alctMaxBin_(ps.getParameter<std::vector<double>>("alctMaxBin")),
0032 clctMaxBin_(ps.getParameter<std::vector<double>>("clctMaxBin")),
0033 lctMaxBin_(ps.getParameter<std::vector<double>>("lctMaxBin")),
0034
0035 useB904ME11_(ps.getParameter<bool>("useB904ME11")),
0036 useB904ME21_(ps.getParameter<bool>("useB904ME21")),
0037 useB904ME234s2_(ps.getParameter<bool>("useB904ME234s2")),
0038 isRun3_(ps.getParameter<bool>("isRun3")),
0039 make1DPlots_(ps.getParameter<bool>("make1DPlots")),
0040 preTriggerAnalysis_(ps.getParameter<bool>("preTriggerAnalysis")) {
0041 useB904_ = useB904ME11_ or useB904ME21_ or useB904ME234s2_;
0042 }
0043
0044 L1TdeCSCTPG::~L1TdeCSCTPG() {}
0045
0046 void L1TdeCSCTPG::bookHistograms(DQMStore::IBooker& iBooker, const edm::Run&, const edm::EventSetup&) {
0047 iBooker.setCurrentFolder(monitorDir_);
0048
0049
0050 if (useB904ME11_) {
0051 chambers_.resize(1);
0052 }
0053
0054 else if (useB904ME21_) {
0055 auto temp = chambers_[3];
0056 chambers_.resize(1);
0057 chambers_[0] = temp;
0058 }
0059
0060 else if (useB904ME234s2_) {
0061 auto temp = chambers_.back();
0062 chambers_.resize(1);
0063 chambers_[0] = temp;
0064 }
0065
0066 else if (isRun3_) {
0067 clctVars_.resize(9);
0068 lctVars_.resize(9);
0069 }
0070
0071 else {
0072 clctVars_.resize(4);
0073 lctVars_.resize(5);
0074 }
0075
0076
0077 if (useB904ME11_ or useB904ME21_ or useB904ME234s2_ or make1DPlots_) {
0078
0079 for (unsigned iType = 0; iType < chambers_.size(); iType++) {
0080
0081 for (unsigned iData = 0; iData < dataEmul_.size(); iData++) {
0082
0083 for (unsigned iVar = 0; iVar < alctVars_.size(); iVar++) {
0084 const std::string key("alct_" + alctVars_[iVar] + "_" + dataEmul_[iData]);
0085 const std::string histName(key + "_" + chambers_[iType]);
0086 const std::string histTitle(chambers_[iType] + " ALCT " + alctVars_[iVar] + " (" + dataEmul_[iData] + ") ");
0087 chamberHistos[iType][key] =
0088 iBooker.book1D(histName, histTitle, alctNBin_[iVar], alctMinBin_[iVar], alctMaxBin_[iVar]);
0089 chamberHistos[iType][key]->getTH1()->SetMinimum(0);
0090 }
0091
0092
0093 for (unsigned iVar = 0; iVar < clctVars_.size(); iVar++) {
0094 const std::string key("clct_" + clctVars_[iVar] + "_" + dataEmul_[iData]);
0095 const std::string histName(key + "_" + chambers_[iType]);
0096 const std::string histTitle(chambers_[iType] + " CLCT " + clctVars_[iVar] + " (" + dataEmul_[iData] + ") ");
0097 chamberHistos[iType][key] =
0098 iBooker.book1D(histName, histTitle, clctNBin_[iVar], clctMinBin_[iVar], clctMaxBin_[iVar]);
0099 chamberHistos[iType][key]->getTH1()->SetMinimum(0);
0100 }
0101
0102
0103 for (unsigned iVar = 0; iVar < lctVars_.size(); iVar++) {
0104 const std::string key("lct_" + lctVars_[iVar] + "_" + dataEmul_[iData]);
0105 const std::string histName(key + "_" + chambers_[iType]);
0106 const std::string histTitle(chambers_[iType] + " LCT " + lctVars_[iVar] + " (" + dataEmul_[iData] + ") ");
0107 chamberHistos[iType][key] =
0108 iBooker.book1D(histName, histTitle, lctNBin_[iVar], lctMinBin_[iVar], lctMaxBin_[iVar]);
0109 chamberHistos[iType][key]->getTH1()->SetMinimum(0);
0110 }
0111 }
0112 }
0113 }
0114
0115
0116
0117
0118 lctDataSummary_denom_ = iBooker.book2D("lct_csctp_data_summary_denom", "LCT Summary", 36, 1, 37, 18, 0, 18);
0119 lctDataSummary_num_ = iBooker.book2D("lct_csctp_data_summary_num", "LCT Summary", 36, 1, 37, 18, 0, 18);
0120 alctDataSummary_denom_ = iBooker.book2D("alct_csctp_data_summary_denom", "ALCT Summary", 36, 1, 37, 18, 0, 18);
0121 alctDataSummary_num_ = iBooker.book2D("alct_csctp_data_summary_num", "ALCT Summary", 36, 1, 37, 18, 0, 18);
0122 clctDataSummary_denom_ = iBooker.book2D("clct_csctp_data_summary_denom", "CLCT Summary", 36, 1, 37, 18, 0, 18);
0123 clctDataSummary_num_ = iBooker.book2D("clct_csctp_data_summary_num", "CLCT Summary", 36, 1, 37, 18, 0, 18);
0124
0125
0126 lctEmulSummary_denom_ = iBooker.book2D("lct_csctp_emul_summary_denom", "LCT Summary", 36, 1, 37, 18, 0, 18);
0127 lctEmulSummary_num_ = iBooker.book2D("lct_csctp_emul_summary_num", "LCT Summary", 36, 1, 37, 18, 0, 18);
0128 alctEmulSummary_denom_ = iBooker.book2D("alct_csctp_emul_summary_denom", "ALCT Summary", 36, 1, 37, 18, 0, 18);
0129 alctEmulSummary_num_ = iBooker.book2D("alct_csctp_emul_summary_num", "ALCT Summary", 36, 1, 37, 18, 0, 18);
0130 clctEmulSummary_denom_ = iBooker.book2D("clct_csctp_emul_summary_denom", "CLCT Summary", 36, 1, 37, 18, 0, 18);
0131 clctEmulSummary_num_ = iBooker.book2D("clct_csctp_emul_summary_num", "CLCT Summary", 36, 1, 37, 18, 0, 18);
0132
0133
0134 lctDataSummary_denom_->setAxisTitle("Chamber", 1);
0135 lctDataSummary_num_->setAxisTitle("Chamber", 1);
0136 alctDataSummary_denom_->setAxisTitle("Chamber", 1);
0137 alctDataSummary_num_->setAxisTitle("Chamber", 1);
0138 clctDataSummary_denom_->setAxisTitle("Chamber", 1);
0139 clctDataSummary_num_->setAxisTitle("Chamber", 1);
0140
0141 lctEmulSummary_denom_->setAxisTitle("Chamber", 1);
0142 lctEmulSummary_num_->setAxisTitle("Chamber", 1);
0143 alctEmulSummary_denom_->setAxisTitle("Chamber", 1);
0144 alctEmulSummary_num_->setAxisTitle("Chamber", 1);
0145 clctEmulSummary_denom_->setAxisTitle("Chamber", 1);
0146 clctEmulSummary_num_->setAxisTitle("Chamber", 1);
0147
0148
0149 lctDataSummary_denom_->setOption("colz");
0150 lctDataSummary_num_->setOption("colz");
0151 alctDataSummary_denom_->setOption("colz");
0152 alctDataSummary_num_->setOption("colz");
0153 clctDataSummary_denom_->setOption("colz");
0154 clctDataSummary_num_->setOption("colz");
0155
0156 lctEmulSummary_denom_->setOption("colz");
0157 lctEmulSummary_num_->setOption("colz");
0158 alctEmulSummary_denom_->setOption("colz");
0159 alctEmulSummary_num_->setOption("colz");
0160 clctEmulSummary_denom_->setOption("colz");
0161 clctEmulSummary_num_->setOption("colz");
0162
0163
0164 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"}};
0165
0166
0167 for (int ybin = 1; ybin <= 9; ++ybin) {
0168 lctDataSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0169 lctDataSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0170 alctDataSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0171 alctDataSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0172 clctDataSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0173 clctDataSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0174
0175 lctEmulSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0176 lctEmulSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0177 alctEmulSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0178 alctEmulSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0179 clctEmulSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0180 clctEmulSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
0181
0182 lctDataSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0183 lctDataSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0184 alctDataSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0185 alctDataSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0186 clctDataSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0187 clctDataSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0188
0189 lctEmulSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0190 lctEmulSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0191 alctEmulSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0192 alctEmulSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0193 clctEmulSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0194 clctEmulSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
0195 }
0196 }
0197
0198 void L1TdeCSCTPG::analyze(const edm::Event& e, const edm::EventSetup& c) {
0199
0200 edm::Handle<CSCALCTDigiCollection> dataALCTs;
0201 edm::Handle<CSCALCTDigiCollection> emulALCTs;
0202 edm::Handle<CSCCLCTDigiCollection> dataCLCTs;
0203 edm::Handle<CSCCLCTDigiCollection> emulCLCTs;
0204 edm::Handle<CSCCLCTPreTriggerDigiCollection> emulpreCLCTs;
0205 edm::Handle<CSCCorrelatedLCTDigiCollection> dataLCTs;
0206 edm::Handle<CSCCorrelatedLCTDigiCollection> emulLCTs;
0207
0208 e.getByToken(dataALCT_token_, dataALCTs);
0209 e.getByToken(emulALCT_token_, emulALCTs);
0210 e.getByToken(dataCLCT_token_, dataCLCTs);
0211 e.getByToken(emulCLCT_token_, emulCLCTs);
0212 e.getByToken(dataLCT_token_, dataLCTs);
0213 e.getByToken(emulLCT_token_, emulLCTs);
0214
0215 if (useB904_)
0216 e.getByToken(emulpreCLCT_token_, emulpreCLCTs);
0217
0218
0219 if (useB904ME11_ or useB904ME21_ or useB904ME234s2_ or make1DPlots_) {
0220 for (auto it = dataALCTs->begin(); it != dataALCTs->end(); it++) {
0221 auto range = dataALCTs->get((*it).first);
0222 const CSCDetId& detid((*it).first);
0223 int type = ((*it).first).iChamberType() - 2;
0224
0225 if (useB904ME11_ and !(detid.isME11()))
0226 continue;
0227 if (useB904ME21_ and !(detid.isME21()))
0228 continue;
0229 if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42()))
0230 continue;
0231
0232 if (useB904ME234s2_ or useB904ME21_)
0233 type = 0;
0234 for (auto alct = range.first; alct != range.second; alct++) {
0235 if (alct->isValid()) {
0236 chamberHistos[type]["alct_quality_data"]->Fill(alct->getQuality());
0237 chamberHistos[type]["alct_wiregroup_data"]->Fill(alct->getKeyWG());
0238 chamberHistos[type]["alct_bx_data"]->Fill(alct->getBX());
0239 }
0240 }
0241 }
0242
0243 for (auto it = emulALCTs->begin(); it != emulALCTs->end(); it++) {
0244 auto range = emulALCTs->get((*it).first);
0245 const CSCDetId& detid((*it).first);
0246 int type = ((*it).first).iChamberType() - 2;
0247
0248 if (useB904ME11_ and !(detid.isME11()))
0249 continue;
0250 if (useB904ME21_ and !(detid.isME21()))
0251 continue;
0252 if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42()))
0253 continue;
0254
0255 if (useB904ME234s2_ or useB904ME21_)
0256 type = 0;
0257 for (auto alct = range.first; alct != range.second; alct++) {
0258 if (alct->isValid()) {
0259 chamberHistos[type]["alct_quality_emul"]->Fill(alct->getQuality());
0260 chamberHistos[type]["alct_wiregroup_emul"]->Fill(alct->getKeyWG());
0261 chamberHistos[type]["alct_bx_emul"]->Fill(alct->getBX());
0262 }
0263 }
0264 }
0265
0266
0267 std::vector<CSCCLCTDigi> tempdata;
0268 std::vector<CSCCLCTDigi> tempemul;
0269
0270 for (auto it = dataCLCTs->begin(); it != dataCLCTs->end(); it++) {
0271 auto range = dataCLCTs->get((*it).first);
0272 const CSCDetId& detid((*it).first);
0273 int type = ((*it).first).iChamberType() - 2;
0274
0275 if (useB904ME11_ and !(detid.isME11()))
0276 continue;
0277 if (useB904ME21_ and !(detid.isME21()))
0278 continue;
0279 if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42()))
0280 continue;
0281
0282 if (useB904ME234s2_ or useB904ME21_)
0283 type = 0;
0284 for (auto clct = range.first; clct != range.second; clct++) {
0285 if (clct->isValid()) {
0286 if (preTriggerAnalysis_) {
0287 tempdata.push_back(*clct);
0288 }
0289 chamberHistos[type]["clct_pattern_data"]->Fill(clct->getPattern());
0290 chamberHistos[type]["clct_quality_data"]->Fill(clct->getQuality());
0291 chamberHistos[type]["clct_halfstrip_data"]->Fill(clct->getKeyStrip());
0292 chamberHistos[type]["clct_bend_data"]->Fill(clct->getBend());
0293 if (isRun3_) {
0294 chamberHistos[type]["clct_run3pattern_data"]->Fill(clct->getRun3Pattern());
0295 chamberHistos[type]["clct_quartstrip_data"]->Fill(clct->getKeyStrip(4));
0296 chamberHistos[type]["clct_eighthstrip_data"]->Fill(clct->getKeyStrip(8));
0297 chamberHistos[type]["clct_slope_data"]->Fill(clct->getSlope());
0298 chamberHistos[type]["clct_compcode_data"]->Fill(clct->getCompCode());
0299 if (useB904_) {
0300 chamberHistos[type]["clct_quartstripbit_data"]->Fill(clct->getQuartStripBit());
0301 chamberHistos[type]["clct_eighthstripbit_data"]->Fill(clct->getEighthStripBit());
0302 }
0303 }
0304 }
0305 }
0306 }
0307
0308 for (auto it = emulCLCTs->begin(); it != emulCLCTs->end(); it++) {
0309 auto range = emulCLCTs->get((*it).first);
0310 const CSCDetId& detid((*it).first);
0311 int type = ((*it).first).iChamberType() - 2;
0312
0313 if (useB904ME11_ and !(detid.isME11()))
0314 continue;
0315 if (useB904ME21_ and !(detid.isME21()))
0316 continue;
0317 if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42()))
0318 continue;
0319
0320 if (useB904ME234s2_ or useB904ME21_)
0321 type = 0;
0322 for (auto clct = range.first; clct != range.second; clct++) {
0323 if (clct->isValid()) {
0324 if (preTriggerAnalysis_) {
0325 tempemul.push_back(*clct);
0326 }
0327 chamberHistos[type]["clct_pattern_emul"]->Fill(clct->getPattern());
0328 chamberHistos[type]["clct_quality_emul"]->Fill(clct->getQuality());
0329 chamberHistos[type]["clct_halfstrip_emul"]->Fill(clct->getKeyStrip());
0330 chamberHistos[type]["clct_bend_emul"]->Fill(clct->getBend());
0331 if (isRun3_) {
0332 chamberHistos[type]["clct_run3pattern_emul"]->Fill(clct->getRun3Pattern());
0333 chamberHistos[type]["clct_quartstrip_emul"]->Fill(clct->getKeyStrip(4));
0334 chamberHistos[type]["clct_eighthstrip_emul"]->Fill(clct->getKeyStrip(8));
0335 chamberHistos[type]["clct_slope_emul"]->Fill(clct->getSlope());
0336 chamberHistos[type]["clct_compcode_emul"]->Fill(clct->getCompCode());
0337 if (useB904_) {
0338 chamberHistos[type]["clct_quartstripbit_emul"]->Fill(clct->getQuartStripBit());
0339 chamberHistos[type]["clct_eighthstripbit_emul"]->Fill(clct->getEighthStripBit());
0340 }
0341 }
0342 }
0343 }
0344 }
0345
0346
0347 if (preTriggerAnalysis_) {
0348 if (tempdata.size() != tempemul.size()) {
0349 for (auto& clct : tempdata) {
0350 edm::LogWarning("L1TdeCSCTPG") << "data" << clct;
0351 }
0352 for (auto& clct : tempemul) {
0353 edm::LogWarning("L1TdeCSCTPG") << "emul" << clct;
0354 }
0355 for (auto it = emulpreCLCTs->begin(); it != emulpreCLCTs->end(); it++) {
0356 auto range = emulpreCLCTs->get((*it).first);
0357 for (auto clct = range.first; clct != range.second; clct++) {
0358 edm::LogWarning("L1TdeCSCTPG") << "emul pre" << *clct;
0359 }
0360 }
0361 }
0362 }
0363
0364 for (auto it = dataLCTs->begin(); it != dataLCTs->end(); it++) {
0365 auto range = dataLCTs->get((*it).first);
0366 const CSCDetId& detid((*it).first);
0367 int type = ((*it).first).iChamberType() - 2;
0368
0369 if (useB904ME11_ and !(detid.isME11()))
0370 continue;
0371 if (useB904ME21_ and !(detid.isME21()))
0372 continue;
0373 if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42()))
0374 continue;
0375
0376 if (useB904ME234s2_ or useB904ME21_)
0377 type = 0;
0378 for (auto lct = range.first; lct != range.second; lct++) {
0379 if (lct->isValid()) {
0380 chamberHistos[type]["lct_pattern_data"]->Fill(lct->getPattern());
0381 chamberHistos[type]["lct_quality_data"]->Fill(lct->getQuality());
0382 chamberHistos[type]["lct_wiregroup_data"]->Fill(lct->getKeyWG());
0383 chamberHistos[type]["lct_halfstrip_data"]->Fill(lct->getStrip());
0384 chamberHistos[type]["lct_bend_data"]->Fill(lct->getBend());
0385 if (isRun3_) {
0386 chamberHistos[type]["lct_run3pattern_data"]->Fill(lct->getRun3Pattern());
0387 chamberHistos[type]["lct_slope_data"]->Fill(lct->getSlope());
0388 chamberHistos[type]["lct_quartstrip_data"]->Fill(lct->getStrip(4));
0389 chamberHistos[type]["lct_eighthstrip_data"]->Fill(lct->getStrip(8));
0390 if (useB904_) {
0391 chamberHistos[type]["lct_quartstripbit_data"]->Fill(lct->getQuartStripBit());
0392 chamberHistos[type]["lct_eighthstripbit_data"]->Fill(lct->getEighthStripBit());
0393 }
0394 }
0395 }
0396 }
0397 }
0398
0399 for (auto it = emulLCTs->begin(); it != emulLCTs->end(); it++) {
0400 auto range = emulLCTs->get((*it).first);
0401 const CSCDetId& detid((*it).first);
0402 int type = ((*it).first).iChamberType() - 2;
0403
0404 if (useB904ME11_ and !(detid.isME11()))
0405 continue;
0406 if (useB904ME21_ and !(detid.isME21()))
0407 continue;
0408 if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42()))
0409 continue;
0410
0411 if (useB904ME234s2_ or useB904ME21_)
0412 type = 0;
0413 for (auto lct = range.first; lct != range.second; lct++) {
0414 if (lct->isValid()) {
0415 chamberHistos[type]["lct_pattern_emul"]->Fill(lct->getPattern());
0416 chamberHistos[type]["lct_quality_emul"]->Fill(lct->getQuality());
0417 chamberHistos[type]["lct_wiregroup_emul"]->Fill(lct->getKeyWG());
0418 chamberHistos[type]["lct_halfstrip_emul"]->Fill(lct->getStrip());
0419 chamberHistos[type]["lct_bend_emul"]->Fill(lct->getBend());
0420 if (isRun3_) {
0421 chamberHistos[type]["lct_run3pattern_emul"]->Fill(lct->getRun3Pattern());
0422 chamberHistos[type]["lct_slope_emul"]->Fill(lct->getSlope());
0423 chamberHistos[type]["lct_quartstrip_emul"]->Fill(lct->getStrip(4));
0424 chamberHistos[type]["lct_eighthstrip_emul"]->Fill(lct->getStrip(8));
0425 if (useB904_) {
0426 chamberHistos[type]["lct_quartstripbit_emul"]->Fill(lct->getQuartStripBit());
0427 chamberHistos[type]["lct_eighthstripbit_emul"]->Fill(lct->getEighthStripBit());
0428 }
0429 }
0430 }
0431 }
0432 }
0433 }
0434
0435
0436 const std::map<std::pair<int, int>, int> histIndexCSC = {{{1, 1}, 8},
0437 {{1, 2}, 7},
0438 {{1, 3}, 6},
0439 {{2, 1}, 5},
0440 {{2, 2}, 4},
0441 {{3, 1}, 3},
0442 {{3, 2}, 2},
0443 {{4, 1}, 1},
0444 {{4, 2}, 0}};
0445
0446 const int min_endcap = CSCDetId::minEndcapId();
0447 const int max_endcap = CSCDetId::maxEndcapId();
0448 const int min_station = CSCDetId::minStationId();
0449 const int max_station = CSCDetId::maxStationId();
0450 const int min_sector = CSCTriggerNumbering::minTriggerSectorId();
0451 const int max_sector = CSCTriggerNumbering::maxTriggerSectorId();
0452 const int min_subsector = CSCTriggerNumbering::minTriggerSubSectorId();
0453 const int max_subsector = CSCTriggerNumbering::maxTriggerSubSectorId();
0454 const int min_chamber = CSCTriggerNumbering::minTriggerCscId();
0455 const int max_chamber = CSCTriggerNumbering::maxTriggerCscId();
0456
0457 for (int endc = min_endcap; endc <= max_endcap; endc++) {
0458
0459 for (int stat = min_station; stat <= max_station; stat++) {
0460 int numsubs = ((stat == 1) ? max_subsector : 1);
0461
0462 for (int sect = min_sector; sect <= max_sector; sect++) {
0463 for (int subs = min_subsector; subs <= numsubs; subs++) {
0464
0465 for (int cham = min_chamber; cham <= max_chamber; cham++) {
0466
0467 int ring = CSCTriggerNumbering::ringFromTriggerLabels(stat, cham);
0468
0469
0470 int chid = CSCTriggerNumbering::chamberFromTriggerLabels(sect, subs, stat, cham);
0471
0472
0473 CSCDetId detid(endc, stat, ring, chid, 0);
0474
0475 int chamber = detid.chamber();
0476
0477 int sr = histIndexCSC.at({stat, ring});
0478 if (endc == 1)
0479 sr = 17 - sr;
0480
0481
0482 auto range_dataALCT = dataALCTs->get(detid);
0483 auto range_emulALCT = emulALCTs->get(detid);
0484
0485 for (auto dalct = range_dataALCT.first; dalct != range_dataALCT.second; dalct++) {
0486 if (dalct->isValid()) {
0487 alctDataSummary_denom_->Fill(chamber, sr);
0488
0489 for (auto ealct = range_emulALCT.first; ealct != range_emulALCT.second; ealct++) {
0490 if (ealct->isValid() and *dalct == *ealct) {
0491 alctDataSummary_num_->Fill(chamber, sr);
0492 }
0493 }
0494 }
0495 }
0496
0497 for (auto ealct = range_emulALCT.first; ealct != range_emulALCT.second; ealct++) {
0498 bool isMatched = false;
0499 if (ealct->isValid()) {
0500 alctEmulSummary_denom_->Fill(chamber, sr);
0501
0502 for (auto dalct = range_dataALCT.first; dalct != range_dataALCT.second; dalct++) {
0503 if (*dalct == *ealct)
0504 isMatched = true;
0505 }
0506
0507
0508 if (!isMatched) {
0509 alctEmulSummary_num_->Fill(chamber, sr);
0510 }
0511 }
0512 }
0513
0514
0515 auto range_dataCLCT = dataCLCTs->get(detid);
0516 auto range_emulCLCT = emulCLCTs->get(detid);
0517
0518 for (auto dclct = range_dataCLCT.first; dclct != range_dataCLCT.second; dclct++) {
0519 if (dclct->isValid()) {
0520 clctDataSummary_denom_->Fill(chamber, sr);
0521
0522 for (auto eclct = range_emulCLCT.first; eclct != range_emulCLCT.second; eclct++) {
0523 if (eclct->isValid() and areSameCLCTs(*dclct, *eclct)) {
0524 clctDataSummary_num_->Fill(chamber, sr);
0525 }
0526 }
0527 }
0528 }
0529
0530 for (auto eclct = range_emulCLCT.first; eclct != range_emulCLCT.second; eclct++) {
0531 bool isMatched = false;
0532 if (eclct->isValid()) {
0533 clctEmulSummary_denom_->Fill(chamber, sr);
0534
0535 for (auto dclct = range_dataCLCT.first; dclct != range_dataCLCT.second; dclct++) {
0536 if (areSameCLCTs(*dclct, *eclct))
0537 isMatched = true;
0538 }
0539
0540
0541 if (!isMatched) {
0542 clctEmulSummary_num_->Fill(chamber, sr);
0543 }
0544 }
0545 }
0546
0547
0548 auto range_dataLCT = dataLCTs->get(detid);
0549 auto range_emulLCT = emulLCTs->get(detid);
0550
0551 for (auto dlct = range_dataLCT.first; dlct != range_dataLCT.second; dlct++) {
0552 if (dlct->isValid()) {
0553 lctDataSummary_denom_->Fill(chamber, sr);
0554
0555 for (auto elct = range_emulLCT.first; elct != range_emulLCT.second; elct++) {
0556 if (elct->isValid() and areSameLCTs(*dlct, *elct)) {
0557 lctDataSummary_num_->Fill(chamber, sr);
0558 }
0559 }
0560 }
0561 }
0562
0563 for (auto elct = range_emulLCT.first; elct != range_emulLCT.second; elct++) {
0564 bool isMatched = false;
0565 if (elct->isValid()) {
0566 lctEmulSummary_denom_->Fill(chamber, sr);
0567
0568 for (auto dlct = range_dataLCT.first; dlct != range_dataLCT.second; dlct++) {
0569 if (areSameLCTs(*dlct, *elct))
0570 isMatched = true;
0571 }
0572
0573
0574 if (!isMatched) {
0575 lctEmulSummary_num_->Fill(chamber, sr);
0576 }
0577 }
0578 }
0579 }
0580 }
0581 }
0582 }
0583 }
0584 }
0585
0586 bool L1TdeCSCTPG::areSameCLCTs(const CSCCLCTDigi& lhs, const CSCCLCTDigi& rhs) const {
0587
0588
0589
0590 bool returnValue = false;
0591 if (lhs.isValid() == rhs.isValid() && lhs.getQuality() == rhs.getQuality() && lhs.getPattern() == rhs.getPattern() &&
0592 lhs.getRun3Pattern() == rhs.getRun3Pattern() && lhs.getKeyStrip() == rhs.getKeyStrip() &&
0593 lhs.getStripType() == rhs.getStripType() && lhs.getBend() == rhs.getBend() &&
0594 lhs.getQuartStripBit() == rhs.getQuartStripBit() && lhs.getEighthStripBit() == rhs.getEighthStripBit()) {
0595 returnValue = true;
0596 }
0597 return returnValue;
0598 }
0599
0600 bool L1TdeCSCTPG::areSameLCTs(const CSCCorrelatedLCTDigi& lhs, const CSCCorrelatedLCTDigi& rhs) const {
0601
0602 bool returnValue = false;
0603 if (lhs.isValid() == rhs.isValid() && lhs.getQuality() == rhs.getQuality() && lhs.getPattern() == rhs.getPattern() &&
0604 lhs.getRun3Pattern() == rhs.getRun3Pattern() && lhs.getStrip() == rhs.getStrip() &&
0605 lhs.getStripType() == rhs.getStripType() && lhs.getBend() == rhs.getBend() &&
0606 lhs.getQuartStripBit() == rhs.getQuartStripBit() && lhs.getEighthStripBit() == rhs.getEighthStripBit() &&
0607 lhs.getKeyWG() == rhs.getKeyWG()) {
0608 returnValue = true;
0609 }
0610 return returnValue;
0611 }