CMS 3D CMS Logo

CSCGEMMotherboardME11.cc
Go to the documentation of this file.
5 
7  unsigned sector, unsigned subsector,
8  unsigned chamber,
9  const edm::ParameterSet& conf)
10  : CSCGEMMotherboard(endcap, station, sector, subsector, chamber, conf)
11  , allLCTs1b(match_trig_window_size)
12  , allLCTs1a(match_trig_window_size)
13  // special configuration parameters for ME11 treatment
14  , smartME1aME1b(commonParams_.getParameter<bool>("smartME1aME1b"))
15  , disableME1a(commonParams_.getParameter<bool>("disableME1a"))
16  , gangedME1a(commonParams_.getParameter<bool>("gangedME1a"))
17  , dropLowQualityCLCTsNoGEMs_ME1a_(tmbParams_.getParameter<bool>("dropLowQualityCLCTsNoGEMs_ME1a"))
18  , dropLowQualityCLCTsNoGEMs_ME1b_(tmbParams_.getParameter<bool>("dropLowQualityCLCTsNoGEMs_ME1b"))
19  , dropLowQualityALCTsNoGEMs_ME1a_(tmbParams_.getParameter<bool>("dropLowQualityALCTsNoGEMs_ME1a"))
20  , dropLowQualityALCTsNoGEMs_ME1b_(tmbParams_.getParameter<bool>("dropLowQualityALCTsNoGEMs_ME1b"))
21  , buildLCTfromALCTandGEM_ME1a_(tmbParams_.getParameter<bool>("buildLCTfromALCTandGEM_ME1a"))
22  , buildLCTfromALCTandGEM_ME1b_(tmbParams_.getParameter<bool>("buildLCTfromALCTandGEM_ME1b"))
23  , buildLCTfromCLCTandGEM_ME1a_(tmbParams_.getParameter<bool>("buildLCTfromCLCTandGEM_ME1a"))
24  , buildLCTfromCLCTandGEM_ME1b_(tmbParams_.getParameter<bool>("buildLCTfromCLCTandGEM_ME1b"))
25  , promoteCLCTGEMquality_ME1a_(tmbParams_.getParameter<bool>("promoteCLCTGEMquality_ME1a"))
26  , promoteCLCTGEMquality_ME1b_(tmbParams_.getParameter<bool>("promoteCLCTGEMquality_ME1b"))
27 {
28  if (!smartME1aME1b) edm::LogError("L1CSCTPEmulatorConfigError")
29  << "+++ Upgrade CSCGEMMotherboardME11 constructed while smartME1aME1b is not set! +++\n";
30 
31  const edm::ParameterSet clctParams(conf.getParameter<edm::ParameterSet>("clctSLHC"));
32  clct1a.reset( new CSCCathodeLCTProcessor(endcap, station, sector, subsector, chamber, clctParams, commonParams_, tmbParams_) );
33  clct1a->setRing(4);
34 
35  // set LUTs
36  tmbLUT_.reset(new CSCGEMMotherboardLUTME11());
37 }
38 
39 
44 {
45  // Constructor used only for testing.
46 
47  clct1a.reset( new CSCCathodeLCTProcessor() );
48  clct1a->setRing(4);
49 }
50 
51 
53 {
54 }
55 
56 
58 {
61 
62  if (clct1a) clct1a->clear();
63  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++) {
64  for (unsigned int mbx = 0; mbx < match_trig_window_size; mbx++) {
65  for (int i=0;i<CSCConstants::MAX_LCTS_PER_CSC;i++) {
66  allLCTs1b(bx,mbx,i).clear();
67  allLCTs1a(bx,mbx,i).clear();
68  }
69  }
70  }
71 }
72 
73 
74 //===============================================
75 //use ALCTs, CLCTs, GEMs to build LCTs
76 //loop over each BX to find valid ALCT in ME1b, try ALCT-CLCT match, if ALCT-CLCT match failed, try ALCT-GEM match
77 //do the same in ME1a
78 //sort LCTs according to different algorithm, and send out number of LCTs up to max_lcts
79 //===============================================
80 
82  const CSCComparatorDigiCollection* compdc,
83  const GEMPadDigiCollection* gemPads)
84 {
85  clear();
86  setupGeometry();
87  debugLUTs();
88 
89  if (gem_g != nullptr) {
90  if (infoV >= 0) edm::LogInfo("L1CSCTPEmulatorSetupInfo")
91  << "+++ run() called for GEM-CSC integrated trigger! +++ \n";
92  gemGeometryAvailable = true;
93  }
94 
95  // check for GEM geometry
96  if (not gemGeometryAvailable){
97  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorSetupError")
98  << "+++ run() called for GEM-CSC integrated trigger without valid GEM geometry! +++ \n";
99  return;
100  }
101  gemCoPadV = coPadProcessor->run(gemPads); // run copad processor in GE1/1
102 
103  if (!( alct and clct and clct1a and smartME1aME1b))
104  {
105  if (infoV >= 0) edm::LogError("L1CSCTPEmulatorSetupError")
106  << "+++ run() called for non-existing ALCT/CLCT processor! +++ \n";
107  return;
108  }
109 
110  alct->setCSCGeometry(csc_g);
111  clct->setCSCGeometry(csc_g);
112  clct1a->setCSCGeometry(csc_g);
113 
114  alctV = alct->run(wiredc); // run anodeLCT
115  clctV1b = clct->run(compdc); // run cathodeLCT in ME1/b
116  clctV1a = clct1a->run(compdc); // run cathodeLCT in ME1/a
117 
118  // if there are no ALCTs and no CLCTs, it does not make sense to run this TMB
119  if (alctV.empty() and clctV1b.empty() and clctV1a.empty()) return;
120 
121  int used_clct_mask[20], used_clct_mask_1a[20];
122  for (int b=0;b<20;b++)
123  used_clct_mask[b] = used_clct_mask_1a[b] = 0;
124 
125  // retrieve CSCChamber geometry
126  const CSCDetId me1aId(theEndcap, 1, 4, theChamber);
127  const CSCChamber* cscChamberME1a(csc_g->chamber(me1aId));
128 
129  retrieveGEMPads(gemPads, gemId);
131 
132  const bool hasPads(!pads_.empty());
133  const bool hasCoPads(hasPads and !coPads_.empty());
134 
135  // ALCT-centric matching
136  for (int bx_alct = 0; bx_alct < CSCConstants::MAX_ALCT_TBINS; bx_alct++)
137  {
138  if (alct->bestALCT[bx_alct].isValid())
139  {
140  const int bx_clct_start(bx_alct - match_trig_window_size/2);
141  const int bx_clct_stop(bx_alct + match_trig_window_size/2);
142  const int bx_copad_start(bx_alct - maxDeltaBXCoPad_);
143  const int bx_copad_stop(bx_alct + maxDeltaBXCoPad_);
144 
145  if (debug_matching){
146  LogTrace("CSCGEMCMotherboardME11") << "========================================================================\n"
147  << "ALCT-CLCT matching in ME1/1 chamber: " << cscChamber->id() << "\n"
148  << "------------------------------------------------------------------------\n"
149  << "+++ Best ALCT Details: " << alct->bestALCT[bx_alct] << "\n"
150  << "+++ Second ALCT Details: " << alct->secondALCT[bx_alct] << std::endl;
151 
152  printGEMTriggerPads(bx_clct_start, bx_clct_stop, CSCPart::ME11);
153  printGEMTriggerCoPads(bx_clct_start, bx_clct_stop, CSCPart::ME11);
154 
155  LogTrace("CSCGEMCMotherboardME11") << "------------------------------------------------------------------------ \n"
156  << "Attempt ALCT-CLCT matching in ME1/b in bx range: [" << bx_clct_start << "," << bx_clct_stop << "]" << std::endl;
157  }
158 
159  // ALCT-to-CLCT matching in ME1b
160  int nSuccesFulMatches = 0;
161  for (int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++)
162  {
163  if (bx_clct < 0 or bx_clct >= CSCConstants::MAX_CLCT_TBINS) continue;
164  if (drop_used_clcts and used_clct_mask[bx_clct]) continue;
165  if (clct->bestCLCT[bx_clct].isValid())
166  {
167  const int quality(clct->bestCLCT[bx_clct].getQuality());
168  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "++Valid ME1b CLCT: " << clct->bestCLCT[bx_clct] << std::endl;
169 
170  // pick the pad that corresponds
171  matches<GEMPadDigi> mPads;
172  matchingPads<GEMPadDigi>(clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
173  alct->bestALCT[bx_alct], alct->secondALCT[bx_alct], ME1B, mPads);
174  matches<GEMCoPadDigi> mCoPads;
175  matchingPads<GEMCoPadDigi>(clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
176  alct->bestALCT[bx_alct], alct->secondALCT[bx_alct], ME1B, mCoPads);
177 
178  // Low quality LCTs have at most 3 layers. Check if there is a matching GEM pad to keep the CLCT
179  if (dropLowQualityCLCTsNoGEMs_ME1b_ and quality < 4 and hasPads){
180  int nFound(mPads.size());
181  // 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
182  const bool clctInEdge(clct->bestCLCT[bx_clct].getKeyStrip() < 5 or clct->bestCLCT[bx_clct].getKeyStrip() > 124);
183  if (clctInEdge){
184  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "\tInfo: low quality CLCT in CSC chamber edge, don't care about GEM pads" << std::endl;
185  }
186  else {
187  if (nFound != 0){
188  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "\tInfo: low quality CLCT with " << nFound << " matching GEM trigger pads" << std::endl;
189  }
190  else {
191  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "\tWarning: low quality CLCT without matching GEM trigger pad" << std::endl;
192  continue;
193  }
194  }
195  }
196 
197  ++nSuccesFulMatches;
198 
199  // if (infoV > 1) LogTrace("CSCMotherboard")
200  int mbx = bx_clct-bx_clct_start;
201  correlateLCTsGEM(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
202  clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct],
203  mPads, mCoPads,
204  allLCTs1b(bx_alct,mbx,0), allLCTs1b(bx_alct,mbx,1), ME1B);
205  if (debug_matching ) {
206  LogTrace("CSCGEMCMotherboardME11") << "Successful ALCT-CLCT match in ME1b: bx_alct = " << bx_alct
207  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop
208  << "]; bx_clct = " << bx_clct << "\n"
209  << "+++ Best CLCT Details: " << clct->bestCLCT[bx_clct] << "\n"
210  << "+++ Second CLCT Details: " << clct->secondCLCT[bx_clct] << std::endl;
211  if (allLCTs1b(bx_alct,mbx,0).isValid())
212  LogTrace("CSCGEMCMotherboardME11") << "LCT #1 "<< allLCTs1b(bx_alct,mbx,0) << std::endl;
213  else
214  LogTrace("CSCGEMCMotherboardME11") << "No valid LCT is built from ALCT-CLCT matching in ME1b" << std::endl;
215  if (allLCTs1b(bx_alct,mbx,1).isValid())
216  LogTrace("CSCGEMCMotherboardME11") << "LCT #2 "<< allLCTs1b(bx_alct,mbx,1) << std::endl;
217  }
218 
219  if (allLCTs1b(bx_alct,mbx,0).isValid()) {
220  used_clct_mask[bx_clct] += 1;
221  if (match_earliest_clct_only) break;
222  }
223  }
224  }
225 
226  // ALCT-to-GEM matching in ME1b
227  int nSuccesFulGEMMatches = 0;
228  if (nSuccesFulMatches==0 and buildLCTfromALCTandGEM_ME1b_){
229  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "++No valid ALCT-CLCT matches in ME1b" << std::endl;
230  for (int bx_gem = bx_copad_start; bx_gem <= bx_copad_stop; bx_gem++) {
231  if (not hasCoPads) {
232  continue;
233  }
234 
235  // find the best matching copad
236  matches<GEMCoPadDigi> copads;
237  matchingPads<CSCALCTDigi, GEMCoPadDigi>(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct], ME1B, copads);
238 
239  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "\t++Number of matching GEM CoPads in BX " << bx_alct << " : "<< copads.size() << std::endl;
240  if (copads.empty()) {
241  continue;
242  }
243 
244  CSCGEMMotherboard::correlateLCTsGEM(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
245  copads, allLCTs1b(bx_alct,0,0), allLCTs1b(bx_alct,0,1), ME1B);
246 
247  if (debug_matching) {
248  LogTrace("CSCGEMCMotherboardME11") << "Successful ALCT-GEM CoPad match in ME1b: bx_alct = " << bx_alct << "\n\n"
249  << "------------------------------------------------------------------------" << std::endl << std::endl;
250  if (allLCTs1b(bx_alct,0,0).isValid())
251  LogTrace("CSCGEMCMotherboardME11") << "LCT #1 "<< allLCTs1b(bx_alct,0,0) << std::endl;
252  else
253  LogTrace("CSCGEMCMotherboardME11") << "No valid LCT is built from ALCT-GEM matching in ME1b" << std::endl;
254  if (allLCTs1b(bx_alct,0,1).isValid())
255  LogTrace("CSCGEMCMotherboardME11") << "LCT #2 "<< allLCTs1b(bx_alct,0,1) << std::endl;
256  }
257 
258  if (allLCTs1b(bx_alct,0,0).isValid()) {
259  ++nSuccesFulGEMMatches;
260  if (match_earliest_clct_only) break;
261  }
262  }
263  }
264 
265  if (debug_matching) {
266  LogTrace("CSCGEMCMotherboardME11") << "========================================================================" << std::endl
267  << "Summary: " << std::endl;
268  if (nSuccesFulMatches>1)
269  LogTrace("CSCGEMCMotherboardME11") << "Too many successful ALCT-CLCT matches in ME1b: " << nSuccesFulMatches
270  << ", CSCDetId " << cscChamber->id()
271  << ", bx_alct = " << bx_alct
272  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop << "]" << std::endl;
273  else if (nSuccesFulMatches==1)
274  LogTrace("CSCGEMCMotherboardME11") << "1 successful ALCT-CLCT match in ME1b: "
275  << " CSCDetId " << cscChamber->id()
276  << ", bx_alct = " << bx_alct
277  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop << "]" << std::endl;
278  else if (nSuccesFulGEMMatches==1)
279  LogTrace("CSCGEMCMotherboardME11") << "1 successful ALCT-GEM match in ME1b: "
280  << " CSCDetId " << cscChamber->id()
281  << ", bx_alct = " << bx_alct
282  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop << "]" << std::endl;
283  else
284  LogTrace("CSCGEMCMotherboardME11") << "Unsuccessful ALCT-CLCT match in ME1b: "
285  << "CSCDetId " << cscChamber->id()
286  << ", bx_alct = " << bx_alct
287  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop << "]" << std::endl;
288 
289  LogTrace("CSCGEMCMotherboardME11") << "------------------------------------------------------------------------" << std::endl
290  << "Attempt ALCT-CLCT matching in ME1/a in bx range: [" << bx_clct_start << "," << bx_clct_stop << "]" << std::endl;
291  }
292 
293  // ALCT-to-CLCT matching in ME1a
294  nSuccesFulMatches = 0;
295  for (int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++)
296  {
297  if (bx_clct < 0 or bx_clct >= CSCConstants::MAX_CLCT_TBINS) continue;
298  if (drop_used_clcts and used_clct_mask_1a[bx_clct]) continue;
299  if (clct1a->bestCLCT[bx_clct].isValid())
300  {
301  const int quality(clct1a->bestCLCT[bx_clct].getQuality());
302  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "++Valid ME1a CLCT: " << clct1a->bestCLCT[bx_clct] << std::endl;
303 
304  // pick the pad that corresponds
305  matches<GEMPadDigi> mPads;
306  matchingPads<GEMPadDigi>(clct1a->bestCLCT[bx_clct], clct1a->secondCLCT[bx_clct],
307  alct->bestALCT[bx_alct], alct->secondALCT[bx_alct], ME1A, mPads);
308  matches<GEMCoPadDigi> mCoPads;
309  matchingPads<GEMCoPadDigi>(clct1a->bestCLCT[bx_clct], clct1a->secondCLCT[bx_clct],
310  alct->bestALCT[bx_alct], alct->secondALCT[bx_alct], ME1A, mCoPads);
311 
312  if (dropLowQualityCLCTsNoGEMs_ME1a_ and quality < 4 and hasPads){
313  int nFound(mPads.size());
314  const bool clctInEdge(clct1a->bestCLCT[bx_clct].getKeyStrip() < 4 or clct1a->bestCLCT[bx_clct].getKeyStrip() > 93);
315  if (clctInEdge){
316  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "\tInfo: low quality CLCT in CSC chamber edge, don't care about GEM pads" << std::endl;
317  }
318  else {
319  if (nFound != 0){
320  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "\tInfo: low quality CLCT with " << nFound << " matching GEM trigger pads" << std::endl;
321  }
322  else {
323  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "\tWarning: low quality CLCT without matching GEM trigger pad" << std::endl;
324  continue;
325  }
326  }
327  }
328  ++nSuccesFulMatches;
329  int mbx = bx_clct-bx_clct_start;
330  correlateLCTsGEM(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
331  clct1a->bestCLCT[bx_clct], clct1a->secondCLCT[bx_clct],
332  mPads, mCoPads,
333  allLCTs1a(bx_alct,mbx,0), allLCTs1a(bx_alct,mbx,1), ME1A);
334  if (debug_matching) {
335  LogTrace("CSCGEMCMotherboardME11") << "Successful ALCT-CLCT match in ME1a: bx_alct = " << bx_alct
336  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop
337  << "]; bx_clct = " << bx_clct << "\n"
338  << "+++ Best CLCT Details: " << clct1a->bestCLCT[bx_clct] << "\n"
339  << "+++ Second CLCT Details: " << clct1a->secondCLCT[bx_clct] << std::endl;
340  if (allLCTs1a(bx_alct,mbx,0).isValid())
341  LogTrace("CSCGEMCMotherboardME11") << "LCT #1 "<< allLCTs1a(bx_alct,mbx,0) << std::endl;
342  else
343  LogTrace("CSCGEMCMotherboardME11") << "No valid LCT is built from ALCT-CLCT matching in ME1a" << std::endl;
344  if (allLCTs1a(bx_alct,mbx,1).isValid())
345  LogTrace("CSCGEMCMotherboardME11") << "LCT #2 "<< allLCTs1a(bx_alct,mbx,1) << std::endl;
346  }
347  if (allLCTs1a(bx_alct,mbx,0).isValid()){
348  used_clct_mask_1a[bx_clct] += 1;
349  if (match_earliest_clct_only) break;
350  }
351  }
352  }
353 
354  // ALCT-to-GEM matching in ME1a
355  nSuccesFulGEMMatches = 0;
356  if (nSuccesFulMatches==0 and buildLCTfromALCTandGEM_ME1a_){
357  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "++No valid ALCT-CLCT matches in ME1a" << std::endl;
358  for (int bx_gem = bx_copad_start; bx_gem <= bx_copad_stop; bx_gem++) {
359  if (not hasCoPads) {
360  continue;
361  }
362 
363  // find the best matching copad
364  matches<GEMCoPadDigi> copads;
365  matchingPads<CSCALCTDigi, GEMCoPadDigi>(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct], ME1A, copads);
366 
367  if (debug_matching) LogTrace("CSCGEMCMotherboardME11") << "\t++Number of matching GEM CoPads in BX " << bx_alct << " : "<< copads.size() << std::endl;
368  if (copads.empty()) {
369  continue;
370  }
371 
372  CSCGEMMotherboard::correlateLCTsGEM(alct->bestALCT[bx_alct], alct->secondALCT[bx_alct],
373  copads, allLCTs1a(bx_alct,0,0), allLCTs1a(bx_alct,0,1), ME1A);
374 
375  if (debug_matching) {
376  LogTrace("CSCGEMCMotherboardME11") << "Successful ALCT-GEM CoPad match in ME1a: bx_alct = " << bx_alct << "\n\n"
377  << "------------------------------------------------------------------------" << std::endl << std::endl;
378  if (allLCTs1a(bx_alct,0,0).isValid())
379  LogTrace("CSCGEMCMotherboardME11") << "LCT #1 "<< allLCTs1a(bx_alct,0,0) << std::endl;
380  else
381  LogTrace("CSCGEMCMotherboardME11") << "No valid LCT is built from ALCT-GEM matching in ME1a" << std::endl;
382  if (allLCTs1a(bx_alct,0,1).isValid())
383  LogTrace("CSCGEMCMotherboardME11") << "LCT #2 "<< allLCTs1a(bx_alct,0,1) << std::endl;
384  }
385 
386  if (allLCTs1a(bx_alct,0,0).isValid()) {
387  ++nSuccesFulGEMMatches;
388  if (match_earliest_clct_only) break;
389  }
390  }
391  }
392 
393  if (debug_matching) {
394  LogTrace("CSCGEMCMotherboardME11") << "======================================================================== \n"
395  << "Summary: " << std::endl;
396  if (nSuccesFulMatches>1)
397  LogTrace("CSCGEMCMotherboardME11") << "Too many successful ALCT-CLCT matches in ME1a: " << nSuccesFulMatches
398  << ", CSCDetId " << cscChamberME1a->id()
399  << ", bx_alct = " << bx_alct
400  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop << "]" << std::endl;
401  else if (nSuccesFulMatches==1)
402  LogTrace("CSCGEMCMotherboardME11") << "1 successful ALCT-CLCT match in ME1a: "
403  << " CSCDetId " << cscChamberME1a->id()
404  << ", bx_alct = " << bx_alct
405  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop << "]" << std::endl;
406  else if (nSuccesFulGEMMatches==1)
407  LogTrace("CSCGEMCMotherboardME11") << "1 successful ALCT-GEM match in ME1a: "
408  << " CSCDetId " << cscChamberME1a->id()
409  << ", bx_alct = " << bx_alct
410  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop << "]" << std::endl;
411  else
412  LogTrace("CSCGEMCMotherboardME11") << "Unsuccessful ALCT-CLCT match in ME1a: "
413  << "CSCDetId " << cscChamberME1a->id()
414  << ", bx_alct = " << bx_alct
415  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop << "]" << std::endl;
416  }
417 
418  } // end of ALCT valid block
419  else {
420  auto coPads(coPads_[bx_alct]);
421  if (!coPads.empty()) {
422  // keep it simple for the time being, only consider the first copad
423  const int bx_clct_start(bx_alct - match_trig_window_size/2);
424  const int bx_clct_stop(bx_alct + match_trig_window_size/2);
425 
426  // matching in ME1b
428  for (int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
429  if (bx_clct < 0 or bx_clct >= CSCConstants::MAX_CLCT_TBINS) continue;
430  if (drop_used_clcts and used_clct_mask[bx_clct]) continue;
431  if (clct->bestCLCT[bx_clct].isValid()) {
432  const int quality(clct->bestCLCT[bx_clct].getQuality());
433  // only use high-Q stubs for the time being
434  if (quality < 4) continue;
435  int mbx = bx_clct-bx_clct_start;
436  CSCGEMMotherboard::correlateLCTsGEM(clct->bestCLCT[bx_clct], clct->secondCLCT[bx_clct], coPads,
437  allLCTs1b(bx_alct,mbx,0), allLCTs1b(bx_alct,mbx,1), ME1B);
438  if (debug_matching) {
439  // if (infoV > 1) LogTrace("CSCMotherboard")
440  LogTrace("CSCGEMCMotherboardME11") << "Successful GEM-CLCT match in ME1b: bx_alct = " << bx_alct
441  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop
442  << "]; bx_clct = " << bx_clct << "\n"
443  << "+++ Best CLCT Details: " << clct->bestCLCT[bx_clct] << "\n"
444  << "+++ Second CLCT Details: " << clct->secondCLCT[bx_clct] << std::endl;
445  }
446  if (allLCTs1b(bx_alct,mbx,0).isValid()) {
447  used_clct_mask[bx_clct] += 1;
448  if (match_earliest_clct_only) break;
449  }
450  }
451  }
452  }
453 
454  // matching in ME1a
456  for (int bx_clct = bx_clct_start; bx_clct <= bx_clct_stop; bx_clct++) {
457  if (bx_clct < 0 || bx_clct >= CSCConstants::MAX_CLCT_TBINS) continue;
458  if (drop_used_clcts && used_clct_mask_1a[bx_clct]) continue;
459  if (clct1a->bestCLCT[bx_clct].isValid()){
460  const int quality(clct1a->bestCLCT[bx_clct].getQuality());
461  // only use high-Q stubs for the time being
462  if (quality < 4) continue;
463  int mbx = bx_clct-bx_clct_start;
464  CSCGEMMotherboard::correlateLCTsGEM(clct1a->bestCLCT[bx_clct], clct1a->secondCLCT[bx_clct], coPads,
465  allLCTs1a(bx_alct,mbx,0), allLCTs1a(bx_alct,mbx,1), ME1A);
466  if (debug_matching) {
467  // if (infoV > 1) LogTrace("CSCMotherboard")
468  LogTrace("CSCGEMCMotherboardME11") << "Successful GEM-CLCT match in ME1a: bx_alct = " << bx_alct
469  << "; match window: [" << bx_clct_start << "; " << bx_clct_stop
470  << "]; bx_clct = " << bx_clct << "\n"
471  << "+++ Best CLCT Details: " << clct1a->bestCLCT[bx_clct] << "\n"
472  << "+++ Second CLCT Details: " << clct1a->secondCLCT[bx_clct] << std::endl;
473  }
474  if (allLCTs1a(bx_alct,mbx,0).isValid()){
475  used_clct_mask_1a[bx_clct] += 1;
476  if (match_earliest_clct_only) break;
477  }
478  }
479  }
480  }
481  }
482  }
483  } // end of ALCT-centric matching
484 
485  if (debug_matching){
486  LogTrace("CSCGEMCMotherboardME11") << "======================================================================== \n"
487  << "Counting the LCTs \n"
488  << "========================================================================" << std::endl;
489  }
490 
491  // reduction of nLCTs per each BX
492  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++)
493  {
494  // counting
495  unsigned int n1a=0, n1b=0;
496  for (unsigned int mbx = 0; mbx < match_trig_window_size; mbx++)
497  for (int i=0;i<CSCConstants::MAX_LCTS_PER_CSC;i++)
498  {
499  int cbx = bx + mbx - match_trig_window_size/2;
500  if (allLCTs1b(bx,mbx,i).isValid())
501  {
502  n1b++;
503  if (infoV > 0) LogDebug("CSCGEMMotherboardME11")
504  << "1b LCT"<<i+1<<" "<<bx<<"/"<<cbx<<": "<<allLCTs1b(bx,mbx,i)<<std::endl;
505  }
506  if (allLCTs1a(bx,mbx,i).isValid())
507  {
508  n1a++;
509  if (infoV > 0) LogDebug("CSCGEMMotherboardME11")
510  << "1a LCT"<<i+1<<" "<<bx<<"/"<<cbx<<": "<<allLCTs1a(bx,mbx,i)<<std::endl;
511  }
512  }
513  if (infoV > 0 and n1a+n1b>0) LogDebug("CSCGEMMotherboardME11")
514  <<"bx "<<bx<<" nLCT:"<<n1a<<" "<<n1b<<" "<<n1a+n1b<<std::endl;
515 
516  // some simple cross-bx sorting algorithms
517  if (tmb_cross_bx_algo == 1 and (n1a>2 or n1b>2) )
518  {
519  n1a=0, n1b=0;
520  for (unsigned int mbx = 0; mbx < match_trig_window_size; mbx++)
521  for (int i=0;i<CSCConstants::MAX_LCTS_PER_CSC;i++)
522  {
523  if (allLCTs1b(bx,pref[mbx],i).isValid())
524  {
525  n1b++;
526  if (n1b>2) allLCTs1b(bx,pref[mbx],i).clear();
527  }
528  if (allLCTs1a(bx,pref[mbx],i).isValid())
529  {
530  n1a++;
531  if (n1a>2) allLCTs1a(bx,pref[mbx],i).clear();
532  }
533  }
534 
535  n1a=0, n1b=0;
536  for (unsigned int mbx = 0; mbx < match_trig_window_size; mbx++)
537  for (int i=0;i<CSCConstants::MAX_LCTS_PER_CSC;i++)
538  {
539  int cbx = bx + mbx - match_trig_window_size/2;
540  if (allLCTs1b(bx,mbx,i).isValid())
541  {
542  n1b++;
543  if (infoV > 0) LogDebug("CSCGEMMotherboardME11")
544  << "1b LCT"<<i+1<<" "<<bx<<"/"<<cbx<<": "<<allLCTs1b(bx,mbx,i)<< std::endl;
545  }
546  if (allLCTs1a(bx,mbx,i).isValid())
547  {
548  n1a++;
549  if (infoV > 0) LogDebug("CSCGEMMotherboardME11")
550  << "1a LCT"<<i+1<<" "<<bx<<"/"<<cbx<<": "<<allLCTs1a(bx,mbx,i)<< std::endl;
551  }
552  }
553  if (infoV > 0 and n1a+n1b>0) LogDebug("CSCGEMMotherboardME11")
554  <<"bx "<<bx<<" nnLCT:"<<n1a<<" "<<n1b<<" "<<n1a+n1b<<std::endl;
555  } // x-bx sorting
556 
557  // Maximum 2 per whole ME11 per BX case:
558  // (supposedly, now we should have max 2 per bx in each 1a and 1b)
559  if (n1a+n1b > max_lcts and tmb_cross_bx_algo == 1)
560  {
561  // do it simple so far: take all low eta 1/b stubs
562  unsigned int nLCT=n1b;
563  n1a=0;
564  // right now nLCT<=2; cut 1a if necessary
565  for (unsigned int mbx=0; mbx<match_trig_window_size; mbx++)
566  for (int i=0;i<CSCConstants::MAX_LCTS_PER_CSC;i++)
567  if (allLCTs1a(bx,mbx,i).isValid()) {
568  nLCT++;
569  if (nLCT>max_lcts) allLCTs1a(bx,mbx,i).clear();
570  else n1a++;
571  }
572  if (infoV > 0 and nLCT>0) LogDebug("CSCGEMMotherboardME11")
573  <<"bx "<<bx<<" nnnLCT: "<<n1a<<" "<<n1b<<" "<<n1a+n1b<< std::endl;
574  }
575  }// reduction per bx
576 
577  unsigned int n1b=0, n1a=0;
578  LogTrace("CSCGEMCMotherboardME11") << "======================================================================== \n"
579  << "Counting the final LCTs \n"
580  << "======================================================================== \n"
581  << "tmb_cross_bx_algo: " << tmb_cross_bx_algo << std::endl;
582 
583  for (const auto& p : readoutLCTs1b()) {
584  n1b++;
585  LogTrace("CSCGEMCMotherboardME11") << "1b LCT "<<n1b<<" " << p <<std::endl;
586  }
587 
588  for (const auto& p : readoutLCTs1a()){
589  n1a++;
590  LogTrace("CSCGEMCMotherboardME11") << "1a LCT "<<n1a<<" " << p <<std::endl;
591 
592  }
593 }
594 
595 std::vector<CSCCorrelatedLCTDigi> CSCGEMMotherboardME11::readoutLCTs1a() const
596 {
597  return readoutLCTs(ME1A);
598 }
599 
600 
601 std::vector<CSCCorrelatedLCTDigi> CSCGEMMotherboardME11::readoutLCTs1b() const
602 {
603  return readoutLCTs(ME1B);
604 }
605 
606 
607 // Returns vector of read-out correlated LCTs, if any. Starts with
608 // the vector of all found LCTs and selects the ones in the read-out
609 // time window.
610 std::vector<CSCCorrelatedLCTDigi> CSCGEMMotherboardME11::readoutLCTs(enum CSCPart me1ab) const
611 {
612  std::vector<CSCCorrelatedLCTDigi> tmpV;
613 
614  // The start time of the L1A*LCT coincidence window should be related
615  // to the fifo_pretrig parameter, but I am not completely sure how.
616  // Just choose it such that the window is centered at bx=7. This may
617  // need further tweaking if the value of tmb_l1a_window_size changes.
618  //static int early_tbins = 4;
619  // The number of LCT bins in the read-out is given by the
620  // tmb_l1a_window_size parameter, forced to be odd
621  const int lct_bins =
623  const int late_tbins = early_tbins + lct_bins;
624 
625  // Start from the vector of all found correlated LCTs and select
626  // those within the LCT*L1A coincidence window.
627  int bx_readout = -1;
628  std::vector<CSCCorrelatedLCTDigi> all_lcts;
629  switch(tmb_cross_bx_algo){
630  case 1:
631  if (me1ab == ME1A and not (mpc_block_me1a or disableME1a)) {
632  allLCTs1a.getMatched(all_lcts);
633  }else if (me1ab == ME1B) {
634  allLCTs1b.getMatched(all_lcts);
635  }
636  break;
637  case 2: sortLCTs(all_lcts, me1ab, CSCUpgradeMotherboard::sortLCTsByQuality);
638  break;
639  case 3: sortLCTs(all_lcts, me1ab, CSCUpgradeMotherboard::sortLCTsByGEMDphi);
640  break;
641  default: LogTrace("CSCGEMCMotherboardME11")<<"tmb_cross_bx_algo error" <<std::endl;
642  break;
643  }
644 
645  for (const auto& lct: all_lcts)
646  {
647  if (!lct.isValid()) continue;
648 
649  int bx = lct.getBX();
650  // Skip LCTs found too early relative to L1Accept.
651  if (bx <= early_tbins) continue;
652 
653  // Skip LCTs found too late relative to L1Accept.
654  if (bx > late_tbins) continue;
655 
656  // If (readout_earliest_2) take only LCTs in the earliest bx in the read-out window:
657  // in digi->raw step, LCTs have to be packed into the TMB header, and
658  // currently there is room just for two.
659  if (readout_earliest_2 and (bx_readout == -1 or bx == bx_readout) )
660  {
661  tmpV.push_back(lct);
662  if (bx_readout == -1) bx_readout = bx;
663  }
664  else tmpV.push_back(lct);
665  }
666  return tmpV;
667 }
668 
669 //sort LCTs in each BX
670 void CSCGEMMotherboardME11::sortLCTs(std::vector<CSCCorrelatedLCTDigi>& LCTs, int bx, enum CSCPart me,
671  bool (*sorter)(const CSCCorrelatedLCTDigi&, const CSCCorrelatedLCTDigi&)) const
672 {
673  const auto& allLCTs(me==ME1A ? allLCTs1a : allLCTs1b);
674 
675  allLCTs.getTimeMatched(bx, LCTs);
676 
678 
679  if (LCTs.size() > max_lcts) LCTs.erase(LCTs.begin()+max_lcts, LCTs.end());
680 }
681 
682 //sort LCTs in whole LCTs BX window
683 void CSCGEMMotherboardME11::sortLCTs(std::vector<CSCCorrelatedLCTDigi>& LCTs_final, enum CSCPart me,
684  bool (*sorter)(const CSCCorrelatedLCTDigi&, const CSCCorrelatedLCTDigi&)) const
685 {
686  for (int bx = 0; bx < CSCConstants::MAX_LCT_TBINS; bx++)
687  {
688  // get sorted LCTs per subchamber
689  std::vector<CSCCorrelatedLCTDigi> LCTs1a;
690  std::vector<CSCCorrelatedLCTDigi> LCTs1b;
691 
694 
695  // temporary collection with all LCTs in the whole chamber
696  std::vector<CSCCorrelatedLCTDigi> LCTs_tmp;
697  LCTs_tmp.insert(LCTs_tmp.begin(), LCTs1b.begin(), LCTs1b.end());
698  LCTs_tmp.insert(LCTs_tmp.end(), LCTs1a.begin(), LCTs1a.end());
699 
700  // sort the selected LCTs
702 
703  //LCTs reduction per BX
704  if (max_lcts > 0)
705  {
706  if (LCTs_tmp.size() > max_lcts) LCTs_tmp.erase(LCTs_tmp.begin()+max_lcts, LCTs_tmp.end());//double check
707  // loop on all the selected LCTs
708  for (const auto& p: LCTs_tmp){
709  // case when you only want to readout ME1A
710  if (me==ME1A and std::find(LCTs1a.begin(), LCTs1a.end(), p) != LCTs1a.end()){
711  LCTs_final.push_back(p);
712  }
713  // case when you only want to readout ME1B
714  else if(me==ME1B and std::find(LCTs1b.begin(), LCTs1b.end(), p) != LCTs1b.end()){
715  LCTs_final.push_back(p);
716  }
717  }
718  }
719  else {
720  if (!LCTs1a.empty() and !LCTs1b.empty() and me==ME1A)
721  LCTs_final.push_back(*LCTs1a.begin());
722  else if (!LCTs1a.empty() and !LCTs1b.empty() and me==ME1B)
723  LCTs_final.push_back(*LCTs1b.begin());
724  else if (!LCTs1a.empty() and LCTs1b.empty() and me==ME1A)
725  LCTs_final.insert(LCTs_final.end(), LCTs1a.begin(), LCTs1a.end());
726  else if (!LCTs1b.empty() and LCTs1a.empty() and me==ME1B)
727  LCTs_final.insert(LCTs_final.end(), LCTs1b.begin(), LCTs1b.end());
728  }
729  }
730 }
731 
732 
734 {
735  if ( !c.isValid() or !a.isValid() ) return false;
736  int key_hs = c.getKeyStrip();
737  int key_wg = a.getKeyWG();
738  if ( me == ME1A )
739  {
740  if ( !gangedME1a )
741  {
742  // wrap around ME11 HS number for -z endcap
743  if (theEndcap==2) key_hs = CSCConstants::MAX_HALF_STRIP_ME1A_UNGANGED - key_hs;
744  if ( key_hs >= (tmbLUT_->get_lut_wg_vs_hs(CSCPart::ME1A))[key_wg][0] and
745  key_hs <= (tmbLUT_->get_lut_wg_vs_hs(CSCPart::ME1A))[key_wg][1] ) return true;
746  return false;
747  }
748  else
749  {
750  if (theEndcap==2) key_hs = CSCConstants::MAX_HALF_STRIP_ME1A_GANGED - key_hs;
751  if ( key_hs >= (tmbLUT_->get_lut_wg_vs_hs(CSCPart::ME1Ag))[key_wg][0] and
752  key_hs <= (tmbLUT_->get_lut_wg_vs_hs(CSCPart::ME1Ag))[key_wg][1] ) return true;
753  return false;
754  }
755  }
756  if ( me == ME1B)
757  {
758  if (theEndcap==2) key_hs = CSCConstants::MAX_HALF_STRIP_ME1B - key_hs;
759  if ( key_hs >= (tmbLUT_->get_lut_wg_vs_hs(CSCPart::ME1B))[key_wg][0] and
760  key_hs <= (tmbLUT_->get_lut_wg_vs_hs(CSCPart::ME1B))[key_wg][1] ) return true;
761  }
762  return false;
763 }
764 
765 
767  const CSCALCTDigi& sALCT,
768  const CSCCLCTDigi& bCLCT,
769  const CSCCLCTDigi& sCLCT,
770  const GEMPadDigiIds& pads,
771  const GEMCoPadDigiIds& copads,
772  CSCCorrelatedLCTDigi& lct1,
773  CSCCorrelatedLCTDigi& lct2,
774  enum CSCPart p) const
775 {
776  CSCALCTDigi bestALCT = bALCT;
777  CSCALCTDigi secondALCT = sALCT;
778  CSCCLCTDigi bestCLCT = bCLCT;
779  CSCCLCTDigi secondCLCT = sCLCT;
780 
781  // assume that always anodeBestValid and cathodeBestValid
782  if (secondALCT == bestALCT) secondALCT.clear();
783  if (secondCLCT == bestCLCT) secondCLCT.clear();
784 
785  const bool ok_bb = bestALCT.isValid() and bestCLCT.isValid();
786  const bool ok_bs = bestALCT.isValid() and secondCLCT.isValid();
787  const bool ok_sb = secondALCT.isValid() and bestCLCT.isValid();
788  const bool ok_ss = secondALCT.isValid() and secondCLCT.isValid();
789 
790  const int ok11 = doesALCTCrossCLCT( bestALCT, bestCLCT, p);
791  const int ok12 = doesALCTCrossCLCT( bestALCT, secondCLCT, p);
792  const int ok21 = doesALCTCrossCLCT( secondALCT, bestCLCT, p);
793  const int ok22 = doesALCTCrossCLCT( secondALCT, secondCLCT, p);
794  const int code = (ok11<<3) | (ok12<<2) | (ok21<<1) | (ok22);
795 
796  int dbg=0;
797  int ring = p;
799  CSCDetId did(theEndcap, theStation, ring, chamb, 0);
800  if (dbg) LogTrace("CSCGEMMotherboardME11")<<"debug correlateLCTs in "<<did<< "\n"
801  <<"ALCT1: "<<bestALCT<<"\n"
802  <<"ALCT2: "<<secondALCT<<"\n"
803  <<"CLCT1: "<<bestCLCT<<"\n"
804  <<"CLCT2: "<<secondCLCT<<"\n"
805  <<"ok 11 12 21 22 code = "<<ok11<<" "<<ok12<<" "<<ok21<<" "<<ok22<<" "<<code<<std::endl;
806 
807  if ( code==0 ) return;
808 
809  // LUT defines correspondence between possible ok## combinations
810  // and resulting lct1 and lct2
811  int lut[16][2] = {
812  //ok: 11 12 21 22
813  {0 ,0 }, // 0 0 0 0
814  {22,0 }, // 0 0 0 1
815  {21,0 }, // 0 0 1 0
816  {21,22}, // 0 0 1 1
817  {12,0 }, // 0 1 0 0
818  {12,22}, // 0 1 0 1
819  {12,21}, // 0 1 1 0
820  {12,21}, // 0 1 1 1
821  {11,0 }, // 1 0 0 0
822  {11,22}, // 1 0 0 1
823  {11,21}, // 1 0 1 0
824  {11,22}, // 1 0 1 1
825  {11,12}, // 1 1 0 0
826  {11,22}, // 1 1 0 1
827  {11,12}, // 1 1 1 0
828  {11,22}, // 1 1 1 1
829  };
830 
831  if (dbg) LogTrace("CSCGEMMotherboardME11")<<"lut 0 1 = "<<lut[code][0]<<" "<<lut[code][1]<<std::endl;
832 
833  // check matching copads
834  const GEMCoPadDigi& bb_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, bestCLCT, copads, p);
835  const GEMCoPadDigi& bs_copad = bestMatchingPad<GEMCoPadDigi>(bestALCT, secondCLCT, copads, p);
836  const GEMCoPadDigi& sb_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, bestCLCT, copads, p);
837  const GEMCoPadDigi& ss_copad = bestMatchingPad<GEMCoPadDigi>(secondALCT, secondCLCT, copads, p);
838 
839  // check matching pads
840  const GEMPadDigi& bb_pad = bestMatchingPad<GEMPadDigi>(bestALCT, bestCLCT, pads, p);
841  const GEMPadDigi& bs_pad = bestMatchingPad<GEMPadDigi>(bestALCT, secondCLCT, pads, p);
842  const GEMPadDigi& sb_pad = bestMatchingPad<GEMPadDigi>(secondALCT, bestCLCT, pads, p);
843  const GEMPadDigi& ss_pad = bestMatchingPad<GEMPadDigi>(secondALCT, secondCLCT, pads, p);
844 
845  // evaluate possible combinations
846  const bool ok_bb_copad = ok11==1 and ok_bb and bb_copad.isValid();
847  const bool ok_bs_copad = ok12==1 and ok_bs and bs_copad.isValid();
848  const bool ok_sb_copad = ok21==1 and ok_sb and sb_copad.isValid();
849  const bool ok_ss_copad = ok22==1 and ok_ss and ss_copad.isValid();
850 
851  const bool ok_bb_pad = (not ok_bb_copad) and ok11==1 and ok_bb and bb_pad.isValid();
852  const bool ok_bs_pad = (not ok_bs_copad) and ok12==1 and ok_bs and bs_pad.isValid();
853  const bool ok_sb_pad = (not ok_sb_copad) and ok21==1 and ok_sb and sb_pad.isValid();
854  const bool ok_ss_pad = (not ok_ss_copad) and ok22==1 and ok_ss and ss_pad.isValid();
855 
856  switch (lut[code][0]) {
857  case 11:
858  if (ok_bb_copad) lct1 = CSCGEMMotherboard::constructLCTsGEM(bestALCT, bestCLCT, bb_copad, p, 1);
859  if (ok_bb_pad) lct1 = CSCGEMMotherboard::constructLCTsGEM(bestALCT, bestCLCT, bb_pad, p, 1);
860  break;
861  case 12:
862  if (ok_bs_copad) lct1 = CSCGEMMotherboard::constructLCTsGEM(bestALCT, secondCLCT, bs_copad, p, 1);
863  if (ok_bs_pad) lct1 = CSCGEMMotherboard::constructLCTsGEM(bestALCT, secondCLCT, bs_pad, p, 1);
864  break;
865  case 21:
866  if (ok_sb_copad) lct1 = CSCGEMMotherboard::constructLCTsGEM(secondALCT, bestCLCT, sb_copad, p, 1);
867  if (ok_sb_pad) lct1 = CSCGEMMotherboard::constructLCTsGEM(secondALCT, bestCLCT, sb_pad, p, 1);
868  break;
869  case 22:
870  if (ok_ss_copad) lct1 = CSCGEMMotherboard::constructLCTsGEM(secondALCT, secondCLCT, ss_copad, p, 1);
871  if (ok_ss_pad) lct1 = CSCGEMMotherboard::constructLCTsGEM(secondALCT, secondCLCT, ss_pad, p, 1);
872  break;
873  default:
874  return;
875  }
876 
877  if (dbg) LogTrace("CSCGEMMotherboardME11")<<"lct1: "<<lct1<<std::endl;
878 
879  switch (lut[code][1]){
880  case 12:
881  if (ok_bs_copad) lct2 = CSCGEMMotherboard::constructLCTsGEM(bestALCT, secondCLCT, bs_copad, p, 2);
882  if (ok_bs_pad) lct2 = CSCGEMMotherboard::constructLCTsGEM(bestALCT, secondCLCT, bs_pad, p, 2);
883  break;
884  case 21:
885  if (ok_sb_copad) lct2 = CSCGEMMotherboard::constructLCTsGEM(secondALCT, bestCLCT, sb_copad, p, 2);
886  if (ok_sb_pad) lct2 = CSCGEMMotherboard::constructLCTsGEM(secondALCT, bestCLCT, sb_pad, p, 2);
887  break;
888  case 22:
889  if (ok_bb_copad) lct2 = CSCGEMMotherboard::constructLCTsGEM(secondALCT, secondCLCT, bb_copad, p, 2);
890  if (ok_bb_pad) lct2 = CSCGEMMotherboard::constructLCTsGEM(secondALCT, secondCLCT, bb_pad, p, 2);
891  break;
892  default:
893  return;
894  }
895 
896  if (dbg) LogTrace("CSCGEMMotherboardME11")<<"lct2: "<<lct2<<std::endl;
897 
898  if (dbg) LogTrace("CSCGEMMotherboardME11")<<"out of correlateLCTs"<<std::endl;
899  return;
900 }
#define LogDebug(id)
void retrieveGEMPads(const GEMPadDigiCollection *pads, unsigned id)
const unsigned theSector
T getParameter(std::string const &) const
std::vector< CSCCLCTDigi > clctV1b
unsigned int match_trig_window_size
CSCDetId id() const
Get the (concrete) DetId.
Definition: CSCChamber.h:37
const unsigned theTrigChamber
bool isValid() const
check ALCT validity (1 - valid ALCT)
Definition: CSCALCTDigi.h:30
GEMCoPadDigiIdsBX coPads_
CSCCorrelatedLCTDigi constructLCTsGEM(const CSCALCTDigi &alct, const GEMCoPadDigi &gem, enum CSCPart, int i) const
bool doesALCTCrossCLCT(const CSCALCTDigi &a, const CSCCLCTDigi &c, int me) const
const unsigned theEndcap
void clear()
clear this ALCT
Definition: CSCALCTDigi.cc:35
static bool sortLCTsByQuality(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
int pref[CSCConstants::MAX_LCT_TBINS]
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const CSCChamber * cscChamber
matches< GEMCoPadDigi > GEMCoPadDigiIds
std::vector< CSCCorrelatedLCTDigi > readoutLCTs1b() const
std::vector< GEMCoPadDigi > gemCoPadV
std::vector< CSCALCTDigi > alctV
void correlateLCTsGEM(const CSCALCTDigi &bestALCT, const CSCALCTDigi &secondALCT, const CSCCLCTDigi &bestCLCT, const CSCCLCTDigi &secondCLCT, const GEMPadDigiIds &pads, const GEMCoPadDigiIds &copads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2, enum CSCPart p) const
unsigned int mpc_block_me1a
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
const unsigned theStation
std::unique_ptr< GEMCoPadProcessor > coPadProcessor
const CSCGeometry * csc_g
edm::ParameterSet commonParams_
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
const unsigned theSubsector
void correlateLCTsGEM(T &best, T &second, const GEMCoPadDigiIds &coPads, CSCCorrelatedLCTDigi &lct1, CSCCorrelatedLCTDigi &lct2, enum CSCPart) const
static bool sortLCTsByGEMDphi(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)
void printGEMTriggerCoPads(int bx_start, int bx_stop, enum CSCPart)
unsigned int tmb_l1a_window_size
std::unique_ptr< CSCCathodeLCTProcessor > clct1a
bool isValid() const
check CLCT validity (1 - valid CLCT)
Definition: CSCCLCTDigi.h:30
#define LogTrace(id)
edm::ParameterSet tmbParams_
void getMatched(std::vector< CSCCorrelatedLCTDigi > &) const
std::unique_ptr< CSCGEMMotherboardLUTME11 > tmbLUT_
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
Definition: CSCGeometry.cc:118
void sortLCTs(std::vector< CSCCorrelatedLCTDigi > &, int bx, enum CSCPart, bool(*sorter)(const CSCCorrelatedLCTDigi &, const CSCCorrelatedLCTDigi &)) const
double b
Definition: hdecay.h:120
std::vector< CSCCLCTDigi > clctV1a
GEMPadDigiIdsBX pads_
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
matches< GEMPadDigi > GEMPadDigiIds
int getKeyStrip() const
Definition: CSCCLCTDigi.h:89
const GEMGeometry * gem_g
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
void printGEMTriggerPads(int bx_start, int bx_stop, enum CSCPart)
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const GEMPadDigiCollection *gemPads) override