CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCGEMMotherboard.cc
Go to the documentation of this file.
1 #include <memory>
2 
5  unsigned station,
6  unsigned sector,
7  unsigned subsector,
8  unsigned chamber,
9  const edm::ParameterSet& conf)
10  : CSCMotherboard(endcap, station, sector, subsector, chamber, conf),
11  drop_low_quality_alct_no_gems_(tmbParams_.getParameter<bool>("dropLowQualityALCTsNoGEMs")),
12  drop_low_quality_clct_no_gems_(tmbParams_.getParameter<bool>("dropLowQualityCLCTsNoGEMs")),
13  build_lct_from_alct_clct_2gem_(tmbParams_.getParameter<bool>("buildLCTfromALCTCLCTand2GEM")),
14  build_lct_from_alct_clct_1gem_(tmbParams_.getParameter<bool>("buildLCTfromALCTCLCTand1GEM")),
15  build_lct_from_alct_gem_(tmbParams_.getParameter<bool>("buildLCTfromALCTandGEM")),
16  build_lct_from_clct_gem_(tmbParams_.getParameter<bool>("buildLCTfromCLCTandGEM")) {
17  // case for ME1/1
18  if (isME11_) {
19  drop_low_quality_clct_no_gems_me1a_ = tmbParams_.getParameter<bool>("dropLowQualityCLCTsNoGEMs_ME1a");
20  build_lct_from_clct_gem_me1a_ = tmbParams_.getParameter<bool>("buildLCTfromCLCTandGEM_ME1a");
21  }
22 
23  max_delta_bx_alct_gem_ = tmbParams_.getParameter<unsigned>("maxDeltaBXALCTGEM");
24  max_delta_bx_clct_gem_ = tmbParams_.getParameter<unsigned>("maxDeltaBXCLCTGEM");
25 
26  assign_gem_csc_bending_ = tmbParams_.getParameter<bool>("assignGEMCSCBending");
27  qualityAssignment_->setGEMCSCBending(assign_gem_csc_bending_);
28 
29  drop_used_gems_ = tmbParams_.getParameter<bool>("tmbDropUsedGems");
30  match_earliest_gem_only_ = tmbParams_.getParameter<bool>("matchEarliestGemsOnly");
31 
32  // These LogErrors are sanity checks and should not be printed
33  if (isME11_ and !runME11ILT_) {
34  edm::LogError("CSCGEMMotherboard") << "TMB constructed while runME11ILT_ is not set!";
35  };
36 
37  if (isME21_ and !runME21ILT_) {
38  edm::LogError("CSCGEMMotherboard") << "TMB constructed while runME21ILT_ is not set!";
39  };
40 
41  // super chamber has layer=0!
43 
44  clusterProc_ = std::make_shared<GEMClusterProcessor>(theRegion, theStation, theChamber, conf);
45 
46  cscGEMMatcher_ = std::make_unique<CSCGEMMatcher>(theRegion, theStation, theChamber, tmbParams_, conf);
47 }
48 
50 
53  clusterProc_->clear();
54 }
55 
57  const CSCComparatorDigiCollection* compdc,
58  const GEMPadDigiClusterCollection* gemClusters) {
59  // Step 1: Setup
60  clear();
61 
62  // check for GEM geometry
63  if (gem_g == nullptr) {
64  edm::LogError("CSCGEMMotherboard") << "run() called for GEM-CSC integrated trigger without valid GEM geometry! \n";
65  return;
66  }
67 
68  // Check that the processors can deliver data
69  if (!(alctProc and clctProc)) {
70  edm::LogError("CSCGEMMotherboard") << "run() called for non-existing ALCT/CLCT processor! \n";
71  return;
72  }
73 
74  alctProc->setCSCGeometry(cscGeometry_);
75  clctProc->setCSCGeometry(cscGeometry_);
76 
77  // set CCLUT parameters if necessary
78  if (runCCLUT_) {
79  clctProc->setESLookupTables(lookupTableCCLUT_);
80  }
81 
82  // Step 2: Run the processors
83  const std::vector<CSCALCTDigi>& alctV = alctProc->run(wiredc); // run anodeLCT
84  const std::vector<CSCCLCTDigi>& clctV = clctProc->run(compdc); // run cathodeLCT
85 
86  // Step 2b: encode high multiplicity bits (independent of LCT construction)
88 
89  // if there are no ALCTs and no CLCTs, do not run the ALCT-CLCT correlation
90  if (alctV.empty() and clctV.empty())
91  return;
92 
93  // set the lookup tables for coordinate conversion and matching
94  if (isME11_) {
95  clusterProc_->setESLookupTables(lookupTableME11ILT_);
96  cscGEMMatcher_->setESLookupTables(lookupTableME11ILT_);
97  }
98  if (isME21_) {
99  clusterProc_->setESLookupTables(lookupTableME21ILT_);
100  cscGEMMatcher_->setESLookupTables(lookupTableME21ILT_);
101  }
102 
103  // Step 3: run the GEM cluster processor to get the internal clusters
104  clusterProc_->run(gemClusters);
105  hasGE21Geometry16Partitions_ = clusterProc_->hasGE21Geometry16Partitions();
106 
107  /*
108  Mask for bunch crossings were LCTs were previously found
109  If LCTs were found in BXi for ALCT-CLCT-2GEM or ALCT-CLCT-1GEM,
110  we do not consider BXi in the future. This is
111  because we consider ALCT-CLCT-2GEM > ALCT-CLCT-1GEM > ALCT-CLCT
112  > CLCT-2GEM > ALCT-2GEM. The mask is passsed from one function to the next.
113  */
114  bool bunch_crossing_mask[CSCConstants::MAX_ALCT_TBINS] = {false};
115 
116  // Step 4: ALCT-CLCT-2GEM and ALCT-CLCT-1GEM matching
118  matchALCTCLCTGEM(bunch_crossing_mask);
119  }
120 
121  // Step 5: regular ALCT-CLCT matching (always enabled)
122  CSCMotherboard::matchALCTCLCT(bunch_crossing_mask);
123 
124  // Step 6: CLCT-2GEM matching for BX's that were not previously masked
126  matchCLCT2GEM(bunch_crossing_mask);
127  }
128 
129  // Step 7: ALCT-2GEM matching for BX's that were not previously masked
131  matchALCT2GEM(bunch_crossing_mask);
132  }
133 
134  // Step 8: Select at most 2 LCTs per BX
135  selectLCTs();
136 }
137 
139  // no matching is done for GE2/1 geometries with 8 eta partitions
140  // this has been superseded by 16-eta partition geometries
142  return;
143 
144  // by default we will try to match with both single clusters and coincidence clusters
145  // if we do not build ALCT-CLCT-2GEM type LCTs, consider only single clusters
149 
150  // array to mask CLCTs
151  bool used_clct_mask[CSCConstants::MAX_CLCT_TBINS] = {false};
152 
153  for (int bx_alct = 0; bx_alct < CSCConstants::MAX_ALCT_TBINS; bx_alct++) {
154  // do not consider invalid ALCTs
155  if (alctProc->getBestALCT(bx_alct).isValid()) {
156  for (unsigned mbx = 0; mbx < match_trig_window_size; mbx++) {
157  // evaluate the preffered CLCT BX, taking into account that there is an offset in the simulation
158  unsigned bx_clct = bx_alct + preferred_bx_match_[mbx] - CSCConstants::ALCT_CLCT_OFFSET;
159 
160  // CLCT BX must be in the time window
161  if (bx_clct >= CSCConstants::MAX_CLCT_TBINS)
162  continue;
163  // drop this CLCT if it was previously matched to an ALCT
164  if (drop_used_clcts and used_clct_mask[bx_clct])
165  continue;
166  // do not consider invalid CLCTs
167  if (clctProc->getBestCLCT(bx_clct).isValid()) {
168  LogTrace("CSCMotherboard") << "Successful ALCT-CLCT match: bx_alct = " << bx_alct << "; bx_clct = " << bx_clct
169  << "; mbx = " << mbx;
170 
171  // now correlate the ALCT and CLCT into LCT.
172  // smaller mbx means more preferred!
173  correlateLCTsGEM(alctProc->getBestALCT(bx_alct),
174  alctProc->getSecondALCT(bx_alct),
175  clctProc->getBestCLCT(bx_clct),
176  clctProc->getSecondCLCT(bx_clct),
177  clusterProc_->getClusters(bx_alct, max_delta_bx_alct_gem_, option),
178  allLCTs_(bx_alct, mbx, 0),
179  allLCTs_(bx_alct, mbx, 1));
180 
181  if (allLCTs_(bx_alct, mbx, 0).isValid()) {
182  // mask this CLCT as used. If a flag is set, the CLCT may or may not be reused
183  used_clct_mask[bx_clct] = true;
184  // mask this bunch crossing for future considation
185  bunch_crossing_mask[bx_alct] = true;
186  // if we only consider the first valid CLCT, we move on to the next ALCT immediately
188  break;
189  }
190  }
191  }
192  }
193  }
194 }
195 
197  // no matching is done for GE2/1 geometries with 8 eta partitions
198  // this has been superseded by 16-eta partition geometries
200  return;
201 
202  // array to mask CLCTs
203  bool used_clct_mask[CSCConstants::MAX_CLCT_TBINS] = {false};
204 
205  for (int bx_gem = 0; bx_gem < CSCConstants::MAX_ALCT_TBINS; bx_gem++) {
206  // do not consider LCT building in this BX if the mask was set
207  if (bunch_crossing_mask[bx_gem])
208  continue;
209 
210  // Check that there is at least one valid GEM coincidence cluster in this BX
211  if (!clusterProc_->getCoincidenceClusters(bx_gem).empty()) {
212  // GEM clusters will have central BX 8. So do ALCTs. But! CLCTs still have central BX 7
213  // therefore we need to make a correction. The correction is thus the same as for ALCT-CLCT
214  for (unsigned mbx = 0; mbx < 2 * max_delta_bx_clct_gem_ + 1; mbx++) {
215  // evaluate the preffered CLCT BX, taking into account that there is an offset in the simulation
216  int bx_clct = bx_gem + preferred_bx_match_[mbx] - CSCConstants::ALCT_CLCT_OFFSET;
217 
218  // CLCT BX must be in the time window
219  if (bx_clct < 0 or bx_clct >= CSCConstants::MAX_CLCT_TBINS)
220  continue;
221  // drop this CLCT if it was previously matched to a GEM coincidence cluster
222  if (drop_used_clcts and used_clct_mask[bx_clct])
223  continue;
224  // do not consider invalid CLCTs
225  if (clctProc->getBestCLCT(bx_clct).isValid()) {
226  // if this is an ME1/a CLCT, you could consider not building this LCT
228  clctProc->getBestCLCT(bx_clct).getKeyStrip() > CSCConstants::MAX_HALF_STRIP_ME1B)
229  continue;
230  // mbx is a relative time difference, which is used later in the
231  // cross-bunching sorting algorithm to determine the preferred LCTs
232  // to be sent to the MPC
233  correlateLCTsGEM(clctProc->getBestCLCT(bx_clct),
234  clctProc->getSecondCLCT(bx_clct),
235  clusterProc_->getCoincidenceClusters(bx_gem),
236  allLCTs_(bx_gem, mbx, 0),
237  allLCTs_(bx_gem, mbx, 1));
238 
239  if (allLCTs_(bx_gem, mbx, 0).isValid()) {
240  // do not consider GEM clusters
241  used_clct_mask[bx_clct] = true;
242  // mask this bunch crossing for future consideration
243  bunch_crossing_mask[bx_gem] = true;
244  // if we only consider the first valid GEM coincidence clusters,
245  // we move on to the next ALCT immediately
247  break;
248  }
249  }
250  }
251  }
252  }
253 }
254 
256  // no matching is done for GE2/1 geometries with 8 eta partitions
257  // this has been superseded by 16-eta partition geometries
259  return;
260 
261  // clear the array to mask GEMs this window is quite wide.
262  // We don't expect GEM coincidence clusters to show up too far
263  // from the central BX (8)
264  bool used_gem_mask[CSCConstants::MAX_ALCT_TBINS] = {false};
265 
266  for (int bx_alct = 0; bx_alct < CSCConstants::MAX_ALCT_TBINS; bx_alct++) {
267  // do not consider LCT building in this BX if the mask was set
268  if (bunch_crossing_mask[bx_alct])
269  continue;
270 
271  if (alctProc->getBestALCT(bx_alct).isValid()) {
272  for (unsigned mbx = 0; mbx < 2 * max_delta_bx_alct_gem_ + 1; mbx++) {
273  // evaluate the preffered GEM BX
274  int bx_gem = bx_alct + preferred_bx_match_[mbx];
275 
276  if (bx_gem < 0 or bx_gem >= CSCConstants::MAX_ALCT_TBINS)
277  continue;
278  // drop GEMs in this BX if one of them was previously matched to an ALCT
279  if (drop_used_gems_ and used_gem_mask[bx_gem])
280  continue;
281  // check for at least one valid GEM cluster
282  if (!clusterProc_->getCoincidenceClusters(bx_gem).empty()) {
283  // now correlate the ALCT and GEM into LCT.
284  // smaller mbx means more preferred!
285  correlateLCTsGEM(alctProc->getBestALCT(bx_alct),
286  alctProc->getSecondALCT(bx_alct),
287  clusterProc_->getCoincidenceClusters(bx_gem),
288  allLCTs_(bx_alct, mbx, 0),
289  allLCTs_(bx_alct, mbx, 1));
290 
291  if (allLCTs_(bx_alct, mbx, 0).isValid()) {
292  // do not consider GEM clusters
293  used_gem_mask[bx_gem] = true;
294  // mask this bunch crossing for future consideration
295  bunch_crossing_mask[bx_alct] = true;
296  // if we only consider the first valid GEM coincidence clusters,
297  // we move on to the next ALCT immediately
299  break;
300  }
301  }
302  }
303  }
304  }
305 }
306 
308  const CSCALCTDigi& sALCT,
309  const CSCCLCTDigi& bCLCT,
310  const CSCCLCTDigi& sCLCT,
312  CSCCorrelatedLCTDigi& lct1,
313  CSCCorrelatedLCTDigi& lct2) const {
314  // case where there no valid clusters
315  if (clusters.empty())
316  return;
317 
318  // temporary container
319  std::vector<CSCCorrelatedLCTDigi> lcts;
320 
321  CSCALCTDigi bestALCT = bALCT;
322  CSCALCTDigi secondALCT = sALCT;
323  CSCCLCTDigi bestCLCT = bCLCT;
324  CSCCLCTDigi secondCLCT = sCLCT;
325 
326  // Sanity checks on the ALCT and CLCT
327  if (!bestALCT.isValid()) {
328  edm::LogError("CSCGEMMotherboard") << "Best ALCT invalid in correlateLCTsGEM!";
329  return;
330  }
331 
332  if (!bestCLCT.isValid()) {
333  edm::LogError("CSCGEMMotherboard") << "Best CLCT invalid in correlateLCTsGEM!";
334  return;
335  }
336 
337  // at this point, we have at least one valid cluster, and we're either dealing
338  // wit GE1/1 or GE2/1 with 16 partitions, both are OK for GEM-CSC trigger
339 
340  // before matching ALCT-CLCT pairs with clusters, we check if we need
341  // to drop particular low quality ALCTs or CLCTs without matching clusters
342  // drop low quality CLCTs if no clusters and flags are set
343  GEMInternalCluster bestALCTCluster, secondALCTCluster;
344  GEMInternalCluster bestCLCTCluster, secondCLCTCluster;
345  cscGEMMatcher_->bestClusterBXLoc(bestALCT, clusters, bestALCTCluster);
346  cscGEMMatcher_->bestClusterBXLoc(secondALCT, clusters, secondALCTCluster);
347  cscGEMMatcher_->bestClusterBXLoc(bestCLCT, clusters, bestCLCTCluster);
348  cscGEMMatcher_->bestClusterBXLoc(secondCLCT, clusters, secondCLCTCluster);
349 
350  dropLowQualityALCTNoClusters(bestALCT, bestALCTCluster);
351  dropLowQualityALCTNoClusters(secondALCT, secondALCTCluster);
352  dropLowQualityCLCTNoClusters(bestCLCT, bestCLCTCluster);
353  dropLowQualityCLCTNoClusters(secondCLCT, secondCLCTCluster);
354 
355  // check which ALCTs and CLCTs are valid after dropping the low-quality ones
356  copyValidToInValid(bestALCT, secondALCT, bestCLCT, secondCLCT);
357 
358  // We can now check possible triplets and construct all LCTs with
359  // valid ALCT, valid CLCTs and coincidence clusters
360  GEMInternalCluster bbCluster, bsCluster, sbCluster, ssCluster;
361  cscGEMMatcher_->bestClusterBXLoc(bestALCT, bestCLCT, clusters, bbCluster);
362  cscGEMMatcher_->bestClusterBXLoc(bestALCT, secondCLCT, clusters, bsCluster);
363  cscGEMMatcher_->bestClusterBXLoc(secondALCT, bestCLCT, clusters, sbCluster);
364  cscGEMMatcher_->bestClusterBXLoc(secondALCT, secondCLCT, clusters, ssCluster);
365 
366  // At this point it is still possible that certain pairs with high-quality
367  // ALCTs and CLCTs do not have matching clusters. In that case we construct
368  // a regular ALCT-CLCT type LCT. For instance, it could be that two muons went
369  // through the chamber, produced 2 ALCTs, 2 CLCTs, but only 1 GEM cluster - because
370  // GEM cluster efficiency is not 100% (closer to 95%). So we don't require
371  // all clusters to be valid. If they are valid, the LCTs is constructed accordingly.
372  // But we do require that the ALCT and CLCT are valid for each pair.
373  CSCCorrelatedLCTDigi lctbb, lctbs, lctsb, lctss;
374  if (bestALCT.isValid() and bestCLCT.isValid()) {
375  constructLCTsGEM(bestALCT, bestCLCT, bbCluster, lctbb);
376  lcts.push_back(lctbb);
377  }
378  if (bestALCT.isValid() and secondCLCT.isValid() and (secondCLCT != bestCLCT)) {
379  constructLCTsGEM(bestALCT, secondCLCT, bsCluster, lctbs);
380  lcts.push_back(lctbs);
381  }
382  if (bestCLCT.isValid() and secondALCT.isValid() and (secondALCT != bestALCT)) {
383  constructLCTsGEM(secondALCT, bestCLCT, sbCluster, lctsb);
384  lcts.push_back(lctsb);
385  }
386  if (secondALCT.isValid() and secondCLCT.isValid() and (secondALCT != bestALCT) and (secondCLCT != bestCLCT)) {
387  constructLCTsGEM(secondALCT, secondCLCT, ssCluster, lctss);
388  lcts.push_back(lctss);
389  }
390 
391  // no LCTs
392  if (lcts.empty())
393  return;
394 
395  // sort by bending angle
396  sortLCTsByBending(lcts);
397 
398  // retain best two
399  lcts.resize(CSCConstants::MAX_LCTS_PER_CSC);
400 
401  // assign the track number
402  if (lcts[0].isValid()) {
403  lct1 = lcts[0];
404  lct1.setTrknmb(1);
405  }
406 
407  if (lcts[1].isValid()) {
408  lct2 = lcts[1];
409  lct2.setTrknmb(2);
410  }
411 }
412 
414  const CSCCLCTDigi& sCLCT,
416  CSCCorrelatedLCTDigi& lct1,
417  CSCCorrelatedLCTDigi& lct2) const {
418  CSCCLCTDigi bestCLCT = bCLCT;
419  CSCCLCTDigi secondCLCT = sCLCT;
420 
421  if (!bestCLCT.isValid()) {
422  edm::LogError("CSCGEMMotherboard") << "Best CLCT invalid in correlateLCTsGEM!";
423  return;
424  }
425 
426  // if the second best CLCT equals the best CLCT, clear it
427  if (secondCLCT == bestCLCT)
428  secondCLCT.clear();
429 
430  // get the best matching cluster
431  GEMInternalCluster bestCluster;
432  GEMInternalCluster secondCluster;
433  cscGEMMatcher_->bestClusterBXLoc(bestCLCT, clusters, bestCluster);
434  cscGEMMatcher_->bestClusterBXLoc(secondCLCT, clusters, secondCluster);
435 
436  // drop low quality CLCTs if no clusters and flags are set
437  dropLowQualityCLCTNoClusters(bestCLCT, bestCluster);
438  dropLowQualityCLCTNoClusters(secondCLCT, secondCluster);
439 
440  // construct all LCTs with valid CLCTs and coincidence clusters
441  if (bestCLCT.isValid() and bestCluster.isCoincidence()) {
442  constructLCTsGEM(bestCLCT, bestCluster, 1, lct1);
443  }
444  if (secondCLCT.isValid() and secondCluster.isCoincidence()) {
445  constructLCTsGEM(secondCLCT, secondCluster, 2, lct2);
446  }
447 }
448 
450  const CSCALCTDigi& sALCT,
452  CSCCorrelatedLCTDigi& lct1,
453  CSCCorrelatedLCTDigi& lct2) const {
454  CSCALCTDigi bestALCT = bALCT;
455  CSCALCTDigi secondALCT = sALCT;
456 
457  if (!bestALCT.isValid()) {
458  edm::LogError("CSCGEMMotherboard") << "Best ALCT invalid in correlateLCTsGEM!";
459  return;
460  }
461 
462  // if the second best ALCT equals the best ALCT, clear it
463  if (secondALCT == bestALCT)
464  secondALCT.clear();
465 
466  // get the best matching cluster
467  GEMInternalCluster bestCluster;
468  GEMInternalCluster secondCluster;
469  cscGEMMatcher_->bestClusterBXLoc(bestALCT, clusters, bestCluster);
470  cscGEMMatcher_->bestClusterBXLoc(secondALCT, clusters, secondCluster);
471 
472  // drop low quality ALCTs if no clusters and flags are set
473  dropLowQualityALCTNoClusters(bestALCT, bestCluster);
474  dropLowQualityALCTNoClusters(secondALCT, secondCluster);
475 
476  // construct all LCTs with valid ALCTs and coincidence clusters
477  if (bestALCT.isValid() and bestCluster.isCoincidence()) {
478  constructLCTsGEM(bestALCT, bestCluster, 1, lct1);
479  }
480  if (secondALCT.isValid() and secondCluster.isCoincidence()) {
481  constructLCTsGEM(secondALCT, secondCluster, 2, lct2);
482  }
483 }
484 
486  const CSCCLCTDigi& clct,
487  const GEMInternalCluster& gem,
488  CSCCorrelatedLCTDigi& thisLCT) const {
489  thisLCT.setValid(true);
490  if (gem.isCoincidence()) {
492  } else if (gem.isValid()) {
494  } else {
496  }
497  thisLCT.setQuality(qualityAssignment_->findQuality(alct, clct, gem));
498  thisLCT.setALCT(getBXShiftedALCT(alct));
499  thisLCT.setCLCT(getBXShiftedCLCT(clct));
500  // set pads if there are any
501  thisLCT.setGEM1(gem.mid1());
502  thisLCT.setGEM2(gem.mid2());
503  thisLCT.setPattern(encodePattern(clct.getPattern()));
504  thisLCT.setMPCLink(0);
505  thisLCT.setBX0(0);
506  thisLCT.setSyncErr(0);
507  thisLCT.setCSCID(theTrigChamber);
508  // track number to be set later in final sorting stage
509  thisLCT.setTrknmb(0);
510  thisLCT.setWireGroup(alct.getKeyWG());
511  thisLCT.setStrip(clct.getKeyStrip());
512  thisLCT.setBend(clct.getBend());
513  thisLCT.setBX(alct.getBX());
514  if (runCCLUT_) {
515  thisLCT.setRun3(true);
517  thisLCT.setSlope(cscGEMMatcher_->calculateGEMCSCBending(clct, gem));
518  else
519  thisLCT.setSlope(clct.getSlope());
520  thisLCT.setQuartStripBit(clct.getQuartStripBit());
521  thisLCT.setEighthStripBit(clct.getEighthStripBit());
522  thisLCT.setRun3Pattern(clct.getRun3Pattern());
523  }
524 }
525 
526 /* Construct LCT from CSC and GEM information. Option CLCT-2GEM */
528  const GEMInternalCluster& gem,
529  int trackNumber,
530  CSCCorrelatedLCTDigi& thisLCT) const {
531  thisLCT.setValid(true);
533  thisLCT.setQuality(qualityAssignment_->findQuality(clct, gem));
534  thisLCT.setCLCT(getBXShiftedCLCT(clct));
535  thisLCT.setGEM1(gem.mid1());
536  thisLCT.setGEM2(gem.mid2());
537  thisLCT.setPattern(encodePattern(clct.getPattern()));
538  thisLCT.setMPCLink(0);
539  thisLCT.setBX0(0);
540  thisLCT.setSyncErr(0);
541  thisLCT.setCSCID(theTrigChamber);
542  thisLCT.setTrknmb(trackNumber);
543  thisLCT.setWireGroup(gem.getKeyWG());
544  thisLCT.setStrip(clct.getKeyStrip());
545  thisLCT.setBend(clct.getBend());
546  thisLCT.setBX(gem.bx());
547  if (runCCLUT_) {
548  thisLCT.setRun3(true);
550  thisLCT.setSlope(cscGEMMatcher_->calculateGEMCSCBending(clct, gem));
551  else
552  thisLCT.setSlope(clct.getSlope());
553  thisLCT.setQuartStripBit(clct.getQuartStripBit());
554  thisLCT.setEighthStripBit(clct.getEighthStripBit());
555  thisLCT.setRun3Pattern(clct.getRun3Pattern());
556  }
557 }
558 
559 /* Construct LCT from CSC and GEM information. Option ALCT-2GEM */
561  const GEMInternalCluster& gem,
562  int trackNumber,
563  CSCCorrelatedLCTDigi& thisLCT) const {
564  thisLCT.setValid(true);
566  thisLCT.setQuality(qualityAssignment_->findQuality(alct, gem));
567  thisLCT.setALCT(getBXShiftedALCT(alct));
568  thisLCT.setGEM1(gem.mid1());
569  thisLCT.setGEM2(gem.mid2());
570  thisLCT.setPattern(10);
571  thisLCT.setMPCLink(0);
572  thisLCT.setBX0(0);
573  thisLCT.setSyncErr(0);
574  thisLCT.setCSCID(theTrigChamber);
575  thisLCT.setTrknmb(trackNumber);
576  thisLCT.setWireGroup(alct.getKeyWG());
577  thisLCT.setStrip(gem.getKeyStrip());
578  thisLCT.setBend(0);
579  thisLCT.setBX(alct.getBX());
580  if (runCCLUT_) {
581  thisLCT.setRun3(true);
582  thisLCT.setSlope(0);
583  thisLCT.setQuartStripBit(false);
584  thisLCT.setEighthStripBit(false);
585  // ALCT-2GEM type LCTs do not bend in the chamber
586  thisLCT.setRun3Pattern(4);
587  }
588 }
589 
591  // clear alct if they are of low quality without matching GEM clusters
592  if (alct.getQuality() == 0 and !cluster.isValid() and drop_low_quality_alct_no_gems_)
593  alct.clear();
594 }
595 
597  // Here, we need to check which could be an ME1/a LCT
598  bool dropLQCLCTNoGEMs = drop_low_quality_clct_no_gems_;
600  dropLQCLCTNoGEMs = drop_low_quality_clct_no_gems_me1a_;
601 
602  // clear clct if they are of low quality without matching GEM clusters
603  if (clct.getQuality() <= 3 and !cluster.isValid() and dropLQCLCTNoGEMs)
604  clct.clear();
605 }
606 
607 void CSCGEMMotherboard::sortLCTsByBending(std::vector<CSCCorrelatedLCTDigi>& lcts) const {
608  /*
609  For Run-2 GEM-CSC trigger primitives, which we temporarily have
610  to integrate with the Run-2 EMTF during LS2, we sort by quality.
611  Larger quality means smaller bending
612  */
613  if (!runCCLUT_) {
614  std::sort(lcts.begin(), lcts.end(), [](const CSCCorrelatedLCTDigi& lct1, const CSCCorrelatedLCTDigi& lct2) -> bool {
615  return lct1.getQuality() > lct2.getQuality();
616  });
617  }
618 
619  /*
620  For Run-3 GEM-CSC trigger primitives, which we have
621  to integrate with the Run-3 EMTF, we sort by slope.
622  Smaller slope means smaller bending
623  */
624  else {
625  std::sort(lcts.begin(), lcts.end(), [](const CSCCorrelatedLCTDigi& lct1, const CSCCorrelatedLCTDigi& lct2) -> bool {
626  return lct1.getSlope() < lct2.getSlope();
627  });
628  }
629 }
GEMPadDigi mid1() const
void matchALCTCLCT(bool bunch_crossing_mask[CSCConstants::MAX_ALCT_TBINS])
uint16_t getRun3Pattern() const
return pattern
Definition: CSCCLCTDigi.h:68
uint16_t getSlope() const
return the slope
void correlateLCTsGEM(const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, const GEMInternalClusters &clusters, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2) const
uint16_t getQuality() const
return quality of a pattern
Definition: CSCALCTDigi.h:46
LCTContainer allLCTs_
uint16_t getKeyStrip(int n=2) const
void setPattern(const uint16_t p)
set pattern
void setALCT(const CSCALCTDigi &alct)
std::unique_ptr< CSCGEMMatcher > cscGEMMatcher_
const CSCL1TPLookupTableME11ILT * lookupTableME11ILT_
void setGEM2(const GEMPadDigi &gem)
std::vector< CSCCLCTDigi > clctV
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
unsigned int match_trig_window_size
uint16_t getBend() const
Definition: CSCCLCTDigi.h:93
CSCALCTDigi getBXShiftedALCT(const CSCALCTDigi &) const
void setSlope(const uint16_t slope)
set the slope
CSCCLCTDigi getBXShiftedCLCT(const CSCCLCTDigi &) const
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:40
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
void setQuartStripBit(const bool quartStripBit)
set single quart strip bit
uint16_t getBX() const
return BX - five low bits of BXN counter tagged by the ALCT
Definition: CSCALCTDigi.h:73
void clear()
clear this ALCT
Definition: CSCALCTDigi.cc:60
void sortLCTsByBending(std::vector< CSCCorrelatedLCTDigi > &lcts) const
void setEighthStripBit(const bool eighthStripBit)
set single eighth strip bit
void setBend(const uint16_t b)
set bend
std::unique_ptr< CSCCathodeLCTProcessor > clctProc
void constructLCTsGEM(const CSCALCTDigi &alct, const CSCCLCTDigi &clct, const GEMInternalCluster &gem, CSCCorrelatedLCTDigi &lct) const
bool drop_low_quality_clct_no_gems_me1a_
Log< level::Error, false > LogError
void setValid(const uint16_t v)
set valid
void copyValidToInValid(CSCALCTDigi &, CSCALCTDigi &, CSCCLCTDigi &, CSCCLCTDigi &) const
void matchALCT2GEM(bool bunch_crossing_mask[CSCConstants::MAX_ALCT_TBINS])
#define LogTrace(id)
uint16_t getKeyStrip(const uint16_t n=2) const
Definition: CSCCLCTDigi.cc:107
void setMPCLink(const uint16_t &link)
Set mpc link number after MPC sorting.
const unsigned theTrigChamber
Definition: CSCBaseboard.h:46
void setWireGroup(const uint16_t wiregroup)
set wiregroup number
std::vector< int > preferred_bx_match_
bool match_earliest_clct_only_
unsigned max_delta_bx_clct_gem_
std::vector< CSCALCTDigi > alctV
bool getEighthStripBit() const
get single eighth strip bit
Definition: CSCCLCTDigi.h:114
std::vector< GEMInternalCluster > GEMInternalClusters
unsigned int encodePattern(const int clctPattern) const
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:50
void dropLowQualityALCTNoClusters(CSCALCTDigi &alct, const GEMInternalCluster &cluster) const
void setRun3Pattern(const uint16_t pattern)
set Run-3 pattern
unsigned theChamber
Definition: CSCBaseboard.h:49
void setBX0(const uint16_t b)
set bx0
GEMPadDigi mid2() const
void matchCLCT2GEM(bool bunch_crossing_mask[CSCConstants::MAX_ALCT_TBINS])
const CSCGeometry * cscGeometry_
Definition: CSCBaseboard.h:71
edm::ParameterSet tmbParams_
Definition: CSCBaseboard.h:78
void setCSCID(const uint16_t c)
set cscID
void setRun3(const bool isRun3)
uint16_t getKeyWG() const
return key wire group
Definition: CSCALCTDigi.h:67
void setBX(const uint16_t b)
set bx
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const unsigned theStation
Definition: CSCBaseboard.h:43
uint16_t getSlope() const
return the slope
Definition: CSCCLCTDigi.h:74
uint16_t getPattern() const
return pattern
Definition: CSCCLCTDigi.h:62
void matchALCTCLCTGEM(bool bunch_crossing_mask[CSCConstants::MAX_ALCT_TBINS])
uint16_t getQuality() const
return the Quality
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const GEMPadDigiClusterCollection *gemPads)
std::shared_ptr< GEMClusterProcessor > clusterProc_
unsigned max_delta_bx_alct_gem_
const CSCL1TPLookupTableME21ILT * lookupTableME21ILT_
std::unique_ptr< CSCAnodeLCTProcessor > alctProc
const CSCL1TPLookupTableCCLUT * lookupTableCCLUT_
void setStrip(const uint16_t s)
set strip
void encodeHighMultiplicityBits()
void clear()
clear this CLCT
Definition: CSCCLCTDigi.cc:73
void dropLowQualityCLCTNoClusters(CSCCLCTDigi &clct, const GEMInternalCluster &cluster) const
unsigned getKeyWG() const
uint16_t getQuality() const
return quality of a pattern (number of layers hit!)
Definition: CSCCLCTDigi.h:56
CSCGEMMotherboard(unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned chamber, const edm::ParameterSet &conf)
void setQuality(const uint16_t q)
set quality code
~CSCGEMMotherboard() override
const GEMGeometry * gem_g
bool isCoincidence() const
void setTrknmb(const uint16_t number)
Set track number (1,2) after sorting LCTs.
void setCLCT(const CSCCLCTDigi &clct)
void setGEM1(const GEMPadDigi &gem)
void setSyncErr(const uint16_t s)
set syncErr
bool getQuartStripBit() const
get single quart strip bit
Definition: CSCCLCTDigi.h:108
std::unique_ptr< LCTQualityAssignment > qualityAssignment_