CMS 3D CMS Logo

CSCMotherboardME11.cc
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // Class: CSCMotherboardME11
4 //
5 // Description:
6 // Extended CSCMotherboard for ME11 to handle ME1a and ME1b separately
7 //
8 // Author List: Vadim Khotilovich 12 May 2009
9 //
10 //
11 //-----------------------------------------------------------------------------
12 
16 
17 
18 
19 // LUT for which ME1/1 wire group can cross which ME1/a halfstrip
20 // 1st index: WG number
21 // 2nd index: inclusive HS range
23 {0, 95},{0, 95},{0, 95},{0, 95},{0, 95},
24 {0, 95},{0, 95},{0, 95},{0, 95},{0, 95},
25 {0, 95},{0, 95},{0, 77},{0, 61},{0, 39},
26 {0, 22},{-1,-1},{-1,-1},{-1,-1},{-1,-1},
27 {-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},
28 {-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},
29 {-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},
30 {-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},
31 {-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},
32 {-1,-1},{-1,-1},{-1,-1} };
33 // a modified LUT for ganged ME1a
35 {0, 31},{0, 31},{0, 31},{0, 31},{0, 31},
36 {0, 31},{0, 31},{0, 31},{0, 31},{0, 31},
37 {0, 31},{0, 31},{0, 31},{0, 31},{0, 31},
38 {0, 22},{-1,-1},{-1,-1},{-1,-1},{-1,-1},
39 {-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},
40 {-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},
41 {-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},
42 {-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},
43 {-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},
44 {-1,-1},{-1,-1},{-1,-1} };
45 
46 // LUT for which ME1/1 wire group can cross which ME1/b halfstrip
47 // 1st index: WG number
48 // 2nd index: inclusive HS range
50 {-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},
51 {-1,-1},{-1,-1},{-1,-1},{-1,-1},{-1,-1},
52 {100, 127},{73, 127},{47, 127},{22, 127},{0, 127},
53 {0, 127},{0, 127},{0, 127},{0, 127},{0, 127},
54 {0, 127},{0, 127},{0, 127},{0, 127},{0, 127},
55 {0, 127},{0, 127},{0, 127},{0, 127},{0, 127},
56 {0, 127},{0, 127},{0, 127},{0, 127},{0, 127},
57 {0, 127},{0, 127},{0, 127},{0, 127},{0, 127},
58 {0, 127},{0, 127},{0, 127},{0, 127},{0, 105},
59 {0, 93},{0, 78},{0, 63} };
60 
61 
63  unsigned sector, unsigned subsector,
64  unsigned chamber,
65  const edm::ParameterSet& conf) :
66  CSCMotherboard(endcap, station, sector, subsector, chamber, conf)
67 {
68  edm::ParameterSet commonParams = conf.getParameter<edm::ParameterSet>("commonParam");
69 
70  // special configuration parameters for ME11 treatment
71  smartME1aME1b = commonParams.getParameter<bool>("smartME1aME1b");
72  disableME1a = commonParams.getParameter<bool>("disableME1a");
73  gangedME1a = commonParams.getParameter<bool>("gangedME1a");
74 
75  if (!isSLHC) edm::LogError("L1CSCTPEmulatorConfigError")
76  << "+++ Upgrade CSCMotherboardME11 constructed while isSLHC is not set! +++\n";
77  if (!smartME1aME1b) edm::LogError("L1CSCTPEmulatorConfigError")
78  << "+++ Upgrade CSCMotherboardME11 constructed while smartME1aME1b is not set! +++\n";
79 
80  edm::ParameterSet alctParams = conf.getParameter<edm::ParameterSet>("alctSLHC");
81  edm::ParameterSet clctParams = conf.getParameter<edm::ParameterSet>("clctSLHC");
82  edm::ParameterSet tmbParams = conf.getParameter<edm::ParameterSet>("tmbSLHC");
83 
84  clct1a.reset( new CSCCathodeLCTProcessor(endcap, station, sector, subsector, chamber, clctParams, commonParams, tmbParams) );
85  clct1a->setRing(4);
86 
87  match_earliest_alct_me11_only = tmbParams.getParameter<bool>("matchEarliestAlctME11Only");
88  match_earliest_clct_me11_only = tmbParams.getParameter<bool>("matchEarliestClctME11Only");
89 
90  // if true: use regular CLCT-to-ALCT matching in TMB
91  // if false: do ALCT-to-CLCT matching
92  clct_to_alct = tmbParams.getParameter<bool>("clctToAlct");
93 
94  // whether to not reuse CLCTs that were used by previous matching ALCTs
95  // in ALCT-to-CLCT algorithm
96  drop_used_clcts = tmbParams.getParameter<bool>("tmbDropUsedClcts");
97 
98  tmb_cross_bx_algo = tmbParams.getParameter<unsigned int>("tmbCrossBxAlgorithm");
99 
100  // maximum lcts per BX in ME11: 2, 3, 4 or 999
101  max_me11_lcts = tmbParams.getParameter<unsigned int>("maxME11LCTs");
102 
104  for (unsigned int m=2; m<match_trig_window_size; m+=2)
105  {
106  pref[m-1] = pref[0] - m/2;
107  pref[m] = pref[0] + m/2;
108  }
109 }
110 
111 
113 {
114  // Constructor used only for testing.
115 
116  clct1a.reset( new CSCCathodeLCTProcessor() );
117  clct1a->setRing(4);
118 
120  for (unsigned int m=2; m<match_trig_window_size; m+=2)
121  {
122  pref[m-1] = pref[0] - m/2;
123  pref[m] = pref[0] + m/2;
124  }
125 }
126 
127 
129 {
130 }
131 
132 
134 {
136  if (clct1a) clct1a->clear();
137  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++)
138  {
139  for (unsigned int mbx = 0; mbx < match_trig_window_size; mbx++)
140  for (int i=0;i<CSCConstants::MAX_LCTS_PER_CSC;i++)
141  {
142  allLCTs1b[bx][mbx][i].clear();
143  allLCTs1a[bx][mbx][i].clear();
144  }
145  }
146 }
147 
148 // Set configuration parameters obtained via EventSetup mechanism.
150 {
151  alct->setConfigParameters(conf);
152  clct->setConfigParameters(conf);
153  clct1a->setConfigParameters(conf);
154  // No config. parameters in DB for the TMB itself yet.
155 }
156 
157 
159  const CSCComparatorDigiCollection* compdc)
160 {
161  clear();
162 
163  if (!( alct && clct && clct1a && smartME1aME1b))
164  {
165  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorSetupError")
166  << "+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
167  return;
168  }
169 
170  alct->setCSCGeometry(csc_g);
171  clct->setCSCGeometry(csc_g);
172  clct1a->setCSCGeometry(csc_g);
173 
174  alctV = alct->run(wiredc); // run anodeLCT
175  clctV1b = clct->run(compdc); // run cathodeLCT in ME1/b
176  clctV1a = clct1a->run(compdc); // run cathodeLCT in ME1/a
177 
178  //int n_clct_a=0, n_clct_b=0;
179  //if (clct1a->bestCLCT[6].isValid() && clct1a->bestCLCT[6].getBX()==6) n_clct_a++;
180  //if (clct1a->secondCLCT[6].isValid() && clct1a->secondCLCT[6].getBX()==6) n_clct_a++;
181 
182  int used_alct_mask[20], used_alct_mask_1a[20];
183  int used_clct_mask[20], used_clct_mask_1a[20];
184  for (int b=0;b<20;b++)
185  used_alct_mask[b] = used_alct_mask_1a[b] = used_clct_mask[b] = used_clct_mask_1a[b] = 0;
186 
187  // CLCT-centric CLCT-to-ALCT matching
188  if (clct_to_alct) for (int bx_clct = 0; bx_clct < CSCConstants::MAX_CLCT_TBINS; bx_clct++)
189  {
190  // matching in ME1b
191  if (clct->bestCLCT[bx_clct].isValid())
192  {
193  int bx_alct_start = bx_clct - match_trig_window_size/2;
194  int bx_alct_stop = bx_clct + match_trig_window_size/2;
195  for (int bx_alct = bx_alct_start; bx_alct <= bx_alct_stop; bx_alct++)
196  {
197  if (bx_alct < 0 || bx_alct >= CSCConstants::MAX_ALCT_TBINS) continue;
198  if (drop_used_alcts && used_alct_mask[bx_alct]) continue;
199  if (alct->bestALCT[bx_alct].isValid())
200  {
201  if (infoV > 1) LogTrace("CSCMotherboard")
202  << "Successful CLCT-ALCT match in ME1b: bx_clct = " << bx_clct
203  << "; match window: [" << bx_alct_start << "; " << bx_alct_stop
204  << "]; bx_alct = " << bx_alct;
205  int mbx = bx_alct_stop - bx_alct;
206  correlateLCTs(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
207  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
208  allLCTs1b[bx_alct][mbx][0], allLCTs1b[bx_alct][mbx][1], ME1B);
209  if (allLCTs1b[bx_alct][mbx][0].isValid())
210  {
211  used_alct_mask[bx_alct] += 1;
213  }
214  }
215  }
216  // Do not report CLCT-only LCT for ME1b
217  }
218  // matching in ME1a
219  if (clct1a->bestCLCT[bx_clct].isValid())
220  {
221  int bx_alct_start = bx_clct - match_trig_window_size/2;
222  int bx_alct_stop = bx_clct + match_trig_window_size/2;
223  for (int bx_alct = bx_alct_start; bx_alct <= bx_alct_stop; bx_alct++)
224  {
225  if (bx_alct < 0 || bx_alct >= CSCConstants::MAX_ALCT_TBINS) continue;
226  if (drop_used_alcts && used_alct_mask_1a[bx_alct]) continue;
227  if (alct->bestALCT[bx_alct].isValid())
228  {
229  if (infoV > 1) LogTrace("CSCMotherboard")
230  << "Successful CLCT-ALCT match in ME1a: bx_clct = " << bx_clct
231  << "; match window: [" << bx_alct_start << "; " << bx_alct_stop
232  << "]; bx_alct = " << bx_alct;
233  int mbx = bx_alct_stop - bx_alct;
234  correlateLCTs(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
235  clct1a->bestCLCT[bx_clct], clct1a->secondCLCT[bx_clct],
236  allLCTs1a[bx_alct][mbx][0], allLCTs1a[bx_alct][mbx][1], ME1A);
237  if (allLCTs1a[bx_alct][mbx][0].isValid())
238  {
239  used_alct_mask_1a[bx_alct] += 1;
241  }
242  }
243  }
244  // Do not report CLCT-only LCT for ME1b
245  }
246  // Do not attempt to make ALCT-only LCT for ME1b
247  } // end of CLCT-centric matching
248 
249  // ALCT-centric ALCT-to-CLCT matching
250  else for (int bx_alct = 0; bx_alct < CSCConstants::MAX_ALCT_TBINS; bx_alct++)
251  {
252  if (alct->bestALCT[bx_alct].isValid())
253  {
254  int bx_clct_start = bx_alct - match_trig_window_size/2;
255  int bx_clct_stop = bx_alct + match_trig_window_size/2;
256 
257  // matching in ME1b
258  for (int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++)
259  {
260  if (bx_clct < 0 || bx_clct >= CSCConstants::MAX_CLCT_TBINS) continue;
261  if (drop_used_clcts && used_clct_mask[bx_clct]) continue;
262  if (clct->bestCLCT[bx_clct].isValid())
263  {
264  if (infoV > 1) LogTrace("CSCMotherboard")
265  << "Successful ALCT-CLCT match in ME1b: bx_alct = " << bx_alct
266  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop
267  << "]; bx_clct = " << bx_clct;
268  int mbx = bx_clct-bx_clct_start;
269  correlateLCTs(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
270  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
271  allLCTs1b[bx_alct][mbx][0], allLCTs1b[bx_alct][mbx][1], ME1B);
272  if (allLCTs1b[bx_alct][mbx][0].isValid())
273  {
274  used_clct_mask[bx_clct] += 1;
276  }
277  }
278  }
279 
280  // matching in ME1a
281  for (int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++)
282  {
283  if (bx_clct < 0 || bx_clct >= CSCConstants::MAX_CLCT_TBINS) continue;
284  if (drop_used_clcts && used_clct_mask_1a[bx_clct]) continue;
285  if (clct1a->bestCLCT[bx_clct].isValid())
286  {
287  if (infoV > 1) LogTrace("CSCMotherboard")
288  << "Successful ALCT-CLCT match in ME1a: bx_alct = " << bx_alct
289  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop
290  << "]; bx_clct = " << bx_clct;
291  int mbx = bx_clct-bx_clct_start;
292  correlateLCTs(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
293  clct1a->bestCLCT[bx_clct], clct1a->secondCLCT[bx_clct],
294  allLCTs1a[bx_alct][mbx][0], allLCTs1a[bx_alct][mbx][1], ME1A);
295  if (allLCTs1a[bx_alct][mbx][0].isValid())
296  {
297  used_clct_mask_1a[bx_clct] += 1;
299  }
300  }
301  }
302  }
303  } // end of ALCT-centric matching
304 
305  // reduction of nLCTs per each BX
306  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++)
307  {
308  // counting
309  unsigned int n1a=0, n1b=0;
310  for (unsigned int mbx = 0; mbx < match_trig_window_size; mbx++)
311  for (int i=0;i<CSCConstants::MAX_LCTS_PER_CSC;i++)
312  {
313  int cbx = bx + mbx - match_trig_window_size/2;
314  if (allLCTs1b[bx][mbx][i].isValid())
315  {
316  n1b++;
317  if (infoV > 0) LogDebug("CSCMotherboard") << "1b LCT"<<i+1<<" "<<bx<<"/"<<cbx<<": "<<allLCTs1b[bx][mbx][i];
318  }
319  if (allLCTs1a[bx][mbx][i].isValid())
320  {
321  n1a++;
322  if (infoV > 0) LogDebug("CSCMotherboard") << "1a LCT"<<i+1<<" "<<bx<<"/"<<cbx<<": "<<allLCTs1a[bx][mbx][i];
323  }
324  }
325  if (infoV > 0 && n1a+n1b>0) LogDebug("CSCMotherboard") <<"bx "<<bx<<" nLCT:"<<n1a<<" "<<n1b<<" "<<n1a+n1b;
326 
327  // some simple cross-bx sorting algorithms
328  if (tmb_cross_bx_algo == 1 && (n1a>2 || n1b>2) )
329  {
330  n1a=0, n1b=0;
331  for (unsigned int mbx = 0; mbx < match_trig_window_size; mbx++)
332  for (int i=0;i<CSCConstants::MAX_LCTS_PER_CSC;i++)
333  {
334  if (allLCTs1b[bx][pref[mbx]][i].isValid())
335  {
336  n1b++;
337  if (n1b>2) allLCTs1b[bx][pref[mbx]][i].clear();
338  }
339  if (allLCTs1a[bx][pref[mbx]][i].isValid())
340  {
341  n1a++;
342  if (n1a>2) allLCTs1a[bx][pref[mbx]][i].clear();
343  }
344  }
345 
346  if (infoV > 0) LogDebug("CSCMotherboard") <<"After x-bx sorting:";
347  n1a=0, n1b=0;
348  for (unsigned int mbx = 0; mbx < match_trig_window_size; mbx++)
349  for (int i=0;i<CSCConstants::MAX_LCTS_PER_CSC;i++)
350  {
351  int cbx = bx + mbx - match_trig_window_size/2;
352  if (allLCTs1b[bx][mbx][i].isValid())
353  {
354  n1b++;
355  if (infoV > 0) LogDebug("CSCMotherboard") << "1b LCT"<<i+1<<" "<<bx<<"/"<<cbx<<": "<<allLCTs1b[bx][mbx][i];
356  }
357  if (allLCTs1a[bx][mbx][i].isValid())
358  {
359  n1a++;
360  if (infoV > 0) LogDebug("CSCMotherboard") << "1a LCT"<<i+1<<" "<<bx<<"/"<<cbx<<": "<<allLCTs1a[bx][mbx][i];
361  }
362  }
363  if (infoV > 0 && n1a+n1b>0) LogDebug("CSCMotherboard") <<"bx "<<bx<<" nnLCT:"<<n1a<<" "<<n1b<<" "<<n1a+n1b;
364  } // x-bx sorting
365 
366  // Maximum 2 or 3 per whole ME11 per BX case:
367  // (supposedly, now we should have max 2 per bx in each 1a and 1b)
368  if ( n1a+n1b > max_me11_lcts )
369  {
370  // do it simple so far: take all low eta 1/b stubs
371  unsigned int nLCT=n1b;
372  n1a=0;
373  // right now nLCT<=2; cut 1a if necessary
374  for (unsigned int mbx=0; mbx<match_trig_window_size; mbx++)
375  for (int i=0;i<CSCConstants::MAX_LCTS_PER_CSC;i++)
376  if (allLCTs1a[bx][mbx][i].isValid()) {
377  nLCT++;
378  if (nLCT>max_me11_lcts) allLCTs1a[bx][mbx][i].clear();
379  else n1a++;
380  }
381  if (infoV > 0 && nLCT>0) LogDebug("CSCMotherboard") <<"bx "<<bx<<" nnnLCT:"<<n1a<<" "<<n1b<<" "<<n1a+n1b;
382  }
383  }// reduction per bx
384 
385  //if (infoV > 1) LogTrace("CSCMotherboardME11")<<"clct_count E:"<<theEndcap<<"S:"<<theStation<<"R:"<<1<<"C:"
386  // <<CSCTriggerNumbering::chamberFromTriggerLabels(theSector,theSubsector, theStation, theTrigChamber)
387  // <<" a "<<n_clct_a<<" b "<<n_clct_b<<" ab "<<n_clct_a+n_clct_b;
388 }
389 
390 
391 std::vector<CSCCorrelatedLCTDigi> CSCMotherboardME11::readoutLCTs1a() const
392 {
393  return readoutLCTs(ME1A);
394 }
395 
396 
397 std::vector<CSCCorrelatedLCTDigi> CSCMotherboardME11::readoutLCTs1b() const
398 {
399  return readoutLCTs(ME1B);
400 }
401 
402 
403 // Returns vector of read-out correlated LCTs, if any. Starts with
404 // the vector of all found LCTs and selects the ones in the read-out
405 // time window.
406 std::vector<CSCCorrelatedLCTDigi> CSCMotherboardME11::readoutLCTs(int me1ab) const
407 {
408  std::vector<CSCCorrelatedLCTDigi> tmpV;
409 
410  // The start time of the L1A*LCT coincidence window should be related
411  // to the fifo_pretrig parameter, but I am not completely sure how.
412  // Just choose it such that the window is centered at bx=7. This may
413  // need further tweaking if the value of tmb_l1a_window_size changes.
414  //static int early_tbins = 4;
415  // The number of LCT bins in the read-out is given by the
416  // tmb_l1a_window_size parameter, forced to be odd
417  const int lct_bins =
419  const int late_tbins = early_tbins + lct_bins;
420 
421 
422  // Start from the vector of all found correlated LCTs and select
423  // those within the LCT*L1A coincidence window.
424  int bx_readout = -1;
425  std::vector<CSCCorrelatedLCTDigi> all_lcts;
426  if (me1ab == ME1A) all_lcts = getLCTs1a();
427  if (me1ab == ME1B) all_lcts = getLCTs1b();
428  std::vector <CSCCorrelatedLCTDigi>::const_iterator plct = all_lcts.begin();
429  for (; plct != all_lcts.end(); plct++)
430  {
431  if (!plct->isValid()) continue;
432 
433  int bx = (*plct).getBX();
434  // Skip LCTs found too early relative to L1Accept.
435  if (bx <= early_tbins) continue;
436 
437  // Skip LCTs found too late relative to L1Accept.
438  if (bx > late_tbins) continue;
439 
440  // If (readout_earliest_2) take only LCTs in the earliest bx in the read-out window:
441  // in digi->raw step, LCTs have to be packed into the TMB header, and
442  // currently there is room just for two.
443  if (readout_earliest_2 && (bx_readout == -1 || bx == bx_readout) )
444  {
445  tmpV.push_back(*plct);
446  if (bx_readout == -1) bx_readout = bx;
447  }
448  else tmpV.push_back(*plct);
449  }
450  return tmpV;
451 }
452 
453 
454 // Returns vector of found correlated LCTs, if any.
455 std::vector<CSCCorrelatedLCTDigi> CSCMotherboardME11::getLCTs1b() const
456 {
457  std::vector<CSCCorrelatedLCTDigi> tmpV;
458 
459  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++)
460  for (unsigned int mbx = 0; mbx < match_trig_window_size; mbx++)
461  for (int i=0;i<CSCConstants::MAX_LCTS_PER_CSC;i++)
462  if (allLCTs1b[bx][mbx][i].isValid()) tmpV.push_back(allLCTs1b[bx][mbx][i]);
463  return tmpV;
464 }
465 
466 // Returns vector of found correlated LCTs, if any.
467 std::vector<CSCCorrelatedLCTDigi> CSCMotherboardME11::getLCTs1a() const
468 {
469  std::vector<CSCCorrelatedLCTDigi> tmpV;
470 
471  // disabled ME1a
472  if (mpc_block_me1a || disableME1a) return tmpV;
473 
474  // Report all LCTs found.
475  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++)
476  for (unsigned int mbx = 0; mbx < match_trig_window_size; mbx++)
477  for (int i=0;i<CSCConstants::MAX_LCTS_PER_CSC;i++)
478  if (allLCTs1a[bx][mbx][i].isValid()) tmpV.push_back(allLCTs1a[bx][mbx][i]);
479  return tmpV;
480 }
481 
482 
484 {
485  if ( !c.isValid() || !a.isValid() ) return false;
486  int key_hs = c.getKeyStrip();
487  int key_wg = a.getKeyWG();
488  if ( me == ME1A )
489  {
490  if ( !gangedME1a )
491  {
492  // wrap around ME11 HS number for -z endcap
493  if (theEndcap==2) key_hs = CSCConstants::MAX_HALF_STRIP_ME1A_UNGANGED - key_hs;
494  if ( key_hs >= lut_wg_vs_hs_me1a[key_wg][0] &&
495  key_hs <= lut_wg_vs_hs_me1a[key_wg][1] ) return true;
496  return false;
497  }
498  else
499  {
500  if (theEndcap==2) key_hs = CSCConstants::MAX_HALF_STRIP_ME1A_GANGED - key_hs;
501  if ( key_hs >= lut_wg_vs_hs_me1ag[key_wg][0] &&
502  key_hs <= lut_wg_vs_hs_me1ag[key_wg][1] ) return true;
503  return false;
504  }
505  }
506  if ( me == ME1B)
507  {
508  if (theEndcap==2) key_hs = CSCConstants::MAX_HALF_STRIP_ME1B - key_hs;
509  if ( key_hs >= lut_wg_vs_hs_me1b[key_wg][0] &&
510  key_hs <= lut_wg_vs_hs_me1b[key_wg][1] ) return true;
511  }
512  return false;
513 }
514 
515 
517  const CSCALCTDigi& sALCT,
518  const CSCCLCTDigi& bCLCT,
519  const CSCCLCTDigi& sCLCT,
520  CSCCorrelatedLCTDigi& lct1,
521  CSCCorrelatedLCTDigi& lct2,
522  int me) const
523 {
524  // assume that always anodeBestValid && cathodeBestValid
525  CSCALCTDigi bestALCT = bALCT;
526  CSCALCTDigi secondALCT = sALCT;
527  CSCCLCTDigi bestCLCT = bCLCT;
528  CSCCLCTDigi secondCLCT = sCLCT;
529 
530  if (secondALCT == bestALCT) secondALCT.clear();
531  if (secondCLCT == bestCLCT) secondCLCT.clear();
532 
533  int ok11 = doesALCTCrossCLCT( bestALCT, bestCLCT, me);
534  int ok12 = doesALCTCrossCLCT( bestALCT, secondCLCT, me);
535  int ok21 = doesALCTCrossCLCT( secondALCT, bestCLCT, me);
536  int ok22 = doesALCTCrossCLCT( secondALCT, secondCLCT, me);
537  int code = (ok11<<3) | (ok12<<2) | (ok21<<1) | (ok22);
538 
539  int dbg=0;
540  int ring = me;
542  CSCDetId did(theEndcap, theStation, ring, chamb, 0);
543  if (dbg) LogTrace("CSCMotherboardME11")<<"debug correlateLCTs in "<<did<<std::endl
544  <<"ALCT1: "<<bestALCT<<std::endl
545  <<"ALCT2: "<<secondALCT<<std::endl
546  <<"CLCT1: "<<bestCLCT<<std::endl
547  <<"CLCT2: "<<secondCLCT<<std::endl
548  <<"ok 11 12 21 22 code = "<<ok11<<" "<<ok12<<" "<<ok21<<" "<<ok22<<" "<<code<<std::endl;
549 
550  if ( code==0 ) return;
551 
552  // LUT defines correspondence between possible ok## combinations
553  // and resulting lct1 and lct2
554  int lut[16][2] = {
555  //ok: 11 12 21 22
556  {0 ,0 }, // 0 0 0 0
557  {22,0 }, // 0 0 0 1
558  {21,0 }, // 0 0 1 0
559  {21,22}, // 0 0 1 1
560  {12,0 }, // 0 1 0 0
561  {12,22}, // 0 1 0 1
562  {12,21}, // 0 1 1 0
563  {12,21}, // 0 1 1 1
564  {11,0 }, // 1 0 0 0
565  {11,22}, // 1 0 0 1
566  {11,21}, // 1 0 1 0
567  {11,22}, // 1 0 1 1
568  {11,12}, // 1 1 0 0
569  {11,22}, // 1 1 0 1
570  {11,12}, // 1 1 1 0
571  {11,22}, // 1 1 1 1
572  };
573 
574  if (dbg) LogTrace("CSCMotherboardME11")<<"lut 0 1 = "<<lut[code][0]<<" "<<lut[code][1]<<std::endl;
575 
576  switch (lut[code][0]) {
577  case 11:
578  lct1 = constructLCTs(bestALCT, bestCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 1);
579  break;
580  case 12:
581  lct1 = constructLCTs(bestALCT, secondCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 1);
582  break;
583  case 21:
584  lct1 = constructLCTs(secondALCT, bestCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 1);
585  break;
586  case 22:
587  lct1 = constructLCTs(secondALCT, secondCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 1);
588  break;
589  default: return;
590  }
591 
592  if (dbg) LogTrace("CSCMotherboardME11")<<"lct1: "<<lct1<<std::endl;
593 
594  switch (lut[code][1])
595  {
596  case 12:
597  lct2 = constructLCTs(bestALCT, secondCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 2);
598  if (dbg) LogTrace("CSCMotherboardME11")<<"lct2: "<<lct2<<std::endl;
599  return;
600  case 21:
601  lct2 = constructLCTs(secondALCT, bestCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 2);
602  if (dbg) LogTrace("CSCMotherboardME11")<<"lct2: "<<lct2<<std::endl;
603  return;
604  case 22:
605  lct2 = constructLCTs(secondALCT, secondCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 2);
606  if (dbg) LogTrace("CSCMotherboardME11")<<"lct2: "<<lct2<<std::endl;
607  return;
608  default: return;
609  }
610  if (dbg) LogTrace("CSCMotherboardME11")<<"out of correlateLCTs"<<std::endl;
611 
612  return;
613 }
614 
#define LogDebug(id)
const unsigned theSector
T getParameter(std::string const &) const
CSCCorrelatedLCTDigi allLCTs1a[CSCConstants::MAX_LCT_TBINS][15][2]
std::vector< CSCCLCTDigi > clctV1a
void correlateLCTs(const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2, int me) const
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc)
void setConfigParameters(const CSCDBL1TPParameters *conf)
unsigned int match_trig_window_size
std::vector< CSCCorrelatedLCTDigi > getLCTs1a() const
const unsigned theTrigChamber
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:30
unsigned int max_me11_lcts
const unsigned theEndcap
void clear()
clear this ALCT
Definition: CSCALCTDigi.cc:35
static const int lut_wg_vs_hs_me1a[48][2]
const CSCGeometry * csc_g
std::unique_ptr< CSCCathodeLCTProcessor > clct1a
unsigned int mpc_block_me1a
unsigned int tmb_cross_bx_algo
const unsigned theStation
std::vector< CSCALCTDigi > alctV
const unsigned theSubsector
unsigned int tmb_l1a_window_size
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:30
int pref[CSCConstants::MAX_LCT_TBINS]
CSCCorrelatedLCTDigi constructLCTs(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT, int type, int trknmb) const
std::vector< CSCCorrelatedLCTDigi > readoutLCTs1a() const
static const int lut_wg_vs_hs_me1b[48][2]
static const int lut_wg_vs_hs_me1ag[48][2]
#define LogTrace(id)
std::vector< CSCCorrelatedLCTDigi > readoutLCTs1b() const
bool doesALCTCrossCLCT(const CSCALCTDigi &a, const CSCCLCTDigi &c, int me) const
CSCCorrelatedLCTDigi allLCTs1b[CSCConstants::MAX_LCT_TBINS][15][2]
std::vector< CSCCorrelatedLCTDigi > getLCTs1b() const
double b
Definition: hdecay.h:120
std::vector< CSCCLCTDigi > clctV1b
std::unique_ptr< CSCAnodeLCTProcessor > alct
double a
Definition: hdecay.h:121
std::unique_ptr< CSCCathodeLCTProcessor > clct
void clear()
clear this CLCT
Definition: CSCCLCTDigi.cc:58
int getKeyStrip() const
Definition: CSCCLCTDigi.h:89
int getKeyWG() const
return key wire group
Definition: CSCALCTDigi.h:57
static int chamberFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station, int TriggerCSCID)
std::vector< CSCCorrelatedLCTDigi > readoutLCTs() const