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 CLCTs that were used by previous matching ALCTs
36  drop_used_clcts = tmbParams_.getParameter<bool>("tmbDropUsedClcts");
37 
38  // whether to readout only the earliest two LCTs in readout window
39  readout_earliest_2 = tmbParams_.getParameter<bool>("tmbReadoutEarliest2");
40 
41  match_earliest_clct_only_ = tmbParams_.getParameter<bool>("matchEarliestClctOnly");
42 
43  infoV = tmbParams_.getParameter<int>("verbosity");
44 
45  alctProc = std::make_unique<CSCAnodeLCTProcessor>(endcap, station, sector, subsector, chamber, conf);
46  clctProc = std::make_unique<CSCCathodeLCTProcessor>(endcap, station, sector, subsector, chamber, conf);
47 
48  // Check and print configuration parameters.
50  if (infoV > 0 && !config_dumped) {
52  config_dumped = true;
53  }
54 
56 
57  // get the preferred CLCT BX match array
58  preferred_bx_match_ = tmbParams_.getParameter<std::vector<int> >("preferredBxMatch");
59 
60  // quality assignment
61  qualityAssignment_ = std::make_unique<LCTQualityAssignment>(endcap, station, sector, subsector, chamber, conf);
62 
63  // quality control of stubs
64  qualityControl_ = std::make_unique<LCTQualityControl>(endcap, station, sector, subsector, chamber, conf);
65 
66  // shower-trigger source
67  showerSource_ = showerParams_.getParameter<unsigned>("source");
68 
69  // enable the upgrade processors for ring 1 stations
70  if (runPhase2_ and theRing == 1) {
71  clctProc = std::make_unique<CSCUpgradeCathodeLCTProcessor>(endcap, station, sector, subsector, chamber, conf);
72  if (enableAlctPhase2_) {
73  alctProc = std::make_unique<CSCUpgradeAnodeLCTProcessor>(endcap, station, sector, subsector, chamber, conf);
74  }
75  }
76 
77  // set up helper class to check if ALCT and CLCT cross
78  ignoreAlctCrossClct_ = tmbParams_.getParameter<bool>("ignoreAlctCrossClct");
79  if (!ignoreAlctCrossClct_) {
80  cscOverlap_ = std::make_unique<CSCALCTCrossCLCT>(endcap, station, theRing, ignoreAlctCrossClct_, conf);
81  }
82 }
83 
85  // clear the processors
86  if (alctProc)
87  alctProc->clear();
88  if (clctProc)
89  clctProc->clear();
90 
91  // clear the ALCT and CLCT containers
92  alctV.clear();
93  clctV.clear();
94  lctV.clear();
95 
96  allLCTs_.clear();
97 
98  // reset the shower trigger
99  shower_.clear();
100 }
101 
102 // Set configuration parameters obtained via EventSetup mechanism.
104  static std::atomic<bool> config_dumped{false};
105 
106  // Config. parameters for the TMB itself.
113 
114  // Config. paramteres for ALCT and CLCT processors.
115  alctProc->setConfigParameters(conf);
116  clctProc->setConfigParameters(conf);
117 
118  // Check and print configuration parameters.
120  if (!config_dumped) {
122  config_dumped = true;
123  }
124 }
125 
127 
129 
131 
133  // Step 1: Setup
134  clear();
135 
136  // Check for existing processors
137  if (!(alctProc && clctProc)) {
138  edm::LogError("CSCMotherboard|SetupError") << "+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
139  return;
140  }
141 
142  // set geometry
143  alctProc->setCSCGeometry(cscGeometry_);
144  clctProc->setCSCGeometry(cscGeometry_);
145 
146  // set CCLUT parameters if necessary
147  if (runCCLUT_) {
148  clctProc->setESLookupTables(lookupTableCCLUT_);
149  }
150 
151  // Step 2: Run the processors
152  alctV = alctProc->run(wiredc); // run anodeLCT
153  clctV = clctProc->run(compdc); // run cathodeLCT
154 
155  // Step 2b: encode high multiplicity bits (independent of LCT construction)
157 
158  // if there are no ALCTs and no CLCTs, it does not make sense to run this TMB
159  if (alctV.empty() and clctV.empty())
160  return;
161 
162  // step 3: match the ALCTs to the CLCTs
163  matchALCTCLCT();
164 
165  // Step 4: Select at most 2 LCTs per BX
166  selectLCTs();
167 }
168 
170  // array to mask CLCTs
171  bool used_clct_mask[CSCConstants::MAX_CLCT_TBINS] = {false};
172 
173  // Step 3: ALCT-centric ALCT-to-CLCT matching
174  int bx_clct_matched = 0; // bx of last matched CLCT
175  for (int bx_alct = 0; bx_alct < CSCConstants::MAX_ALCT_TBINS; bx_alct++) {
176  // There should be at least one valid CLCT or ALCT for a
177  // correlated LCT to be formed. Decision on whether to reject
178  // non-complete LCTs (and if yes of which type) is made further
179  // upstream.
180  if (alctProc->getBestALCT(bx_alct).isValid()) {
181  // Look for CLCTs within the match-time window. The window is
182  // centered at the ALCT bx; therefore, we make an assumption
183  // that anode and cathode hits are perfectly synchronized. This
184  // is always true for MC, but only an approximation when the
185  // data is analyzed (which works fairly good as long as wide
186  // windows are used). To get rid of this assumption, one would
187  // need to access "full BX" words, which are not readily
188  // available.
189  bool is_matched = false;
190  // loop on the preferred "delta BX" array
191  for (unsigned mbx = 0; mbx < match_trig_window_size; mbx++) {
192  // evaluate the preffered CLCT BX, taking into account that there is an offset in the simulation
193  unsigned bx_clct = bx_alct + preferred_bx_match_[mbx] - CSCConstants::ALCT_CLCT_OFFSET;
194  // check that the CLCT BX is valid
195  if (bx_clct >= CSCConstants::MAX_CLCT_TBINS)
196  continue;
197  // do not consider previously matched CLCTs
198  if (drop_used_clcts && used_clct_mask[bx_clct])
199  continue;
200  // only consider >=4 layer CLCTs for ALCT-CLCT type LCTs
201  // this condition is lowered to >=3 layers for CLCTs in the
202  // matchALCTCLCTGEM function
203  if (clctProc->getBestCLCT(bx_clct).getQuality() <= 3)
204  continue;
205  // a valid CLCT with sufficient layers!
206  if (clctProc->getBestCLCT(bx_clct).isValid()) {
207  if (infoV > 1)
208  LogTrace("CSCMotherboard") << "Successful ALCT-CLCT match: bx_alct = " << bx_alct
209  << "; bx_clct = " << bx_clct << "; mbx = " << mbx;
210  // now correlate the ALCT and CLCT into LCT.
211  // smaller mbx means more preferred!
212  correlateLCTs(alctProc->getBestALCT(bx_alct),
213  alctProc->getSecondALCT(bx_alct),
214  clctProc->getBestCLCT(bx_clct),
215  clctProc->getSecondCLCT(bx_clct),
216  allLCTs_(bx_alct, mbx, 0),
217  allLCTs_(bx_alct, mbx, 1),
219  // when the first LCT is valid, you can mask the matched CLCT and/or
220  // move on to the next ALCT if match_earliest_clct_only_ is set to true
221  if (allLCTs_(bx_alct, mbx, 0).isValid()) {
222  is_matched = true;
223  used_clct_mask[bx_clct] = true;
224  bx_clct_matched = bx_clct;
226  break;
227  }
228  }
229  }
230  // No CLCT within the match time interval found: report ALCT-only LCT
231  // (use dummy CLCTs).
232  if (!is_matched) {
233  if (infoV > 1)
234  LogTrace("CSCMotherboard") << "Unsuccessful ALCT-CLCT match (ALCT only): bx_alct = " << bx_alct
235  << " first ALCT " << alctProc->getBestALCT(bx_alct);
236  if (alct_trig_enable)
237  correlateLCTs(alctProc->getBestALCT(bx_alct),
238  alctProc->getSecondALCT(bx_alct),
239  clctProc->getBestCLCT(bx_alct),
240  clctProc->getSecondCLCT(bx_alct),
241  allLCTs_(bx_alct, 0, 0),
242  allLCTs_(bx_alct, 0, 1),
244  }
245  }
246  // No valid ALCTs; attempt to make CLCT-only LCT. Use only CLCTs
247  // which have zeroth chance to be matched at later cathode times.
248  // (I am not entirely sure this perfectly matches the firmware logic.)
249  // Use dummy ALCTs.
250  else {
251  int bx_clct = bx_alct - match_trig_window_size / 2;
252  if (bx_clct >= 0 && bx_clct > bx_clct_matched) {
253  if (clctProc->getBestCLCT(bx_clct).isValid() and clct_trig_enable) {
254  if (infoV > 1)
255  LogTrace("CSCMotherboard") << "Unsuccessful ALCT-CLCT match (CLCT only): bx_clct = " << bx_clct;
256  correlateLCTs(alctProc->getBestALCT(bx_alct),
257  alctProc->getSecondALCT(bx_alct),
258  clctProc->getBestCLCT(bx_clct),
259  clctProc->getSecondCLCT(bx_clct),
260  allLCTs_(bx_clct, 0, 0),
261  allLCTs_(bx_clct, 0, 1),
263  }
264  }
265  }
266  }
267 }
268 
269 // Returns vector of read-out correlated LCTs, if any. Starts with
270 // the vector of all found LCTs and selects the ones in the read-out
271 // time window.
272 std::vector<CSCCorrelatedLCTDigi> CSCMotherboard::readoutLCTs() const {
273  // temporary container for further selection
274  std::vector<CSCCorrelatedLCTDigi> tmpV;
275 
276  /*
277  LCTs in the BX window [early_tbin,...,late_tbin] are considered good for physics
278  The central LCT BX is time bin 8.
279  For tmb_l1a_window_size set to 7 (Run-1, Run-2), the window is [5, 6, 7, 8, 9, 10, 11]
280  For tmb_l1a_window_size set to 5 (Run-3), the window is [6, 7, 8, 9, 10]
281  For tmb_l1a_window_size set to 3 (Run-4?), the window is [ 7, 8, 9]
282  */
283  const unsigned delta_tbin = tmb_l1a_window_size / 2;
284  int early_tbin = CSCConstants::LCT_CENTRAL_BX - delta_tbin;
285  int late_tbin = CSCConstants::LCT_CENTRAL_BX + delta_tbin;
286  /*
287  Special case for an even-numbered time-window,
288  For instance tmb_l1a_window_size set to 6: [5, 6, 7, 8, 9, 10]
289  */
290  if (tmb_l1a_window_size % 2 == 0)
291  late_tbin = CSCConstants::LCT_CENTRAL_BX + delta_tbin - 1;
292  const int max_late_tbin = CSCConstants::MAX_LCT_TBINS - 1;
293 
294  // debugging messages when early_tbin or late_tbin has a suspicious value
295  if (early_tbin < 0) {
296  edm::LogWarning("CSCMotherboard|SuspiciousParameters")
297  << "Early time bin (early_tbin) smaller than minimum allowed, which is 0. set early_tbin to 0.";
298  early_tbin = 0;
299  }
300  if (late_tbin > max_late_tbin) {
301  edm::LogWarning("CSCMotherboard|SuspiciousParameters")
302  << "Late time bin (late_tbin) larger than maximum allowed, which is " << max_late_tbin
303  << ". set early_tbin to max allowed";
304  late_tbin = CSCConstants::MAX_LCT_TBINS - 1;
305  }
306 
307  // Start from the vector of all found correlated LCTs and select
308  // those within the LCT*L1A coincidence window.
309  int bx_readout = -1;
310  for (const auto& lct : lctV) {
311  // extra check on invalid LCTs
312  if (!lct.isValid()) {
313  continue;
314  }
315 
316  const int bx = lct.getBX();
317  // Skip LCTs found too early relative to L1Accept.
318  if (bx < early_tbin) {
319  if (infoV > 1)
320  LogDebug("CSCMotherboard") << " Do not report correlated LCT on key halfstrip " << lct.getStrip()
321  << " and key wire " << lct.getKeyWG() << ": found at bx " << bx
322  << ", whereas the earliest allowed bx is " << early_tbin;
323  continue;
324  }
325 
326  // Skip LCTs found too late relative to L1Accept.
327  if (bx > late_tbin) {
328  if (infoV > 1)
329  LogDebug("CSCMotherboard") << " Do not report correlated LCT on key halfstrip " << lct.getStrip()
330  << " and key wire " << lct.getKeyWG() << ": found at bx " << bx
331  << ", whereas the latest allowed bx is " << late_tbin;
332  continue;
333  }
334 
335  // Do not report LCTs found in ME1/A if mpc_block_me1a is set.
336  if (mpc_block_me1a and isME11_ and lct.getStrip() > CSCConstants::MAX_HALF_STRIP_ME1B) {
337  continue;
338  }
339 
340  // If (readout_earliest_2) take only LCTs in the earliest bx in the read-out window:
341  // in digi->raw step, LCTs have to be packed into the TMB header, and
342  // currently there is room just for two.
343  if (readout_earliest_2) {
344  if (bx_readout == -1 || bx == bx_readout) {
345  tmpV.push_back(lct);
346  if (bx_readout == -1)
347  bx_readout = bx;
348  }
349  }
350  // if readout_earliest_2 == false, save all LCTs
351  else {
352  tmpV.push_back(lct);
353  }
354  }
355 
356  // do a final check on the LCTs in readout
357  qualityControl_->checkMultiplicityBX(tmpV);
358  for (const auto& lct : tmpV) {
359  qualityControl_->checkValid(lct);
360  /*std::cout << "\n########################################## Emu LCT ##########################################\n" << std::endl;
361  std::cout << "Emu LCT: " << lct << std::endl;
362  std::cout << "\n########################################## THE END ##########################################\n" << std::endl;*/
363  }
364 
365  return tmpV;
366 }
367 
369 
371  const CSCALCTDigi& sALCT,
372  const CSCCLCTDigi& bCLCT,
373  const CSCCLCTDigi& sCLCT,
374  CSCCorrelatedLCTDigi& bLCT,
375  CSCCorrelatedLCTDigi& sLCT,
376  int type) const {
377  CSCALCTDigi bestALCT = bALCT;
378  CSCALCTDigi secondALCT = sALCT;
379  CSCCLCTDigi bestCLCT = bCLCT;
380  CSCCLCTDigi secondCLCT = sCLCT;
381 
382  // extra check to make sure that both CLCTs have at least 4 layers
383  // for regular ALCT-CLCT type LCTs. A check was already done on the
384  // best CLCT, but not yet on the second best CLCT. The check on best
385  // CLCT is repeated for completeness
386  if (bestCLCT.getQuality() <= 3)
387  bestCLCT.clear();
388  if (secondCLCT.getQuality() <= 3)
389  secondCLCT.clear();
390 
391  // if the best ALCT/CLCT is valid, but the second ALCT/CLCT is not,
392  // the information is copied over
393  copyValidToInValidALCT(bestALCT, secondALCT);
394  copyValidToInValidCLCT(bestCLCT, secondCLCT);
395 
396  // ALCT-only LCTs
397  const bool bestCase1(alct_trig_enable and bestALCT.isValid());
398  // CLCT-only LCTs
399  const bool bestCase2(clct_trig_enable and bestCLCT.isValid());
400  /*
401  Normal case: ALCT-CLCT matched LCTs. We require ALCT and CLCT to be valid.
402  Optionally, we can check if the ALCT cross the CLCT. This check will always return true
403  for a valid ALCT-CLCT pair in non-ME1/1 chambers. For ME1/1 chambers, it returns true,
404  only when the ALCT-CLCT pair crosses and when the parameter "checkAlctCrossClct" is set to True.
405  It is recommended to keep "checkAlctCrossClct" set to False, so that the EMTF receives
406  all information, even if it's unphysical.
407  */
408  const bool bestCase3(match_trig_enable and bestALCT.isValid() and bestCLCT.isValid() and
409  doesALCTCrossCLCT(bestALCT, bestCLCT));
410 
411  // at least one of the cases must be valid
412  if (bestCase1 or bestCase2 or bestCase3) {
413  constructLCTs(bestALCT, bestCLCT, type, 1, bLCT);
414  }
415 
416  // ALCT-only LCTs
417  const bool secondCase1(alct_trig_enable and secondALCT.isValid());
418  // CLCT-only LCTs
419  const bool secondCase2(clct_trig_enable and secondCLCT.isValid());
420  /*
421  Normal case: ALCT-CLCT matched LCTs. We require ALCT and CLCT to be valid.
422  Optionally, we can check if the ALCT cross the CLCT. This check will always return true
423  for a valid ALCT-CLCT pair in non-ME1/1 chambers. For ME1/1 chambers, it returns true,
424  only when the ALCT-CLCT pair crosses and when the parameter "checkAlctCrossClct" is set to True.
425  It is recommended to keep "checkAlctCrossClct" set to False, so that the EMTF receives
426  all information, even if it's unphysical.
427  */
428  const bool secondCase3(match_trig_enable and secondALCT.isValid() and secondCLCT.isValid() and
429  doesALCTCrossCLCT(secondALCT, secondCLCT));
430 
431  // at least one component must be different in order to consider the secondLCT
432  if ((secondALCT != bestALCT) or (secondCLCT != bestCLCT)) {
433  // at least one of the cases must be valid
434  if (secondCase1 or secondCase2 or secondCase3)
435  constructLCTs(secondALCT, secondCLCT, type, 2, sLCT);
436  }
437 }
438 
439 // copy the valid ALCT/CLCT information to the valid ALCT
441  if (bestALCT.isValid() and !secondALCT.isValid())
442  secondALCT = bestALCT;
443 }
444 
445 // copy the valid CLCT information to the valid CLCT
447  if (bestCLCT.isValid() and !secondCLCT.isValid())
448  secondCLCT = bestCLCT;
449 }
450 
451 bool CSCMotherboard::doesALCTCrossCLCT(const CSCALCTDigi& alct, const CSCCLCTDigi& clct) const {
453  return true;
454  else
455  return cscOverlap_->doesALCTCrossCLCT(alct, clct);
456 }
457 
458 // This method calculates all the TMB words and then passes them to the
459 // constructor of correlated LCTs.
461  const CSCALCTDigi& aLCT, const CSCCLCTDigi& cLCT, int type, int trknmb, CSCCorrelatedLCTDigi& thisLCT) const {
462  thisLCT.setValid(true);
463  thisLCT.setType(type);
464  // make sure to shift the ALCT BX from 8 to 3 and the CLCT BX from 8 to 7!
465  thisLCT.setALCT(getBXShiftedALCT(aLCT));
466  thisLCT.setCLCT(getBXShiftedCLCT(cLCT));
467  thisLCT.setPattern(encodePattern(cLCT.getPattern()));
468  thisLCT.setMPCLink(0);
469  thisLCT.setBX0(0);
470  thisLCT.setSyncErr(0);
471  thisLCT.setCSCID(theTrigChamber);
472  thisLCT.setTrknmb(trknmb);
473  thisLCT.setWireGroup(aLCT.getKeyWG());
474  thisLCT.setStrip(cLCT.getKeyStrip());
475  thisLCT.setBend(cLCT.getBend());
476  // Bunch crossing: get it from cathode LCT if anode LCT is not there.
477  int bx = aLCT.isValid() ? aLCT.getBX() : cLCT.getBX();
478  thisLCT.setBX(bx);
479  thisLCT.setQuality(qualityAssignment_->findQuality(aLCT, cLCT));
480  if (runCCLUT_) {
481  thisLCT.setRun3(true);
482  // 4-bit slope value derived with the CCLUT algorithm
483  thisLCT.setSlope(cLCT.getSlope());
484  thisLCT.setQuartStripBit(cLCT.getQuartStripBit());
485  thisLCT.setEighthStripBit(cLCT.getEighthStripBit());
486  thisLCT.setRun3Pattern(cLCT.getRun3Pattern());
487  }
488 }
489 
490 // CLCT pattern number: encodes the pattern number itself
491 unsigned int CSCMotherboard::encodePattern(const int ptn) const {
492  const int kPatternBitWidth = 4;
493 
494  // In the TMB07 firmware, LCT pattern is just a 4-bit CLCT pattern.
495  unsigned int pattern = (abs(ptn) & ((1 << kPatternBitWidth) - 1));
496 
497  return pattern;
498 }
499 
501  // in each of the LCT time bins
502  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++) {
503  unsigned nLCTs = 0;
504 
505  std::vector<CSCCorrelatedLCTDigi> tempV;
506  // check each of the preferred combinations
507  for (unsigned int mbx = 0; mbx < match_trig_window_size; mbx++) {
508  // select at most 2
509  for (int i = 0; i < CSCConstants::MAX_LCTS_PER_CSC; i++) {
510  if (allLCTs_(bx, mbx, i).isValid() and nLCTs < 2) {
511  tempV.push_back(allLCTs_(bx, mbx, i));
512  ++nLCTs;
513  }
514  }
515  }
516  // store the best 2
517  for (const auto& lct : tempV) {
518  lctV.push_back(lct);
519  }
520  }
521 
522  // Show the pre-selected LCTs. They're not final yet. Some selection is done in the readoutLCTs function
523  if (infoV > 0) {
524  for (const auto& lct : lctV) {
525  LogDebug("CSCMotherboard") << "Selected LCT" << lct;
526  }
527  }
528 }
529 
531  // Make sure that the parameter values are within the allowed range.
532 
533  // Max expected values.
534  static const unsigned int max_mpc_block_me1a = 1 << 1;
535  static const unsigned int max_alct_trig_enable = 1 << 1;
536  static const unsigned int max_clct_trig_enable = 1 << 1;
537  static const unsigned int max_match_trig_enable = 1 << 1;
538  static const unsigned int max_match_trig_window_size = 1 << 4;
539  static const unsigned int max_tmb_l1a_window_size = 1 << 4;
540 
541  // Checks.
542  CSCBaseboard::checkConfigParameters(mpc_block_me1a, max_mpc_block_me1a, def_mpc_block_me1a, "mpc_block_me1a");
543  CSCBaseboard::checkConfigParameters(alct_trig_enable, max_alct_trig_enable, def_alct_trig_enable, "alct_trig_enable");
544  CSCBaseboard::checkConfigParameters(clct_trig_enable, max_clct_trig_enable, def_clct_trig_enable, "clct_trig_enable");
546  match_trig_enable, max_match_trig_enable, def_match_trig_enable, "match_trig_enable");
548  match_trig_window_size, max_match_trig_window_size, def_match_trig_window_size, "match_trig_window_size");
550  tmb_l1a_window_size, max_tmb_l1a_window_size, def_tmb_l1a_window_size, "tmb_l1a_window_size");
551 }
552 
554  std::ostringstream strm;
555  strm << "\n";
556  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
557  strm << "+ TMB configuration parameters: +\n";
558  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
559  strm << " mpc_block_me1a [block/not block triggers which come from ME1/A] = " << mpc_block_me1a << "\n";
560  strm << " alct_trig_enable [allow ALCT-only triggers] = " << alct_trig_enable << "\n";
561  strm << " clct_trig_enable [allow CLCT-only triggers] = " << clct_trig_enable << "\n";
562  strm << " match_trig_enable [allow matched ALCT-CLCT triggers] = " << match_trig_enable << "\n";
563  strm << " match_trig_window_size [ALCT-CLCT match window width, in 25 ns] = " << match_trig_window_size << "\n";
564  strm << " tmb_l1a_window_size [L1Accept window width, in 25 ns bins] = " << tmb_l1a_window_size << "\n";
565  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
566  LogDebug("CSCMotherboard") << strm.str();
567 }
568 
570  CSCALCTDigi aLCT_shifted = aLCT;
571  aLCT_shifted.setBX(aLCT_shifted.getBX() - (CSCConstants::LCT_CENTRAL_BX - CSCConstants::ALCT_CENTRAL_BX));
572  return aLCT_shifted;
573 }
574 
576  CSCCLCTDigi cLCT_shifted = cLCT;
577  cLCT_shifted.setBX(cLCT_shifted.getBX() - CSCConstants::ALCT_CLCT_OFFSET);
578  return cLCT_shifted;
579 }
580 
582  // get the high multiplicity
583  // for anode this reflects what is already in the anode CSCShowerDigi object
584  unsigned cathodeInTime = clctProc->getInTimeHMT();
585  unsigned anodeInTime = alctProc->getInTimeHMT();
586 
587  // assign the bits
588  unsigned inTimeHMT_;
589 
590  // set the value according to source
591  switch (showerSource_) {
592  case 0:
593  inTimeHMT_ = cathodeInTime;
594  break;
595  case 1:
596  inTimeHMT_ = anodeInTime;
597  break;
598  case 2:
599  inTimeHMT_ = anodeInTime | cathodeInTime;
600  break;
601  case 3:
602  inTimeHMT_ = anodeInTime & cathodeInTime;
603  break;
604  default:
605  inTimeHMT_ = cathodeInTime;
606  break;
607  };
608 
609  // create a new object
610  shower_ = CSCShowerDigi(inTimeHMT_, 0, theTrigChamber);
611 }
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:40
LCTContainer allLCTs_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
virtual std::vector< CSCCorrelatedLCTDigi > readoutLCTs() const
void setPattern(const uint16_t p)
set pattern
void setALCT(const CSCALCTDigi &alct)
uint16_t getBX() const
return BX - five low bits of BXN counter tagged by the ALCT
Definition: CSCALCTDigi.h:73
const CSCL1TPLookupTableME11ILT * lookupTableME11ILT_
std::vector< CSCCLCTDigi > clctV
unsigned int clct_trig_enable
void setESLookupTables(const CSCL1TPLookupTableCCLUT *conf)
unsigned int encodePattern(const int clctPattern) const
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
unsigned int match_trig_window_size
bool enableAlctPhase2_
Definition: CSCBaseboard.h:94
void setSlope(const uint16_t slope)
set the slope
static const unsigned int def_alct_trig_enable
void checkConfigParameters(unsigned int &var, const unsigned int var_max, const unsigned int var_def, const std::string &var_str)
uint16_t getQuality() const
return quality of a pattern (number of layers hit!)
Definition: CSCCLCTDigi.h:56
unsigned int tmbMpcBlockMe1a() const
uint16_t getKeyStrip(const uint16_t n=2) const
Definition: CSCCLCTDigi.cc:107
static const unsigned int def_mpc_block_me1a
void setQuartStripBit(const bool quartStripBit)
set single quart strip bit
bool getEighthStripBit() const
get single eighth strip bit
Definition: CSCCLCTDigi.h:114
void setEighthStripBit(const bool eighthStripBit)
set single eighth strip bit
std::vector< CSCCorrelatedLCTDigi > lctV
void setBend(const uint16_t b)
set bend
std::unique_ptr< CSCCathodeLCTProcessor > clctProc
static const unsigned int def_clct_trig_enable
Log< level::Error, false > LogError
void setValid(const uint16_t v)
set valid
unsigned int tmbTmbL1aWindowSize() const
#define LogTrace(id)
void copyValidToInValidALCT(CSCALCTDigi &, CSCALCTDigi &) const
CSCCLCTDigi getBXShiftedCLCT(const CSCCLCTDigi &) const
void setMatchTrigWindowSize(unsigned trig_window_size)
Definition: LCTContainer.h:41
unsigned int mpc_block_me1a
void setMPCLink(const uint16_t &link)
Set mpc link number after MPC sorting.
bool getQuartStripBit() const
get single quart strip bit
Definition: CSCCLCTDigi.h:108
const unsigned theTrigChamber
Definition: CSCBaseboard.h:46
void setWireGroup(const uint16_t wiregroup)
set wiregroup number
void correlateLCTs(const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, CSCCorrelatedLCTDigi &bLCT, CSCCorrelatedLCTDigi &sLCT, int type) const
unsigned int tmbMatchTrigWindowSize() const
std::vector< int > preferred_bx_match_
bool match_earliest_clct_only_
CSCMotherboard(unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf)
std::unique_ptr< CSCALCTCrossCLCT > cscOverlap_
static const unsigned int def_tmb_l1a_window_size
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
std::vector< CSCALCTDigi > alctV
void dumpConfigParams() const
uint16_t getKeyWG() const
return key wire group
Definition: CSCALCTDigi.h:67
uint16_t getBend() const
Definition: CSCCLCTDigi.h:93
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
unsigned int tmb_l1a_window_size
void checkConfigParameters()
unsigned int match_trig_enable
void copyValidToInValidCLCT(CSCCLCTDigi &, CSCCLCTDigi &) const
void setRun3Pattern(const uint16_t pattern)
set Run-3 pattern
void setBX0(const uint16_t b)
set bx0
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:50
CSCShowerDigi shower_
void setBX(const uint16_t BX)
set BX
Definition: CSCALCTDigi.h:76
const CSCGeometry * cscGeometry_
Definition: CSCBaseboard.h:71
edm::ParameterSet tmbParams_
Definition: CSCBaseboard.h:78
void setCSCID(const uint16_t c)
set cscID
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc)
void setRun3(const bool isRun3)
bool doesALCTCrossCLCT(const CSCALCTDigi &, const CSCCLCTDigi &) const
void setBX(const uint16_t b)
set bx
static const unsigned int def_match_trig_window_size
unsigned int tmbMatchTrigEnable() const
uint16_t getBX() const
return BX
Definition: CSCCLCTDigi.h:123
uint16_t getPattern() const
return pattern
Definition: CSCCLCTDigi.h:62
unsigned int alct_trig_enable
const CSCL1TPLookupTableME21ILT * lookupTableME21ILT_
void setBX(const uint16_t bx)
set bx
Definition: CSCCLCTDigi.h:129
std::unique_ptr< CSCAnodeLCTProcessor > alctProc
unsigned showerSource_
const CSCL1TPLookupTableCCLUT * lookupTableCCLUT_
uint16_t getSlope() const
return the slope
Definition: CSCCLCTDigi.h:74
unsigned int tmbClctTrigEnable() const
void setStrip(const uint16_t s)
set strip
void encodeHighMultiplicityBits()
unsigned int tmbAlctTrigEnable() const
uint16_t getRun3Pattern() const
return pattern
Definition: CSCCLCTDigi.h:68
void clear()
clear this CLCT
Definition: CSCCLCTDigi.cc:73
void clear()
clear this Shower
unsigned theRing
Definition: CSCBaseboard.h:48
void setQuality(const uint16_t q)
set quality code
CSCALCTDigi getBXShiftedALCT(const CSCALCTDigi &) const
Log< level::Warning, false > LogWarning
edm::ParameterSet showerParams_
Definition: CSCBaseboard.h:87
void setConfigParameters(const CSCDBL1TPParameters *conf)
std::unique_ptr< LCTQualityControl > qualityControl_
void setTrknmb(const uint16_t number)
Set track number (1,2) after sorting LCTs.
void setCLCT(const CSCCLCTDigi &clct)
static const unsigned int def_match_trig_enable
void setSyncErr(const uint16_t s)
set syncErr
CSCShowerDigi readoutShower() const
#define LogDebug(id)
std::unique_ptr< LCTQualityAssignment > qualityAssignment_
void constructLCTs(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT, int type, int trknmb, CSCCorrelatedLCTDigi &lct) const