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