CMS 3D CMS Logo

CSCTriggerPrimitivesBuilder.cc
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // Class: CSCTriggerPrimitivesBuilder
4 //
5 // Description: Algorithm to build anode, cathode, and correlated LCTs
6 // in each endcap muon CSC chamber from wire and comparator
7 // digis.
8 //
9 // Author List: S. Valuev, UCLA.
10 //
11 //
12 // Modifications:
13 //
14 //-----------------------------------------------------------------------------
15 
23 
25 
31 
32 //------------------
33 // Static variables
34 //------------------
45 
46 //-------------
47 // Constructor
48 //-------------
50 {
51  // Receives ParameterSet percolated down from EDProducer.
52 
53  // special configuration parameters for ME11 treatment
54  edm::ParameterSet commonParams = conf.getParameter<edm::ParameterSet>("commonParam");
55  smartME1aME1b = commonParams.getParameter<bool>("smartME1aME1b");
56  disableME1a = commonParams.getParameter<bool>("disableME1a");
57  disableME42 = commonParams.getParameter<bool>("disableME42");
58 
59  checkBadChambers_ = conf.getParameter<bool>("checkBadChambers");
60 
61  runME11ILT_ = commonParams.existsAs<bool>("runME11ILT")?commonParams.getParameter<bool>("runME11ILT"):false;
62  runME21ILT_ = commonParams.existsAs<bool>("runME21ILT")?commonParams.getParameter<bool>("runME21ILT"):false;
63  runME3141ILT_ = commonParams.existsAs<bool>("runME3141ILT")?commonParams.getParameter<bool>("runME3141ILT"):false;
64 
65  // ORCA way of initializing boards.
66  for (int endc = min_endcap; endc <= max_endcap; endc++)
67  {
68  for (int stat = min_station; stat <= max_station; stat++)
69  {
70  int numsubs = ((stat == 1) ? max_subsector : 1);
71  for (int sect = min_sector; sect <= max_sector; sect++)
72  {
73  for (int subs = min_subsector; subs <= numsubs; subs++)
74  {
75  for (int cham = min_chamber; cham <= max_chamber; cham++)
76  {
77  if ((endc <= 0 || endc > MAX_ENDCAPS) ||
78  (stat <= 0 || stat > MAX_STATIONS) ||
79  (sect <= 0 || sect > MAX_SECTORS) ||
80  (subs <= 0 || subs > MAX_SUBSECTORS) ||
81  (cham <= 0 || stat > MAX_CHAMBERS))
82  {
83  edm::LogError("L1CSCTPEmulatorSetupError")
84  << "+++ trying to instantiate TMB of illegal CSC id ["
85  << " endcap = " << endc << " station = " << stat
86  << " sector = " << sect << " subsector = " << subs
87  << " chamber = " << cham << "]; skipping it... +++\n";
88  continue;
89  }
91  // When the motherboard is instantiated, it instantiates ALCT
92  // and CLCT processors.
93  if (stat==1 && ring==1 && smartME1aME1b && !runME11ILT_)
94  tmb_[endc-1][stat-1][sect-1][subs-1][cham-1].reset( new CSCMotherboardME11(endc, stat, sect, subs, cham, conf) );
95  else if (stat==1 && ring==1 && smartME1aME1b && runME11ILT_)
96  tmb_[endc-1][stat-1][sect-1][subs-1][cham-1].reset( new CSCMotherboardME11GEM(endc, stat, sect, subs, cham, conf) );
97  else if (stat==2 && ring==1 && runME21ILT_)
98  tmb_[endc-1][stat-1][sect-1][subs-1][cham-1].reset( new CSCMotherboardME21GEM(endc, stat, sect, subs, cham, conf) );
99  else if ((stat==3 || stat==4) && ring==1 && runME3141ILT_)
100  tmb_[endc-1][stat-1][sect-1][subs-1][cham-1].reset( new CSCMotherboardME3141RPC(endc, stat, sect, subs, cham, conf) );
101  else
102  tmb_[endc-1][stat-1][sect-1][subs-1][cham-1].reset( new CSCMotherboard(endc, stat, sect, subs, cham, conf) );
103  }
104  }
105  }
106  }
107  }
108 
109  // Get min and max BX to sort LCTs in MPC.
110  m_minBX = conf.getParameter<int>("MinBX");
111  m_maxBX = conf.getParameter<int>("MaxBX");
112 
113  // Init MPC
114  m_muonportcard.reset( new CSCMuonPortCard(conf) );
115 }
116 
117 //------------
118 // Destructor
119 //------------
121 {
122 }
123 
124 //------------
125 // Operations
126 //------------
127 // Set configuration parameters obtained via EventSetup mechanism.
129 {
130  // Receives CSCDBL1TPParameters percolated down from ESProducer.
131 
132  for (int endc = min_endcap; endc <= max_endcap; endc++)
133  {
134  for (int stat = min_station; stat <= max_station; stat++)
135  {
136  int numsubs = ((stat == 1) ? max_subsector : 1);
137  for (int sect = min_sector; sect <= max_sector; sect++)
138  {
139  for (int subs = min_subsector; subs <= numsubs; subs++)
140  {
141  for (int cham = min_chamber; cham <= max_chamber; cham++)
142  {
143  tmb_[endc-1][stat-1][sect-1][subs-1][cham-1]->setConfigParameters(conf);
144  }
145  }
146  }
147  }
148  }
149 }
150 
151 // Build anode, cathode, and correlated LCTs in each chamber and fill them
152 // into output collections. Pass collections of wire and comparator digis
153 // to Trigger MotherBoard (TMB) processors, which, in turn, pass them to
154 // ALCT and CLCT processors. Up to 2 anode and 2 cathode LCTs can be found
155 // in each chamber during any bunch crossing. The 2 projections are then
156 // combined into three-dimensional "correlated" LCTs in the TMB. Finally,
157 // MPC processor sorts up to 18 LCTs from 9 TMBs and writes collections of
158 // up to 3 best LCTs per (sub)sector into Event (to be used by the Sector
159 // Receiver).
161  const CSCWireDigiCollection* wiredc,
162  const CSCComparatorDigiCollection* compdc,
163  const GEMPadDigiCollection* gemPads,
164  const RPCDigiCollection* rpcDigis,
165  CSCALCTDigiCollection& oc_alct,
166  CSCCLCTDigiCollection& oc_clct,
167  CSCCLCTPreTriggerCollection & oc_pretrig,
169  CSCCorrelatedLCTDigiCollection& oc_sorted_lct,
170  GEMCoPadDigiCollection& oc_gemcopad)
171 {
172  // CSC geometry.
174 
175  for (int endc = min_endcap; endc <= max_endcap; endc++)
176  {
177  for (int stat = min_station; stat <= max_station; stat++)
178  {
179  int numsubs = ((stat == 1) ? max_subsector : 1);
180  for (int sect = min_sector; sect <= max_sector; sect++)
181  {
182  for (int subs = min_subsector; subs <= numsubs; subs++)
183  {
184  for (int cham = min_chamber; cham <= max_chamber; cham++)
185  {
186 
188 
189  if (disableME42 && stat==4 && ring==2) continue;
190 
191  CSCMotherboard* tmb = tmb_[endc-1][stat-1][sect-1][subs-1][cham-1].get();
192 
193  // Run processors only if chamber exists in geometry.
194  if (tmb == 0 || theGeom->chamber(endc, stat, sect, subs, cham) == 0) continue;
195 
197 
198  // 0th layer means whole chamber.
199  CSCDetId detid(endc, stat, ring, chid, 0);
200 
201  // Skip chambers marked as bad (usually includes most of ME4/2 chambers;
202  // also, there's no ME1/a-1/b separation, it's whole ME1/1)
203  if (checkBadChambers_ && badChambers->isInBadChamber(detid)) continue;
204 
205 
206  // running upgraded ME1/1 TMBs
207  if (stat==1 && ring==1 && smartME1aME1b && !runME11ILT_)
208  {
209  CSCMotherboardME11* tmb11 = static_cast<CSCMotherboardME11*>(tmb);
210 
211  //LogTrace("CSCTriggerPrimitivesBuilder")<<"CSCTriggerPrimitivesBuilder::build in E:"<<endc<<" S:"<<stat<<" R:"<<ring;
212 
213  tmb11->run(wiredc,compdc);
214  std::vector<CSCCorrelatedLCTDigi> lctV = tmb11->readoutLCTs1b();
215  std::vector<CSCCorrelatedLCTDigi> lctV1a = tmb11->readoutLCTs1a();
216 
217  std::vector<CSCALCTDigi> alctV1a, alctV = tmb11->alct->readoutALCTs();
218 
219  std::vector<CSCCLCTDigi> clctV = tmb11->clct->readoutCLCTs();
220  std::vector<int> preTriggerBXs = tmb11->clct->preTriggerBXs();
221  std::vector<CSCCLCTDigi> clctV1a = tmb11->clct1a->readoutCLCTs();
222  std::vector<int> preTriggerBXs1a = tmb11->clct1a->preTriggerBXs();
223 
224  // perform simple separation of ALCTs into 1/a and 1/b
225  // for 'smart' case. Some duplication occurs for WG [10,15]
226  std::vector<CSCALCTDigi> tmpV(alctV);
227  alctV.clear();
228  for (unsigned int al=0; al < tmpV.size(); al++)
229  {
230  if (tmpV[al].getKeyWG()<=15) alctV1a.push_back(tmpV[al]);
231  if (tmpV[al].getKeyWG()>=10) alctV.push_back(tmpV[al]);
232  }
233  //LogTrace("CSCTriggerPrimitivesBuilder")<<"CSCTriggerPrimitivesBuilder:: a="<<alctV.size()<<" c="<<clctV.size()<<" l="<<lctV.size()
234  // <<" 1a: a="<<alctV1a.size()<<" c="<<clctV1a.size()<<" l="<<lctV1a.size();
235 
236  // ME1/b
237 
238  if (!(lctV.empty()&&alctV.empty()&&clctV.empty())) {
239  LogTrace("L1CSCTrigger")
240  << "CSCTriggerPrimitivesBuilder results in " <<detid;
241  }
242 
243  // Correlated LCTs.
244  if (!lctV.empty()) {
245  LogTrace("L1CSCTrigger")
246  << "Put " << lctV.size() << " ME1b LCT digi"
247  << ((lctV.size() > 1) ? "s " : " ") << "in collection\n";
248  oc_lct.put(std::make_pair(lctV.begin(),lctV.end()), detid);
249  }
250 
251  // Anode LCTs.
252  if (!alctV.empty()) {
253  LogTrace("L1CSCTrigger")
254  << "Put " << alctV.size() << " ME1b ALCT digi"
255  << ((alctV.size() > 1) ? "s " : " ") << "in collection\n";
256  oc_alct.put(std::make_pair(alctV.begin(),alctV.end()), detid);
257  }
258 
259  // Cathode LCTs.
260  if (!clctV.empty()) {
261  LogTrace("L1CSCTrigger")
262  << "Put " << clctV.size() << " ME1b CLCT digi"
263  << ((clctV.size() > 1) ? "s " : " ") << "in collection\n";
264  oc_clct.put(std::make_pair(clctV.begin(),clctV.end()), detid);
265  }
266 
267  // Cathode LCTs pretriggers
268  if (!preTriggerBXs.empty()) {
269  LogTrace("L1CSCTrigger")
270  << "Put " << preTriggerBXs.size() << " CLCT pretrigger"
271  << ((preTriggerBXs.size() > 1) ? "s " : " ") << "in collection\n";
272  oc_pretrig.put(std::make_pair(preTriggerBXs.begin(),preTriggerBXs.end()), detid);
273  }
274 
275  // ME1/a
276 
277  if (disableME1a) continue;
278 
279  CSCDetId detid1a(endc, stat, 4, chid, 0);
280 
281  if (!(lctV1a.empty()&&alctV1a.empty()&&clctV1a.empty())){
282  LogTrace("L1CSCTrigger") << "CSCTriggerPrimitivesBuilder results in " <<detid1a;
283  }
284 
285  // Correlated LCTs.
286  if (!lctV1a.empty()) {
287  LogTrace("L1CSCTrigger")
288  << "Put " << lctV1a.size() << " ME1a LCT digi"
289  << ((lctV1a.size() > 1) ? "s " : " ") << "in collection\n";
290  oc_lct.put(std::make_pair(lctV1a.begin(),lctV1a.end()), detid1a);
291  }
292 
293  // Anode LCTs.
294  if (!alctV1a.empty()) {
295  LogTrace("L1CSCTrigger")
296  << "Put " << alctV1a.size() << " ME1a ALCT digi"
297  << ((alctV1a.size() > 1) ? "s " : " ") << "in collection\n";
298  oc_alct.put(std::make_pair(alctV1a.begin(),alctV1a.end()), detid1a);
299  }
300 
301  // Cathode LCTs.
302  if (!clctV1a.empty()) {
303  LogTrace("L1CSCTrigger")
304  << "Put " << clctV1a.size() << " ME1a CLCT digi"
305  << ((clctV1a.size() > 1) ? "s " : " ") << "in collection\n";
306  oc_clct.put(std::make_pair(clctV1a.begin(),clctV1a.end()), detid1a);
307  }
308 
309  // Cathode LCTs pretriggers
310  if (!preTriggerBXs1a.empty()) {
311  LogTrace("L1CSCTrigger")
312  << "Put " << preTriggerBXs1a.size() << " CLCT pretrigger"
313  << ((preTriggerBXs1a.size() > 1) ? "s " : " ") << "in collection\n";
314  oc_pretrig.put(std::make_pair(preTriggerBXs1a.begin(),preTriggerBXs1a.end()), detid1a);
315  }
316  } // upgraded TMB
317 
318  // running upgraded ME1/1 TMBs with GEMs
319  else if (stat==1 && ring==1 && smartME1aME1b && runME11ILT_)
320  {
321  CSCMotherboardME11GEM* tmb11GEM = static_cast<CSCMotherboardME11GEM*>(tmb);
322 
323  tmb11GEM->setCSCGeometry(csc_g);
324  tmb11GEM->setGEMGeometry(gem_g);
325  //LogTrace("CSCTriggerPrimitivesBuilder")<<"CSCTriggerPrimitivesBuilder::build in E:"<<endc<<" S:"<<stat<<" R:"<<ring;
326  tmb11GEM->run(wiredc, compdc, gemPads);
327 
328  std::vector<CSCCorrelatedLCTDigi> lctV = tmb11GEM->readoutLCTs1b();
329  std::vector<CSCCorrelatedLCTDigi> lctV1a = tmb11GEM->readoutLCTs1a();
330 
331  std::vector<CSCALCTDigi> alctV1a, alctV = tmb11GEM->alct->readoutALCTs();
332 
333  std::vector<CSCCLCTDigi> clctV = tmb11GEM->clct->readoutCLCTs();
334  std::vector<int> preTriggerBXs = tmb11GEM->clct->preTriggerBXs();
335  std::vector<CSCCLCTDigi> clctV1a = tmb11GEM->clct1a->readoutCLCTs();
336  std::vector<int> preTriggerBXs1a = tmb11GEM->clct1a->preTriggerBXs();
337 
338  std::vector<GEMCoPadDigi> copads = tmb11GEM->readoutCoPads();
339 
340  // perform simple separation of ALCTs into 1/a and 1/b
341  // for 'smart' case. Some duplication occurs for WG [10,15]
342  std::vector<CSCALCTDigi> tmpV(alctV);
343  alctV.clear();
344  for (unsigned int al=0; al < tmpV.size(); al++)
345  {
346  if (tmpV[al].getKeyWG()<=15) alctV1a.push_back(tmpV[al]);
347  if (tmpV[al].getKeyWG()>=10) alctV.push_back(tmpV[al]);
348  }
349  //LogTrace("CSCTriggerPrimitivesBuilder")<<"CSCTriggerPrimitivesBuilder:: a="<<alctV.size()<<" c="<<clctV.size()<<" l="<<lctV.size()
350  // <<" 1a: a="<<alctV1a.size()<<" c="<<clctV1a.size()<<" l="<<lctV1a.size();
351 
352  // ME1/b
353 
354  if (!(lctV.empty()&&alctV.empty()&&clctV.empty())) {
355  LogTrace("L1CSCTrigger")
356  << "CSCTriggerPrimitivesBuilder results in " <<detid;
357  }
358 
359  // Correlated LCTs.
360  if (!lctV.empty()) {
361  LogTrace("L1CSCTrigger")
362  << "Put " << lctV.size() << " ME1b LCT digi"
363  << ((lctV.size() > 1) ? "s " : " ") << "in collection\n";
364  oc_lct.put(std::make_pair(lctV.begin(),lctV.end()), detid);
365  }
366 
367  // Anode LCTs.
368  if (!alctV.empty()) {
369  LogTrace("L1CSCTrigger")
370  << "Put " << alctV.size() << " ME1b ALCT digi"
371  << ((alctV.size() > 1) ? "s " : " ") << "in collection\n";
372  oc_alct.put(std::make_pair(alctV.begin(),alctV.end()), detid);
373  }
374 
375  // Cathode LCTs.
376  if (!clctV.empty()) {
377  LogTrace("L1CSCTrigger")
378  << "Put " << clctV.size() << " ME1b CLCT digi"
379  << ((clctV.size() > 1) ? "s " : " ") << "in collection\n";
380  oc_clct.put(std::make_pair(clctV.begin(),clctV.end()), detid);
381  }
382 
383  // Cathode LCTs pretriggers
384  if (!preTriggerBXs.empty()) {
385  LogTrace("L1CSCTrigger")
386  << "Put " << preTriggerBXs.size() << " CLCT pretrigger"
387  << ((preTriggerBXs.size() > 1) ? "s " : " ") << "in collection\n";
388  oc_pretrig.put(std::make_pair(preTriggerBXs.begin(),preTriggerBXs.end()), detid);
389  }
390  // 0th layer means whole chamber.
391  GEMDetId gemId(detid.zendcap(), 1, 1, 1, chid, 0);
392 
393  // GEM coincidence pads
394  if (!copads.empty()) {
395  LogTrace("L1CSCTrigger")
396  << "Put " << copads.size() << " GEM coincidence pad"
397  << ((copads.size() > 1) ? "s " : " ") << "in collection\n";
398  oc_gemcopad.put(std::make_pair(copads.begin(),copads.end()), gemId);
399  }
400 
401  // ME1/a
402 
403  if (disableME1a) continue;
404 
405  CSCDetId detid1a(endc, stat, 4, chid, 0);
406 
407  if (!(lctV1a.empty()&&alctV1a.empty()&&clctV1a.empty())){
408  LogTrace("L1CSCTrigger") << "CSCTriggerPrimitivesBuilder results in " <<detid1a;
409  }
410 
411  // Correlated LCTs.
412  if (!lctV1a.empty()) {
413  LogTrace("L1CSCTrigger")
414  << "Put " << lctV1a.size() << " ME1a LCT digi"
415  << ((lctV1a.size() > 1) ? "s " : " ") << "in collection\n";
416  oc_lct.put(std::make_pair(lctV1a.begin(),lctV1a.end()), detid1a);
417  }
418 
419  // Anode LCTs.
420  if (!alctV1a.empty()) {
421  LogTrace("L1CSCTrigger")
422  << "Put " << alctV1a.size() << " ME1a ALCT digi"
423  << ((alctV1a.size() > 1) ? "s " : " ") << "in collection\n";
424  oc_alct.put(std::make_pair(alctV1a.begin(),alctV1a.end()), detid1a);
425  }
426 
427  // Cathode LCTs.
428  if (!clctV1a.empty()) {
429  LogTrace("L1CSCTrigger")
430  << "Put " << clctV1a.size() << " ME1a CLCT digi"
431  << ((clctV1a.size() > 1) ? "s " : " ") << "in collection\n";
432  oc_clct.put(std::make_pair(clctV1a.begin(),clctV1a.end()), detid1a);
433  }
434 
435  // Cathode LCTs pretriggers
436  if (!preTriggerBXs1a.empty()) {
437  LogTrace("L1CSCTrigger")
438  << "Put " << preTriggerBXs.size() << " CLCT pretrigger"
439  << ((preTriggerBXs.size() > 1) ? "s " : " ") << "in collection\n";
440  oc_pretrig.put(std::make_pair(preTriggerBXs.begin(),preTriggerBXs.end()), detid);
441  }
442  }
443 
444  // running upgraded ME2/1 TMBs
445  else if (stat==2 && ring==1 && runME21ILT_)
446  {
447  CSCMotherboardME21GEM* tmb21GEM = static_cast<CSCMotherboardME21GEM*>(tmb);
448  tmb21GEM->setCSCGeometry(csc_g);
449  tmb21GEM->setGEMGeometry(gem_g);
450  tmb21GEM->run(wiredc, compdc, gemPads);
451  std::vector<CSCCorrelatedLCTDigi> lctV = tmb21GEM->readoutLCTs();
452  std::vector<CSCALCTDigi> alctV = tmb21GEM->alct->readoutALCTs();
453  std::vector<CSCCLCTDigi> clctV = tmb21GEM->clct->readoutCLCTs();
454  std::vector<int> preTriggerBXs = tmb21GEM->clct->preTriggerBXs();
455 
456  std::vector<GEMCoPadDigi> copads = tmb21GEM->readoutCoPads();
457 
458  if (!(alctV.empty() && clctV.empty() && lctV.empty())) {
459  LogTrace("L1CSCTrigger")
460  << "CSCTriggerPrimitivesBuilder got results in " <<detid;
461  }
462 
463  // Correlated LCTs.
464  if (!lctV.empty()) {
465  LogTrace("L1CSCTrigger")
466  << "Put " << lctV.size() << " LCT digi"
467  << ((lctV.size() > 1) ? "s " : " ") << "in collection\n";
468  oc_lct.put(std::make_pair(lctV.begin(),lctV.end()), detid);
469  }
470 
471  // Anode LCTs.
472  if (!alctV.empty()) {
473  LogTrace("L1CSCTrigger")
474  << "Put " << alctV.size() << " ALCT digi"
475  << ((alctV.size() > 1) ? "s " : " ") << "in collection\n";
476  oc_alct.put(std::make_pair(alctV.begin(),alctV.end()), detid);
477  }
478 
479  // Cathode LCTs.
480  if (!clctV.empty()) {
481  LogTrace("L1CSCTrigger")
482  << "Put " << clctV.size() << " CLCT digi"
483  << ((clctV.size() > 1) ? "s " : " ") << "in collection\n";
484  oc_clct.put(std::make_pair(clctV.begin(),clctV.end()), detid);
485  }
486 
487  // Cathode LCTs pretriggers
488  if (!preTriggerBXs.empty()) {
489  LogTrace("L1CSCTrigger")
490  << "Put " << preTriggerBXs.size() << " CLCT pretrigger"
491  << ((preTriggerBXs.size() > 1) ? "s " : " ") << "in collection\n";
492  oc_pretrig.put(std::make_pair(preTriggerBXs.begin(),preTriggerBXs.end()), detid);
493  }
494 
495  // 0th layer means whole chamber.
496  GEMDetId gemId(detid.zendcap(), 1, 2, 1, chid, 0);
497 
498  // GEM coincidence pads
499  if (!copads.empty()) {
500  LogTrace("L1CSCTrigger")
501  << "Put " << copads.size() << " GEM coincidence pad"
502  << ((copads.size() > 1) ? "s " : " ") << "in collection\n";
503  oc_gemcopad.put(std::make_pair(copads.begin(),copads.end()), gemId);
504  }
505  }
506  // running upgraded ME3/1-ME4/1 TMBs
507  else if ((stat==3 or stat==4) && ring==1 && runME3141ILT_)
508  {
509  CSCMotherboardME3141RPC* tmb3141RPC = static_cast<CSCMotherboardME3141RPC*>(tmb);
510  tmb3141RPC->setCSCGeometry(csc_g);
511  tmb3141RPC->setRPCGeometry(rpc_g);
512  tmb3141RPC->run(wiredc, compdc, rpcDigis);
513  std::vector<CSCCorrelatedLCTDigi> lctV = tmb3141RPC->readoutLCTs();
514  std::vector<CSCALCTDigi> alctV = tmb3141RPC->alct->readoutALCTs();
515  std::vector<CSCCLCTDigi> clctV = tmb3141RPC->clct->readoutCLCTs();
516  std::vector<int> preTriggerBXs = tmb3141RPC->clct->preTriggerBXs();
517 
518  if (!(alctV.empty() && clctV.empty() && lctV.empty())) {
519  LogTrace("L1CSCTrigger")
520  << "CSCTriggerPrimitivesBuilder got results in " <<detid;
521  }
522 
523  // Correlated LCTs.
524  if (!lctV.empty()) {
525  LogTrace("L1CSCTrigger")
526  << "Put " << lctV.size() << " LCT digi"
527  << ((lctV.size() > 1) ? "s " : " ") << "in collection\n";
528  oc_lct.put(std::make_pair(lctV.begin(),lctV.end()), detid);
529  }
530  // Anode LCTs.
531  if (!alctV.empty()) {
532  LogTrace("L1CSCTrigger")
533  << "Put " << alctV.size() << " ALCT digi"
534  << ((alctV.size() > 1) ? "s " : " ") << "in collection\n";
535  oc_alct.put(std::make_pair(alctV.begin(),alctV.end()), detid);
536  }
537 
538  // Cathode LCTs.
539  if (!clctV.empty()) {
540  LogTrace("L1CSCTrigger")
541  << "Put " << clctV.size() << " CLCT digi"
542  << ((clctV.size() > 1) ? "s " : " ") << "in collection\n";
543  oc_clct.put(std::make_pair(clctV.begin(),clctV.end()), detid);
544  }
545 
546  // Cathode LCTs pretriggers
547  if (!preTriggerBXs.empty()) {
548  LogTrace("L1CSCTrigger")
549  << "Put " << preTriggerBXs.size() << " CLCT pretrigger"
550  << ((preTriggerBXs.size() > 1) ? "s " : " ") << "in collection\n";
551  oc_pretrig.put(std::make_pair(preTriggerBXs.begin(),preTriggerBXs.end()), detid);
552  }
553  }
554 
555  // running non-upgraded TMB
556  else
557  {
558  tmb->run(wiredc,compdc);
559 
560  std::vector<CSCCorrelatedLCTDigi> lctV = tmb->readoutLCTs();
561  std::vector<CSCALCTDigi> alctV = tmb->alct->readoutALCTs();
562  std::vector<CSCCLCTDigi> clctV = tmb->clct->readoutCLCTs();
563  std::vector<int> preTriggerBXs = tmb->clct->preTriggerBXs();
564 
565  if (!(alctV.empty() && clctV.empty() && lctV.empty())) {
566  LogTrace("L1CSCTrigger")
567  << "CSCTriggerPrimitivesBuilder got results in " <<detid;
568  }
569 
570  /*
571  // tmp kludge: tightening of ME1a LCTs
572  if (stat==1 && ring==1) {
573  std::vector<CSCCorrelatedLCTDigi> lctV11;
574  for (unsigned t=0;t<lctV.size();t++){
575  if (lctV[t].getStrip() < 127) lctV11.push_back(lctV[t]);
576  else if (lctV[t].getQuality() >= 14) lctV11.push_back(lctV[t]);
577  }
578  lctV = lctV11;
579  }
580  */
581 
582  // Correlated LCTs.
583  if (!lctV.empty()) {
584  LogTrace("L1CSCTrigger")
585  << "Put " << lctV.size() << " LCT digi"
586  << ((lctV.size() > 1) ? "s " : " ") << "in collection\n";
587  oc_lct.put(std::make_pair(lctV.begin(),lctV.end()), detid);
588  }
589 
590  // Anode LCTs.
591  if (!alctV.empty()) {
592  LogTrace("L1CSCTrigger")
593  << "Put " << alctV.size() << " ALCT digi"
594  << ((alctV.size() > 1) ? "s " : " ") << "in collection\n";
595  oc_alct.put(std::make_pair(alctV.begin(),alctV.end()), detid);
596  }
597 
598  // Cathode LCTs.
599  if (!clctV.empty()) {
600  LogTrace("L1CSCTrigger")
601  << "Put " << clctV.size() << " CLCT digi"
602  << ((clctV.size() > 1) ? "s " : " ") << "in collection\n";
603  oc_clct.put(std::make_pair(clctV.begin(),clctV.end()), detid);
604  }
605 
606  // Cathode LCTs pretriggers
607  if (!preTriggerBXs.empty()) {
608  LogTrace("L1CSCTrigger")
609  << "Put " << preTriggerBXs.size() << " CLCT pretrigger"
610  << ((preTriggerBXs.size() > 1) ? "s " : " ") << "in collection\n";
611  oc_pretrig.put(std::make_pair(preTriggerBXs.begin(),preTriggerBXs.end()), detid);
612  }
613  } // non-upgraded TMB
614  }
615  }
616  }
617  }
618  }
619 
620  // run MPC simulation
621  m_muonportcard->loadDigis(oc_lct);
622 
623  // temporary hack to ensure that all MPC LCTs are read out
624  if (runOnData_) {
625  m_minBX = 5;
626  m_maxBX = 11;
627  }
628 
629  std::vector<csctf::TrackStub> result;
630  for(int bx = m_minBX; bx <= m_maxBX; ++bx)
631  for(int e = min_endcap; e <= max_endcap; ++e)
632  for(int st = min_station; st <= max_station; ++st)
633  for(int se = min_sector; se <= max_sector; ++se)
634  {
635  if(st == 1)
636  {
637  std::vector<csctf::TrackStub> subs1, subs2;
638  subs1 = m_muonportcard->sort(e, st, se, 1, bx);
639  subs2 = m_muonportcard->sort(e, st, se, 2, bx);
640  result.insert(result.end(), subs1.begin(), subs1.end());
641  result.insert(result.end(), subs2.begin(), subs2.end());
642  }
643  else
644  {
645  std::vector<csctf::TrackStub> sector;
646  sector = m_muonportcard->sort(e, st, se, 0, bx);
647  result.insert(result.end(), sector.begin(), sector.end());
648  }
649  }
650 
651  std::vector<csctf::TrackStub>::const_iterator itr = result.begin();
652  for (; itr != result.end(); itr++)
653  {
654  oc_sorted_lct.insertDigi(CSCDetId(itr->getDetId().rawId()), *(itr->getDigi()));
655  LogDebug("L1CSCTrigger")
656  << "MPC " << *(itr->getDigi()) << " found in ME"
657  << ((itr->endcap() == 1) ? "+" : "-") << itr->station() << "/"
658  << CSCDetId(itr->getDetId().rawId()).ring() << "/"
659  << CSCDetId(itr->getDetId().rawId()).chamber()
660  << " (sector " << itr->sector()
661  << " trig id. " << itr->cscid() << ")" << "\n";
662  }
663 }
#define LogDebug(id)
std::vector< GEMCoPadDigi > readoutCoPads()
T getParameter(std::string const &) const
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc)
std::unique_ptr< CSCMotherboard > tmb_[MAX_ENDCAPS][MAX_STATIONS][MAX_SECTORS][MAX_SUBSECTORS][MAX_CHAMBERS]
void setCSCGeometry(const CSCGeometry *g)
set CSC and RPC geometries for the matching needs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
CSCChamber * chamber(unsigned endcap, unsigned station, unsigned sector, unsigned subsector, unsigned tcscid) const
Return the CSCChamber for a corresponding endcap/station/sector/subsector/trigger cscid...
std::vector< CSCCorrelatedLCTDigi > readoutLCTs1a()
std::vector< CSCCorrelatedLCTDigi > readoutLCTs()
static int minEndcapId()
Definition: CSCDetId.h:236
void setGEMGeometry(const GEMGeometry *g)
static int maxTriggerSectorId()
std::vector< CSCCorrelatedLCTDigi > readoutLCTs()
static int maxStationId()
Definition: CSCDetId.h:239
static int minTriggerSectorId()
static int ringFromTriggerLabels(int station, int triggerCSCID)
std::unique_ptr< CSCCathodeLCTProcessor > clct1a
void setConfigParameters(const CSCDBL1TPParameters *conf)
bool isInBadChamber(IndexType ichamber) const
Is the chamber with index &#39;ichamber&#39; flagged as bad?
bool runOnData_
temporary flag to run on data
CSCTriggerPrimitivesBuilder(const edm::ParameterSet &)
static CSCTriggerGeomManager * get()
static int minStationId()
Definition: CSCDetId.h:238
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
void setCSCGeometry(const CSCGeometry *g)
set CSC and GEM geometries for the matching needs
void run(const std::vector< int > w_time[CSCConstants::NUM_LAYERS][CSCConstants::MAX_NUM_WIRES], const std::vector< int > hs_times[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS], const std::vector< int > ds_times[CSCConstants::NUM_LAYERS][CSCConstants::NUM_HALF_STRIPS_7CFEBS])
static int maxEndcapId()
Definition: CSCDetId.h:237
#define LogTrace(id)
short int zendcap() const
Definition: CSCDetId.h:100
void setCSCGeometry(const CSCGeometry *g)
set CSC and GEM geometries for the matching needs
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const GEMPadDigiCollection *gemPads)
void build(const CSCBadChambers *badChambers, const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const GEMPadDigiCollection *gemPads, const RPCDigiCollection *rpcDigis, CSCALCTDigiCollection &oc_alct, CSCCLCTDigiCollection &oc_clct, CSCCLCTPreTriggerCollection &oc_pretrig, CSCCorrelatedLCTDigiCollection &oc_lct, CSCCorrelatedLCTDigiCollection &oc_sorted_lct, GEMCoPadDigiCollection &oc_gemcopad)
static int minTriggerSubSectorId()
bool checkBadChambers_
a flag whether to skip chambers from the bad chambers map
std::vector< CSCCorrelatedLCTDigi > readoutLCTs1b()
std::unique_ptr< CSCAnodeLCTProcessor > alct
std::unique_ptr< CSCCathodeLCTProcessor > clct
std::vector< CSCCorrelatedLCTDigi > readoutLCTs1b()
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const GEMPadDigiCollection *gemPads)
std::vector< CSCCorrelatedLCTDigi > readoutLCTs()
std::unique_ptr< CSCMuonPortCard > m_muonportcard
void setGEMGeometry(const GEMGeometry *g)
std::unique_ptr< CSCCathodeLCTProcessor > clct1a
void run(const CSCWireDigiCollection *wiredc, const CSCComparatorDigiCollection *compdc, const RPCDigiCollection *rpcDigis)
std::vector< GEMCoPadDigi > readoutCoPads()
void setRPCGeometry(const RPCGeometry *g)
static int chamberFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station, int TriggerCSCID)
static int maxTriggerSubSectorId()
std::vector< CSCCorrelatedLCTDigi > readoutLCTs1a()