CMS 3D CMS Logo

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