CMS 3D CMS Logo

CSCAnodeLCTProcessor.cc
Go to the documentation of this file.
2 #include <set>
3 
4 // Default values of configuration parameters.
5 const unsigned int CSCAnodeLCTProcessor::def_fifo_tbins = 16;
6 const unsigned int CSCAnodeLCTProcessor::def_fifo_pretrig = 10;
7 const unsigned int CSCAnodeLCTProcessor::def_drift_delay = 2;
12 const unsigned int CSCAnodeLCTProcessor::def_trig_mode = 2; // 3?
13 const unsigned int CSCAnodeLCTProcessor::def_accel_mode = 0; // 1?
14 const unsigned int CSCAnodeLCTProcessor::def_l1a_window_width = 7; // 5?
15 
16 //----------------
17 // Constructors --
18 //----------------
19 
21  unsigned station,
22  unsigned sector,
23  unsigned subsector,
24  unsigned chamber,
25  const edm::ParameterSet& conf)
26  : CSCBaseboard(endcap, station, sector, subsector, chamber, conf) {
27  static std::atomic<bool> config_dumped{false};
28 
29  // ALCT configuration parameters.
30  fifo_tbins = alctParams_.getParameter<unsigned int>("alctFifoTbins");
31  fifo_pretrig = alctParams_.getParameter<unsigned int>("alctFifoPretrig");
32  drift_delay = alctParams_.getParameter<unsigned int>("alctDriftDelay");
33  nplanes_hit_pretrig = alctParams_.getParameter<unsigned int>("alctNplanesHitPretrig");
34  nplanes_hit_pattern = alctParams_.getParameter<unsigned int>("alctNplanesHitPattern");
35  nplanes_hit_accel_pretrig = alctParams_.getParameter<unsigned int>("alctNplanesHitAccelPretrig");
36  nplanes_hit_accel_pattern = alctParams_.getParameter<unsigned int>("alctNplanesHitAccelPattern");
37  trig_mode = alctParams_.getParameter<unsigned int>("alctTrigMode");
38  accel_mode = alctParams_.getParameter<unsigned int>("alctAccelMode");
39  l1a_window_width = alctParams_.getParameter<unsigned int>("alctL1aWindowWidth");
40 
41  hit_persist = alctParams_.getParameter<unsigned int>("alctHitPersist");
42 
43  // Verbosity level, set to 0 (no print) by default.
44  infoV = alctParams_.getParameter<int>("verbosity");
45 
46  // separate handle for early time bins
47  early_tbins = alctParams_.getParameter<int>("alctEarlyTbins");
48  if (early_tbins < 0)
50 
51  // delta BX time depth for ghostCancellationLogic
52  ghost_cancellation_bx_depth = alctParams_.getParameter<int>("alctGhostCancellationBxDepth");
53 
54  // whether to consider ALCT candidates' qualities while doing ghostCancellationLogic on +-1 wire groups
55  ghost_cancellation_side_quality = alctParams_.getParameter<bool>("alctGhostCancellationSideQuality");
56 
57  // deadtime clocks after pretrigger (extra in addition to drift_delay)
58  pretrig_extra_deadtime = alctParams_.getParameter<unsigned int>("alctPretrigDeadtime");
59 
60  // whether to use narrow pattern mask for the rings close to the beam
61  narrow_mask_r1 = alctParams_.getParameter<bool>("alctNarrowMaskForR1");
62 
63  // Check and print configuration parameters.
65  if ((infoV > 0 || (isSLHC_)) && !config_dumped) {
66  //std::cout<<"**** ALCT constructor parameters dump ****"<<std::endl;
68  config_dumped = true;
69  }
70 
71  numWireGroups = 0; // Will be set later.
72  MESelection = (theStation < 3) ? 0 : 1;
73 
74  // whether to calculate bx as corrected_bx instead of pretrigger one
75  use_corrected_bx = false;
76  if (isSLHC_) {
77  use_corrected_bx = alctParams_.getParameter<bool>("alctUseCorrectedBx");
78  }
79 
80  // Load appropriate pattern mask.
82 }
83 
85  // Used for debugging. -JM
86  static std::atomic<bool> config_dumped{false};
87 
88  // ALCT parameters.
90  infoV = 2;
91 
92  early_tbins = 4;
93 
94  // Check and print configuration parameters.
96  if (!config_dumped) {
97  //std::cout<<"**** ALCT default constructor parameters dump ****"<<std::endl;
99  config_dumped = true;
100  }
101 
103  MESelection = (theStation < 3) ? 0 : 1;
104 
105  // Load pattern mask.
106  loadPatternMask();
107 }
108 
110  // Load appropriate pattern mask.
111  for (int i_patt = 0; i_patt < CSCConstants::NUM_ALCT_PATTERNS; i_patt++) {
112  for (int i_wire = 0; i_wire < CSCConstants::MAX_WIRES_IN_PATTERN; i_wire++) {
113  pattern_mask[i_patt][i_wire] = CSCPatternBank::alct_pattern_mask_open[i_patt][i_wire];
114  if (narrow_mask_r1 && (theRing == 1 || theRing == 4))
115  pattern_mask[i_patt][i_wire] = CSCPatternBank::alct_pattern_mask_r1[i_patt][i_wire];
116  }
117  }
118 }
119 
121  // Set default values for configuration parameters.
132 }
133 
134 // Set configuration parameters obtained via EventSetup mechanism.
136  static std::atomic<bool> config_dumped{false};
137 
138  fifo_tbins = conf->alctFifoTbins();
139  fifo_pretrig = conf->alctFifoPretrig();
140  drift_delay = conf->alctDriftDelay();
145  trig_mode = conf->alctTrigMode();
146  accel_mode = conf->alctAccelMode();
148 
149  // Check and print configuration parameters.
151  if (!config_dumped) {
152  //std::cout<<"**** ALCT setConfigParam parameters dump ****"<<std::endl;
154  config_dumped = true;
155  }
156 }
157 
159  // Make sure that the parameter values are within the allowed range.
160 
161  // Max expected values.
162  static const unsigned int max_fifo_tbins = 1 << 5;
163  static const unsigned int max_fifo_pretrig = 1 << 5;
164  static const unsigned int max_drift_delay = 1 << 2;
165  static const unsigned int max_nplanes_hit_pretrig = 1 << 3;
166  static const unsigned int max_nplanes_hit_pattern = 1 << 3;
167  static const unsigned int max_nplanes_hit_accel_pretrig = 1 << 3;
168  static const unsigned int max_nplanes_hit_accel_pattern = 1 << 3;
169  static const unsigned int max_trig_mode = 1 << 2;
170  static const unsigned int max_accel_mode = 1 << 2;
171  static const unsigned int max_l1a_window_width = CSCConstants::MAX_ALCT_TBINS; // 4 bits
172 
173  // Checks.
174  CSCBaseboard::checkConfigParameters(fifo_tbins, max_fifo_tbins, def_fifo_tbins, "fifo_tbins");
175  CSCBaseboard::checkConfigParameters(fifo_pretrig, max_fifo_pretrig, def_fifo_pretrig, "fifo_pretrig");
176  CSCBaseboard::checkConfigParameters(drift_delay, max_drift_delay, def_drift_delay, "drift_delay");
178  nplanes_hit_pretrig, max_nplanes_hit_pretrig, def_nplanes_hit_pretrig, "nplanes_hit_pretrig");
180  nplanes_hit_pattern, max_nplanes_hit_pattern, def_nplanes_hit_pattern, "nplanes_hit_pattern");
182  max_nplanes_hit_accel_pretrig,
184  "nplanes_hit_accel_pretrig");
186  max_nplanes_hit_accel_pattern,
188  "nplanes_hit_accel_pattern");
189  CSCBaseboard::checkConfigParameters(trig_mode, max_trig_mode, def_trig_mode, "trig_mode");
190  CSCBaseboard::checkConfigParameters(accel_mode, max_accel_mode, def_accel_mode, "accel_mode");
191  CSCBaseboard::checkConfigParameters(l1a_window_width, max_l1a_window_width, def_l1a_window_width, "l1a_window_width");
192 }
193 
195  for (int bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++) {
196  bestALCT[bx].clear();
197  secondALCT[bx].clear();
198  for (int iALCT = 0; iALCT < CSCConstants::MAX_ALCTS_PER_PROCESSOR; iALCT++) {
199  ALCTContainer_[bx][iALCT].clear();
200  }
201  }
202  lct_list.clear();
203 }
204 
205 void CSCAnodeLCTProcessor::clear(const int wire, const int pattern) {
206  /* Clear the data off of selected pattern */
207  if (pattern == 0)
208  quality[wire][0] = -999;
209  else {
210  quality[wire][1] = -999;
211  quality[wire][2] = -999;
212  }
213 }
214 
215 std::vector<CSCALCTDigi> CSCAnodeLCTProcessor::run(const CSCWireDigiCollection* wiredc) {
216  static std::atomic<bool> config_dumped{false};
217  if ((infoV > 0 || (isSLHC_)) && !config_dumped) {
218  //std::cout<<"**** ALCT run parameters dump ****"<<std::endl;
220  config_dumped = true;
221  }
222 
223  // Get the number of wire groups for the given chamber. Do it only once
224  // per chamber.
225  if (numWireGroups == 0) {
226  if (cscChamber_) {
229  if (infoV >= 0)
230  edm::LogError("CSCAnodeLCTProcessor|SetupError")
231  << "+++ Number of wire groups, " << numWireGroups << " found in " << theCSCName_ << " (sector "
232  << theSector << " subsector " << theSubsector << " trig id. " << theTrigChamber << ")"
233  << " exceeds max expected, " << CSCConstants::MAX_NUM_WIRES << " +++\n"
234  << "+++ CSC geometry looks garbled; no emulation possible +++\n";
235  numWireGroups = -1;
236  }
237  } else {
238  if (infoV >= 0)
239  edm::LogError("CSCAnodeLCTProcessor|SetupError")
240  << "+++ " << theCSCName_ << " (sector " << theSector << " subsector " << theSubsector << " trig id. "
241  << theTrigChamber << ")"
242  << " is not defined in current geometry! +++\n"
243  << "+++ CSC geometry looks garbled; no emulation possible +++\n";
244  numWireGroups = -1;
245  }
246  }
247 
248  if (numWireGroups < 0) {
249  if (infoV >= 0)
250  edm::LogError("CSCAnodeLCTProcessor|SetupError")
251  << "+++ " << theCSCName_ << " (sector " << theSector << " subsector " << theSubsector << " trig id. "
252  << theTrigChamber << "):"
253  << " numWireGroups = " << numWireGroups << "; ALCT emulation skipped! +++";
254  std::vector<CSCALCTDigi> emptyV;
255  return emptyV;
256  }
257 
258  // Get wire digis in this chamber from wire digi collection.
259  bool noDigis = getDigis(wiredc);
260 
261  if (!noDigis) {
262  // First get wire times from the wire digis.
264  readWireDigis(wire);
265 
266  // Pass an array of wire times on to another run() doing the LCT search.
267  // If the number of layers containing digis is smaller than that
268  // required to trigger, quit right away.
269  const unsigned int min_layers =
273 
274  unsigned int layersHit = 0;
275  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
276  for (int i_wire = 0; i_wire < numWireGroups; i_wire++) {
277  if (!wire[i_layer][i_wire].empty()) {
278  layersHit++;
279  break;
280  }
281  }
282  }
283  if (layersHit >= min_layers)
284  run(wire);
285  }
286 
287  // Return vector of all found ALCTs.
288  return getALCTs();
289 }
290 
292  bool trigger = false;
293 
294  // Check if there are any in-time hits and do the pulse extension.
295  bool chamber_empty = pulseExtension(wire);
296 
297  // Take the best MAX_CLCTS_PER_PROCESSOR candidates per bx.
298  int ALCTIndex_[CSCConstants::MAX_ALCT_TBINS] = {};
299 
300  // Only do the rest of the processing if chamber is not empty.
301  // Stop drift_delay bx's short of fifo_tbins since at later bx's we will
302  // not have a full set of hits to start pattern search anyway.
303  unsigned int stop_bx = fifo_tbins - drift_delay;
304  if (!chamber_empty) {
305  for (int i_wire = 0; i_wire < numWireGroups; i_wire++) {
306  unsigned int start_bx = 0;
307  // Allow for more than one pass over the hits in the time window.
308  while (start_bx < stop_bx) {
309  if (preTrigger(i_wire, start_bx)) {
310  if (infoV > 2)
311  showPatterns(i_wire);
312  if (patternDetection(i_wire)) {
313  trigger = true;
314  int ghost_cleared[2] = {0, 0};
315  ghostCancellationLogicOneWire(i_wire, ghost_cleared);
316 
317  int bx = (use_corrected_bx) ? first_bx_corrected[i_wire] : first_bx[i_wire];
319  edm::LogError("CSCAnodeLCTProcessor")
320  << " bx of valid trigger : " << bx << " > max allowed value " << CSCConstants::MAX_ALCT_TBINS;
321 
322  //acceleration mode
323  if (quality[i_wire][0] > 0 and bx < CSCConstants::MAX_ALCT_TBINS) {
324  int valid = (ghost_cleared[0] == 0) ? 1 : 0; //cancelled, valid=0, otherwise it is 1
325  const auto& newALCT(CSCALCTDigi(valid, quality[i_wire][0], 1, 0, i_wire, bx));
326  lct_list.push_back(newALCT);
327  ALCTContainer_[bx][ALCTIndex_[bx]] = newALCT;
328  ALCTIndex_[bx]++;
329  if (infoV > 1)
330  LogTrace("CSCAnodeLCTProcessor") << "Add one ALCT to list " << lct_list.back();
331  }
332 
333  //collision mode
334  if (quality[i_wire][1] > 0 and bx < CSCConstants::MAX_ALCT_TBINS) {
335  int valid = (ghost_cleared[1] == 0) ? 1 : 0; //cancelled, valid=0, otherwise it is 1
336  const auto& newALCT(CSCALCTDigi(valid, quality[i_wire][1], 0, quality[i_wire][2], i_wire, bx));
337  lct_list.push_back(newALCT);
338  ALCTContainer_[bx][ALCTIndex_[bx]] = newALCT;
339  ALCTIndex_[bx]++;
340  if (infoV > 1)
341  LogTrace("CSCAnodeLCTProcessor") << "Add one ALCT to list " << lct_list.back();
342  }
343 
344  //break;
345  // Assume that the earliest time when another pre-trigger can
346  // occur in case pattern detection failed is bx_pretrigger+4:
347  // this seems to match the data.
348  start_bx = first_bx[i_wire] + drift_delay + pretrig_extra_deadtime;
349  } else {
350  //only pretrigger, no trigger ==> no dead time, continue to find next pretrigger
351  start_bx = first_bx[i_wire] + 1;
352  }
353  } else { //no pretrigger, skip this wiregroup
354  break;
355  }
356  } // end of while
357  }
358  }
359 
360  // Do the rest only if there is at least one trigger candidate.
361  if (trigger) {
362  //ghostCancellationLogic();
363  lctSearch();
364  }
365 }
366 
368  // Routine for getting digis and filling digiV vector.
369  bool noDigis = true;
370 
371  // Loop over layers and save wire digis on each one into digiV[layer].
372  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
373  digiV[i_layer].clear();
374 
375  CSCDetId detid(theEndcap, theStation, theRing, theChamber, i_layer + 1);
376  getDigis(wiredc, detid);
377 
378  // If this is ME1/1, fetch digis in corresponding ME1/A (ring=4) as well.
379  if (isME11_ && !disableME1a_) {
380  CSCDetId detid_me1a(theEndcap, theStation, 4, theChamber, i_layer + 1);
381  getDigis(wiredc, detid_me1a);
382  }
383 
384  if (!digiV[i_layer].empty()) {
385  noDigis = false;
386  if (infoV > 1) {
387  LogTrace("CSCAnodeLCTProcessor") << "found " << digiV[i_layer].size() << " wire digi(s) in layer " << i_layer
388  << " of " << theCSCName_ << " (trig. sector " << theSector << " subsector "
389  << theSubsector << " id " << theTrigChamber << ")";
390  for (const auto& wd : digiV[i_layer]) {
391  LogTrace("CSCAnodeLCTProcessor") << " " << wd;
392  }
393  }
394  }
395  }
396 
397  return noDigis;
398 }
399 
401  CSCWireDigiCollection::Range rwired = wiredc->get(id);
402  for (CSCWireDigiCollection::const_iterator digiIt = rwired.first; digiIt != rwired.second; ++digiIt) {
403  digiV[id.layer() - 1].push_back(*digiIt);
404  }
405 }
406 
408  // Loop over all 6 layers.
409  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
410  // Loop over all digis in the layer and find the wireGroup and bx
411  // time for each.
412  for (const auto& wd : digiV[i_layer]) {
413  int i_wire = wd.getWireGroup() - 1;
414  std::vector<int> bx_times = wd.getTimeBinsOn();
415 
416  // Check that the wires and times are appropriate.
417  if (i_wire < 0 || i_wire >= numWireGroups) {
418  if (infoV >= 0)
419  edm::LogWarning("CSCAnodeLCTProcessor|WrongInput")
420  << "+++ Found wire digi with wrong wire number = " << i_wire << " (max wires = " << numWireGroups
421  << "); skipping it... +++\n";
422  continue;
423  }
424  // Accept digis in expected time window. Total number of time
425  // bins in DAQ readout is given by fifo_tbins, which thus
426  // determines the maximum length of time interval. Anode raw
427  // hits in DAQ readout start (fifo_pretrig - 6) clocks before
428  // L1Accept. If times earlier than L1Accept were recorded, we
429  // use them since they can modify the ALCTs found later, via
430  // ghost-cancellation logic.
431  int last_time = -999;
432  if (bx_times.size() == fifo_tbins) {
433  wire[i_layer][i_wire].push_back(0);
434  wire[i_layer][i_wire].push_back(6);
435  } else {
436  for (unsigned int i = 0; i < bx_times.size(); i++) {
437  // Find rising edge change
438  if (i > 0 && bx_times[i] == (bx_times[i - 1] + 1))
439  continue;
440  if (bx_times[i] < static_cast<int>(fifo_tbins)) {
441  if (infoV > 2)
442  LogTrace("CSCAnodeLCTProcessor")
443  << "Digi on layer " << i_layer << " wire " << i_wire << " at time " << bx_times[i];
444 
445  // Finally save times of hit wires. One shot module will
446  // not restart if a new pulse comes before the expiration
447  // of the 6-bx period.
448  if (last_time < 0 || ((bx_times[i] - last_time) >= 6)) {
449  wire[i_layer][i_wire].push_back(bx_times[i]);
450  last_time = bx_times[i];
451  }
452  } else {
453  if (infoV > 1)
454  LogTrace("CSCAnodeLCTProcessor") << "+++ Skipping wire digi: wire = " << i_wire << " layer = " << i_layer
455  << ", bx = " << bx_times[i] << " +++";
456  }
457  }
458  }
459  }
460  }
461 }
462 
464  const std::vector<int> wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) {
465  bool chamber_empty = true;
466  int i_wire, i_layer, digi_num;
467  const unsigned int bits_in_pulse = 8 * sizeof(pulse[0][0]);
468 
469  for (i_wire = 0; i_wire < numWireGroups; i_wire++) {
470  for (i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
471  pulse[i_layer][i_wire] = 0;
472  }
473  first_bx[i_wire] = -999;
474  first_bx_corrected[i_wire] = -999;
475  for (int j = 0; j < 3; j++)
476  quality[i_wire][j] = -999;
477  }
478 
479  for (i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
480  digi_num = 0;
481  for (i_wire = 0; i_wire < numWireGroups; i_wire++) {
482  if (!wire[i_layer][i_wire].empty()) {
483  std::vector<int> bx_times = wire[i_layer][i_wire];
484  for (unsigned int i = 0; i < bx_times.size(); i++) {
485  // Check that min and max times are within the allowed range.
486  if (bx_times[i] < 0 || bx_times[i] + hit_persist >= bits_in_pulse) {
487  if (infoV > 0)
488  edm::LogWarning("CSCAnodeLCTProcessor|OutOfTimeDigi")
489  << "+++ BX time of wire digi (wire = " << i_wire << " layer = " << i_layer << ") bx = " << bx_times[i]
490  << " is not within the range (0-" << bits_in_pulse
491  << "] allowed for pulse extension. Skip this digi! +++\n";
492  continue;
493  }
494 
495  // Found at least one in-time digi; set chamber_empty to false
496  if (chamber_empty)
497  chamber_empty = false;
498 
499  // make the pulse
500  for (unsigned int bx = bx_times[i]; bx < (bx_times[i] + hit_persist); bx++)
501  pulse[i_layer][i_wire] = pulse[i_layer][i_wire] | (1 << bx);
502 
503  // Debug information.
504  if (infoV > 1) {
505  LogTrace("CSCAnodeLCTProcessor") << "Wire digi: layer " << i_layer << " digi #" << ++digi_num
506  << " wire group " << i_wire << " time " << bx_times[i];
507  if (infoV > 2) {
508  std::ostringstream strstrm;
509  for (int i = 1; i <= 32; i++) {
510  strstrm << ((pulse[i_layer][i_wire] >> (32 - i)) & 1);
511  }
512  LogTrace("CSCAnodeLCTProcessor") << " Pulse: " << strstrm.str();
513  }
514  }
515  }
516  }
517  }
518  }
519 
520  if (infoV > 1 && !chamber_empty) {
521  dumpDigis(wire);
522  }
523 
524  return chamber_empty;
525 }
526 
527 bool CSCAnodeLCTProcessor::preTrigger(const int key_wire, const int start_bx) {
528  int nPreTriggers = 0;
529 
530  unsigned int layers_hit;
531  bool hit_layer[CSCConstants::NUM_LAYERS];
532  int this_layer, this_wire;
533  // If nplanes_hit_accel_pretrig is 0, the firmware uses the value
534  // of nplanes_hit_pretrig instead.
535  const unsigned int nplanes_hit_pretrig_acc =
537  const unsigned int pretrig_thresh[CSCConstants::NUM_ALCT_PATTERNS] = {
538  nplanes_hit_pretrig_acc, nplanes_hit_pretrig, nplanes_hit_pretrig};
539 
540  // Loop over bx times, accelerator and collision patterns to
541  // look for pretrigger.
542  // Stop drift_delay bx's short of fifo_tbins since at later bx's we will
543  // not have a full set of hits to start pattern search anyway.
544  unsigned int stop_bx = fifo_tbins - drift_delay;
545  for (unsigned int bx_time = start_bx; bx_time < stop_bx; bx_time++) {
546  for (int i_pattern = 0; i_pattern < CSCConstants::NUM_ALCT_PATTERNS; i_pattern++) {
547  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++)
548  hit_layer[i_layer] = false;
549  layers_hit = 0;
550 
551  for (int i_wire = 0; i_wire < CSCConstants::MAX_WIRES_IN_PATTERN; i_wire++) {
552  if (pattern_mask[i_pattern][i_wire] != 0) {
553  this_layer = CSCPatternBank::alct_pattern_envelope[i_wire];
554  this_wire = CSCPatternBank::alct_keywire_offset[MESelection][i_wire] + key_wire;
555  if ((this_wire >= 0) && (this_wire < numWireGroups)) {
556  // Perform bit operation to see if pulse is 1 at a certain bx_time.
557  if (((pulse[this_layer][this_wire] >> bx_time) & 1) == 1) {
558  // Store number of layers hit.
559  if (hit_layer[this_layer] == false) {
560  hit_layer[this_layer] = true;
561  layers_hit++;
562  }
563 
564  // See if number of layers hit is greater than or equal to
565  // pretrig_thresh.
566  if (layers_hit >= pretrig_thresh[i_pattern]) {
567  first_bx[key_wire] = bx_time;
568  if (infoV > 1) {
569  LogTrace("CSCAnodeLCTProcessor") << "Pretrigger was satisfied for wire: " << key_wire
570  << " pattern: " << i_pattern << " bx_time: " << bx_time;
571  }
572  // make a new pre-trigger
573  nPreTriggers++;
574  // make a new pre-trigger digi
575  // useful for calculating DAQ rates
576  thePreTriggerDigis.emplace_back(
577  CSCALCTPreTriggerDigi(1, layers_hit - 3, 0, 0, this_wire, bx_time, nPreTriggers));
578  return true;
579  }
580  }
581  }
582  }
583  }
584  }
585  }
586  // If the pretrigger was never satisfied, then return false.
587  return false;
588 }
589 
590 bool CSCAnodeLCTProcessor::patternDetection(const int key_wire) {
591  bool trigger = false;
592  bool hit_layer[CSCConstants::NUM_LAYERS];
593  unsigned int temp_quality;
594  int this_layer, this_wire, delta_wire;
595  // If nplanes_hit_accel_pattern is 0, the firmware uses the value
596  // of nplanes_hit_pattern instead.
597  const unsigned int nplanes_hit_pattern_acc =
599  const unsigned int pattern_thresh[CSCConstants::NUM_ALCT_PATTERNS] = {
600  nplanes_hit_pattern_acc, nplanes_hit_pattern, nplanes_hit_pattern};
601  const std::string ptn_label[] = {"Accelerator", "CollisionA", "CollisionB"};
602 
603  for (int i_pattern = 0; i_pattern < CSCConstants::NUM_ALCT_PATTERNS; i_pattern++) {
604  temp_quality = 0;
605  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++)
606  hit_layer[i_layer] = false;
607 
608  double num_pattern_hits = 0., times_sum = 0.;
609  std::multiset<int> mset_for_median;
610  mset_for_median.clear();
611 
612  for (int i_wire = 0; i_wire < CSCConstants::MAX_WIRES_IN_PATTERN; i_wire++) {
613  if (pattern_mask[i_pattern][i_wire] != 0) {
614  this_layer = CSCPatternBank::alct_pattern_envelope[i_wire];
615  delta_wire = CSCPatternBank::alct_keywire_offset[MESelection][i_wire];
616  this_wire = delta_wire + key_wire;
617  if ((this_wire >= 0) && (this_wire < numWireGroups)) {
618  // Wait a drift_delay time later and look for layers hit in
619  // the pattern.
620  if (((pulse[this_layer][this_wire] >> (first_bx[key_wire] + drift_delay)) & 1) == 1) {
621  // If layer has never had a hit before, then increment number
622  // of layer hits.
623  if (hit_layer[this_layer] == false) {
624  temp_quality++;
625  // keep track of which layers already had hits.
626  hit_layer[this_layer] = true;
627  if (infoV > 1)
628  LogTrace("CSCAnodeLCTProcessor")
629  << "bx_time: " << first_bx[key_wire] << " pattern: " << i_pattern << " keywire: " << key_wire
630  << " layer: " << this_layer << " quality: " << temp_quality;
631  }
632 
633  // for averaged time use only the closest WGs around the key WG
634  if (abs(delta_wire) < 2) {
635  // find at what bx did pulse on this wire&layer start
636  // use hit_pesrist constraint on how far back we can go
637  int first_bx_layer = first_bx[key_wire] + drift_delay;
638  for (unsigned int dbx = 0; dbx < hit_persist; dbx++) {
639  if (((pulse[this_layer][this_wire] >> (first_bx_layer - 1)) & 1) == 1)
640  first_bx_layer--;
641  else
642  break;
643  }
644  times_sum += (double)first_bx_layer;
645  num_pattern_hits += 1.;
646  mset_for_median.insert(first_bx_layer);
647  if (infoV > 2)
648  LogTrace("CSCAnodeLCTProcessor") << " 1st bx in layer: " << first_bx_layer << " sum bx: " << times_sum
649  << " #pat. hits: " << num_pattern_hits;
650  }
651  }
652  }
653  }
654  }
655 
656  // calculate median
657  const int sz = mset_for_median.size();
658  if (sz > 0) {
659  std::multiset<int>::iterator im = mset_for_median.begin();
660  if (sz > 1)
661  std::advance(im, sz / 2 - 1);
662  if (sz == 1)
663  first_bx_corrected[key_wire] = *im;
664  else if ((sz % 2) == 1)
665  first_bx_corrected[key_wire] = *(++im);
666  else
667  first_bx_corrected[key_wire] = ((*im) + (*(++im))) / 2;
668 
669 #if defined(EDM_ML_DEBUG)
670  if (infoV > 1) {
671  auto lt = LogTrace("CSCAnodeLCTProcessor")
672  << "bx=" << first_bx[key_wire] << " bx_cor=" << first_bx_corrected[key_wire] << " bxset=";
673  for (im = mset_for_median.begin(); im != mset_for_median.end(); im++) {
674  lt << " " << *im;
675  }
676  }
677 #endif
678  }
679 
680  if (temp_quality >= pattern_thresh[i_pattern]) {
681  trigger = true;
682 
683  // Quality definition changed on 22 June 2007: it no longer depends
684  // on pattern_thresh.
685  temp_quality = getTempALCTQuality(temp_quality);
686 
687  if (i_pattern == 0) {
688  // Accelerator pattern
689  quality[key_wire][0] = temp_quality;
690  } else {
691  // Only one collision pattern (of the best quality) is reported
692  if (static_cast<int>(temp_quality) > quality[key_wire][1]) {
693  quality[key_wire][1] = temp_quality; //real quality
694  quality[key_wire][2] = i_pattern - 1; // pattern, left or right
695  }
696  }
697  if (infoV > 1) {
698  LogTrace("CSCAnodeLCTProcessor") << "Pattern found; keywire: " << key_wire << " type: " << ptn_label[i_pattern]
699  << " quality: " << temp_quality << "\n";
700  }
701  }
702  }
703  if (infoV > 1 && quality[key_wire][1] > 0) {
704  if (quality[key_wire][2] == 0)
705  LogTrace("CSCAnodeLCTProcessor") << "Collision Pattern A is chosen"
706  << "\n";
707  else if (quality[key_wire][2] == 1)
708  LogTrace("CSCAnodeLCTProcessor") << "Collision Pattern B is chosen"
709  << "\n";
710  }
711 
712  trigMode(key_wire);
713 
714  return trigger;
715 }
716 
718  int ghost_cleared[CSCConstants::MAX_NUM_WIRES][2];
719 
720  for (int key_wire = 0; key_wire < numWireGroups; key_wire++) {
721  for (int i_pattern = 0; i_pattern < 2; i_pattern++) {
722  ghost_cleared[key_wire][i_pattern] = 0;
723 
724  // Non-empty wire group.
725  int qual_this = quality[key_wire][i_pattern];
726  if (qual_this > 0) {
727  // Previous wire.
728  int qual_prev = (key_wire > 0) ? quality[key_wire - 1][i_pattern] : 0;
729  if (qual_prev > 0) {
730  int dt = first_bx[key_wire] - first_bx[key_wire - 1];
731  // Cancel this wire
732  // 1) If the candidate at the previous wire is at the same bx
733  // clock and has better quality (or equal quality - this has
734  // been implemented only in 2004).
735  // 2) If the candidate at the previous wire is up to 4 clocks
736  // earlier, regardless of quality.
737  if (dt == 0) {
738  if (qual_prev >= qual_this)
739  ghost_cleared[key_wire][i_pattern] = 1;
740  } else if (dt > 0 && dt <= ghost_cancellation_bx_depth) {
741  if ((!ghost_cancellation_side_quality) || (qual_prev > qual_this))
742  ghost_cleared[key_wire][i_pattern] = 1;
743  }
744  }
745 
746  // Next wire.
747  // Skip this step if this wire is already declared "ghost".
748  if (ghost_cleared[key_wire][i_pattern] == 1) {
749  if (infoV > 1)
750  LogTrace("CSCAnodeLCTProcessor")
751  << ((i_pattern == 0) ? "Accelerator" : "Collision") << " pattern ghost cancelled on key_wire "
752  << key_wire << " q=" << qual_this << " by wire " << key_wire - 1 << " q=" << qual_prev;
753  continue;
754  }
755 
756  int qual_next = (key_wire < numWireGroups - 1) ? quality[key_wire + 1][i_pattern] : 0;
757  if (qual_next > 0) {
758  int dt = first_bx[key_wire] - first_bx[key_wire + 1];
759  // Same cancellation logic as for the previous wire.
760  if (dt == 0) {
761  if (qual_next > qual_this)
762  ghost_cleared[key_wire][i_pattern] = 1;
763  } else if (dt > 0 && dt <= ghost_cancellation_bx_depth) {
764  if ((!ghost_cancellation_side_quality) || (qual_next >= qual_this))
765  ghost_cleared[key_wire][i_pattern] = 1;
766  }
767  }
768  if (ghost_cleared[key_wire][i_pattern] == 1) {
769  if (infoV > 1)
770  LogTrace("CSCAnodeLCTProcessor")
771  << ((i_pattern == 0) ? "Accelerator" : "Collision") << " pattern ghost cancelled on key_wire "
772  << key_wire << " q=" << qual_this << " by wire " << key_wire + 1 << " q=" << qual_next;
773  continue;
774  }
775  }
776  }
777  }
778 
779  // All cancellation is done in parallel, so wiregroups do not know what
780  // their neighbors are cancelling.
781  // namely, if wiregroup 10, 11, 12 all have trigger and same quality, only wiregroup 10 can keep the trigger
782  for (int key_wire = 0; key_wire < numWireGroups; key_wire++) {
783  for (int i_pattern = 0; i_pattern < 2; i_pattern++) {
784  if (ghost_cleared[key_wire][i_pattern] > 0) {
785  clear(key_wire, i_pattern);
786  }
787  }
788  }
789 }
790 
791 void CSCAnodeLCTProcessor::ghostCancellationLogicOneWire(const int key_wire, int* ghost_cleared) {
792  //int ghost_cleared[2];
793 
794  for (int i_pattern = 0; i_pattern < 2; i_pattern++) {
795  ghost_cleared[i_pattern] = 0;
796  if (key_wire == 0)
797  continue; //ignore
798 
799  // Non-empty wire group.
800  int qual_this = quality[key_wire][i_pattern];
801  if (qual_this > 0) {
802  // Previous wire.
803  //int qual_prev = (key_wire > 0) ? quality[key_wire-1][i_pattern] : 0;
804  //previous ALCTs were pushed to lct_list, stop use the array quality[key_wire-1][i_pattern]
805  for (auto& p : lct_list) {
806  //ignore whether ALCT is valid or not in ghost cancellation
807  //if wiregroup 10, 11, 12 all have trigger and same quality, only wiregroup 10 can keep the trigger
808  //this met with firmware
809  if (not(p.getKeyWG() == key_wire - 1 and 1 - p.getAccelerator() == i_pattern))
810  continue;
811 
812  bool ghost_cleared_prev = false;
813  int qual_prev = p.getQuality();
814  int first_bx_prev = p.getBX();
815  if (infoV > 1)
816  LogTrace("CSCAnodeLCTProcessor")
817  << "ghost concellation logic " << ((i_pattern == 0) ? "Accelerator" : "Collision") << " key_wire "
818  << key_wire << " quality " << qual_this << " bx " << first_bx[key_wire] << " previous key_wire "
819  << key_wire - 1 << " quality " << qual_prev << " bx " << first_bx[key_wire - 1];
820 
821  //int dt = first_bx[key_wire] - first_bx[key_wire-1];
822  int dt = first_bx[key_wire] - first_bx_prev;
823  // Cancel this wire
824  // 1) If the candidate at the previous wire is at the same bx
825  // clock and has better quality (or equal quality - this has
826  // been implemented only in 2004).
827  // 2) If the candidate at the previous wire is up to 4 clocks
828  // earlier, regardless of quality.
829  if (dt == 0) {
830  if (qual_prev >= qual_this)
831  ghost_cleared[i_pattern] = 1;
832  else if (qual_prev < qual_this)
833  ghost_cleared_prev = true;
834  } else if (dt > 0 && dt <= ghost_cancellation_bx_depth) {
835  if ((!ghost_cancellation_side_quality) || (qual_prev > qual_this))
836  ghost_cleared[i_pattern] = 1;
837  } else if (dt < 0 && dt * (-1) <= ghost_cancellation_bx_depth) {
838  if ((!ghost_cancellation_side_quality) || (qual_prev < qual_this))
839  ghost_cleared_prev = true;
840  }
841 
842  if (ghost_cleared[i_pattern] == 1) {
843  if (infoV > 1)
844  LogTrace("CSCAnodeLCTProcessor")
845  << ((i_pattern == 0) ? "Accelerator" : "Collision") << " pattern ghost cancelled on key_wire "
846  << key_wire << " q=" << qual_this << " by wire " << key_wire - 1 << " q=" << qual_prev;
847  //cancellation for key_wire is done when ALCT is created and pushed to lct_list
848  }
849 
850  if (ghost_cleared_prev) {
851  if (infoV > 1)
852  LogTrace("CSCAnodeLCTProcessor")
853  << ((i_pattern == 0) ? "Accelerator" : "Collision") << " pattern ghost cancelled on key_wire "
854  << key_wire - 1 << " q=" << qual_prev << " by wire " << key_wire << " q=" << qual_this;
855  p.setValid(0); //clean prev ALCT
856  }
857  }
858 
859  } // if qual_this > 0
860  } //i_pattern
861 }
862 
864  // Best track selector selects two collision and two accelerator ALCTs
865  // with the best quality per time bin.
866  const std::vector<CSCALCTDigi>& fourBest = bestTrackSelector(lct_list);
867 
868  if (infoV > 0) {
869  int n_alct_all = 0, n_alct = 0;
870  for (const auto& p : lct_list) {
871  if (p.isValid() && p.getBX() == CSCConstants::LCT_CENTRAL_BX)
872  n_alct_all++;
873  }
874  for (const auto& p : fourBest) {
875  if (p.isValid() && p.getBX() == CSCConstants::LCT_CENTRAL_BX)
876  n_alct++;
877  }
878 
879  LogTrace("CSCAnodeLCTProcessor") << "alct_count E:" << theEndcap << "S:" << theStation << "R:" << theRing
880  << "C:" << theChamber << " all " << n_alct_all << " found " << n_alct;
881  }
882 
883  // Select two best of four per time bin, based on quality and
884  // accel_mode parameter.
885  for (const auto& p : fourBest) {
886  const int bx = p.getBX();
888  if (infoV > 0)
889  edm::LogWarning("CSCAnodeLCTProcessor|OutOfTimeALCT")
890  << "+++ Bx of ALCT candidate, " << bx << ", exceeds max allowed, " << CSCConstants::MAX_ALCT_TBINS - 1
891  << "; skipping it... +++\n";
892  continue;
893  }
894 
895  if (isBetterALCT(p, bestALCT[bx])) {
897  secondALCT[bx] = bestALCT[bx];
898  }
899  bestALCT[bx] = p;
900  } else if (isBetterALCT(p, secondALCT[bx])) {
901  secondALCT[bx] = p;
902  }
903  }
904 
905  for (int bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++) {
906  if (bestALCT[bx].isValid()) {
907  bestALCT[bx].setTrknmb(1);
908  if (infoV > 0) {
909  LogDebug("CSCAnodeLCTProcessor") << bestALCT[bx] << " fullBX = " << bestALCT[bx].getFullBX() << " found in "
910  << theCSCName_ << " (sector " << theSector << " subsector " << theSubsector
911  << " trig id. " << theTrigChamber << ")"
912  << "\n";
913  }
914  if (secondALCT[bx].isValid()) {
915  secondALCT[bx].setTrknmb(2);
916  if (infoV > 0) {
917  LogDebug("CSCAnodeLCTProcessor")
918  << secondALCT[bx] << " fullBX = " << secondALCT[bx].getFullBX() << " found in " << theCSCName_
919  << " (sector " << theSector << " subsector " << theSubsector << " trig id. " << theTrigChamber << ")"
920  << "\n";
921  }
922  }
923  }
924  }
925 
926  // set track number for the other ALCTs
927  for (int bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++) {
928  for (int iALCT = 0; iALCT < CSCConstants::MAX_ALCTS_PER_PROCESSOR; iALCT++) {
929  if (ALCTContainer_[bx][iALCT].isValid()) {
930  ALCTContainer_[bx][iALCT].setTrknmb(iALCT + 1);
931  if (infoV > 0) {
932  LogDebug("CSCAnodeLCTProcessor")
933  << ALCTContainer_[bx][iALCT] << " found in " << theCSCName_ << " (sector " << theSector << " subsector "
934  << theSubsector << " trig id. " << theTrigChamber << ")"
935  << "\n";
936  }
937  }
938  }
939  }
940 }
941 
942 std::vector<CSCALCTDigi> CSCAnodeLCTProcessor::bestTrackSelector(const std::vector<CSCALCTDigi>& all_alcts) {
945 
946  if (infoV > 1) {
947  LogTrace("CSCAnodeLCTProcessor") << all_alcts.size() << " ALCTs at the input of best-track selector: ";
948  for (const auto& p : all_alcts) {
949  if (!p.isValid())
950  continue;
951  LogTrace("CSCAnodeLCTProcessor") << p;
952  }
953  }
954 
957  for (const auto& p : all_alcts) {
958  if (!p.isValid())
959  continue;
960 
961  // Select two collision and two accelerator ALCTs with the highest
962  // quality at every bx. The search for best ALCTs is done in parallel
963  // for collision and accelerator patterns, and simultaneously for
964  // two ALCTs, tA and tB. If two or more ALCTs have equal qualities,
965  // the priority is given to the ALCT with larger wiregroup number
966  // in the search for tA (collision and accelerator), and to the ALCT
967  // with smaller wiregroup number in the search for tB.
968  int bx = p.getBX();
969  int accel = p.getAccelerator();
970  int qual = p.getQuality();
971  int wire = p.getKeyWG();
972  bool vA = tA[bx][accel].isValid();
973  bool vB = tB[bx][accel].isValid();
974  int qA = tA[bx][accel].getQuality();
975  int qB = tB[bx][accel].getQuality();
976  int wA = tA[bx][accel].getKeyWG();
977  int wB = tB[bx][accel].getKeyWG();
978  if (!vA || qual > qA || (qual == qA && wire > wA)) {
979  tA[bx][accel] = p;
980  }
981  if (!vB || qual > qB || (qual == qB && wire < wB)) {
982  tB[bx][accel] = p;
983  }
984  }
985 
986  for (int bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++) {
987  for (int accel = 0; accel <= 1; accel++) {
988  // Best ALCT is always tA.
989  if (tA[bx][accel].isValid()) {
990  if (infoV > 2) {
991  LogTrace("CSCAnodeLCTProcessor") << "tA: " << tA[bx][accel];
992  LogTrace("CSCAnodeLCTProcessor") << "tB: " << tB[bx][accel];
993  }
994  bestALCTs[bx][accel] = tA[bx][accel];
995 
996  // If tA exists, tB exists too.
997  if (tA[bx][accel] != tB[bx][accel] && tA[bx][accel].getQuality() == tB[bx][accel].getQuality()) {
998  secondALCTs[bx][accel] = tB[bx][accel];
999  } else {
1000  // Funny part: if tA and tB are the same, or the quality of tB
1001  // is inferior to the quality of tA, the second best ALCT is
1002  // not tB. Instead it is the largest-wiregroup ALCT among those
1003  // ALCT whose qualities are lower than the quality of the best one.
1004  for (const auto& p : all_alcts) {
1005  if (p.isValid() && p.getAccelerator() == accel && p.getBX() == bx &&
1006  p.getQuality() < bestALCTs[bx][accel].getQuality() &&
1007  p.getQuality() >= secondALCTs[bx][accel].getQuality() &&
1008  p.getKeyWG() >= secondALCTs[bx][accel].getKeyWG()) {
1009  secondALCTs[bx][accel] = p;
1010  }
1011  }
1012  }
1013  }
1014  }
1015  }
1016 
1017  // Fill the vector with up to four best ALCTs per bx and return it.
1018  std::vector<CSCALCTDigi> fourBest;
1019  for (int bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++) {
1020  for (int i = 0; i < CSCConstants::MAX_ALCTS_PER_PROCESSOR; i++) {
1021  if (bestALCTs[bx][i].isValid()) {
1022  fourBest.push_back(bestALCTs[bx][i]);
1023  }
1024  }
1025  for (int i = 0; i < CSCConstants::MAX_ALCTS_PER_PROCESSOR; i++) {
1026  if (secondALCTs[bx][i].isValid()) {
1027  fourBest.push_back(secondALCTs[bx][i]);
1028  }
1029  }
1030  }
1031 
1032  if (infoV > 1) {
1033  LogTrace("CSCAnodeLCTProcessor") << fourBest.size() << " ALCTs selected: ";
1034  for (const auto& p : fourBest) {
1035  LogTrace("CSCAnodeLCTProcessor") << p;
1036  }
1037  }
1038 
1039  return fourBest;
1040 }
1041 
1042 bool CSCAnodeLCTProcessor::isBetterALCT(const CSCALCTDigi& lhsALCT, const CSCALCTDigi& rhsALCT) const {
1043  bool returnValue = false;
1044 
1045  if (lhsALCT.isValid() && !rhsALCT.isValid()) {
1046  return true;
1047  }
1048 
1049  // ALCTs found at earlier bx times are ranked higher than ALCTs found at
1050  // later bx times regardless of the quality.
1051  if (lhsALCT.getBX() < rhsALCT.getBX()) {
1052  returnValue = true;
1053  }
1054  if (lhsALCT.getBX() != rhsALCT.getBX()) {
1055  return returnValue;
1056  }
1057 
1058  // First check the quality of ALCTs.
1059  const int qual1 = lhsALCT.getQuality();
1060  const int qual2 = rhsALCT.getQuality();
1061  if (qual1 > qual2) {
1062  returnValue = true;
1063  }
1064  // If qualities are the same, check accelerator bits of both ALCTs.
1065  // If they are not the same, rank according to accel_mode value.
1066  // If they are the same, keep the track selector assignment.
1067  //else if (qual1 == qual2 &&
1068  // lhsALCT.getAccelerator() != rhsALCT.getAccelerator() &&
1069  // quality[lhsALCT.getKeyWG()][1-lhsALCT.getAccelerator()] >
1070  // quality[rhsALCT.getKeyWG()][1-rhsALCT.getAccelerator()])
1071  // {returnValue = true;}
1072  else if (qual1 == qual2 && lhsALCT.getAccelerator() != rhsALCT.getAccelerator()) {
1073  if ((accel_mode == 0 || accel_mode == 1) && rhsALCT.getAccelerator() == 0)
1074  returnValue = true;
1075  if ((accel_mode == 2 || accel_mode == 3) && lhsALCT.getAccelerator() == 0)
1076  returnValue = true;
1077  }
1078 
1079  return returnValue;
1080 }
1081 
1082 void CSCAnodeLCTProcessor::trigMode(const int key_wire) {
1083  switch (trig_mode) {
1084  default:
1085  case 0:
1086  // Enables both collision and accelerator tracks
1087  break;
1088  case 1:
1089  // Disables collision tracks
1090  if (quality[key_wire][1] > 0) {
1091  quality[key_wire][1] = 0;
1092  if (infoV > 1)
1093  LogTrace("CSCAnodeLCTProcessor") << "trigMode(): collision track " << key_wire << " disabled"
1094  << "\n";
1095  }
1096  break;
1097  case 2:
1098  // Disables accelerator tracks
1099  if (quality[key_wire][0] > 0) {
1100  quality[key_wire][0] = 0;
1101  if (infoV > 1)
1102  LogTrace("CSCAnodeLCTProcessor") << "trigMode(): accelerator track " << key_wire << " disabled"
1103  << "\n";
1104  }
1105  break;
1106  case 3:
1107  // Disables collision track if there is an accelerator track found
1108  // in the same wire group at the same time
1109  if (quality[key_wire][0] > 0 && quality[key_wire][1] > 0) {
1110  quality[key_wire][1] = 0;
1111  if (infoV > 1)
1112  LogTrace("CSCAnodeLCTProcessor") << "trigMode(): collision track " << key_wire << " disabled"
1113  << "\n";
1114  }
1115  break;
1116  }
1117 }
1118 
1119 void CSCAnodeLCTProcessor::accelMode(const int key_wire) {
1120  int promotionBit = 1 << 2;
1121 
1122  switch (accel_mode) {
1123  default:
1124  case 0:
1125  // Ignore accelerator muons.
1126  if (quality[key_wire][0] > 0) {
1127  quality[key_wire][0] = 0;
1128  if (infoV > 1)
1129  LogTrace("CSCAnodeLCTProcessor") << "alctMode(): accelerator track " << key_wire << " ignored"
1130  << "\n";
1131  }
1132  break;
1133  case 1:
1134  // Prefer collision muons by adding promotion bit.
1135  if (quality[key_wire][1] > 0) {
1136  quality[key_wire][1] += promotionBit;
1137  if (infoV > 1)
1138  LogTrace("CSCAnodeLCTProcessor") << "alctMode(): collision track " << key_wire << " promoted"
1139  << "\n";
1140  }
1141  break;
1142  case 2:
1143  // Prefer accelerator muons by adding promotion bit.
1144  if (quality[key_wire][0] > 0) {
1145  quality[key_wire][0] += promotionBit;
1146  if (infoV > 1)
1147  LogTrace("CSCAnodeLCTProcessor") << "alctMode(): accelerator track " << key_wire << " promoted"
1148  << "\n";
1149  }
1150  break;
1151  case 3:
1152  // Ignore collision muons.
1153  if (quality[key_wire][1] > 0) {
1154  quality[key_wire][1] = 0;
1155  if (infoV > 1)
1156  LogTrace("CSCAnodeLCTProcessor") << "alctMode(): collision track " << key_wire << " ignored"
1157  << "\n";
1158  }
1159  break;
1160  }
1161 }
1162 
1163 // Dump of configuration parameters.
1165  std::ostringstream strm;
1166  strm << "\n";
1167  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
1168  strm << "+ ALCT configuration parameters: +\n";
1169  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
1170  strm << " fifo_tbins [total number of time bins in DAQ readout] = " << fifo_tbins << "\n";
1171  strm << " fifo_pretrig [start time of anode raw hits in DAQ readout] = " << fifo_pretrig << "\n";
1172  strm << " drift_delay [drift delay after pre-trigger, in 25 ns bins] = " << drift_delay << "\n";
1173  strm << " nplanes_hit_pretrig [min. number of layers hit for pre-trigger] = " << nplanes_hit_pretrig << "\n";
1174  strm << " nplanes_hit_pattern [min. number of layers hit for trigger] = " << nplanes_hit_pattern << "\n";
1175  strm << " nplanes_hit_accel_pretrig [min. number of layers hit for accel."
1176  << " pre-trig.] = " << nplanes_hit_accel_pretrig << "\n";
1177  strm << " nplanes_hit_accel_pattern [min. number of layers hit for accel."
1178  << " trigger] = " << nplanes_hit_accel_pattern << "\n";
1179  strm << " trig_mode [enabling/disabling collision/accelerator tracks] = " << trig_mode << "\n";
1180  strm << " accel_mode [preference to collision/accelerator tracks] = " << accel_mode << "\n";
1181  strm << " l1a_window_width [L1Accept window width, in 25 ns bins] = " << l1a_window_width << "\n";
1182  strm << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
1183  LogDebug("CSCAnodeLCTProcessor") << strm.str();
1184  //std::cout<<strm.str()<<std::endl;
1185 }
1186 
1187 // Dump of digis on wire groups.
1189  const std::vector<int> wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) const {
1190  LogDebug("CSCAnodeLCTProcessor") << theCSCName_ << " nWiregroups " << numWireGroups;
1191 
1192  std::ostringstream strstrm;
1193  for (int i_wire = 0; i_wire < numWireGroups; i_wire++) {
1194  if (i_wire % 10 == 0) {
1195  if (i_wire < 100)
1196  strstrm << i_wire / 10;
1197  else
1198  strstrm << (i_wire - 100) / 10;
1199  } else
1200  strstrm << " ";
1201  }
1202  strstrm << "\n";
1203  for (int i_wire = 0; i_wire < numWireGroups; i_wire++) {
1204  strstrm << i_wire % 10;
1205  }
1206  for (int i_layer = 0; i_layer < CSCConstants::NUM_LAYERS; i_layer++) {
1207  strstrm << "\n";
1208  for (int i_wire = 0; i_wire < numWireGroups; i_wire++) {
1209  if (!wire[i_layer][i_wire].empty()) {
1210  std::vector<int> bx_times = wire[i_layer][i_wire];
1211  strstrm << std::hex << bx_times[0] << std::dec;
1212  } else {
1213  strstrm << ".";
1214  }
1215  }
1216  }
1217  LogTrace("CSCAnodeLCTProcessor") << strstrm.str();
1218 }
1219 
1220 // Returns vector of read-out ALCTs, if any. Starts with the vector of
1221 // all found ALCTs and selects the ones in the read-out time window.
1222 std::vector<CSCALCTDigi> CSCAnodeLCTProcessor::readoutALCTs(int nMaxALCTs) const {
1223  std::vector<CSCALCTDigi> tmpV;
1224 
1225  // The number of LCT bins in the read-out is given by the
1226  // l1a_window_width parameter, but made even by setting the LSB of
1227  // l1a_window_width to 0.
1228  const int lct_bins = l1a_window_width;
1229  static std::atomic<int> late_tbins{early_tbins + lct_bins};
1230 
1231  static std::atomic<int> ifois{0};
1232  if (ifois == 0) {
1233  if (infoV >= 0 && early_tbins < 0) {
1234  edm::LogWarning("CSCAnodeLCTProcessor|SuspiciousParameters")
1235  << "+++ fifo_pretrig = " << fifo_pretrig << "; in-time ALCTs are not getting read-out!!! +++"
1236  << "\n";
1237  }
1238 
1239  if (late_tbins > CSCConstants::MAX_ALCT_TBINS - 1) {
1240  if (infoV >= 0)
1241  edm::LogWarning("CSCAnodeLCTProcessor|SuspiciousParameters")
1242  << "+++ Allowed range of time bins, [0-" << late_tbins << "] exceeds max allowed, "
1243  << CSCConstants::MAX_ALCT_TBINS - 1 << " +++\n"
1244  << "+++ Set late_tbins to max allowed +++\n";
1245  late_tbins = CSCConstants::MAX_ALCT_TBINS - 1;
1246  }
1247  ifois = 1;
1248  }
1249 
1250  // Start from the vector of all found ALCTs and select those within
1251  // the ALCT*L1A coincidence window.
1252  const std::vector<CSCALCTDigi>& all_alcts = getALCTs(nMaxALCTs);
1253  for (const auto& p : all_alcts) {
1254  if (!p.isValid())
1255  continue;
1256 
1257  int bx = p.getBX();
1258  // Skip ALCTs found too early relative to L1Accept.
1259  if (bx <= early_tbins) {
1260  if (infoV > 1)
1261  LogDebug("CSCAnodeLCTProcessor") << " Do not report ALCT on keywire " << p.getKeyWG() << ": found at bx " << bx
1262  << ", whereas the earliest allowed bx is " << early_tbins + 1;
1263  continue;
1264  }
1265 
1266  // Skip ALCTs found too late relative to L1Accept.
1267  if (bx > late_tbins) {
1268  if (infoV > 1)
1269  LogDebug("CSCAnodeLCTProcessor") << " Do not report ALCT on keywire " << p.getKeyWG() << ": found at bx " << bx
1270  << ", whereas the latest allowed bx is " << late_tbins;
1271  continue;
1272  }
1273 
1274  tmpV.push_back(p);
1275  }
1276 
1277  // shift the BX from 8 to 3
1278  // ALCTs in real data have the central BX in bin 3
1279  // which is the middle of the 7BX wide L1A window
1280  // ALCTs used in the TMB emulator have central BX at bin 8
1281  // but right before we put emulated ALCTs in the event, we shift the BX
1282  // by -5 to make sure they are compatible with real data ALCTs!
1283  for (auto& p : tmpV) {
1284  p.setBX(p.getBX() - (CSCConstants::LCT_CENTRAL_BX - l1a_window_width / 2));
1285  }
1286  return tmpV;
1287 }
1288 
1289 // Returns vector of all found ALCTs, if any. Used in ALCT-CLCT matching.
1290 std::vector<CSCALCTDigi> CSCAnodeLCTProcessor::getALCTs(int nMaxALCTs) const {
1291  std::vector<CSCALCTDigi> tmpV;
1292  for (int bx = 0; bx < CSCConstants::MAX_ALCT_TBINS; bx++) {
1293  if (nMaxALCTs == CSCConstants::MAX_ALCTS_READOUT) {
1294  if (bestALCT[bx].isValid())
1295  tmpV.push_back(bestALCT[bx]);
1296  if (secondALCT[bx].isValid())
1297  tmpV.push_back(secondALCT[bx]);
1298  } else {
1299  for (int iALCT = 0; iALCT < CSCConstants::MAX_ALCTS_PER_PROCESSOR; iALCT++) {
1300  if (ALCTContainer_[bx][iALCT].isValid()) {
1301  tmpV.push_back(ALCTContainer_[bx][iALCT]);
1302  }
1303  }
1304  }
1305  }
1306  return tmpV;
1307 }
1308 
1310 
1312 
1315 
1316 void CSCAnodeLCTProcessor::showPatterns(const int key_wire) {
1317  /* Method to test the pretrigger */
1318  for (int i_pattern = 0; i_pattern < CSCConstants::NUM_ALCT_PATTERNS; i_pattern++) {
1319  std::ostringstream strstrm_header;
1320  LogTrace("CSCAnodeLCTProcessor") << "\n"
1321  << "Pattern: " << i_pattern << " Key wire: " << key_wire;
1322  for (int i = 1; i <= 32; i++) {
1323  strstrm_header << ((32 - i) % 10);
1324  }
1325  LogTrace("CSCAnodeLCTProcessor") << strstrm_header.str();
1326  for (int i_wire = 0; i_wire < CSCConstants::MAX_WIRES_IN_PATTERN; i_wire++) {
1327  if (pattern_mask[i_pattern][i_wire] != 0) {
1328  std::ostringstream strstrm_pulse;
1329  int this_layer = CSCPatternBank::alct_pattern_envelope[i_wire];
1330  int this_wire = CSCPatternBank::alct_keywire_offset[MESelection][i_wire] + key_wire;
1331  if (this_wire >= 0 && this_wire < numWireGroups) {
1332  for (int i = 1; i <= 32; i++) {
1333  strstrm_pulse << ((pulse[this_layer][this_wire] >> (32 - i)) & 1);
1334  }
1335  LogTrace("CSCAnodeLCTProcessor")
1336  << strstrm_pulse.str() << " on layer " << this_layer << " wire " << this_wire;
1337  }
1338  }
1339  }
1340  LogTrace("CSCAnodeLCTProcessor") << "-------------------------------------------";
1341  }
1342 }
1343 
1344 int CSCAnodeLCTProcessor::getTempALCTQuality(int temp_quality) const {
1345  int Q;
1346  if (temp_quality > 3)
1347  Q = temp_quality - 3;
1348  else
1349  Q = 0; // quality code 0 is valid!
1350 
1351  return Q;
1352 }
CSCConstants::MAX_NUM_WIRES
Definition: CSCConstants.h:22
CSCPatternBank::alct_pattern_envelope
static const int alct_pattern_envelope[CSCConstants::MAX_WIRES_IN_PATTERN]
Definition: CSCPatternBank.h:21
CSCALCTDigi::getBX
uint16_t getBX() const
return BX - five low bits of BXN counter tagged by the ALCT
Definition: CSCALCTDigi.h:70
CSCAnodeLCTProcessor::nplanes_hit_accel_pattern
unsigned int nplanes_hit_accel_pattern
Definition: CSCAnodeLCTProcessor.h:128
CSCDBL1TPParameters
Definition: CSCDBL1TPParameters.h:14
CSCAnodeLCTProcessor::narrow_mask_r1
bool narrow_mask_r1
Definition: CSCAnodeLCTProcessor.h:151
mps_fire.i
i
Definition: mps_fire.py:355
CSCAnodeLCTProcessor::patternDetection
bool patternDetection(const int key_wire)
Definition: CSCAnodeLCTProcessor.cc:590
CSCBaseboard::theEndcap
const unsigned theEndcap
Definition: CSCBaseboard.h:42
CSCAnodeLCTProcessor::pretrig_extra_deadtime
unsigned int pretrig_extra_deadtime
Definition: CSCAnodeLCTProcessor.h:145
CSCAnodeLCTProcessor::readWireDigis
void readWireDigis(std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES])
Definition: CSCAnodeLCTProcessor.cc:407
CSCPatternBank::alct_pattern_mask_open
static const ALCTPatterns alct_pattern_mask_open
Definition: CSCPatternBank.h:29
CSCAnodeLCTProcessor::nplanes_hit_pattern
unsigned int nplanes_hit_pattern
Definition: CSCAnodeLCTProcessor.h:128
CSCChamber::layer
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to the given id.
Definition: CSCChamber.cc:30
CSCDBL1TPParameters::alctNplanesHitPattern
unsigned int alctNplanesHitPattern() const
Definition: CSCDBL1TPParameters.h:32
CSCBaseboard::cscChamber_
const CSCChamber * cscChamber_
Definition: CSCBaseboard.h:64
CSCBaseboard::theSector
const unsigned theSector
Definition: CSCBaseboard.h:44
CSCAnodeLCTProcessor::def_drift_delay
static const unsigned int def_drift_delay
Definition: CSCAnodeLCTProcessor.h:155
CSCAnodeLCTProcessor::getTempALCTQuality
virtual int getTempALCTQuality(int temp_quality) const
Definition: CSCAnodeLCTProcessor.cc:1344
CSCAnodeLCTProcessor::hit_persist
unsigned int hit_persist
Definition: CSCAnodeLCTProcessor.h:132
CSCBaseboard::isSLHC_
bool isSLHC_
Definition: CSCBaseboard.h:82
CSCConstants::MAX_ALCT_TBINS
Definition: CSCConstants.h:62
CSCPatternBank::alct_keywire_offset
static const int alct_keywire_offset[2][CSCConstants::MAX_WIRES_IN_PATTERN]
Definition: CSCPatternBank.h:25
relativeConstraints.station
station
Definition: relativeConstraints.py:67
CSCBaseboard::disableME1a_
bool disableME1a_
Definition: CSCBaseboard.h:86
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CSCBaseboard::theStation
const unsigned theStation
Definition: CSCBaseboard.h:43
CSCAnodeLCTProcessor::run
std::vector< CSCALCTDigi > run(const CSCWireDigiCollection *wiredc)
Definition: CSCAnodeLCTProcessor.cc:215
CSCAnodeLCTProcessor::MESelection
int MESelection
Definition: CSCAnodeLCTProcessor.h:109
CSCDBL1TPParameters::alctTrigMode
unsigned int alctTrigMode() const
Definition: CSCDBL1TPParameters.h:41
CSCALCTDigi::clear
void clear()
clear this ALCT
Definition: CSCALCTDigi.cc:43
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
CSCBaseboard::theCSCName_
std::string theCSCName_
Definition: CSCBaseboard.h:79
CSCAnodeLCTProcessor::early_tbins
int early_tbins
Definition: CSCAnodeLCTProcessor.h:135
CSCConstants::LCT_CENTRAL_BX
Definition: CSCConstants.h:77
CSCAnodeLCTProcessor::showPatterns
void showPatterns(const int key_wire)
Definition: CSCAnodeLCTProcessor.cc:1316
CSCAnodeLCTProcessor::trig_mode
unsigned int trig_mode
Definition: CSCAnodeLCTProcessor.h:129
CSCAnodeLCTProcessor::loadPatternMask
void loadPatternMask()
Definition: CSCAnodeLCTProcessor.cc:109
CSCConstants::NUM_ALCT_PATTERNS
Definition: CSCConstants.h:50
CSCAnodeLCTProcessor::checkConfigParameters
void checkConfigParameters()
Definition: CSCAnodeLCTProcessor.cc:158
CSCAnodeLCTProcessor::first_bx_corrected
int first_bx_corrected[CSCConstants::MAX_NUM_WIRES]
Definition: CSCAnodeLCTProcessor.h:112
CSCAnodeLCTProcessor::def_nplanes_hit_accel_pretrig
static const unsigned int def_nplanes_hit_accel_pretrig
Definition: CSCAnodeLCTProcessor.h:157
CSCAnodeLCTProcessor::def_fifo_tbins
static const unsigned int def_fifo_tbins
Definition: CSCAnodeLCTProcessor.h:154
CSCAnodeLCTProcessor::def_accel_mode
static const unsigned int def_accel_mode
Definition: CSCAnodeLCTProcessor.h:159
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
CSCAnodeLCTProcessor::dumpConfigParams
void dumpConfigParams() const
Definition: CSCAnodeLCTProcessor.cc:1164
validateGeometry_cfg.valid
valid
Definition: validateGeometry_cfg.py:21
class-composition.Q
Q
Definition: class-composition.py:82
CSCAnodeLCTProcessor::l1a_window_width
unsigned int l1a_window_width
Definition: CSCAnodeLCTProcessor.h:129
MuonDigiCollection::const_iterator
std::vector< DigiType >::const_iterator const_iterator
Definition: MuonDigiCollection.h:94
CSCPatternBank::alct_pattern_mask_r1
static const ALCTPatterns alct_pattern_mask_r1
Definition: CSCPatternBank.h:32
CSCDBL1TPParameters::alctNplanesHitPretrig
unsigned int alctNplanesHitPretrig() const
Definition: CSCDBL1TPParameters.h:29
dt
float dt
Definition: AMPTWrapper.h:136
CSCAnodeLCTProcessor::trigMode
void trigMode(const int key_wire)
Definition: CSCAnodeLCTProcessor.cc:1082
CSCAnodeLCTProcessor::quality
int quality[CSCConstants::MAX_NUM_WIRES][3]
Definition: CSCAnodeLCTProcessor.h:113
CSCALCTDigi::getKeyWG
uint16_t getKeyWG() const
return key wire group
Definition: CSCALCTDigi.h:64
CSCAnodeLCTProcessor::accel_mode
unsigned int accel_mode
Definition: CSCAnodeLCTProcessor.h:129
CSCAnodeLCTProcessor::preTrigger
bool preTrigger(const int key_wire, const int start_bx)
Definition: CSCAnodeLCTProcessor.cc:527
CSCAnodeLCTProcessor::lct_list
std::vector< CSCALCTDigi > lct_list
Definition: CSCAnodeLCTProcessor.h:117
CSCAnodeLCTProcessor::readoutALCTs
std::vector< CSCALCTDigi > readoutALCTs(int nMaxALCTs=CSCConstants::MAX_ALCTS_READOUT) const
Definition: CSCAnodeLCTProcessor.cc:1222
CSCAnodeLCTProcessor::def_fifo_pretrig
static const unsigned int def_fifo_pretrig
Definition: CSCAnodeLCTProcessor.h:154
CSCAnodeLCTProcessor::pattern_mask
int pattern_mask[CSCConstants::NUM_ALCT_PATTERNS][CSCConstants::MAX_WIRES_IN_PATTERN]
Definition: CSCAnodeLCTProcessor.h:163
CSCDBL1TPParameters::alctNplanesHitAccelPretrig
unsigned int alctNplanesHitAccelPretrig() const
Definition: CSCDBL1TPParameters.h:35
CSCConstants::MAX_WIRES_IN_PATTERN
Definition: CSCConstants.h:54
CSCDBL1TPParameters::alctFifoPretrig
unsigned int alctFifoPretrig() const
Definition: CSCDBL1TPParameters.h:23
CSCAnodeLCTProcessor::def_nplanes_hit_pattern
static const unsigned int def_nplanes_hit_pattern
Definition: CSCAnodeLCTProcessor.h:156
CSCAnodeLCTProcessor::setConfigParameters
void setConfigParameters(const CSCDBL1TPParameters *conf)
Definition: CSCAnodeLCTProcessor.cc:135
CSCConstants::NUM_LAYERS
Definition: CSCConstants.h:46
CSCDBL1TPParameters::alctAccelMode
unsigned int alctAccelMode() const
Definition: CSCDBL1TPParameters.h:44
CSCAnodeLCTProcessor::drift_delay
unsigned int drift_delay
Definition: CSCAnodeLCTProcessor.h:126
CSCBaseboard::theSubsector
const unsigned theSubsector
Definition: CSCBaseboard.h:45
CSCLayer::geometry
const CSCLayerGeometry * geometry() const
Definition: CSCLayer.h:44
CSCConstants::MAX_ALCTS_READOUT
Definition: CSCConstants.h:71
CSCAnodeLCTProcessor::thePreTriggerDigis
std::vector< CSCALCTPreTriggerDigi > thePreTriggerDigis
Definition: CSCAnodeLCTProcessor.h:119
CSCAnodeLCTProcessor::clear
void clear()
Definition: CSCAnodeLCTProcessor.cc:194
CSCALCTDigi::getQuality
uint16_t getQuality() const
return quality of a pattern
Definition: CSCALCTDigi.h:43
CSCConstants::ALCT_EMUL_TIME_OFFSET
Definition: CSCConstants.h:18
CSCAnodeLCTProcessor::secondALCT
CSCALCTDigi secondALCT[CSCConstants::MAX_ALCT_TBINS]
Definition: CSCAnodeLCTProcessor.h:99
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
CSCAnodeLCTProcessor::ghostCancellationLogic
virtual void ghostCancellationLogic()
Definition: CSCAnodeLCTProcessor.cc:717
CSCDBL1TPParameters::alctDriftDelay
unsigned int alctDriftDelay() const
Definition: CSCDBL1TPParameters.h:26
edm::LogWarning
Definition: MessageLogger.h:141
CSCAnodeLCTProcessor.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
CSCAnodeLCTProcessor::CSCAnodeLCTProcessor
CSCAnodeLCTProcessor()
Definition: CSCAnodeLCTProcessor.cc:84
CSCAnodeLCTProcessor::ghostCancellationLogicOneWire
virtual void ghostCancellationLogicOneWire(const int key_wire, int *ghost_cleared)
Definition: CSCAnodeLCTProcessor.cc:791
CSCConstants::MAX_ALCTS_PER_PROCESSOR
Definition: CSCConstants.h:70
CSCBaseboard
Definition: CSCBaseboard.h:15
CSCAnodeLCTProcessor::bestTrackSelector
std::vector< CSCALCTDigi > bestTrackSelector(const std::vector< CSCALCTDigi > &all_alcts)
Definition: CSCAnodeLCTProcessor.cc:942
CSCDetId
Definition: CSCDetId.h:26
CSCAnodeLCTProcessor::def_l1a_window_width
static const unsigned int def_l1a_window_width
Definition: CSCAnodeLCTProcessor.h:160
CSCAnodeLCTProcessor::use_corrected_bx
bool use_corrected_bx
Definition: CSCAnodeLCTProcessor.h:148
topSingleLeptonDQM_PU_cfi.pattern
pattern
Definition: topSingleLeptonDQM_PU_cfi.py:39
CSCAnodeLCTProcessor::numWireGroups
int numWireGroups
Definition: CSCAnodeLCTProcessor.h:108
CSCAnodeLCTProcessor::dumpDigis
void dumpDigis(const std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]) const
Definition: CSCAnodeLCTProcessor.cc:1188
CSCAnodeLCTProcessor::fifo_pretrig
unsigned int fifo_pretrig
Definition: CSCAnodeLCTProcessor.h:126
CSCAnodeLCTProcessor::ghost_cancellation_side_quality
bool ghost_cancellation_side_quality
Definition: CSCAnodeLCTProcessor.h:142
CSCAnodeLCTProcessor::accelMode
void accelMode(const int key_wire)
Definition: CSCAnodeLCTProcessor.cc:1119
CSCBaseboard::theChamber
unsigned theChamber
Definition: CSCBaseboard.h:49
CSCALCTDigi::getFullBX
uint16_t getFullBX() const
return 12-bit full BX.
Definition: CSCALCTDigi.h:82
CSCAnodeLCTProcessor::isBetterALCT
bool isBetterALCT(const CSCALCTDigi &lhsALCT, const CSCALCTDigi &rhsALCT) const
Definition: CSCAnodeLCTProcessor.cc:1042
CSCAnodeLCTProcessor::ALCTContainer_
CSCALCTDigi ALCTContainer_[CSCConstants::MAX_ALCT_TBINS][CSCConstants::MAX_ALCTS_PER_PROCESSOR]
Definition: CSCAnodeLCTProcessor.h:102
CSCALCTPreTriggerDigi
Definition: CSCALCTPreTriggerDigi.h:13
CSCAnodeLCTProcessor::def_nplanes_hit_pretrig
static const unsigned int def_nplanes_hit_pretrig
Definition: CSCAnodeLCTProcessor.h:156
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
CSCWireDigiCollection
CSCAnodeLCTProcessor::pulseExtension
bool pulseExtension(const std::vector< int > wire[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES])
Definition: CSCAnodeLCTProcessor.cc:463
CSCAnodeLCTProcessor::getSecondALCT
CSCALCTDigi getSecondALCT(int bx) const
Definition: CSCAnodeLCTProcessor.cc:1311
CSCALCTDigi::getAccelerator
uint16_t getAccelerator() const
Definition: CSCALCTDigi.h:50
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
CSCDBL1TPParameters::alctL1aWindowWidth
unsigned int alctL1aWindowWidth() const
Definition: CSCDBL1TPParameters.h:47
CSCALCTDigi
Definition: CSCALCTDigi.h:16
CSCAnodeLCTProcessor::def_nplanes_hit_accel_pattern
static const unsigned int def_nplanes_hit_accel_pattern
Definition: CSCAnodeLCTProcessor.h:158
CSCAnodeLCTProcessor::first_bx
int first_bx[CSCConstants::MAX_NUM_WIRES]
Definition: CSCAnodeLCTProcessor.h:111
CSCAnodeLCTProcessor::def_trig_mode
static const unsigned int def_trig_mode
Definition: CSCAnodeLCTProcessor.h:159
CSCAnodeLCTProcessor::setDefaultConfigParameters
void setDefaultConfigParameters()
Definition: CSCAnodeLCTProcessor.cc:120
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
CSCAnodeLCTProcessor::getALCTs
std::vector< CSCALCTDigi > getALCTs(int nMaxALCTs=CSCConstants::MAX_ALCTS_READOUT) const
Definition: CSCAnodeLCTProcessor.cc:1290
MuonDigiCollection::Range
std::pair< const_iterator, const_iterator > Range
Definition: MuonDigiCollection.h:95
CSCBaseboard::theTrigChamber
const unsigned theTrigChamber
Definition: CSCBaseboard.h:46
CSCAnodeLCTProcessor::nplanes_hit_pretrig
unsigned int nplanes_hit_pretrig
Definition: CSCAnodeLCTProcessor.h:127
CSCDBL1TPParameters::alctNplanesHitAccelPattern
unsigned int alctNplanesHitAccelPattern() const
Definition: CSCDBL1TPParameters.h:38
CSCALCTDigi::isValid
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:37
CSCAnodeLCTProcessor::pulse
unsigned int pulse[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES]
Definition: CSCAnodeLCTProcessor.h:115
trigger
Definition: HLTPrescaleTableCond.h:8
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
CSCAnodeLCTProcessor::ghost_cancellation_bx_depth
int ghost_cancellation_bx_depth
Definition: CSCAnodeLCTProcessor.h:138
CSCAnodeLCTProcessor::getDigis
bool getDigis(const CSCWireDigiCollection *wiredc)
Definition: CSCAnodeLCTProcessor.cc:367
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
CSCAnodeLCTProcessor::getBestALCT
CSCALCTDigi getBestALCT(int bx) const
Definition: CSCAnodeLCTProcessor.cc:1309
CSCALCTDigi::setTrknmb
void setTrknmb(const uint16_t number)
Set track number (1,2) after sorting ALCTs.
Definition: CSCALCTDigi.h:79
CSCAnodeLCTProcessor::lctSearch
void lctSearch()
Definition: CSCAnodeLCTProcessor.cc:863
CSCAnodeLCTProcessor::bestALCT
CSCALCTDigi bestALCT[CSCConstants::MAX_ALCT_TBINS]
Definition: CSCAnodeLCTProcessor.h:96
CSCLayerGeometry::numberOfWireGroups
int numberOfWireGroups() const
Definition: CSCLayerGeometry.h:76
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
CSCBaseboard::isME11_
bool isME11_
Definition: CSCBaseboard.h:52
CSCDBL1TPParameters::alctFifoTbins
unsigned int alctFifoTbins() const
Definition: CSCDBL1TPParameters.h:20
CSCAnodeLCTProcessor::nplanes_hit_accel_pretrig
unsigned int nplanes_hit_accel_pretrig
Definition: CSCAnodeLCTProcessor.h:127
CSCAnodeLCTProcessor::fifo_tbins
unsigned int fifo_tbins
Definition: CSCAnodeLCTProcessor.h:126
CSCAnodeLCTProcessor::digiV
std::vector< CSCWireDigi > digiV[CSCConstants::NUM_LAYERS]
Definition: CSCAnodeLCTProcessor.h:114
CSCBaseboard::alctParams_
edm::ParameterSet alctParams_
Definition: CSCBaseboard.h:73
CSCBaseboard::infoV
int infoV
Definition: CSCBaseboard.h:61
CSCBaseboard::theRing
unsigned theRing
Definition: CSCBaseboard.h:48