CMS 3D CMS Logo

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