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->coPadProcessor->readoutCoPads();
339  // perform simple separation of ALCTs into 1/a and 1/b
340  // for 'smart' case. Some duplication occurs for WG [10,15]
341  std::vector<CSCALCTDigi> tmpV(alctV);
342  alctV.clear();
343  for (unsigned int al=0; al < tmpV.size(); al++)
344  {
345  if (tmpV[al].getKeyWG()<=15) alctV1a.push_back(tmpV[al]);
346  if (tmpV[al].getKeyWG()>=10) alctV.push_back(tmpV[al]);
347  }
348  //LogTrace("CSCTriggerPrimitivesBuilder")<<"CSCTriggerPrimitivesBuilder:: a="<<alctV.size()<<" c="<<clctV.size()<<" l="<<lctV.size()
349  // <<" 1a: a="<<alctV1a.size()<<" c="<<clctV1a.size()<<" l="<<lctV1a.size();
350 
351  // ME1/b
352 
353  if (!(lctV.empty()&&alctV.empty()&&clctV.empty())) {
354  LogTrace("L1CSCTrigger")
355  << "CSCTriggerPrimitivesBuilder results in " <<detid;
356  }
357 
358  // Correlated LCTs.
359  if (!lctV.empty()) {
360  LogTrace("L1CSCTrigger")
361  << "Put " << lctV.size() << " ME1b LCT digi"
362  << ((lctV.size() > 1) ? "s " : " ") << "in collection\n";
363  oc_lct.put(std::make_pair(lctV.begin(),lctV.end()), detid);
364  }
365 
366  // Anode LCTs.
367  if (!alctV.empty()) {
368  LogTrace("L1CSCTrigger")
369  << "Put " << alctV.size() << " ME1b ALCT digi"
370  << ((alctV.size() > 1) ? "s " : " ") << "in collection\n";
371  oc_alct.put(std::make_pair(alctV.begin(),alctV.end()), detid);
372  }
373 
374  // Cathode LCTs.
375  if (!clctV.empty()) {
376  LogTrace("L1CSCTrigger")
377  << "Put " << clctV.size() << " ME1b CLCT digi"
378  << ((clctV.size() > 1) ? "s " : " ") << "in collection\n";
379  oc_clct.put(std::make_pair(clctV.begin(),clctV.end()), detid);
380  }
381 
382  // Cathode LCTs pretriggers
383  if (!preTriggerBXs.empty()) {
384  LogTrace("L1CSCTrigger")
385  << "Put " << preTriggerBXs.size() << " CLCT pretrigger"
386  << ((preTriggerBXs.size() > 1) ? "s " : " ") << "in collection\n";
387  oc_pretrig.put(std::make_pair(preTriggerBXs.begin(),preTriggerBXs.end()), detid);
388  }
389  // 0th layer means whole chamber.
390  GEMDetId gemId(detid.zendcap(), 1, 1, 0, chid, 0);
391 
392  // GEM coincidence pads
393  if (!copads.empty()) {
394  LogTrace("L1CSCTrigger")
395  << "Put " << copads.size() << " GEM coincidence pad"
396  << ((copads.size() > 1) ? "s " : " ") << "in collection\n";
397  oc_gemcopad.put(std::make_pair(copads.begin(),copads.end()), gemId);
398  }
399 
400  // ME1/a
401 
402  if (disableME1a) continue;
403 
404  CSCDetId detid1a(endc, stat, 4, chid, 0);
405 
406  if (!(lctV1a.empty()&&alctV1a.empty()&&clctV1a.empty())){
407  LogTrace("L1CSCTrigger") << "CSCTriggerPrimitivesBuilder results in " <<detid1a;
408  }
409 
410  // Correlated LCTs.
411  if (!lctV1a.empty()) {
412  LogTrace("L1CSCTrigger")
413  << "Put " << lctV1a.size() << " ME1a LCT digi"
414  << ((lctV1a.size() > 1) ? "s " : " ") << "in collection\n";
415  oc_lct.put(std::make_pair(lctV1a.begin(),lctV1a.end()), detid1a);
416  }
417 
418  // Anode LCTs.
419  if (!alctV1a.empty()) {
420  LogTrace("L1CSCTrigger")
421  << "Put " << alctV1a.size() << " ME1a ALCT digi"
422  << ((alctV1a.size() > 1) ? "s " : " ") << "in collection\n";
423  oc_alct.put(std::make_pair(alctV1a.begin(),alctV1a.end()), detid1a);
424  }
425 
426  // Cathode LCTs.
427  if (!clctV1a.empty()) {
428  LogTrace("L1CSCTrigger")
429  << "Put " << clctV1a.size() << " ME1a CLCT digi"
430  << ((clctV1a.size() > 1) ? "s " : " ") << "in collection\n";
431  oc_clct.put(std::make_pair(clctV1a.begin(),clctV1a.end()), detid1a);
432  }
433 
434  // Cathode LCTs pretriggers
435  if (!preTriggerBXs1a.empty()) {
436  LogTrace("L1CSCTrigger")
437  << "Put " << preTriggerBXs.size() << " CLCT pretrigger"
438  << ((preTriggerBXs.size() > 1) ? "s " : " ") << "in collection\n";
439  oc_pretrig.put(std::make_pair(preTriggerBXs.begin(),preTriggerBXs.end()), detid);
440  }
441  }
442 
443  // running upgraded ME2/1 TMBs
444  else if (stat==2 && ring==1 && runME21ILT_)
445  {
446  CSCMotherboardME21GEM* tmb21GEM = static_cast<CSCMotherboardME21GEM*>(tmb);
447  tmb21GEM->setCSCGeometry(csc_g);
448  tmb21GEM->setGEMGeometry(gem_g);
449  tmb21GEM->run(wiredc, compdc, gemPads);
450  std::vector<CSCCorrelatedLCTDigi> lctV = tmb21GEM->readoutLCTs();
451  std::vector<CSCALCTDigi> alctV = tmb21GEM->alct->readoutALCTs();
452  std::vector<CSCCLCTDigi> clctV = tmb21GEM->clct->readoutCLCTs();
453  std::vector<int> preTriggerBXs = tmb21GEM->clct->preTriggerBXs();
454 
455  std::vector<GEMCoPadDigi> copads = tmb21GEM->coPadProcessor->readoutCoPads();
456 
457  if (!(alctV.empty() && clctV.empty() && lctV.empty())) {
458  LogTrace("L1CSCTrigger")
459  << "CSCTriggerPrimitivesBuilder got results in " <<detid;
460  }
461 
462  // Correlated LCTs.
463  if (!lctV.empty()) {
464  LogTrace("L1CSCTrigger")
465  << "Put " << lctV.size() << " LCT digi"
466  << ((lctV.size() > 1) ? "s " : " ") << "in collection\n";
467  oc_lct.put(std::make_pair(lctV.begin(),lctV.end()), detid);
468  }
469 
470  // Anode LCTs.
471  if (!alctV.empty()) {
472  LogTrace("L1CSCTrigger")
473  << "Put " << alctV.size() << " ALCT digi"
474  << ((alctV.size() > 1) ? "s " : " ") << "in collection\n";
475  oc_alct.put(std::make_pair(alctV.begin(),alctV.end()), detid);
476  }
477 
478  // Cathode LCTs.
479  if (!clctV.empty()) {
480  LogTrace("L1CSCTrigger")
481  << "Put " << clctV.size() << " CLCT digi"
482  << ((clctV.size() > 1) ? "s " : " ") << "in collection\n";
483  oc_clct.put(std::make_pair(clctV.begin(),clctV.end()), detid);
484  }
485 
486  // Cathode LCTs pretriggers
487  if (!preTriggerBXs.empty()) {
488  LogTrace("L1CSCTrigger")
489  << "Put " << preTriggerBXs.size() << " CLCT pretrigger"
490  << ((preTriggerBXs.size() > 1) ? "s " : " ") << "in collection\n";
491  oc_pretrig.put(std::make_pair(preTriggerBXs.begin(),preTriggerBXs.end()), detid);
492  }
493 
494  // 0th layer means whole chamber.
495  GEMDetId gemId(detid.zendcap(), 1, 2, 0, chid, 0);
496 
497  // GEM coincidence pads
498  if (!copads.empty()) {
499  LogTrace("L1CSCTrigger")
500  << "Put " << copads.size() << " GEM coincidence pad"
501  << ((copads.size() > 1) ? "s " : " ") << "in collection\n";
502  oc_gemcopad.put(std::make_pair(copads.begin(),copads.end()), gemId);
503  }
504  }
505  // running upgraded ME3/1-ME4/1 TMBs
506  else if ((stat==3 or stat==4) && ring==1 && runME3141ILT_)
507  {
508  CSCMotherboardME3141RPC* tmb3141RPC = static_cast<CSCMotherboardME3141RPC*>(tmb);
509  tmb3141RPC->setCSCGeometry(csc_g);
510  tmb3141RPC->setRPCGeometry(rpc_g);
511  tmb3141RPC->run(wiredc, compdc, rpcDigis);
512  std::vector<CSCCorrelatedLCTDigi> lctV = tmb3141RPC->readoutLCTs();
513  std::vector<CSCALCTDigi> alctV = tmb3141RPC->alct->readoutALCTs();
514  std::vector<CSCCLCTDigi> clctV = tmb3141RPC->clct->readoutCLCTs();
515  std::vector<int> preTriggerBXs = tmb3141RPC->clct->preTriggerBXs();
516 
517  if (!(alctV.empty() && clctV.empty() && lctV.empty())) {
518  LogTrace("L1CSCTrigger")
519  << "CSCTriggerPrimitivesBuilder got results in " <<detid;
520  }
521 
522  // Correlated LCTs.
523  if (!lctV.empty()) {
524  LogTrace("L1CSCTrigger")
525  << "Put " << lctV.size() << " LCT digi"
526  << ((lctV.size() > 1) ? "s " : " ") << "in collection\n";
527  oc_lct.put(std::make_pair(lctV.begin(),lctV.end()), detid);
528  }
529  // Anode LCTs.
530  if (!alctV.empty()) {
531  LogTrace("L1CSCTrigger")
532  << "Put " << alctV.size() << " ALCT digi"
533  << ((alctV.size() > 1) ? "s " : " ") << "in collection\n";
534  oc_alct.put(std::make_pair(alctV.begin(),alctV.end()), detid);
535  }
536 
537  // Cathode LCTs.
538  if (!clctV.empty()) {
539  LogTrace("L1CSCTrigger")
540  << "Put " << clctV.size() << " CLCT digi"
541  << ((clctV.size() > 1) ? "s " : " ") << "in collection\n";
542  oc_clct.put(std::make_pair(clctV.begin(),clctV.end()), detid);
543  }
544 
545  // Cathode LCTs pretriggers
546  if (!preTriggerBXs.empty()) {
547  LogTrace("L1CSCTrigger")
548  << "Put " << preTriggerBXs.size() << " CLCT pretrigger"
549  << ((preTriggerBXs.size() > 1) ? "s " : " ") << "in collection\n";
550  oc_pretrig.put(std::make_pair(preTriggerBXs.begin(),preTriggerBXs.end()), detid);
551  }
552  }
553 
554  // running non-upgraded TMB
555  else
556  {
557  tmb->run(wiredc,compdc);
558 
559  std::vector<CSCCorrelatedLCTDigi> lctV = tmb->readoutLCTs();
560  std::vector<CSCALCTDigi> alctV = tmb->alct->readoutALCTs();
561  std::vector<CSCCLCTDigi> clctV = tmb->clct->readoutCLCTs();
562  std::vector<int> preTriggerBXs = tmb->clct->preTriggerBXs();
563 
564  if (!(alctV.empty() && clctV.empty() && lctV.empty())) {
565  LogTrace("L1CSCTrigger")
566  << "CSCTriggerPrimitivesBuilder got results in " <<detid;
567  }
568 
569  /*
570  // tmp kludge: tightening of ME1a LCTs
571  if (stat==1 && ring==1) {
572  std::vector<CSCCorrelatedLCTDigi> lctV11;
573  for (unsigned t=0;t<lctV.size();t++){
574  if (lctV[t].getStrip() < 127) lctV11.push_back(lctV[t]);
575  else if (lctV[t].getQuality() >= 14) lctV11.push_back(lctV[t]);
576  }
577  lctV = lctV11;
578  }
579  */
580 
581  // Correlated LCTs.
582  if (!lctV.empty()) {
583  LogTrace("L1CSCTrigger")
584  << "Put " << lctV.size() << " LCT digi"
585  << ((lctV.size() > 1) ? "s " : " ") << "in collection\n";
586  oc_lct.put(std::make_pair(lctV.begin(),lctV.end()), detid);
587  }
588 
589  // Anode LCTs.
590  if (!alctV.empty()) {
591  LogTrace("L1CSCTrigger")
592  << "Put " << alctV.size() << " ALCT digi"
593  << ((alctV.size() > 1) ? "s " : " ") << "in collection\n";
594  oc_alct.put(std::make_pair(alctV.begin(),alctV.end()), detid);
595  }
596 
597  // Cathode LCTs.
598  if (!clctV.empty()) {
599  LogTrace("L1CSCTrigger")
600  << "Put " << clctV.size() << " CLCT digi"
601  << ((clctV.size() > 1) ? "s " : " ") << "in collection\n";
602  oc_clct.put(std::make_pair(clctV.begin(),clctV.end()), detid);
603  }
604 
605  // Cathode LCTs pretriggers
606  if (!preTriggerBXs.empty()) {
607  LogTrace("L1CSCTrigger")
608  << "Put " << preTriggerBXs.size() << " CLCT pretrigger"
609  << ((preTriggerBXs.size() > 1) ? "s " : " ") << "in collection\n";
610  oc_pretrig.put(std::make_pair(preTriggerBXs.begin(),preTriggerBXs.end()), detid);
611  }
612  } // non-upgraded TMB
613  }
614  }
615  }
616  }
617  }
618 
619  // run MPC simulation
620  m_muonportcard->loadDigis(oc_lct);
621 
622  // temporary hack to ensure that all MPC LCTs are read out
623  if (runOnData_) {
624  m_minBX = 5;
625  m_maxBX = 11;
626  }
627 
628  std::vector<csctf::TrackStub> result;
629  for(int bx = m_minBX; bx <= m_maxBX; ++bx)
630  for(int e = min_endcap; e <= max_endcap; ++e)
631  for(int st = min_station; st <= max_station; ++st)
632  for(int se = min_sector; se <= max_sector; ++se)
633  {
634  if(st == 1)
635  {
636  std::vector<csctf::TrackStub> subs1, subs2;
637  subs1 = m_muonportcard->sort(e, st, se, 1, bx);
638  subs2 = m_muonportcard->sort(e, st, se, 2, bx);
639  result.insert(result.end(), subs1.begin(), subs1.end());
640  result.insert(result.end(), subs2.begin(), subs2.end());
641  }
642  else
643  {
644  std::vector<csctf::TrackStub> sector;
645  sector = m_muonportcard->sort(e, st, se, 0, bx);
646  result.insert(result.end(), sector.begin(), sector.end());
647  }
648  }
649 
650  std::vector<csctf::TrackStub>::const_iterator itr = result.begin();
651  for (; itr != result.end(); itr++)
652  {
653  oc_sorted_lct.insertDigi(CSCDetId(itr->getDetId().rawId()), *(itr->getDigi()));
654  LogDebug("L1CSCTrigger")
655  << "MPC " << *(itr->getDigi()) << " found in ME"
656  << ((itr->endcap() == 1) ? "+" : "-") << itr->station() << "/"
657  << CSCDetId(itr->getDetId().rawId()).ring() << "/"
658  << CSCDetId(itr->getDetId().rawId()).chamber()
659  << " (sector " << itr->sector()
660  << " trig id. " << itr->cscid() << ")" << "\n";
661  }
662 }
#define LogDebug(id)
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::unique_ptr< GEMCoPadProcessor > coPadProcessor
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
std::unique_ptr< GEMCoPadProcessor > coPadProcessor
#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)
void setRPCGeometry(const RPCGeometry *g)
static int chamberFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station, int TriggerCSCID)
static int maxTriggerSubSectorId()
std::vector< CSCCorrelatedLCTDigi > readoutLCTs1a()