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