CMS 3D CMS Logo

CSCGEMMotherboardME11.cc
Go to the documentation of this file.
2 
4  unsigned sector, unsigned subsector,
5  unsigned chamber,
6  const edm::ParameterSet& conf)
7  : CSCGEMMotherboard(endcap, station, sector, subsector, chamber, conf)
8  // special configuration parameters for ME11 treatment
9  , dropLowQualityCLCTsNoGEMs_ME1a_(tmbParams_.getParameter<bool>("dropLowQualityCLCTsNoGEMs_ME1a"))
10  , dropLowQualityCLCTsNoGEMs_ME1b_(tmbParams_.getParameter<bool>("dropLowQualityCLCTsNoGEMs_ME1b"))
11  , dropLowQualityALCTsNoGEMs_ME1a_(tmbParams_.getParameter<bool>("dropLowQualityALCTsNoGEMs_ME1a"))
12  , dropLowQualityALCTsNoGEMs_ME1b_(tmbParams_.getParameter<bool>("dropLowQualityALCTsNoGEMs_ME1b"))
13  , buildLCTfromALCTandGEM_ME1a_(tmbParams_.getParameter<bool>("buildLCTfromALCTandGEM_ME1a"))
14  , buildLCTfromALCTandGEM_ME1b_(tmbParams_.getParameter<bool>("buildLCTfromALCTandGEM_ME1b"))
15  , buildLCTfromCLCTandGEM_ME1a_(tmbParams_.getParameter<bool>("buildLCTfromCLCTandGEM_ME1a"))
16  , buildLCTfromCLCTandGEM_ME1b_(tmbParams_.getParameter<bool>("buildLCTfromCLCTandGEM_ME1b"))
17  , promoteCLCTGEMquality_ME1a_(tmbParams_.getParameter<bool>("promoteCLCTGEMquality_ME1a"))
18  , promoteCLCTGEMquality_ME1b_(tmbParams_.getParameter<bool>("promoteCLCTGEMquality_ME1b"))
19 {
20  if (!isSLHC_) edm::LogError("CSCGEMMotherboardME11|ConfigError")
21  << "+++ Upgrade CSCGEMMotherboardME11 constructed while isSLHC is not set! +++\n";
22 
23  // set LUTs
24  tmbLUT_.reset(new CSCGEMMotherboardLUTME11());
25  cscTmbLUT_.reset(new CSCMotherboardLUTME11());
26 }
27 
28 
31 {
32  // Constructor used only for testing.
33  if (!isSLHC_) edm::LogError("CSCGEMMotherboardME11|ConfigError")
34  << "+++ Upgrade CSCGEMMotherboardME11 constructed while isSLHC is not set! +++\n";
35 }
36 
37 
39 {
40 }
41 
42 
43 //===============================================
44 //use ALCTs, CLCTs, GEMs to build LCTs
45 //loop over each BX to find valid ALCT in ME1b, try ALCT-CLCT match, if ALCT-CLCT match failed, try ALCT-GEM match
46 //do the same in ME1a
47 //sort LCTs according to different algorithm, and send out number of LCTs up to max_lcts
48 //===============================================
49 
51  const CSCComparatorDigiCollection* compdc,
52  const GEMPadDigiCollection* gemPads)
53 {
55  setupGeometry();
56  debugLUTs();
57 
58  if (gem_g != nullptr) {
59  if (infoV >= 0) edm::LogInfo("CSCGEMMotherboardME11|SetupInfo")
60  << "+++ run() called for GEM-CSC integrated trigger! +++ \n";
61  gemGeometryAvailable = true;
62  }
63 
64  // check for GEM geometry
65  if (not gemGeometryAvailable){
66  if (infoV >= 0) edm::LogError("CSCGEMMotherboardME11|SetupError")
67  << "+++ run() called for GEM-CSC integrated trigger without valid GEM geometry! +++ \n";
68  return;
69  }
70  gemCoPadV = coPadProcessor->run(gemPads); // run copad processor in GE1/1
71 
72  if (!( alctProc and clctProc and isSLHC_))
73  {
74  if (infoV >= 0) edm::LogError("CSCGEMMotherboardME11|SetupError")
75  << "+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
76  return;
77  }
78 
79  alctProc->setCSCGeometry(cscGeometry_);
80  clctProc->setCSCGeometry(cscGeometry_);
81 
82  alctV = alctProc->run(wiredc); // run anodeLCT
83  clctV = clctProc->run(compdc); // run cathodeLCT
84 
85  // if there are no ALCTs and no CLCTs, it does not make sense to run this TMB
86  if (alctV.empty() and clctV.empty()) return;
87 
88  LogTrace("CSCGEMCMotherboardME11") <<"ALL ALCTs from ME11 "<< std::endl;
89  for (const auto& alct : alctV)
90  if (alct.isValid())
91  LogTrace("CSCGEMCMotherboardME11") << alct << std::endl;
92 
93  LogTrace("CSCGEMCMotherboardME11") <<"ALL CLCTs from ME11 "<< std::endl;
94  for (const auto& clct : clctV)
95  if (clct.isValid())
96  LogTrace("CSCGEMCMotherboardME11") << clct << std::endl;
97 
98  int used_clct_mask[20];
99  for (int b=0;b<20;b++)
100  used_clct_mask[b] = 0;
101 
102  retrieveGEMPads(gemPads, gemId);
104 
105  const bool hasPads(!pads_.empty());
106  const bool hasCoPads(hasPads and !coPads_.empty());
107 
108  // ALCT-centric matching
109  for (int bx_alct = 0; bx_alct < CSCConstants::MAX_ALCT_TBINS; bx_alct++)
110  {
111  if (alctProc->bestALCT[bx_alct].isValid())
112  {
113  const int bx_clct_start(bx_alct - match_trig_window_size/2 - alctClctOffset_);
114  const int bx_clct_stop(bx_alct + match_trig_window_size/2 - alctClctOffset_);
115  const int bx_copad_start(bx_alct - maxDeltaBXCoPad_);
116  const int bx_copad_stop(bx_alct + maxDeltaBXCoPad_);
117 
118  if (debug_matching){
119  LogTrace("CSCGEMCMotherboardME11") << "========================================================================\n"
120  << "ALCT-CLCT matching in ME1/1 chamber: " << cscId_ << "\n"
121  << "------------------------------------------------------------------------\n"
122  << "+++ Best ALCT Details: " << alctProc->bestALCT[bx_alct] << "\n"
123  << "+++ Second ALCT Details: " << alctProc->secondALCT[bx_alct] << std::endl;
124 
125  printGEMTriggerPads(bx_clct_start, bx_clct_stop, CSCPart::ME11);
126  printGEMTriggerCoPads(bx_clct_start, bx_clct_stop, CSCPart::ME11);
127 
128  LogTrace("CSCGEMCMotherboardME11") << "------------------------------------------------------------------------ \n"
129  << "Attempt ALCT-CLCT matching in ME1/b in bx range: [" << bx_clct_start << "," << bx_clct_stop << "]" << std::endl;
130  }
131 
132  // ALCT-to-CLCT matching in ME1b
133  int nSuccesFulMatches = 0;
134  for (int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++)
135  {
136  if (bx_clct < 0 or bx_clct >= CSCConstants::MAX_CLCT_TBINS) continue;
137  if (drop_used_clcts and used_clct_mask[bx_clct]) continue;
138  if (clctProc->bestCLCT[bx_clct].isValid())
139  {
140  const int quality(clctProc->bestCLCT[bx_clct].getQuality());
141  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "++Valid ME1b CLCT: " << clctProc->bestCLCT[bx_clct] << std::endl;
142 
143  // pick the pad that corresponds
144  matches<GEMPadDigi> mPads;
145  matchingPads<GEMPadDigi>(clctProc->bestCLCT[bx_clct], clctProc->secondCLCT[bx_clct],
146  alctProc->bestALCT[bx_alct], alctProc->secondALCT[bx_alct], mPads);
147  matches<GEMCoPadDigi> mCoPads;
148  matchingPads<GEMCoPadDigi>(clctProc->bestCLCT[bx_clct], clctProc->secondCLCT[bx_clct],
149  alctProc->bestALCT[bx_alct], alctProc->secondALCT[bx_alct], mCoPads);
150 
151  // Low quality LCTs have at most 3 layers. Check if there is a matching GEM pad to keep the CLCT
152  if (dropLowQualityCLCTsNoGEMs_ME1b_ and quality < 4 and hasPads){
153  int nFound(mPads.size());
154  // these halfstrips (1,2,3,4) and (125,126,127,128) do not have matching GEM pads because GEM chambers are slightly wider than CSCs
155  const bool clctInEdge(clctProc->bestCLCT[bx_clct].getKeyStrip() < 5 or clctProc->bestCLCT[bx_clct].getKeyStrip() > 124);
156  if (clctInEdge){
157  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "\tInfo: low quality CLCT in CSC chamber edge, don't care about GEM pads" << std::endl;
158  }
159  else {
160  if (nFound != 0){
161  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "\tInfo: low quality CLCT with " << nFound << " matching GEM trigger pads" << std::endl;
162  }
163  else {
164  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "\tWarning: low quality CLCT without matching GEM trigger pad" << std::endl;
165  continue;
166  }
167  }
168  }
169 
170  ++nSuccesFulMatches;
171 
172  // if (infoV > 1) LogTrace("CSCMotherboard")
173  int mbx = bx_clct-bx_clct_start;
174  correlateLCTsGEM(alctProc->bestALCT[bx_alct], alctProc->secondALCT[bx_alct],
175  clctProc->bestCLCT[bx_clct], clctProc->secondCLCT[bx_clct],
176  mPads, mCoPads,
177  allLCTs(bx_alct,mbx,0), allLCTs(bx_alct,mbx,1));
178  if (debug_matching ) {
179  LogTrace("CSCGEMCMotherboardME11") << "Successful ALCT-CLCT match in ME1b: bx_alct = " << bx_alct
180  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop
181  << "]; bx_clct = " << bx_clct << "\n"
182  << "+++ Best CLCT Details: " << clctProc->bestCLCT[bx_clct] << "\n"
183  << "+++ Second CLCT Details: " << clctProc->secondCLCT[bx_clct] << std::endl;
184  if (allLCTs(bx_alct,mbx,0).isValid())
185  LogTrace("CSCGEMCMotherboardME11") << "LCT #1 "<< allLCTs(bx_alct,mbx,0) << std::endl;
186  else
187  LogTrace("CSCGEMCMotherboardME11") << "No valid LCT is built from ALCT-CLCT matching in ME1b" << std::endl;
188  if (allLCTs(bx_alct,mbx,1).isValid())
189  LogTrace("CSCGEMCMotherboardME11") << "LCT #2 "<< allLCTs(bx_alct,mbx,1) << std::endl;
190  }
191 
192  if (allLCTs(bx_alct,mbx,0).isValid()) {
193  used_clct_mask[bx_clct] += 1;
194  if (match_earliest_clct_only) break;
195  }
196  }
197  }
198 
199  // ALCT-to-GEM matching in ME1b
200  int nSuccesFulGEMMatches = 0;
201  if (nSuccesFulMatches==0 and buildLCTfromALCTandGEM_ME1b_){
202  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "++No valid ALCT-CLCT matches in ME1b" << std::endl;
203  for (int bx_gem = bx_copad_start; bx_gem <= bx_copad_stop; bx_gem++) {
204  if (not hasCoPads) {
205  continue;
206  }
207 
208  // find the best matching copad
209  matches<GEMCoPadDigi> copads;
210  matchingPads<CSCALCTDigi, GEMCoPadDigi>(alctProc->bestALCT[bx_alct], alctProc->secondALCT[bx_alct], copads);
211 
212  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "\t++Number of matching GEM CoPads in BX " << bx_alct << " : "<< copads.size() << std::endl;
213  if (copads.empty()) {
214  continue;
215  }
216 
217  CSCGEMMotherboard::correlateLCTsGEM(alctProc->bestALCT[bx_alct], alctProc->secondALCT[bx_alct],
218  copads, allLCTs(bx_alct,0,0), allLCTs(bx_alct,0,1));
219 
220  if (debug_matching) {
221  LogTrace("CSCGEMCMotherboardME11") << "Successful ALCT-GEM CoPad match in ME1b: bx_alct = " << bx_alct << "\n\n"
222  << "------------------------------------------------------------------------" << std::endl << std::endl;
223  if (allLCTs(bx_alct,0,0).isValid())
224  LogTrace("CSCGEMCMotherboardME11") << "LCT #1 "<< allLCTs(bx_alct,0,0) << std::endl;
225  else
226  LogTrace("CSCGEMCMotherboardME11") << "No valid LCT is built from ALCT-GEM matching in ME1b" << std::endl;
227  if (allLCTs(bx_alct,0,1).isValid())
228  LogTrace("CSCGEMCMotherboardME11") << "LCT #2 "<< allLCTs(bx_alct,0,1) << std::endl;
229  }
230 
231  if (allLCTs(bx_alct,0,0).isValid()) {
232  ++nSuccesFulGEMMatches;
233  if (match_earliest_clct_only) break;
234  }
235  }
236  }
237 
238  if (debug_matching) {
239  LogTrace("CSCGEMCMotherboardME11") << "========================================================================" << std::endl
240  << "Summary: " << std::endl;
241  if (nSuccesFulMatches>1)
242  LogTrace("CSCGEMCMotherboardME11") << "Too many successful ALCT-CLCT matches in ME1/1: " << nSuccesFulMatches
243  << ", CSCDetId " << cscId_
244  << ", bx_alct = " << bx_alct
245  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop << "]" << std::endl;
246  else if (nSuccesFulMatches==1)
247  LogTrace("CSCGEMCMotherboardME11") << "1 successful ALCT-CLCT match in ME1/1: "
248  << " CSCDetId " << cscId_
249  << ", bx_alct = " << bx_alct
250  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop << "]" << std::endl;
251  else if (nSuccesFulGEMMatches==1)
252  LogTrace("CSCGEMCMotherboardME11") << "1 successful ALCT-GEM match in ME1/1: "
253  << " CSCDetId " << cscId_
254  << ", bx_alct = " << bx_alct
255  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop << "]" << std::endl;
256  else
257  LogTrace("CSCGEMCMotherboardME11") << "Unsuccessful ALCT-CLCT match in ME1/1: "
258  << "CSCDetId " << cscId_
259  << ", bx_alct = " << bx_alct
260  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop << "]" << std::endl;
261  }
262  } // end of ALCT valid block
263  else {
264  auto coPads(coPads_[bx_alct]);
265  if (!coPads.empty()) {
266  // keep it simple for the time being, only consider the first copad
267  const int bx_clct_start(bx_alct - match_trig_window_size/2);
268  const int bx_clct_stop(bx_alct + match_trig_window_size/2);
269 
270  // matching in ME1b
272  for (int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
273  if (bx_clct < 0 or bx_clct >= CSCConstants::MAX_CLCT_TBINS) continue;
274  if (drop_used_clcts and used_clct_mask[bx_clct]) continue;
275  if (clctProc->bestCLCT[bx_clct].isValid()) {
276  const int quality(clctProc->bestCLCT[bx_clct].getQuality());
277  // only use high-Q stubs for the time being
278  if (quality < 4) continue;
279  int mbx = bx_clct-bx_clct_start;
280  CSCGEMMotherboard::correlateLCTsGEM(clctProc->bestCLCT[bx_clct], clctProc->secondCLCT[bx_clct], coPads,
281  allLCTs(bx_alct,mbx,0), allLCTs(bx_alct,mbx,1));
282  if (debug_matching) {
283  // if (infoV > 1) LogTrace("CSCMotherboard")
284  LogTrace("CSCGEMCMotherboardME11") << "Successful GEM-CLCT match in ME1b: bx_alct = " << bx_alct
285  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop
286  << "]; bx_clct = " << bx_clct << "\n"
287  << "+++ Best CLCT Details: " << clctProc->bestCLCT[bx_clct] << "\n"
288  << "+++ Second CLCT Details: " << clctProc->secondCLCT[bx_clct] << std::endl;
289  }
290  if (allLCTs(bx_alct,mbx,0).isValid()) {
291  used_clct_mask[bx_clct] += 1;
292  if (match_earliest_clct_only) break;
293  }
294  }
295  } //end of clct loop
296  }
297  } // if (!coPads.empty())
298  }
299  } // end of ALCT-centric matching
300 
301  if (debug_matching){
302  LogTrace("CSCGEMCMotherboardME11") << "======================================================================== \n"
303  << "Counting the LCTs in CSCGEMMotherboard ME11 \n"
304  << "========================================================================" << std::endl;
305  }
306 
307 
308  unsigned int n1b=0, n1a=0;
309  LogTrace("CSCGEMCMotherboardME11") << "======================================================================== \n"
310  << "Counting the final LCTs in CSCGEMMotherboard ME11\n"
311  << "======================================================================== \n"
312  << "tmb_cross_bx_algo: " << tmb_cross_bx_algo << std::endl;
313 
314  for (const auto& p : readoutLCTs1b()) {
315  n1b++;
316  LogTrace("CSCGEMCMotherboardME11") << "1b LCT "<<n1b<<" " << p <<std::endl;
317  }
318 
319  for (const auto& p : readoutLCTs1a()){
320  n1a++;
321  LogTrace("CSCGEMCMotherboardME11") << "1a LCT "<<n1a<<" " << p <<std::endl;
322 
323  }
324 }
325 
326 std::vector<CSCCorrelatedLCTDigi> CSCGEMMotherboardME11::readoutLCTs1a() const
327 {
328  return readoutLCTsME11(ME1A);
329 }
330 
331 
332 std::vector<CSCCorrelatedLCTDigi> CSCGEMMotherboardME11::readoutLCTs1b() const
333 {
334  return readoutLCTsME11(ME1B);
335 }
336 
337 
338 // Returns vector of read-out correlated LCTs, if any. Starts with
339 // the vector of all found LCTs and selects the ones in the read-out
340 // time window.
341 std::vector<CSCCorrelatedLCTDigi> CSCGEMMotherboardME11::readoutLCTsME11(enum CSCPart me1ab) const
342 {
343  std::vector<CSCCorrelatedLCTDigi> tmpV;
344 
345  // The start time of the L1A*LCT coincidence window should be related
346  // to the fifo_pretrig parameter, but I am not completely sure how.
347  // Just choose it such that the window is centered at bx=7. This may
348  // need further tweaking if the value of tmb_l1a_window_size changes.
349  //static int early_tbins = 4;
350  // The number of LCT bins in the read-out is given by the
351  // tmb_l1a_window_size parameter, forced to be odd
352  const int lct_bins =
354  const int late_tbins = early_tbins + lct_bins;
355 
356  // Start from the vector of all found correlated LCTs and select
357  // those within the LCT*L1A coincidence window.
358  int bx_readout = -1;
359  std::vector<CSCCorrelatedLCTDigi> all_lcts;
360  switch(tmb_cross_bx_algo){
361  case 0: case 1:
362  allLCTs.getMatched(all_lcts);
363  break;
365  break;
367  break;
368  default: LogTrace("CSCGEMCMotherboardME11")<<"tmb_cross_bx_algo error" <<std::endl;
369  break;
370  }
371 
372  for (const auto& lct: all_lcts)
373  {
374  if (!lct.isValid()) continue;
375 
376  int bx = lct.getBX();
377  // Skip LCTs found too early relative to L1Accept.
378  if (bx <= early_tbins) continue;
379 
380  // Skip LCTs found too late relative to L1Accept.
381  if (bx > late_tbins) continue;
382 
383  if ((me1ab == CSCPart::ME1B and lct.getStrip() > CSCConstants::MAX_HALF_STRIP_ME1B ) or (me1ab == CSCPart::ME1A and lct.getStrip() <= CSCConstants::MAX_HALF_STRIP_ME1B))
384  continue;
385 
386  // If (readout_earliest_2) take only LCTs in the earliest bx in the read-out window:
387  // in digi->raw step, LCTs have to be packed into the TMB header, and
388  // currently there is room just for two.
389  if (readout_earliest_2 and (bx_readout == -1 or bx == bx_readout) )
390  {
391  tmpV.push_back(lct);
392  if (bx_readout == -1) bx_readout = bx;
393  }
394  else tmpV.push_back(lct);
395  }
396  return tmpV;
397 }
398 
399 //sort LCTs in each BX
400 //
401 void CSCGEMMotherboardME11::sortLCTs(std::vector<CSCCorrelatedLCTDigi>& LCTs, int bx,
402  bool (*sorter)(const CSCCorrelatedLCTDigi&, const CSCCorrelatedLCTDigi&)) const
403 {
404  allLCTs.getTimeMatched(bx, LCTs);
405 
407 
408  if (LCTs.size() > max_lcts) LCTs.erase(LCTs.begin()+max_lcts, LCTs.end());
409 }
410 
411 //sort LCTs in whole LCTs BX window
412 void CSCGEMMotherboardME11::sortLCTs(std::vector<CSCCorrelatedLCTDigi>& LCTs,
413  bool (*sorter)(const CSCCorrelatedLCTDigi&, const CSCCorrelatedLCTDigi&)) const
414 {
415  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++) {
416  // temporary collection with all LCTs in the whole chamber
417  std::vector<CSCCorrelatedLCTDigi> LCTs_tmp;
418  CSCGEMMotherboardME11::sortLCTs(LCTs_tmp, bx, *sorter);
419 
420  // Add the LCTs
421  for (const auto& p: LCTs_tmp){
422  LCTs.push_back(p);
423  }
424  }
425 }
426 
427 
429 {
430  return cscTmbLUT_->doesALCTCrossCLCT(a, c, theEndcap, gangedME1a_);
431 }
432 
433 bool CSCGEMMotherboardME11::doesWiregroupCrossStrip(int key_wg, int key_strip) const
434 {
435  return cscTmbLUT_->doesWiregroupCrossStrip(key_wg, key_strip, theEndcap, gangedME1a_);
436 }
437 
438 
440  const CSCALCTDigi& sALCT,
441  const CSCCLCTDigi& bCLCT,
442  const CSCCLCTDigi& sCLCT,
443  const GEMPadDigiIds& pads,
444  const GEMCoPadDigiIds& copads,
445  CSCCorrelatedLCTDigi& lct1,
446  CSCCorrelatedLCTDigi& lct2) const
447 {
448  CSCALCTDigi bestALCT = bALCT;
449  CSCALCTDigi secondALCT = sALCT;
450  CSCCLCTDigi bestCLCT = bCLCT;
451  CSCCLCTDigi secondCLCT = sCLCT;
452 
453  // assume that always anodeBestValid and cathodeBestValid
454  if (secondALCT == bestALCT) secondALCT.clear();
455  if (secondCLCT == bestCLCT) secondCLCT.clear();
456 
457  const bool ok_bb = bestALCT.isValid() and bestCLCT.isValid();
458  const bool ok_bs = bestALCT.isValid() and secondCLCT.isValid();
459  const bool ok_sb = secondALCT.isValid() and bestCLCT.isValid();
460  const bool ok_ss = secondALCT.isValid() and secondCLCT.isValid();
461 
462  const int ok11 = doesALCTCrossCLCT( bestALCT, bestCLCT);
463  const int ok12 = doesALCTCrossCLCT( bestALCT, secondCLCT);
464  const int ok21 = doesALCTCrossCLCT( secondALCT, bestCLCT);
465  const int ok22 = doesALCTCrossCLCT( secondALCT, secondCLCT);
466  const int code = (ok11<<3) | (ok12<<2) | (ok21<<1) | (ok22);
467 
468  int dbg=0;
469  if (dbg) LogTrace("CSCGEMMotherboardME11")<<"debug correlateLCTs in ME11"<< cscId_ << "\n"
470  <<"ALCT1: "<<bestALCT<<"\n"
471  <<"ALCT2: "<<secondALCT<<"\n"
472  <<"CLCT1: "<<bestCLCT<<"\n"
473  <<"CLCT2: "<<secondCLCT<<"\n"
474  <<"ok 11 12 21 22 code = "<<ok11<<" "<<ok12<<" "<<ok21<<" "<<ok22<<" "<<code<<std::endl;
475 
476  if ( code==0 ) return;
477 
478  // LUT defines correspondence between possible ok## combinations
479  // and resulting lct1 and lct2
480  int lut[16][2] = {
481  //ok: 11 12 21 22
482  {0 ,0 }, // 0 0 0 0
483  {22,0 }, // 0 0 0 1
484  {21,0 }, // 0 0 1 0
485  {21,22}, // 0 0 1 1
486  {12,0 }, // 0 1 0 0
487  {12,22}, // 0 1 0 1
488  {12,21}, // 0 1 1 0
489  {12,21}, // 0 1 1 1
490  {11,0 }, // 1 0 0 0
491  {11,22}, // 1 0 0 1
492  {11,21}, // 1 0 1 0
493  {11,22}, // 1 0 1 1
494  {11,12}, // 1 1 0 0
495  {11,22}, // 1 1 0 1
496  {11,12}, // 1 1 1 0
497  {11,22}, // 1 1 1 1
498  };
499 
500  if (dbg) LogTrace("CSCGEMMotherboardME11")<<"lut 0 1 = "<<lut[code][0]<<" "<<lut[code][1]<<std::endl;
501 
502  // check matching copads
503  const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads);
504  const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads);
505  const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads);
506  const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads);
507 
508  // check matching pads
509  const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads);
510  const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads);
511  const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads);
512  const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads);
513 
514  // evaluate possible combinations
515  const bool ok_bb_copad = ok11==1 and ok_bb and bb_copad.isValid();
516  const bool ok_bs_copad = ok12==1 and ok_bs and bs_copad.isValid();
517  const bool ok_sb_copad = ok21==1 and ok_sb and sb_copad.isValid();
518  const bool ok_ss_copad = ok22==1 and ok_ss and ss_copad.isValid();
519 
520  const bool ok_bb_pad = (not ok_bb_copad) and ok11==1 and ok_bb and bb_pad.isValid();
521  const bool ok_bs_pad = (not ok_bs_copad) and ok12==1 and ok_bs and bs_pad.isValid();
522  const bool ok_sb_pad = (not ok_sb_copad) and ok21==1 and ok_sb and sb_pad.isValid();
523  const bool ok_ss_pad = (not ok_ss_copad) and ok22==1 and ok_ss and ss_pad.isValid();
524 
525  switch (lut[code][0]) {
526  case 11:
527  if (ok_bb_copad) lct1 = CSCGEMMotherboard::constructLCTsGEM(bestALCT, bestCLCT, bb_copad, 1);
528  else if (ok_bb_pad) lct1 = CSCGEMMotherboard::constructLCTsGEM(bestALCT, bestCLCT, bb_pad, 1);
529  else lct1 = constructLCTs(bestALCT, bestCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 1);
530  break;
531  case 12:
532  if (ok_bs_copad) lct1 = CSCGEMMotherboard::constructLCTsGEM(bestALCT, secondCLCT, bs_copad, 1);
533  else if (ok_bs_pad) lct1 = CSCGEMMotherboard::constructLCTsGEM(bestALCT, secondCLCT, bs_pad, 1);
534  else lct1 = constructLCTs(bestALCT, secondCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 1);
535  break;
536  case 21:
537  if (ok_sb_copad) lct1 = CSCGEMMotherboard::constructLCTsGEM(secondALCT, bestCLCT, sb_copad, 1);
538  else if (ok_sb_pad) lct1 = CSCGEMMotherboard::constructLCTsGEM(secondALCT, bestCLCT, sb_pad, 1);
539  else lct1 = constructLCTs(secondALCT, bestCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 1);
540  break;
541  case 22:
542  if (ok_ss_copad) lct1 = CSCGEMMotherboard::constructLCTsGEM(secondALCT, secondCLCT, ss_copad, 1);
543  else if (ok_ss_pad) lct1 = CSCGEMMotherboard::constructLCTsGEM(secondALCT, secondCLCT, ss_pad, 1);
544  else lct1 = constructLCTs(secondALCT, secondCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 1);
545  break;
546  default:
547  return;
548  }
549 
550  if (dbg) LogTrace("CSCGEMMotherboardME11")<<"lct1: "<<lct1<<std::endl;
551 
552  switch (lut[code][1]){
553  case 12:
554  if (ok_bs_copad) lct2 = CSCGEMMotherboard::constructLCTsGEM(bestALCT, secondCLCT, bs_copad, 2);
555  else if (ok_bs_pad) lct2 = CSCGEMMotherboard::constructLCTsGEM(bestALCT, secondCLCT, bs_pad, 2);
556  else lct2 = constructLCTs(bestALCT, secondCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 2);
557  break;
558  case 21:
559  if (ok_sb_copad) lct2 = CSCGEMMotherboard::constructLCTsGEM(secondALCT, bestCLCT, sb_copad, 2);
560  else if (ok_sb_pad) lct2 = CSCGEMMotherboard::constructLCTsGEM(secondALCT, bestCLCT, sb_pad, 2);
561  else lct2 = constructLCTs(secondALCT, bestCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 2);
562  break;
563  case 22:
564  if (ok_bb_copad) lct2 = CSCGEMMotherboard::constructLCTsGEM(secondALCT, secondCLCT, bb_copad, 2);
565  else if (ok_bb_pad) lct2 = CSCGEMMotherboard::constructLCTsGEM(secondALCT, secondCLCT, bb_pad, 2);
566  else lct2 = constructLCTs(secondALCT, secondCLCT, CSCCorrelatedLCTDigi::ALCTCLCT, 2);
567  break;
568  default:
569  return;
570  }
571 
572  if (dbg) LogTrace("CSCGEMMotherboardME11")<<"lct2: "<<lct2<<std::endl;
573 
574  if (dbg) LogTrace("CSCGEMMotherboardME11")<<"out of correlateLCTs"<<std::endl;
575  return;
576 }
void retrieveGEMPads(const GEMPadDigiCollection *pads, unsigned id)
const unsigned theEndcap
Definition: CSCBaseboard.h:33
std::vector< CSCCLCTDigi > clctV
unsigned int match_trig_window_size
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:32
GEMCoPadDigiIdsBX coPads_
void sortLCTs(std::vector< CSCCorrelatedLCTDigi > &, int bx, bool(*sorter)(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)) const
void clear()
clear this ALCT
Definition: CSCALCTDigi.cc:39
bool doesALCTCrossCLCT(const CSCALCTDigi &a, const CSCCLCTDigi &c) const
std::unique_ptr< CSCCathodeLCTProcessor > clctProc
static bool sortLCTsByQuality(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
matches< GEMCoPadDigi > GEMCoPadDigiIds
std::vector< CSCCorrelatedLCTDigi > readoutLCTs1b() const
CSCDetId cscId_
Definition: CSCBaseboard.h:46
std::vector< GEMCoPadDigi > gemCoPadV
bool gangedME1a_
Definition: CSCBaseboard.h:77
std::unique_ptr< CSCMotherboardLUTME11 > cscTmbLUT_
bool isValid() const
Definition: GEMCoPadDigi.cc:32
void sortLCTs(std::vector< CSCCorrelatedLCTDigi > &lcts, bool(*sorter)(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)) const
std::vector< CSCCorrelatedLCTDigi > readoutLCTs1a() const
std::unique_ptr< GEMCoPadProcessor > coPadProcessor
void correlateLCTsGEM(T &best, T &second, const GEMCoPadDigiIds &coPads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2) const
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
std::vector< CSCALCTDigi > alctV
static bool sortLCTsByGEMDphi(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
void printGEMTriggerCoPads(int bx_start, int bx_stop, enum CSCPart)
unsigned int tmb_l1a_window_size
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:35
CSCCorrelatedLCTDigi constructLCTs(const CSCALCTDigi &aLCT, const CSCCLCTDigi &cLCT, int type, int trknmb) const
void getTimeMatched(const int bx, std::vector< CSCCorrelatedLCTDigi > &) const
#define LogTrace(id)
const CSCGeometry * cscGeometry_
Definition: CSCBaseboard.h:54
CSCCorrelatedLCTDigi constructLCTsGEM(const CSCALCTDigi &alct, const GEMCoPadDigi &gem, int i) const
std::vector< CSCCorrelatedLCTDigi > readoutLCTsME11(enum CSCPart me1ab) const
void getMatched(std::vector< CSCCorrelatedLCTDigi > &) const
std::unique_ptr< CSCGEMMotherboardLUTME11 > tmbLUT_
double b
Definition: hdecay.h:120
void correlateLCTsGEM(const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, const GEMPadDigiIds &pads, const GEMCoPadDigiIds &copads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2) const
bool doesWiregroupCrossStrip(int key_wg, int key_hs) const override
std::unique_ptr< CSCAnodeLCTProcessor > alctProc
GEMPadDigiIdsBX pads_
double a
Definition: hdecay.h:121
void clear()
clear this CLCT
Definition: CSCCLCTDigi.cc:54
matches< GEMPadDigi > GEMPadDigiIds
const GEMGeometry * gem_g
unsigned int alctClctOffset_
Definition: CSCBaseboard.h:86
void printGEMTriggerPads(int bx_start, int bx_stop, enum CSCPart)
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const GEMPadDigiCollection *gemPads) override