CMS 3D CMS Logo

CSCMotherboard.cc
Go to the documentation of this file.
2 #include <iostream>
3 #include <memory>
4 
5 // Default values of configuration parameters.
6 const unsigned int CSCMotherboard::def_mpc_block_me1a = 1;
7 const unsigned int CSCMotherboard::def_alct_trig_enable = 0;
8 const unsigned int CSCMotherboard::def_clct_trig_enable = 0;
9 const unsigned int CSCMotherboard::def_match_trig_enable = 1;
10 const unsigned int CSCMotherboard::def_match_trig_window_size = 7;
11 const unsigned int CSCMotherboard::def_tmb_l1a_window_size = 7;
12 
14  unsigned station,
15  unsigned sector,
16  unsigned subsector,
17  unsigned chamber,
18  const edm::ParameterSet& conf)
19  : CSCBaseboard(endcap, station, sector, subsector, chamber, conf) {
20  // Normal constructor. -JM
21  // Pass ALCT, CLCT, and common parameters on to ALCT and CLCT processors.
22  static std::atomic<bool> config_dumped{false};
23 
24  mpc_block_me1a = tmbParams_.getParameter<unsigned int>("mpcBlockMe1a");
25  alct_trig_enable = tmbParams_.getParameter<unsigned int>("alctTrigEnable");
26  clct_trig_enable = tmbParams_.getParameter<unsigned int>("clctTrigEnable");
27  match_trig_enable = tmbParams_.getParameter<unsigned int>("matchTrigEnable");
28  match_trig_window_size = tmbParams_.getParameter<unsigned int>("matchTrigWindowSize");
29  tmb_l1a_window_size = // Common to CLCT and TMB
30  tmbParams_.getParameter<unsigned int>("tmbL1aWindowSize");
31 
32  // configuration handle for number of early time bins
33  early_tbins = tmbParams_.getParameter<int>("tmbEarlyTbins");
34 
35  // whether to not reuse ALCTs that were used by previous matching CLCTs
36  drop_used_alcts = tmbParams_.getParameter<bool>("tmbDropUsedAlcts");
37  drop_used_clcts = tmbParams_.getParameter<bool>("tmbDropUsedClcts");
38 
39  clct_to_alct = tmbParams_.getParameter<bool>("clctToAlct");
40 
41  // special tmb bits
42  useHighMultiplicityBits_ = tmbParams_.getParameter<bool>("useHighMultiplicityBits");
44 
45  // whether to readout only the earliest two LCTs in readout window
46  readout_earliest_2 = tmbParams_.getParameter<bool>("tmbReadoutEarliest2");
47 
48  infoV = tmbParams_.getParameter<int>("verbosity");
49 
50  alctProc = std::make_unique<CSCAnodeLCTProcessor>(endcap, station, sector, subsector, chamber, conf);
51  clctProc = std::make_unique<CSCCathodeLCTProcessor>(endcap, station, sector, subsector, chamber, conf);
52 
53  // Check and print configuration parameters.
55  if (infoV > 0 && !config_dumped) {
57  config_dumped = true;
58  }
59 
60  // quality control of stubs
61  qualityControl_ = std::make_unique<LCTQualityControl>(endcap, station, sector, subsector, chamber, conf);
62 }
63 
65  // Constructor used only for testing. -JM
66  static std::atomic<bool> config_dumped{false};
67 
68  early_tbins = 4;
69 
70  alctProc = std::make_unique<CSCAnodeLCTProcessor>();
71  clctProc = std::make_unique<CSCCathodeLCTProcessor>();
78 
79  infoV = 2;
80 
81  // Check and print configuration parameters.
83  if (infoV > 0 && !config_dumped) {
85  config_dumped = true;
86  }
87 }
88 
90  // clear the processors
91  if (alctProc)
92  alctProc->clear();
93  if (clctProc)
94  clctProc->clear();
95 
96  // clear the ALCT and CLCT containers
97  alctV.clear();
98  clctV.clear();
99 
100  // clear the LCT containers
101  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++) {
102  firstLCT[bx].clear();
103  secondLCT[bx].clear();
104  }
105 }
106 
107 // Set configuration parameters obtained via EventSetup mechanism.
109  static std::atomic<bool> config_dumped{false};
110 
111  // Config. parameters for the TMB itself.
118 
119  // Config. paramteres for ALCT and CLCT processors.
120  alctProc->setConfigParameters(conf);
121  clctProc->setConfigParameters(conf);
122 
123  // Check and print configuration parameters.
125  if (!config_dumped) {
127  config_dumped = true;
128  }
129 }
130 
132  // clear the ALCT/CLCT/LCT containers. Clear the processors
133  clear();
134 
135  // Check for existing processors
136  if (!(alctProc && clctProc)) {
137  edm::LogError("CSCMotherboard|SetupError") << "+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
138  return;
139  }
140 
141  // set geometry
142  alctProc->setCSCGeometry(cscGeometry_);
143  clctProc->setCSCGeometry(cscGeometry_);
144 
145  alctV = alctProc->run(wiredc); // run anodeLCT
146  clctV = clctProc->run(compdc); // run cathodeLCT
147 
148  // if there are no ALCTs and no CLCTs, it does not make sense to run this TMB
149  if (alctV.empty() and clctV.empty())
150  return;
151 
152  // encode high multiplicity bits
153  unsigned alctBits = alctProc->getHighMultiplictyBits();
154  encodeHighMultiplicityBits(alctBits);
155 
156  // CLCT-centric matching
157  if (clct_to_alct) {
158  int used_alct_mask[20];
159  for (int a = 0; a < 20; ++a)
160  used_alct_mask[a] = 0;
161 
162  int bx_alct_matched = 0; // bx of last matched ALCT
163  for (int bx_clct = 0; bx_clct < CSCConstants::MAX_CLCT_TBINS; bx_clct++) {
164  // There should be at least one valid ALCT or CLCT for a
165  // correlated LCT to be formed. Decision on whether to reject
166  // non-complete LCTs (and if yes of which type) is made further
167  // upstream.
168  if (clctProc->getBestCLCT(bx_clct).isValid()) {
169  // Look for ALCTs within the match-time window. The window is
170  // centered at the CLCT bx; therefore, we make an assumption
171  // that anode and cathode hits are perfectly synchronized. This
172  // is always true for MC, but only an approximation when the
173  // data is analyzed (which works fairly good as long as wide
174  // windows are used). To get rid of this assumption, one would
175  // need to access "full BX" words, which are not readily
176  // available.
177  bool is_matched = false;
178  const int bx_alct_start = bx_clct - match_trig_window_size / 2 + CSCConstants::ALCT_CLCT_OFFSET;
179  const int bx_alct_stop = bx_clct + match_trig_window_size / 2 + CSCConstants::ALCT_CLCT_OFFSET;
180 
181  for (int bx_alct = bx_alct_start; bx_alct <= bx_alct_stop; bx_alct++) {
182  if (bx_alct < 0 || bx_alct >= CSCConstants::MAX_ALCT_TBINS)
183  continue;
184  // default: do not reuse ALCTs that were used with previous CLCTs
185  if (drop_used_alcts && used_alct_mask[bx_alct])
186  continue;
187  if (alctProc->getBestALCT(bx_alct).isValid()) {
188  if (infoV > 1)
189  LogTrace("CSCMotherboard") << "Successful CLCT-ALCT match: bx_clct = " << bx_clct << "; match window: ["
190  << bx_alct_start << "; " << bx_alct_stop << "]; bx_alct = " << bx_alct;
191  correlateLCTs(alctProc->getBestALCT(bx_alct),
192  alctProc->getSecondALCT(bx_alct),
193  clctProc->getBestCLCT(bx_clct),
194  clctProc->getSecondCLCT(bx_clct),
196  used_alct_mask[bx_alct] += 1;
197  is_matched = true;
198  bx_alct_matched = bx_alct;
199  break;
200  }
201  }
202  // No ALCT within the match time interval found: report CLCT-only LCT
203  // (use dummy ALCTs).
204  if (!is_matched and clct_trig_enable) {
205  if (infoV > 1)
206  LogTrace("CSCMotherboard") << "Unsuccessful CLCT-ALCT match (CLCT only): bx_clct = " << bx_clct
207  << " first ALCT " << clctProc->getBestCLCT(bx_clct) << "; match window: ["
208  << bx_alct_start << "; " << bx_alct_stop << "]";
209  correlateLCTs(alctProc->getBestALCT(bx_clct),
210  alctProc->getSecondALCT(bx_clct),
211  clctProc->getBestCLCT(bx_clct),
212  clctProc->getSecondCLCT(bx_clct),
214  }
215  }
216  // No valid CLCTs; attempt to make ALCT-only LCT. Use only ALCTs
217  // which have zeroth chance to be matched at later cathode times.
218  // (I am not entirely sure this perfectly matches the firmware logic.)
219  // Use dummy CLCTs.
220  else {
221  int bx_alct = bx_clct - match_trig_window_size / 2;
222  if (bx_alct >= 0 && bx_alct > bx_alct_matched) {
223  if (alctProc->getBestALCT(bx_alct).isValid() and alct_trig_enable) {
224  if (infoV > 1)
225  LogTrace("CSCMotherboard") << "Unsuccessful CLCT-ALCT match (ALCT only): bx_alct = " << bx_alct;
226  correlateLCTs(alctProc->getBestALCT(bx_alct),
227  alctProc->getSecondALCT(bx_alct),
228  clctProc->getBestCLCT(bx_clct),
229  clctProc->getSecondCLCT(bx_clct),
231  }
232  }
233  }
234  }
235  }
236  // ALCT-centric matching
237  else {
238  int used_clct_mask[20];
239  for (int a = 0; a < 20; ++a)
240  used_clct_mask[a] = 0;
241 
242  int bx_clct_matched = 0; // bx of last matched CLCT
243  for (int bx_alct = 0; bx_alct < CSCConstants::MAX_ALCT_TBINS; bx_alct++) {
244  // There should be at least one valid CLCT or ALCT for a
245  // correlated LCT to be formed. Decision on whether to reject
246  // non-complete LCTs (and if yes of which type) is made further
247  // upstream.
248  if (alctProc->getBestALCT(bx_alct).isValid()) {
249  // Look for CLCTs within the match-time window. The window is
250  // centered at the ALCT bx; therefore, we make an assumption
251  // that anode and cathode hits are perfectly synchronized. This
252  // is always true for MC, but only an approximation when the
253  // data is analyzed (which works fairly good as long as wide
254  // windows are used). To get rid of this assumption, one would
255  // need to access "full BX" words, which are not readily
256  // available.
257  bool is_matched = false;
258  const int bx_clct_start = bx_alct - match_trig_window_size / 2 - CSCConstants::ALCT_CLCT_OFFSET;
259  const int bx_clct_stop = bx_alct + match_trig_window_size / 2 - CSCConstants::ALCT_CLCT_OFFSET;
260 
261  for (int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
262  if (bx_clct < 0 || bx_clct >= CSCConstants::MAX_CLCT_TBINS)
263  continue;
264  // default: do not reuse CLCTs that were used with previous ALCTs
265  if (drop_used_clcts && used_clct_mask[bx_clct])
266  continue;
267  if (clctProc->getBestCLCT(bx_clct).isValid()) {
268  if (infoV > 1)
269  LogTrace("CSCMotherboard") << "Successful ALCT-CLCT match: bx_alct = " << bx_alct << "; match window: ["
270  << bx_clct_start << "; " << bx_clct_stop << "]; bx_clct = " << bx_clct;
271  correlateLCTs(alctProc->getBestALCT(bx_alct),
272  alctProc->getSecondALCT(bx_alct),
273  clctProc->getBestCLCT(bx_clct),
274  clctProc->getSecondCLCT(bx_clct),
276  used_clct_mask[bx_clct] += 1;
277  is_matched = true;
278  bx_clct_matched = bx_clct;
279  break;
280  }
281  }
282  // No CLCT within the match time interval found: report ALCT-only LCT
283  // (use dummy CLCTs).
284  if (!is_matched) {
285  if (infoV > 1)
286  LogTrace("CSCMotherboard") << "Unsuccessful ALCT-CLCT match (ALCT only): bx_alct = " << bx_alct
287  << " first ALCT " << alctProc->getBestALCT(bx_alct) << "; match window: ["
288  << bx_clct_start << "; " << bx_clct_stop << "]";
289  if (alct_trig_enable)
290  correlateLCTs(alctProc->getBestALCT(bx_alct),
291  alctProc->getSecondALCT(bx_alct),
292  clctProc->getBestCLCT(bx_alct),
293  clctProc->getSecondCLCT(bx_alct),
295  }
296  }
297  // No valid ALCTs; attempt to make CLCT-only LCT. Use only CLCTs
298  // which have zeroth chance to be matched at later cathode times.
299  // (I am not entirely sure this perfectly matches the firmware logic.)
300  // Use dummy ALCTs.
301  else {
302  int bx_clct = bx_alct - match_trig_window_size / 2;
303  if (bx_clct >= 0 && bx_clct > bx_clct_matched) {
304  if (clctProc->getBestCLCT(bx_clct).isValid() and clct_trig_enable) {
305  if (infoV > 1)
306  LogTrace("CSCMotherboard") << "Unsuccessful ALCT-CLCT match (CLCT only): bx_clct = " << bx_clct;
307  correlateLCTs(alctProc->getBestALCT(bx_alct),
308  alctProc->getSecondALCT(bx_alct),
309  clctProc->getBestCLCT(bx_clct),
310  clctProc->getSecondCLCT(bx_clct),
312  }
313  }
314  }
315  }
316  }
317 
318  // Debug first and second LCTs
319  if (infoV > 0) {
320  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++) {
321  if (firstLCT[bx].isValid())
322  LogDebug("CSCMotherboard") << firstLCT[bx];
323  if (secondLCT[bx].isValid())
324  LogDebug("CSCMotherboard") << secondLCT[bx];
325  }
326  }
327 }
328 
329 // Returns vector of read-out correlated LCTs, if any. Starts with
330 // the vector of all found LCTs and selects the ones in the read-out
331 // time window.
332 std::vector<CSCCorrelatedLCTDigi> CSCMotherboard::readoutLCTs() const {
333  std::vector<CSCCorrelatedLCTDigi> tmpV;
334 
335  // The start time of the L1A*LCT coincidence window should be related
336  // to the fifo_pretrig parameter, but I am not completely sure how.
337  // Just choose it such that the window is centered at bx=7. This may
338  // need further tweaking if the value of tmb_l1a_window_size changes.
339  //static int early_tbins = 4;
340 
341  // Empirical correction to match 2009 collision data (firmware change?)
342  int lct_bins = tmb_l1a_window_size;
343  int late_tbins = early_tbins + lct_bins;
344 
345  int ifois = 0;
346  if (ifois == 0) {
347  if (infoV >= 0 && early_tbins < 0) {
348  edm::LogWarning("CSCMotherboard|SuspiciousParameters")
349  << "+++ early_tbins = " << early_tbins << "; in-time LCTs are not getting read-out!!! +++"
350  << "\n";
351  }
352 
353  if (late_tbins > CSCConstants::MAX_LCT_TBINS - 1) {
354  if (infoV >= 0)
355  edm::LogWarning("CSCMotherboard|SuspiciousParameters")
356  << "+++ Allowed range of time bins, [0-" << late_tbins << "] exceeds max allowed, "
357  << CSCConstants::MAX_LCT_TBINS - 1 << " +++\n"
358  << "+++ Set late_tbins to max allowed +++\n";
359  late_tbins = CSCConstants::MAX_LCT_TBINS - 1;
360  }
361  ifois = 1;
362  }
363 
364  // Start from the vector of all found correlated LCTs and select
365  // those within the LCT*L1A coincidence window.
366  int bx_readout = -1;
367  const std::vector<CSCCorrelatedLCTDigi>& all_lcts = getLCTs();
368  for (auto plct = all_lcts.begin(); plct != all_lcts.end(); plct++) {
369  if (!plct->isValid())
370  continue;
371 
372  int bx = (*plct).getBX();
373  // Skip LCTs found too early relative to L1Accept.
374  if (bx <= early_tbins) {
375  if (infoV > 1)
376  LogDebug("CSCMotherboard") << " Do not report correlated LCT on key halfstrip " << plct->getStrip()
377  << " and key wire " << plct->getKeyWG() << ": found at bx " << bx
378  << ", whereas the earliest allowed bx is " << early_tbins + 1;
379  continue;
380  }
381 
382  // Skip LCTs found too late relative to L1Accept.
383  if (bx > late_tbins) {
384  if (infoV > 1)
385  LogDebug("CSCMotherboard") << " Do not report correlated LCT on key halfstrip " << plct->getStrip()
386  << " and key wire " << plct->getKeyWG() << ": found at bx " << bx
387  << ", whereas the latest allowed bx is " << late_tbins;
388  continue;
389  }
390 
391  // If (readout_earliest_2) take only LCTs in the earliest bx in the read-out window:
392  // in digi->raw step, LCTs have to be packed into the TMB header, and
393  // currently there is room just for two.
394  if (readout_earliest_2) {
395  if (bx_readout == -1 || bx == bx_readout) {
396  tmpV.push_back(*plct);
397  if (bx_readout == -1)
398  bx_readout = bx;
399  }
400  }
401  // if readout_earliest_2 == false, save all LCTs
402  else
403  tmpV.push_back(*plct);
404  }
405 
406  // do a final check on the LCTs in readout
407  qualityControl_->checkMultiplicityBX(tmpV);
408  for (const auto& lct : tmpV) {
409  qualityControl_->checkValid(lct);
410  }
411 
412  return tmpV;
413 }
414 
415 // Returns vector of all found correlated LCTs, if any.
416 std::vector<CSCCorrelatedLCTDigi> CSCMotherboard::getLCTs() const {
417  std::vector<CSCCorrelatedLCTDigi> tmpV;
418 
419  // Do not report LCTs found in ME1/A if mpc_block_me1/a is set.
420  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++) {
421  if (firstLCT[bx].isValid())
423  tmpV.push_back(firstLCT[bx]);
424  if (secondLCT[bx].isValid())
426  tmpV.push_back(secondLCT[bx]);
427  }
428  return tmpV;
429 }
430 
432  const CSCALCTDigi& bALCT, const CSCALCTDigi& sALCT, const CSCCLCTDigi& bCLCT, const CSCCLCTDigi& sCLCT, int type) {
433  CSCALCTDigi bestALCT = bALCT;
434  CSCALCTDigi secondALCT = sALCT;
435  CSCCLCTDigi bestCLCT = bCLCT;
436  CSCCLCTDigi secondCLCT = sCLCT;
437 
438  bool anodeBestValid = bestALCT.isValid();
439  bool anodeSecondValid = secondALCT.isValid();
440  bool cathodeBestValid = bestCLCT.isValid();
441  bool cathodeSecondValid = secondCLCT.isValid();
442 
443  if (anodeBestValid && !anodeSecondValid)
444  secondALCT = bestALCT;
445  if (!anodeBestValid && anodeSecondValid)
446  bestALCT = secondALCT;
447  if (cathodeBestValid && !cathodeSecondValid)
448  secondCLCT = bestCLCT;
449  if (!cathodeBestValid && cathodeSecondValid)
450  bestCLCT = secondCLCT;
451 
452  // ALCT-CLCT matching conditions are defined by "trig_enable" configuration
453  // parameters.
454  if ((alct_trig_enable && bestALCT.isValid()) || (clct_trig_enable && bestCLCT.isValid()) ||
455  (match_trig_enable && bestALCT.isValid() && bestCLCT.isValid())) {
456  const CSCCorrelatedLCTDigi& lct = constructLCTs(bestALCT, bestCLCT, type, 1);
457  int bx = lct.getBX();
458  if (bx >= 0 && bx < CSCConstants::MAX_LCT_TBINS) {
459  firstLCT[bx] = lct;
460  } else {
461  if (infoV > 0)
462  edm::LogWarning("CSCMotherboard|OutOfTimeLCT")
463  << "+++ Bx of first LCT candidate, " << bx << ", is not within the allowed range, [0-"
464  << CSCConstants::MAX_LCT_TBINS - 1 << "); skipping it... +++\n";
465  }
466  }
467 
468  if (((secondALCT != bestALCT) || (secondCLCT != bestCLCT)) &&
469  ((alct_trig_enable && secondALCT.isValid()) || (clct_trig_enable && secondCLCT.isValid()) ||
470  (match_trig_enable && secondALCT.isValid() && secondCLCT.isValid()))) {
471  const CSCCorrelatedLCTDigi& lct = constructLCTs(secondALCT, secondCLCT, type, 2);
472  int bx = lct.getBX();
473  if (bx >= 0 && bx < CSCConstants::MAX_LCT_TBINS) {
474  secondLCT[bx] = lct;
475  } else {
476  if (infoV > 0)
477  edm::LogWarning("CSCMotherboard|OutOfTimeLCT")
478  << "+++ Bx of second LCT candidate, " << bx << ", is not within the allowed range, [0-"
479  << CSCConstants::MAX_LCT_TBINS - 1 << "); skipping it... +++\n";
480  }
481  }
482 }
483 
484 // This method calculates all the TMB words and then passes them to the
485 // constructor of correlated LCTs.
487  const CSCCLCTDigi& cLCT,
488  int type,
489  int trknmb) const {
490  // CLCT pattern number
491  unsigned int pattern = encodePattern(cLCT.getPattern());
492  if (runCCLUT_) {
493  pattern = cLCT.getSlope();
494  }
495 
496  // LCT quality number
497  unsigned int quality;
498  if (runCCLUT_) {
499  quality = static_cast<unsigned int>(findQualityRun3(aLCT, cLCT));
500  } else {
501  quality = static_cast<unsigned int>(findQuality(aLCT, cLCT));
502  }
503 
504  // Bunch crossing: get it from cathode LCT if anode LCT is not there.
505  int bx = aLCT.isValid() ? aLCT.getBX() : cLCT.getBX();
506 
507  // Not used in Run-2. Will not be assigned in Run-3
508  unsigned int syncErr = 0;
509 
510  // construct correlated LCT
511  CSCCorrelatedLCTDigi thisLCT(trknmb,
512  1,
513  quality,
514  aLCT.getKeyWG(),
515  cLCT.getKeyStrip(),
516  pattern,
517  cLCT.getBend(),
518  bx,
519  0,
520  0,
521  syncErr,
523  thisLCT.setType(type);
524 
525  if (runCCLUT_) {
526  thisLCT.setRun3(true);
527  }
528 
529  // in Run-3 we plan to denote the presence of exotic signatures in the chamber
531  thisLCT.setHMT(highMultiplicityBits_);
532 
533  // make sure to shift the ALCT BX from 8 to 3 and the CLCT BX from 8 to 7!
534  thisLCT.setALCT(getBXShiftedALCT(aLCT));
535  thisLCT.setCLCT(getBXShiftedCLCT(cLCT));
536  return thisLCT;
537 }
538 
539 // CLCT pattern number: encodes the pattern number itself
540 unsigned int CSCMotherboard::encodePattern(const int ptn) const {
541  const int kPatternBitWidth = 4;
542 
543  // In the TMB07 firmware, LCT pattern is just a 4-bit CLCT pattern.
544  unsigned int pattern = (abs(ptn) & ((1 << kPatternBitWidth) - 1));
545 
546  return pattern;
547 }
548 
549 // 4-bit LCT quality number.
551  // Either ALCT or CLCT is invalid
552  if (!(aLCT.isValid()) || !(cLCT.isValid())) {
553  // No CLCT
554  if (aLCT.isValid() && !(cLCT.isValid()))
555  return LCT_Quality::NO_CLCT;
556 
557  // No ALCT
558  else if (!(aLCT.isValid()) && cLCT.isValid())
559  return LCT_Quality::NO_ALCT;
560 
561  // No ALCT and no CLCT
562  else
563  return LCT_Quality::INVALID;
564  }
565  // Both ALCT and CLCT are valid
566  else {
567  const int pattern(cLCT.getPattern());
568 
569  // Layer-trigger in CLCT
570  if (pattern == 1)
572 
573  // Multi-layer pattern in CLCT
574  else {
575  // ALCT quality is the number of layers hit minus 3.
576  const bool a4(aLCT.getQuality() >= 1);
577 
578  // CLCT quality is the number of layers hit.
579  const bool c4(cLCT.getQuality() >= 4);
580 
581  // quality = 4; "reserved for low-quality muons in future"
582 
583  // marginal anode and cathode
584  if (!a4 && !c4)
586 
587  // HQ anode, but marginal cathode
588  else if (a4 && !c4)
590 
591  // HQ cathode, but marginal anode
592  else if (!a4 && c4)
594 
595  // HQ muon, but accelerator ALCT
596  else if (a4 && c4) {
597  if (aLCT.getAccelerator())
599 
600  else {
601  // quality = 9; "reserved for HQ muons with future patterns
602  // quality = 10; "reserved for HQ muons with future patterns
603 
604  // High quality muons are determined by their CLCT pattern
605  if (pattern == 2 || pattern == 3)
607 
608  else if (pattern == 4 || pattern == 5)
610 
611  else if (pattern == 6 || pattern == 7)
613 
614  else if (pattern == 8 || pattern == 9)
616 
617  else if (pattern == 10)
619 
620  else {
621  edm::LogWarning("CSCMotherboard")
622  << "findQuality: Unexpected CLCT pattern id = " << pattern << " in " << theCSCName_;
623  return LCT_Quality::INVALID;
624  }
625  }
626  }
627  }
628  }
629  return LCT_Quality::INVALID;
630 }
631 
632 // 2-bit LCT quality number for Run-3
634  const CSCCLCTDigi& cLCT) const {
635  // Run-3 definition
636  if (!(aLCT.isValid()) and !(cLCT.isValid())) {
638  }
639  // use number of layers on each as indicator
640  else {
641  bool a4 = (aLCT.getQuality() >= 1);
642  bool a5 = (aLCT.getQuality() >= 1);
643  bool a6 = (aLCT.getQuality() >= 1);
644 
645  bool c4 = (cLCT.getQuality() >= 4);
646  bool c5 = (cLCT.getQuality() >= 4);
647  bool c6 = (cLCT.getQuality() >= 4);
648  if (a6 or c6)
649  return LCT_QualityRun3::HighQ;
650  else if (a5 or c5)
651  return LCT_QualityRun3::MedQ;
652  else if (a4 or c4)
653  return LCT_QualityRun3::LowQ;
654  }
656 }
657 
659  // Make sure that the parameter values are within the allowed range.
660 
661  // Max expected values.
662  static const unsigned int max_mpc_block_me1a = 1 << 1;
663  static const unsigned int max_alct_trig_enable = 1 << 1;
664  static const unsigned int max_clct_trig_enable = 1 << 1;
665  static const unsigned int max_match_trig_enable = 1 << 1;
666  static const unsigned int max_match_trig_window_size = 1 << 4;
667  static const unsigned int max_tmb_l1a_window_size = 1 << 4;
668 
669  // Checks.
670  CSCBaseboard::checkConfigParameters(mpc_block_me1a, max_mpc_block_me1a, def_mpc_block_me1a, "mpc_block_me1a");
671  CSCBaseboard::checkConfigParameters(alct_trig_enable, max_alct_trig_enable, def_alct_trig_enable, "alct_trig_enable");
672  CSCBaseboard::checkConfigParameters(clct_trig_enable, max_clct_trig_enable, def_clct_trig_enable, "clct_trig_enable");
674  match_trig_enable, max_match_trig_enable, def_match_trig_enable, "match_trig_enable");
676  match_trig_window_size, max_match_trig_window_size, def_match_trig_window_size, "match_trig_window_size");
678  tmb_l1a_window_size, max_tmb_l1a_window_size, def_tmb_l1a_window_size, "tmb_l1a_window_size");
679 }
680 
682  std::ostringstream strm;
683  strm << "\n";
684  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
685  strm << "+ TMB configuration parameters: +\n";
686  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
687  strm << " mpc_block_me1a [block/not block triggers which come from ME1/A] = " << mpc_block_me1a << "\n";
688  strm << " alct_trig_enable [allow ALCT-only triggers] = " << alct_trig_enable << "\n";
689  strm << " clct_trig_enable [allow CLCT-only triggers] = " << clct_trig_enable << "\n";
690  strm << " match_trig_enable [allow matched ALCT-CLCT triggers] = " << match_trig_enable << "\n";
691  strm << " match_trig_window_size [ALCT-CLCT match window width, in 25 ns] = " << match_trig_window_size << "\n";
692  strm << " tmb_l1a_window_size [L1Accept window width, in 25 ns bins] = " << tmb_l1a_window_size << "\n";
693  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
694  LogDebug("CSCMotherboard") << strm.str();
695 }
696 
698  CSCALCTDigi aLCT_shifted = aLCT;
699  aLCT_shifted.setBX(aLCT_shifted.getBX() - (CSCConstants::LCT_CENTRAL_BX - tmb_l1a_window_size / 2));
700  return aLCT_shifted;
701 }
702 
704  CSCCLCTDigi cLCT_shifted = cLCT;
705  cLCT_shifted.setBX(cLCT_shifted.getBX() - CSCConstants::ALCT_CLCT_OFFSET);
706  return cLCT_shifted;
707 }
708 
710  // encode the high multiplicity bits in the (O)TMB based on
711  // the high multiplicity bits from the ALCT processor
712  // draft version: simply rellay the ALCT bits.
713  // future versions may involve also bits from the CLCT processor
714  // this depends on memory constraints in the TMB FPGA
715  highMultiplicityBits_ = alctBits;
716 }
CSCMotherboard::LCT_Quality::NO_CLCT
CSCMotherboard::run
virtual void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc)
Definition: CSCMotherboard.cc:131
CSCALCTDigi::getBX
uint16_t getBX() const
return BX - five low bits of BXN counter tagged by the ALCT
Definition: CSCALCTDigi.h:73
CSCDBL1TPParameters
Definition: CSCDBL1TPParameters.h:14
CSCMotherboard::qualityControl_
std::unique_ptr< LCTQualityControl > qualityControl_
Definition: CSCMotherboard.h:128
CSCMotherboard::match_trig_window_size
unsigned int match_trig_window_size
Definition: CSCMotherboard.h:99
CSCMotherboard::def_clct_trig_enable
static const unsigned int def_clct_trig_enable
Definition: CSCMotherboard.h:123
CSCMotherboard::mpc_block_me1a
unsigned int mpc_block_me1a
Definition: CSCMotherboard.h:97
CSCMotherboard::drop_used_alcts
bool drop_used_alcts
Definition: CSCMotherboard.h:102
CSCBaseboard::cscGeometry_
const CSCGeometry * cscGeometry_
Definition: CSCBaseboard.h:66
CSCMotherboard::secondLCT
CSCCorrelatedLCTDigi secondLCT[CSCConstants::MAX_LCT_TBINS]
Definition: CSCMotherboard.h:90
CSCConstants::MAX_ALCT_TBINS
Definition: CSCConstants.h:64
CSCMotherboard::useHighMultiplicityBits_
bool useHighMultiplicityBits_
Definition: CSCMotherboard.h:119
CSCMotherboard::LCT_Quality::HQ_CATHODE_MARGINAL_ANODE
CSCBaseboard::tmbParams_
edm::ParameterSet tmbParams_
Definition: CSCBaseboard.h:73
CSCMotherboard::LCT_Quality::NO_ALCT
relativeConstraints.station
station
Definition: relativeConstraints.py:67
CSCMotherboard::alctProc
std::unique_ptr< CSCAnodeLCTProcessor > alctProc
Definition: CSCMotherboard.h:75
CSCCorrelatedLCTDigi::CLCTALCT
Definition: CSCCorrelatedLCTDigi.h:195
CSCMotherboard::correlateLCTs
void correlateLCTs(const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, int type)
Definition: CSCMotherboard.cc:431
CSCMotherboard::LCT_Quality::CLCT_LAYER_TRIGGER
CSCDBL1TPParameters::tmbClctTrigEnable
unsigned int tmbClctTrigEnable() const
Definition: CSCDBL1TPParameters.h:80
CSCMotherboard::findQuality
LCT_Quality findQuality(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT) const
Definition: CSCMotherboard.cc:550
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
CSCBaseboard::theCSCName_
std::string theCSCName_
Definition: CSCBaseboard.h:82
CSCConstants::LCT_CENTRAL_BX
Definition: CSCConstants.h:79
CSCMotherboard::def_alct_trig_enable
static const unsigned int def_alct_trig_enable
Definition: CSCMotherboard.h:123
CSCMotherboard::clear
void clear()
Definition: CSCMotherboard.cc:89
CSCMotherboard::clct_trig_enable
unsigned int clct_trig_enable
Definition: CSCMotherboard.h:98
CSCBaseboard::checkConfigParameters
void checkConfigParameters(unsigned int &var, const unsigned int var_max, const unsigned int var_def, const std::string &var_str)
Definition: CSCBaseboard.cc:92
CSCConstants::ALCT_CLCT_OFFSET
Definition: CSCConstants.h:81
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
CSCDBL1TPParameters::tmbMpcBlockMe1a
unsigned int tmbMpcBlockMe1a() const
Definition: CSCDBL1TPParameters.h:74
CSCCLCTDigi::getKeyStrip
uint16_t getKeyStrip(const uint16_t n=2) const
Definition: CSCCLCTDigi.cc:133
CSCMotherboard::LCT_QualityRun3::LowQ
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
CSCCLCTDigi
Definition: CSCCLCTDigi.h:17
CSCCorrelatedLCTDigi::ALCTCLCT
Definition: CSCCorrelatedLCTDigi.h:196
CSCMotherboard::LCT_QualityRun3
LCT_QualityRun3
Definition: CSCMotherboard.h:166
CSCMotherboard::checkConfigParameters
void checkConfigParameters()
Definition: CSCMotherboard.cc:658
CSCMotherboard::CSCMotherboard
CSCMotherboard()
Definition: CSCMotherboard.cc:64
CSCMotherboard::clctV
std::vector< CSCCLCTDigi > clctV
Definition: CSCMotherboard.h:84
CSCMotherboard::clctProc
std::unique_ptr< CSCCathodeLCTProcessor > clctProc
Definition: CSCMotherboard.h:78
CSCMotherboard::LCT_Quality::HQ_PATTERN_10
CSCALCTDigi::getKeyWG
uint16_t getKeyWG() const
return key wire group
Definition: CSCALCTDigi.h:67
CSCCLCTDigi::getQuality
uint16_t getQuality() const
return quality of a pattern (number of layers hit!)
Definition: CSCCLCTDigi.h:56
CSCCLCTDigi::getBend
uint16_t getBend() const
Definition: CSCCLCTDigi.h:91
CSCMotherboard::alctV
std::vector< CSCALCTDigi > alctV
Definition: CSCMotherboard.h:83
CSCMotherboard::constructLCTs
CSCCorrelatedLCTDigi constructLCTs(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT, int type, int trknmb) const
Definition: CSCMotherboard.cc:486
CSCDBL1TPParameters::tmbMatchTrigWindowSize
unsigned int tmbMatchTrigWindowSize() const
Definition: CSCDBL1TPParameters.h:86
CSCCorrelatedLCTDigi::CLCTONLY
Definition: CSCCorrelatedLCTDigi.h:201
CSCMotherboard::LCT_Quality::INVALID
CSCMotherboard::dumpConfigParams
void dumpConfigParams() const
Definition: CSCMotherboard.cc:681
CSCMotherboard::def_tmb_l1a_window_size
static const unsigned int def_tmb_l1a_window_size
Definition: CSCMotherboard.h:125
CSCConstants::MAX_LCT_TBINS
Definition: CSCConstants.h:65
CSCMotherboard::LCT_Quality::HQ_PATTERN_4_5
CSCMotherboard.h
CSCALCTDigi::setBX
void setBX(const uint16_t BX)
set BX
Definition: CSCALCTDigi.h:76
CSCALCTDigi::getQuality
uint16_t getQuality() const
return quality of a pattern
Definition: CSCALCTDigi.h:46
CSCMotherboard::findQualityRun3
LCT_QualityRun3 findQualityRun3(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT) const
Definition: CSCMotherboard.cc:633
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::ParameterSet
Definition: ParameterSet.h:47
a
double a
Definition: hdecay.h:119
CSCDBL1TPParameters::tmbMatchTrigEnable
unsigned int tmbMatchTrigEnable() const
Definition: CSCDBL1TPParameters.h:83
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
CSCMotherboard::LCT_Quality::HQ_PATTERN_8_9
CSCBaseboard
Definition: CSCBaseboard.h:15
CSCMotherboard::LCT_Quality::MARGINAL_ANODE_CATHODE
CSCMotherboard::getLCTs
std::vector< CSCCorrelatedLCTDigi > getLCTs() const
Definition: CSCMotherboard.cc:416
CSCConstants::MAX_HALF_STRIP_ME1B
Definition: CSCConstants.h:39
CSCMotherboard::early_tbins
int early_tbins
Definition: CSCMotherboard.h:108
CSCCLCTDigi::isValid
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:50
CSCDBL1TPParameters::tmbTmbL1aWindowSize
unsigned int tmbTmbL1aWindowSize() const
Definition: CSCDBL1TPParameters.h:89
topSingleLeptonDQM_PU_cfi.pattern
pattern
Definition: topSingleLeptonDQM_PU_cfi.py:39
CSCComparatorDigiCollection
CSCCorrelatedLCTDigi::clear
void clear()
clear this LCT
Definition: CSCCorrelatedLCTDigi.cc:49
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
CSCCLCTDigi::getSlope
uint16_t getSlope() const
return the slope
Definition: CSCCLCTDigi.cc:106
CSCMotherboard::readout_earliest_2
bool readout_earliest_2
Definition: CSCMotherboard.h:111
CSCDBL1TPParameters::tmbAlctTrigEnable
unsigned int tmbAlctTrigEnable() const
Definition: CSCDBL1TPParameters.h:77
CSCMotherboard::drop_used_clcts
bool drop_used_clcts
Definition: CSCMotherboard.h:105
CSCCLCTDigi::getBX
uint16_t getBX() const
return BX
Definition: CSCCLCTDigi.h:121
CSCMotherboard::encodeHighMultiplicityBits
void encodeHighMultiplicityBits(unsigned alctBits)
Definition: CSCMotherboard.cc:709
CSCMotherboard::readoutLCTs
virtual std::vector< CSCCorrelatedLCTDigi > readoutLCTs() const
Definition: CSCMotherboard.cc:332
CSCMotherboard::getBXShiftedCLCT
CSCCLCTDigi getBXShiftedCLCT(const CSCCLCTDigi &) const
Definition: CSCMotherboard.cc:703
CSCMotherboard::tmb_l1a_window_size
unsigned int tmb_l1a_window_size
Definition: CSCMotherboard.h:99
CSCWireDigiCollection
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
CSCALCTDigi::getAccelerator
uint16_t getAccelerator() const
Definition: CSCALCTDigi.h:53
CSCMotherboard::LCT_Quality::HQ_PATTERN_2_3
CSCMotherboard::setConfigParameters
void setConfigParameters(const CSCDBL1TPParameters *conf)
Definition: CSCMotherboard.cc:108
CSCMotherboard::LCT_Quality::HQ_ACCEL_ALCT
CSCMotherboard::highMultiplicityBits_
unsigned int highMultiplicityBits_
Definition: CSCMotherboard.h:118
CSCMotherboard::LCT_QualityRun3::HighQ
CSCALCTDigi
Definition: CSCALCTDigi.h:17
CSCMotherboard::alct_trig_enable
unsigned int alct_trig_enable
Definition: CSCMotherboard.h:98
CSCConstants::MAX_CLCT_TBINS
Definition: CSCConstants.h:63
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
or
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
CSCBaseboard::theTrigChamber
const unsigned theTrigChamber
Definition: CSCBaseboard.h:46
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
CSCCLCTDigi::setBX
void setBX(const uint16_t bx)
set bx
Definition: CSCCLCTDigi.h:127
CSCMotherboard::encodePattern
unsigned int encodePattern(const int clctPattern) const
Definition: CSCMotherboard.cc:540
CSCCorrelatedLCTDigi::ALCTONLY
Definition: CSCCorrelatedLCTDigi.h:202
CSCMotherboard::def_match_trig_window_size
static const unsigned int def_match_trig_window_size
Definition: CSCMotherboard.h:124
CSCALCTDigi::isValid
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:40
CSCMotherboard::clct_to_alct
bool clct_to_alct
Definition: CSCMotherboard.h:115
CSCMotherboard::def_mpc_block_me1a
static const unsigned int def_mpc_block_me1a
Definition: CSCMotherboard.h:122
CSCMotherboard::LCT_Quality::HQ_ANODE_MARGINAL_CATHODE
CSCMotherboard::def_match_trig_enable
static const unsigned int def_match_trig_enable
Definition: CSCMotherboard.h:124
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
CSCMotherboard::match_trig_enable
unsigned int match_trig_enable
Definition: CSCMotherboard.h:98
CSCMotherboard::getBXShiftedALCT
CSCALCTDigi getBXShiftedALCT(const CSCALCTDigi &) const
Definition: CSCMotherboard.cc:697
CSCCLCTDigi::getPattern
uint16_t getPattern() const
return pattern
Definition: CSCCLCTDigi.cc:88
CSCCorrelatedLCTDigi::getBX
uint16_t getBX() const
return BX
Definition: CSCCorrelatedLCTDigi.h:111
CSCMotherboard::LCT_QualityRun3::INVALID
CSCCorrelatedLCTDigi::setType
void setType(int type)
Definition: CSCCorrelatedLCTDigi.h:207
CSCMotherboard::LCT_QualityRun3::MedQ
CSCBaseboard::isME11_
bool isME11_
Definition: CSCBaseboard.h:52
CSCMotherboard::LCT_Quality
LCT_Quality
Definition: CSCMotherboard.h:147
CSCMotherboard::firstLCT
CSCCorrelatedLCTDigi firstLCT[CSCConstants::MAX_LCT_TBINS]
Definition: CSCMotherboard.h:87
CSCCorrelatedLCTDigi
Definition: CSCCorrelatedLCTDigi.h:19
CSCBaseboard::runCCLUT_
bool runCCLUT_
Definition: CSCBaseboard.h:103
CSCMotherboard::LCT_Quality::HQ_PATTERN_6_7
CSCBaseboard::infoV
int infoV
Definition: CSCBaseboard.h:64