CMS 3D CMS Logo

L1TdeCSCTPG.cc
Go to the documentation of this file.
1 #include <string>
2 
5 
7  : dataALCT_token_(consumes<CSCALCTDigiCollection>(ps.getParameter<edm::InputTag>("dataALCT"))),
8  emulALCT_token_(consumes<CSCALCTDigiCollection>(ps.getParameter<edm::InputTag>("emulALCT"))),
9  dataCLCT_token_(consumes<CSCCLCTDigiCollection>(ps.getParameter<edm::InputTag>("dataCLCT"))),
10  emulCLCT_token_(consumes<CSCCLCTDigiCollection>(ps.getParameter<edm::InputTag>("emulCLCT"))),
11  emulpreCLCT_token_(consumes<CSCCLCTPreTriggerDigiCollection>(ps.getParameter<edm::InputTag>("emulpreCLCT"))),
12  dataLCT_token_(consumes<CSCCorrelatedLCTDigiCollection>(ps.getParameter<edm::InputTag>("dataLCT"))),
13  emulLCT_token_(consumes<CSCCorrelatedLCTDigiCollection>(ps.getParameter<edm::InputTag>("emulLCT"))),
14  monitorDir_(ps.getParameter<std::string>("monitorDir")),
15 
16  chambers_(ps.getParameter<std::vector<std::string>>("chambers")),
17  dataEmul_(ps.getParameter<std::vector<std::string>>("dataEmul")),
18 
19  // variables
20  alctVars_(ps.getParameter<std::vector<std::string>>("alctVars")),
21  clctVars_(ps.getParameter<std::vector<std::string>>("clctVars")),
22  lctVars_(ps.getParameter<std::vector<std::string>>("lctVars")),
23 
24  // binning
25  alctNBin_(ps.getParameter<std::vector<unsigned>>("alctNBin")),
26  clctNBin_(ps.getParameter<std::vector<unsigned>>("clctNBin")),
27  lctNBin_(ps.getParameter<std::vector<unsigned>>("lctNBin")),
28  alctMinBin_(ps.getParameter<std::vector<double>>("alctMinBin")),
29  clctMinBin_(ps.getParameter<std::vector<double>>("clctMinBin")),
30  lctMinBin_(ps.getParameter<std::vector<double>>("lctMinBin")),
31  alctMaxBin_(ps.getParameter<std::vector<double>>("alctMaxBin")),
32  clctMaxBin_(ps.getParameter<std::vector<double>>("clctMaxBin")),
33  lctMaxBin_(ps.getParameter<std::vector<double>>("lctMaxBin")),
34  // options for test stands at B904
35  useB904ME11_(ps.getParameter<bool>("useB904ME11")),
36  useB904ME21_(ps.getParameter<bool>("useB904ME21")),
37  useB904ME234s2_(ps.getParameter<bool>("useB904ME234s2")),
38  isRun3_(ps.getParameter<bool>("isRun3")),
39  make1DPlots_(ps.getParameter<bool>("make1DPlots")),
40  preTriggerAnalysis_(ps.getParameter<bool>("preTriggerAnalysis")) {
42 }
43 
45 
48 
49  // remove the non-ME1/1 chambers from the list when useB904ME11 is set to true
50  if (useB904ME11_) {
51  chambers_.resize(1);
52  }
53  // similar for ME2/1
54  else if (useB904ME21_) {
55  auto temp = chambers_[3];
56  chambers_.resize(1);
57  chambers_[0] = temp;
58  }
59  // similar for ME4/2
60  else if (useB904ME234s2_) {
61  auto temp = chambers_.back();
62  chambers_.resize(1);
63  chambers_[0] = temp;
64  }
65  // collision data in Run-3
66  else if (isRun3_) {
67  clctVars_.resize(9);
68  lctVars_.resize(9);
69  }
70  // do not analyze Run-3 properties in Run-1 and Run-2 eras
71  else {
72  clctVars_.resize(4);
73  lctVars_.resize(5);
74  }
75 
76  // 1D plots for experts
78  // chamber type
79  for (unsigned iType = 0; iType < chambers_.size(); iType++) {
80  // data vs emulator
81  for (unsigned iData = 0; iData < dataEmul_.size(); iData++) {
82  // alct variable
83  for (unsigned iVar = 0; iVar < alctVars_.size(); iVar++) {
84  const std::string key("alct_" + alctVars_[iVar] + "_" + dataEmul_[iData]);
85  const std::string histName(key + "_" + chambers_[iType]);
86  const std::string histTitle(chambers_[iType] + " ALCT " + alctVars_[iVar] + " (" + dataEmul_[iData] + ") ");
87  chamberHistos[iType][key] =
88  iBooker.book1D(histName, histTitle, alctNBin_[iVar], alctMinBin_[iVar], alctMaxBin_[iVar]);
89  chamberHistos[iType][key]->getTH1()->SetMinimum(0);
90  }
91 
92  // clct variable
93  for (unsigned iVar = 0; iVar < clctVars_.size(); iVar++) {
94  const std::string key("clct_" + clctVars_[iVar] + "_" + dataEmul_[iData]);
95  const std::string histName(key + "_" + chambers_[iType]);
96  const std::string histTitle(chambers_[iType] + " CLCT " + clctVars_[iVar] + " (" + dataEmul_[iData] + ") ");
97  chamberHistos[iType][key] =
98  iBooker.book1D(histName, histTitle, clctNBin_[iVar], clctMinBin_[iVar], clctMaxBin_[iVar]);
99  chamberHistos[iType][key]->getTH1()->SetMinimum(0);
100  }
101 
102  // lct variable
103  for (unsigned iVar = 0; iVar < lctVars_.size(); iVar++) {
104  const std::string key("lct_" + lctVars_[iVar] + "_" + dataEmul_[iData]);
105  const std::string histName(key + "_" + chambers_[iType]);
106  const std::string histTitle(chambers_[iType] + " LCT " + lctVars_[iVar] + " (" + dataEmul_[iData] + ") ");
107  chamberHistos[iType][key] =
108  iBooker.book1D(histName, histTitle, lctNBin_[iVar], lctMinBin_[iVar], lctMaxBin_[iVar]);
109  chamberHistos[iType][key]->getTH1()->SetMinimum(0);
110  }
111  }
112  }
113  }
114 
115  // 2D summary plots
116 
117  // These plots are for showing the efficiency that the unpacked data are being correctly emulated (having a emulated data counterpart)
118  lctDataSummary_denom_ = iBooker.book2D("lct_csctp_data_summary_denom", "LCT Summary", 36, 1, 37, 18, 0, 18);
119  lctDataSummary_num_ = iBooker.book2D("lct_csctp_data_summary_num", "LCT Summary", 36, 1, 37, 18, 0, 18);
120  alctDataSummary_denom_ = iBooker.book2D("alct_csctp_data_summary_denom", "ALCT Summary", 36, 1, 37, 18, 0, 18);
121  alctDataSummary_num_ = iBooker.book2D("alct_csctp_data_summary_num", "ALCT Summary", 36, 1, 37, 18, 0, 18);
122  clctDataSummary_denom_ = iBooker.book2D("clct_csctp_data_summary_denom", "CLCT Summary", 36, 1, 37, 18, 0, 18);
123  clctDataSummary_num_ = iBooker.book2D("clct_csctp_data_summary_num", "CLCT Summary", 36, 1, 37, 18, 0, 18);
124 
125  // These plots are for showing the fraction of emulated data that does not have counterparts in the unpacked data
126  lctEmulSummary_denom_ = iBooker.book2D("lct_csctp_emul_summary_denom", "LCT Summary", 36, 1, 37, 18, 0, 18);
127  lctEmulSummary_num_ = iBooker.book2D("lct_csctp_emul_summary_num", "LCT Summary", 36, 1, 37, 18, 0, 18);
128  alctEmulSummary_denom_ = iBooker.book2D("alct_csctp_emul_summary_denom", "ALCT Summary", 36, 1, 37, 18, 0, 18);
129  alctEmulSummary_num_ = iBooker.book2D("alct_csctp_emul_summary_num", "ALCT Summary", 36, 1, 37, 18, 0, 18);
130  clctEmulSummary_denom_ = iBooker.book2D("clct_csctp_emul_summary_denom", "CLCT Summary", 36, 1, 37, 18, 0, 18);
131  clctEmulSummary_num_ = iBooker.book2D("clct_csctp_emul_summary_num", "CLCT Summary", 36, 1, 37, 18, 0, 18);
132 
133  // x labels
134  lctDataSummary_denom_->setAxisTitle("Chamber", 1);
135  lctDataSummary_num_->setAxisTitle("Chamber", 1);
136  alctDataSummary_denom_->setAxisTitle("Chamber", 1);
137  alctDataSummary_num_->setAxisTitle("Chamber", 1);
138  clctDataSummary_denom_->setAxisTitle("Chamber", 1);
139  clctDataSummary_num_->setAxisTitle("Chamber", 1);
140 
141  lctEmulSummary_denom_->setAxisTitle("Chamber", 1);
142  lctEmulSummary_num_->setAxisTitle("Chamber", 1);
143  alctEmulSummary_denom_->setAxisTitle("Chamber", 1);
144  alctEmulSummary_num_->setAxisTitle("Chamber", 1);
145  clctEmulSummary_denom_->setAxisTitle("Chamber", 1);
146  clctEmulSummary_num_->setAxisTitle("Chamber", 1);
147 
148  // plotting option
155 
162 
163  // summary plots
164  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"}};
165 
166  // y labels
167  for (int ybin = 1; ybin <= 9; ++ybin) {
168  lctDataSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
169  lctDataSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
170  alctDataSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
171  alctDataSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
172  clctDataSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
173  clctDataSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
174 
175  lctEmulSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
176  lctEmulSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
177  alctEmulSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
178  alctEmulSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
179  clctEmulSummary_denom_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
180  clctEmulSummary_num_->setBinLabel(ybin, "ME-" + suffix_label[ybin - 1], 2);
181 
182  lctDataSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
183  lctDataSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
184  alctDataSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
185  alctDataSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
186  clctDataSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
187  clctDataSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
188 
189  lctEmulSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
190  lctEmulSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
191  alctEmulSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
192  alctEmulSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
193  clctEmulSummary_denom_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
194  clctEmulSummary_num_->setBinLabel(19 - ybin, "ME+" + suffix_label[ybin - 1], 2);
195  }
196 }
197 
199  // handles
207 
208  e.getByToken(dataALCT_token_, dataALCTs);
209  e.getByToken(emulALCT_token_, emulALCTs);
210  e.getByToken(dataCLCT_token_, dataCLCTs);
211  e.getByToken(emulCLCT_token_, emulCLCTs);
212  e.getByToken(dataLCT_token_, dataLCTs);
213  e.getByToken(emulLCT_token_, emulLCTs);
214  // only do pre-trigger analysis when B904 setup is used
215  if (useB904_)
216  e.getByToken(emulpreCLCT_token_, emulpreCLCTs);
217 
218  // 1D plots for experts
220  for (auto it = dataALCTs->begin(); it != dataALCTs->end(); it++) {
221  auto range = dataALCTs->get((*it).first);
222  const CSCDetId& detid((*it).first);
223  int type = ((*it).first).iChamberType() - 2;
224  // ignore non-ME1/1 chambers when using B904 test-stand data
225  if (useB904ME11_ and !(detid.isME11()))
226  continue;
227  if (useB904ME21_ and !(detid.isME21()))
228  continue;
229  if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42()))
230  continue;
231  // to prevent crashes because you are booking histos for single b904 chamber
233  type = 0;
234  for (auto alct = range.first; alct != range.second; alct++) {
235  if (alct->isValid()) {
236  chamberHistos[type]["alct_quality_data"]->Fill(alct->getQuality());
237  chamberHistos[type]["alct_wiregroup_data"]->Fill(alct->getKeyWG());
238  chamberHistos[type]["alct_bx_data"]->Fill(alct->getBX());
239  }
240  }
241  }
242 
243  for (auto it = emulALCTs->begin(); it != emulALCTs->end(); it++) {
244  auto range = emulALCTs->get((*it).first);
245  const CSCDetId& detid((*it).first);
246  int type = ((*it).first).iChamberType() - 2;
247  // ignore non-ME1/1 chambers when using B904 test-stand data
248  if (useB904ME11_ and !(detid.isME11()))
249  continue;
250  if (useB904ME21_ and !(detid.isME21()))
251  continue;
252  if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42()))
253  continue;
254  // to prevent crashes because you are booking histos for single b904 chamber
256  type = 0;
257  for (auto alct = range.first; alct != range.second; alct++) {
258  if (alct->isValid()) {
259  chamberHistos[type]["alct_quality_emul"]->Fill(alct->getQuality());
260  chamberHistos[type]["alct_wiregroup_emul"]->Fill(alct->getKeyWG());
261  chamberHistos[type]["alct_bx_emul"]->Fill(alct->getBX());
262  }
263  }
264  }
265 
266  // temporary containers for B904 analysis
267  std::vector<CSCCLCTDigi> tempdata;
268  std::vector<CSCCLCTDigi> tempemul;
269 
270  for (auto it = dataCLCTs->begin(); it != dataCLCTs->end(); it++) {
271  auto range = dataCLCTs->get((*it).first);
272  const CSCDetId& detid((*it).first);
273  int type = ((*it).first).iChamberType() - 2;
274  // ignore non-ME1/1 chambers when using B904 test-stand data
275  if (useB904ME11_ and !(detid.isME11()))
276  continue;
277  if (useB904ME21_ and !(detid.isME21()))
278  continue;
279  if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42()))
280  continue;
281  // to prevent crashes because you are booking histos for single b904 chamber
283  type = 0;
284  for (auto clct = range.first; clct != range.second; clct++) {
285  if (clct->isValid()) {
286  if (preTriggerAnalysis_) {
287  tempdata.push_back(*clct);
288  }
289  chamberHistos[type]["clct_pattern_data"]->Fill(clct->getPattern());
290  chamberHistos[type]["clct_quality_data"]->Fill(clct->getQuality());
291  chamberHistos[type]["clct_halfstrip_data"]->Fill(clct->getKeyStrip());
292  chamberHistos[type]["clct_bend_data"]->Fill(clct->getBend());
293  if (isRun3_) {
294  chamberHistos[type]["clct_run3pattern_data"]->Fill(clct->getRun3Pattern());
295  chamberHistos[type]["clct_quartstrip_data"]->Fill(clct->getKeyStrip(4));
296  chamberHistos[type]["clct_eighthstrip_data"]->Fill(clct->getKeyStrip(8));
297  chamberHistos[type]["clct_slope_data"]->Fill(clct->getSlope());
298  chamberHistos[type]["clct_compcode_data"]->Fill(clct->getCompCode());
299  if (useB904_) {
300  chamberHistos[type]["clct_quartstripbit_data"]->Fill(clct->getQuartStripBit());
301  chamberHistos[type]["clct_eighthstripbit_data"]->Fill(clct->getEighthStripBit());
302  }
303  }
304  }
305  }
306  }
307 
308  for (auto it = emulCLCTs->begin(); it != emulCLCTs->end(); it++) {
309  auto range = emulCLCTs->get((*it).first);
310  const CSCDetId& detid((*it).first);
311  int type = ((*it).first).iChamberType() - 2;
312  // ignore non-ME1/1 chambers when using B904 test-stand data
313  if (useB904ME11_ and !(detid.isME11()))
314  continue;
315  if (useB904ME21_ and !(detid.isME21()))
316  continue;
317  if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42()))
318  continue;
319  // to prevent crashes because you are booking histos for single b904 chamber
321  type = 0;
322  for (auto clct = range.first; clct != range.second; clct++) {
323  if (clct->isValid()) {
324  if (preTriggerAnalysis_) {
325  tempemul.push_back(*clct);
326  }
327  chamberHistos[type]["clct_pattern_emul"]->Fill(clct->getPattern());
328  chamberHistos[type]["clct_quality_emul"]->Fill(clct->getQuality());
329  chamberHistos[type]["clct_halfstrip_emul"]->Fill(clct->getKeyStrip());
330  chamberHistos[type]["clct_bend_emul"]->Fill(clct->getBend());
331  if (isRun3_) {
332  chamberHistos[type]["clct_run3pattern_emul"]->Fill(clct->getRun3Pattern());
333  chamberHistos[type]["clct_quartstrip_emul"]->Fill(clct->getKeyStrip(4));
334  chamberHistos[type]["clct_eighthstrip_emul"]->Fill(clct->getKeyStrip(8));
335  chamberHistos[type]["clct_slope_emul"]->Fill(clct->getSlope());
336  chamberHistos[type]["clct_compcode_emul"]->Fill(clct->getCompCode());
337  if (useB904_) {
338  chamberHistos[type]["clct_quartstripbit_emul"]->Fill(clct->getQuartStripBit());
339  chamberHistos[type]["clct_eighthstripbit_emul"]->Fill(clct->getEighthStripBit());
340  }
341  }
342  }
343  }
344  }
345 
346  // Pre-trigger analysis
347  if (preTriggerAnalysis_) {
348  if (tempdata.size() != tempemul.size()) {
349  for (auto& clct : tempdata) {
350  edm::LogWarning("L1TdeCSCTPG") << "data" << clct;
351  }
352  for (auto& clct : tempemul) {
353  edm::LogWarning("L1TdeCSCTPG") << "emul" << clct;
354  }
355  for (auto it = emulpreCLCTs->begin(); it != emulpreCLCTs->end(); it++) {
356  auto range = emulpreCLCTs->get((*it).first);
357  for (auto clct = range.first; clct != range.second; clct++) {
358  edm::LogWarning("L1TdeCSCTPG") << "emul pre" << *clct;
359  }
360  }
361  }
362  }
363 
364  for (auto it = dataLCTs->begin(); it != dataLCTs->end(); it++) {
365  auto range = dataLCTs->get((*it).first);
366  const CSCDetId& detid((*it).first);
367  int type = ((*it).first).iChamberType() - 2;
368  // ignore non-ME1/1 chambers when using B904 test-stand data
369  if (useB904ME11_ and !(detid.isME11()))
370  continue;
371  if (useB904ME21_ and !(detid.isME21()))
372  continue;
373  if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42()))
374  continue;
375  // to prevent crashes because you are booking histos for single b904 chamber
377  type = 0;
378  for (auto lct = range.first; lct != range.second; lct++) {
379  if (lct->isValid()) {
380  chamberHistos[type]["lct_pattern_data"]->Fill(lct->getPattern());
381  chamberHistos[type]["lct_quality_data"]->Fill(lct->getQuality());
382  chamberHistos[type]["lct_wiregroup_data"]->Fill(lct->getKeyWG());
383  chamberHistos[type]["lct_halfstrip_data"]->Fill(lct->getStrip());
384  chamberHistos[type]["lct_bend_data"]->Fill(lct->getBend());
385  if (isRun3_) {
386  chamberHistos[type]["lct_run3pattern_data"]->Fill(lct->getRun3Pattern());
387  chamberHistos[type]["lct_slope_data"]->Fill(lct->getSlope());
388  chamberHistos[type]["lct_quartstrip_data"]->Fill(lct->getStrip(4));
389  chamberHistos[type]["lct_eighthstrip_data"]->Fill(lct->getStrip(8));
390  if (useB904_) {
391  chamberHistos[type]["lct_quartstripbit_data"]->Fill(lct->getQuartStripBit());
392  chamberHistos[type]["lct_eighthstripbit_data"]->Fill(lct->getEighthStripBit());
393  }
394  }
395  }
396  }
397  }
398 
399  for (auto it = emulLCTs->begin(); it != emulLCTs->end(); it++) {
400  auto range = emulLCTs->get((*it).first);
401  const CSCDetId& detid((*it).first);
402  int type = ((*it).first).iChamberType() - 2;
403  // ignore non-ME1/1 chambers when using B904 test-stand data
404  if (useB904ME11_ and !(detid.isME11()))
405  continue;
406  if (useB904ME21_ and !(detid.isME21()))
407  continue;
408  if (useB904ME234s2_ and !(detid.isME22() or detid.isME32() or detid.isME42()))
409  continue;
410  // to prevent crashes because you are booking histos for single b904 chamber
412  type = 0;
413  for (auto lct = range.first; lct != range.second; lct++) {
414  if (lct->isValid()) {
415  chamberHistos[type]["lct_pattern_emul"]->Fill(lct->getPattern());
416  chamberHistos[type]["lct_quality_emul"]->Fill(lct->getQuality());
417  chamberHistos[type]["lct_wiregroup_emul"]->Fill(lct->getKeyWG());
418  chamberHistos[type]["lct_halfstrip_emul"]->Fill(lct->getStrip());
419  chamberHistos[type]["lct_bend_emul"]->Fill(lct->getBend());
420  if (isRun3_) {
421  chamberHistos[type]["lct_run3pattern_emul"]->Fill(lct->getRun3Pattern());
422  chamberHistos[type]["lct_slope_emul"]->Fill(lct->getSlope());
423  chamberHistos[type]["lct_quartstrip_emul"]->Fill(lct->getStrip(4));
424  chamberHistos[type]["lct_eighthstrip_emul"]->Fill(lct->getStrip(8));
425  if (useB904_) {
426  chamberHistos[type]["lct_quartstripbit_emul"]->Fill(lct->getQuartStripBit());
427  chamberHistos[type]["lct_eighthstripbit_emul"]->Fill(lct->getEighthStripBit());
428  }
429  }
430  }
431  }
432  }
433  }
434 
435  // summary plots
436  const std::map<std::pair<int, int>, int> histIndexCSC = {{{1, 1}, 8},
437  {{1, 2}, 7},
438  {{1, 3}, 6},
439  {{2, 1}, 5},
440  {{2, 2}, 4},
441  {{3, 1}, 3},
442  {{3, 2}, 2},
443  {{4, 1}, 1},
444  {{4, 2}, 0}};
445 
446  const int min_endcap = CSCDetId::minEndcapId();
447  const int max_endcap = CSCDetId::maxEndcapId();
448  const int min_station = CSCDetId::minStationId();
449  const int max_station = CSCDetId::maxStationId();
450  const int min_sector = CSCTriggerNumbering::minTriggerSectorId();
451  const int max_sector = CSCTriggerNumbering::maxTriggerSectorId();
452  const int min_subsector = CSCTriggerNumbering::minTriggerSubSectorId();
453  const int max_subsector = CSCTriggerNumbering::maxTriggerSubSectorId();
454  const int min_chamber = CSCTriggerNumbering::minTriggerCscId();
455  const int max_chamber = CSCTriggerNumbering::maxTriggerCscId();
456 
457  for (int endc = min_endcap; endc <= max_endcap; endc++) {
458  // loop on all stations
459  for (int stat = min_station; stat <= max_station; stat++) {
460  int numsubs = ((stat == 1) ? max_subsector : 1);
461  // loop on sectors and subsectors
462  for (int sect = min_sector; sect <= max_sector; sect++) {
463  for (int subs = min_subsector; subs <= numsubs; subs++) {
464  // loop on all chambers
465  for (int cham = min_chamber; cham <= max_chamber; cham++) {
466  // extract the ring number
468 
469  // actual chamber number =/= trigger chamber number
471 
472  // 0th layer means whole chamber.
473  CSCDetId detid(endc, stat, ring, chid, 0);
474 
475  int chamber = detid.chamber();
476 
477  int sr = histIndexCSC.at({stat, ring});
478  if (endc == 1)
479  sr = 17 - sr;
480 
481  // ALCT analysis
482  auto range_dataALCT = dataALCTs->get(detid);
483  auto range_emulALCT = emulALCTs->get(detid);
484 
485  for (auto dalct = range_dataALCT.first; dalct != range_dataALCT.second; dalct++) {
486  if (dalct->isValid()) {
488  // check for least one matching ALCT
489  for (auto ealct = range_emulALCT.first; ealct != range_emulALCT.second; ealct++) {
490  if (ealct->isValid() and *dalct == *ealct) {
492  }
493  }
494  }
495  }
496 
497  for (auto ealct = range_emulALCT.first; ealct != range_emulALCT.second; ealct++) {
498  bool isMatched = false;
499  if (ealct->isValid()) {
501  // check for least one matching ALCT
502  for (auto dalct = range_dataALCT.first; dalct != range_dataALCT.second; dalct++) {
503  if (*dalct == *ealct)
504  isMatched = true;
505  }
506  // only fill when it is not matched to an ALCT
507  // to understand if the emulator is producing too many ALCTs
508  if (!isMatched) {
510  }
511  }
512  }
513 
514  // CLCT analysis
515  auto range_dataCLCT = dataCLCTs->get(detid);
516  auto range_emulCLCT = emulCLCTs->get(detid);
517 
518  for (auto dclct = range_dataCLCT.first; dclct != range_dataCLCT.second; dclct++) {
519  if (dclct->isValid()) {
521  // check for least one matching CLCT
522  for (auto eclct = range_emulCLCT.first; eclct != range_emulCLCT.second; eclct++) {
523  if (eclct->isValid() and areSameCLCTs(*dclct, *eclct)) {
525  }
526  }
527  }
528  }
529 
530  for (auto eclct = range_emulCLCT.first; eclct != range_emulCLCT.second; eclct++) {
531  bool isMatched = false;
532  if (eclct->isValid()) {
534  // check for least one matching CLCT
535  for (auto dclct = range_dataCLCT.first; dclct != range_dataCLCT.second; dclct++) {
536  if (areSameCLCTs(*dclct, *eclct))
537  isMatched = true;
538  }
539  // only fill when it is not matched to an CLCT
540  // to understand if the emulator is producing too many CLCTs
541  if (!isMatched) {
543  }
544  }
545  }
546 
547  // LCT analysis
548  auto range_dataLCT = dataLCTs->get(detid);
549  auto range_emulLCT = emulLCTs->get(detid);
550 
551  for (auto dlct = range_dataLCT.first; dlct != range_dataLCT.second; dlct++) {
552  if (dlct->isValid()) {
554  // check for least one matching LCT
555  for (auto elct = range_emulLCT.first; elct != range_emulLCT.second; elct++) {
556  if (elct->isValid() and areSameLCTs(*dlct, *elct)) {
558  }
559  }
560  }
561  }
562 
563  for (auto elct = range_emulLCT.first; elct != range_emulLCT.second; elct++) {
564  bool isMatched = false;
565  if (elct->isValid()) {
567  // check for least one matching LCT
568  for (auto dlct = range_dataLCT.first; dlct != range_dataLCT.second; dlct++) {
569  if (areSameLCTs(*dlct, *elct))
570  isMatched = true;
571  }
572  // only fill when it is not matched to an LCT
573  // to understand if the emulator is producing too many LCTs
574  if (!isMatched) {
576  }
577  }
578  }
579  }
580  }
581  }
582  }
583  }
584 }
585 
586 bool L1TdeCSCTPG::areSameCLCTs(const CSCCLCTDigi& lhs, const CSCCLCTDigi& rhs) const {
587  // because the comparator code is degenerate (several comparator codes can produce the
588  // same slope and position), we leave it out of the comparison
589  // do not include the BX
590  bool returnValue = false;
591  if (lhs.isValid() == rhs.isValid() && lhs.getQuality() == rhs.getQuality() && lhs.getPattern() == rhs.getPattern() &&
592  lhs.getRun3Pattern() == rhs.getRun3Pattern() && lhs.getKeyStrip() == rhs.getKeyStrip() &&
593  lhs.getStripType() == rhs.getStripType() && lhs.getBend() == rhs.getBend() &&
594  lhs.getQuartStripBit() == rhs.getQuartStripBit() && lhs.getEighthStripBit() == rhs.getEighthStripBit()) {
595  returnValue = true;
596  }
597  return returnValue;
598 }
599 
601  // do not include the BX
602  bool returnValue = false;
603  if (lhs.isValid() == rhs.isValid() && lhs.getQuality() == rhs.getQuality() && lhs.getPattern() == rhs.getPattern() &&
604  lhs.getRun3Pattern() == rhs.getRun3Pattern() && lhs.getStrip() == rhs.getStrip() &&
605  lhs.getStripType() == rhs.getStripType() && lhs.getBend() == rhs.getBend() &&
606  lhs.getQuartStripBit() == rhs.getQuartStripBit() && lhs.getEighthStripBit() == rhs.getEighthStripBit() &&
607  lhs.getKeyWG() == rhs.getKeyWG()) {
608  returnValue = true;
609  }
610  return returnValue;
611 }
uint16_t getStripType() const
return strip type (obsolete since mid-2008)
MonitorElement * lctEmulSummary_denom_
Definition: L1TdeCSCTPG.h:90
std::vector< double > lctMaxBin_
Definition: L1TdeCSCTPG.h:55
edm::EDGetTokenT< CSCALCTDigiCollection > dataALCT_token_
Definition: L1TdeCSCTPG.h:30
MonitorElement * lctEmulSummary_num_
Definition: L1TdeCSCTPG.h:91
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > dataLCT_token_
Definition: L1TdeCSCTPG.h:35
bool useB904ME234s2_
Definition: L1TdeCSCTPG.h:65
std::vector< std::string > alctVars_
Definition: L1TdeCSCTPG.h:43
MonitorElement * clctEmulSummary_num_
Definition: L1TdeCSCTPG.h:95
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
static int minEndcapId()
Definition: CSCDetId.h:234
std::vector< unsigned > alctNBin_
Definition: L1TdeCSCTPG.h:47
bool isME22() const
Definition: CSCDetId.cc:68
uint16_t getPattern() const
return the Run-2 pattern ID
virtual void setOption(const char *option)
uint16_t getQuality() const
return quality of a pattern (number of layers hit!)
Definition: CSCCLCTDigi.h:56
static int maxTriggerSectorId()
uint16_t getKeyStrip(const uint16_t n=2) const
Definition: CSCCLCTDigi.cc:107
bool getEighthStripBit() const
get single eighth strip bit
Definition: CSCCLCTDigi.h:114
bool useB904ME11_
Definition: L1TdeCSCTPG.h:63
std::vector< double > alctMinBin_
Definition: L1TdeCSCTPG.h:50
static int maxStationId()
Definition: CSCDetId.h:237
bool isME32() const
Definition: CSCDetId.cc:70
MonitorElement * alctDataSummary_num_
Definition: L1TdeCSCTPG.h:86
bool isRun3_
Definition: L1TdeCSCTPG.h:67
static int minTriggerSectorId()
static int ringFromTriggerLabels(int station, int triggerCSCID)
edm::EDGetTokenT< CSCCorrelatedLCTDigiCollection > emulLCT_token_
Definition: L1TdeCSCTPG.h:36
void Fill(long long x)
bool useB904_
Definition: L1TdeCSCTPG.h:62
bool getQuartStripBit() const
get single quart strip bit
Definition: CSCCLCTDigi.h:108
MonitorElement * lctDataSummary_denom_
Definition: L1TdeCSCTPG.h:83
bool preTriggerAnalysis_
Definition: L1TdeCSCTPG.h:76
static int minStationId()
Definition: CSCDetId.h:236
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
~L1TdeCSCTPG() override
Definition: L1TdeCSCTPG.cc:44
uint16_t getBend() const
Definition: CSCCLCTDigi.h:93
static int maxEndcapId()
Definition: CSCDetId.h:235
std::map< uint32_t, std::map< std::string, MonitorElement * > > chamberHistos
Definition: L1TdeCSCTPG.h:80
bool isME21() const
Definition: CSCDetId.cc:67
bool isValid() const
return valid pattern bit
bool useB904ME21_
Definition: L1TdeCSCTPG.h:64
Range get(const IndexType &index) const
return the digis for a given DetUnit
MonitorElement * lctDataSummary_num_
Definition: L1TdeCSCTPG.h:84
std::vector< unsigned > lctNBin_
Definition: L1TdeCSCTPG.h:49
key
prepare the HTCondor submission files and eventually submit them
int chamber() const
Definition: CSCDetId.h:62
bool isMatched(TrackingRecHit const &hit)
uint16_t getStripType() const
return striptype
Definition: CSCCLCTDigi.h:85
MonitorElement * alctEmulSummary_num_
Definition: L1TdeCSCTPG.h:93
bool getEighthStripBit() const
get single eighth strip bit
std::vector< double > alctMaxBin_
Definition: L1TdeCSCTPG.h:53
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:50
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
DigiRangeIterator begin() const
MonitorElement * alctDataSummary_denom_
Definition: L1TdeCSCTPG.h:85
bool areSameLCTs(const CSCCorrelatedLCTDigi &lhs, const CSCCorrelatedLCTDigi &rhs) const
Definition: L1TdeCSCTPG.cc:600
edm::EDGetTokenT< CSCALCTDigiCollection > emulALCT_token_
Definition: L1TdeCSCTPG.h:31
std::vector< std::string > chambers_
Definition: L1TdeCSCTPG.h:40
uint16_t getQuality() const
return the Quality
L1TdeCSCTPG(const edm::ParameterSet &ps)
Definition: L1TdeCSCTPG.cc:6
uint16_t getStrip(uint16_t n=2) const
return the key halfstrip from 0,159
MonitorElement * clctEmulSummary_denom_
Definition: L1TdeCSCTPG.h:94
std::vector< unsigned > clctNBin_
Definition: L1TdeCSCTPG.h:48
bool isME11() const
Definition: CSCDetId.cc:64
static int minTriggerSubSectorId()
bool getQuartStripBit() const
get single quart strip bit
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:221
std::vector< double > clctMaxBin_
Definition: L1TdeCSCTPG.h:54
uint16_t getPattern() const
return pattern
Definition: CSCCLCTDigi.h:62
uint16_t getKeyWG() const
return the key wire group. counts from 0.
std::vector< std::string > dataEmul_
Definition: L1TdeCSCTPG.h:41
std::string monitorDir_
Definition: L1TdeCSCTPG.h:37
edm::EDGetTokenT< CSCCLCTDigiCollection > dataCLCT_token_
Definition: L1TdeCSCTPG.h:32
HLT enums.
std::vector< std::string > lctVars_
Definition: L1TdeCSCTPG.h:45
std::vector< double > clctMinBin_
Definition: L1TdeCSCTPG.h:51
std::vector< double > lctMinBin_
Definition: L1TdeCSCTPG.h:52
uint16_t getRun3Pattern() const
return pattern
Definition: CSCCLCTDigi.h:68
bool isME42() const
Definition: CSCDetId.cc:72
edm::EDGetTokenT< CSCCLCTPreTriggerDigiCollection > emulpreCLCT_token_
Definition: L1TdeCSCTPG.h:34
bool areSameCLCTs(const CSCCLCTDigi &lhs, const CSCCLCTDigi &rhs) const
Definition: L1TdeCSCTPG.cc:586
bool make1DPlots_
Definition: L1TdeCSCTPG.h:73
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
uint16_t getRun3Pattern() const
return the Run-3 pattern ID
void bookHistograms(DQMStore::IBooker &, const edm::Run &, const edm::EventSetup &) override
Definition: L1TdeCSCTPG.cc:46
std::vector< std::string > clctVars_
Definition: L1TdeCSCTPG.h:44
MonitorElement * clctDataSummary_denom_
Definition: L1TdeCSCTPG.h:87
MonitorElement * alctEmulSummary_denom_
Definition: L1TdeCSCTPG.h:92
static int chamberFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station, int TriggerCSCID)
static int maxTriggerSubSectorId()
MonitorElement * clctDataSummary_num_
Definition: L1TdeCSCTPG.h:88
DigiRangeIterator end() const
Definition: Run.h:45
edm::EDGetTokenT< CSCCLCTDigiCollection > emulCLCT_token_
Definition: L1TdeCSCTPG.h:33
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: L1TdeCSCTPG.cc:198
A container for a generic type of digis indexed by some index, implemented with a map<IndexType...