CMS 3D CMS Logo

PrimitiveSelection.cc
Go to the documentation of this file.
2 
3 #include "helper.h" // merge_map_into_map
4 
5 // 18 in ME1; 9x3 in ME2,3,4; 9 from neighbor sector.
6 // Arranged in FW as 6 stations, 9 chambers per station.
7 #define NUM_CSC_CHAMBERS 6 * 9
8 // 6x2 in RE1,2; 12x2 in RE3,4; 6 from neighbor sector.
9 // Arranged in FW as 7 stations, 6 chambers per station.
10 // For Phase 2, add RE1/3, RE2/3, RE3/1, RE4/1 -> 10 chambers per station
11 #define NUM_RPC_CHAMBERS 7 * 10
12 // 6 in GE1/1; 3 in GE2/1; 3 in ME0; 3 from neighbor sector. (unconfirmed!)
13 #define NUM_GEM_CHAMBERS 15
14 // 2x4 in MB1,2,3,4; 4 from neighbor sector. (unconfirmed!)
15 #define NUM_DT_CHAMBERS 3 * 4
16 
18  int endcap,
19  int sector,
20  int bx,
21  int bxShiftCSC,
22  int bxShiftRPC,
23  int bxShiftGEM,
24  int bxShiftME0,
25  bool includeNeighbor,
26  bool duplicateTheta,
27  bool bugME11Dupes) {
28  verbose_ = verbose;
29  endcap_ = endcap;
30  sector_ = sector;
31  bx_ = bx;
32 
33  bxShiftCSC_ = bxShiftCSC;
34  bxShiftRPC_ = bxShiftRPC;
35  bxShiftGEM_ = bxShiftGEM;
36  bxShiftME0_ = bxShiftME0;
37 
38  includeNeighbor_ = includeNeighbor;
39  duplicateTheta_ = duplicateTheta;
40  bugME11Dupes_ = bugME11Dupes;
41 }
42 
43 // _____________________________________________________________________________
44 // Specialized process() for CSC
45 template <>
47  const TriggerPrimitiveCollection& muon_primitives,
48  std::map<int, TriggerPrimitiveCollection>& selected_csc_map) const {
49  TriggerPrimitiveCollection::const_iterator tp_it = muon_primitives.begin();
50  TriggerPrimitiveCollection::const_iterator tp_end = muon_primitives.end();
51 
52  for (; tp_it != tp_end; ++tp_it) {
53  TriggerPrimitive new_tp = *tp_it; // make a copy and apply patches to this copy
54 
55  // Patch the CLCT pattern number
56  // It should be 0-10, see: L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc
57  bool patchPattern = true;
58  if (patchPattern && new_tp.subsystem() == TriggerPrimitive::kCSC) {
59  if (new_tp.getCSCData().pattern == 11 || new_tp.getCSCData().pattern == 12 || new_tp.getCSCData().pattern == 13 ||
60  new_tp.getCSCData().pattern == 14) { // 11, 12, 13, 14 -> 10
61  edm::LogWarning("L1T") << "EMTF patching corrupt CSC LCT pattern: changing " << new_tp.getCSCData().pattern
62  << " to 10";
63  new_tp.accessCSCData().pattern = 10;
64  }
65  }
66 
67  // Patch the LCT quality number
68  // It should be 1-15, see: L1Trigger/CSCTriggerPrimitives/src/CSCMotherboard.cc
69  bool patchQuality = true;
70  if (patchQuality && new_tp.subsystem() == TriggerPrimitive::kCSC) {
71  if (new_tp.getCSCData().quality == 0) { // 0 -> 1
72  edm::LogWarning("L1T") << "EMTF patching corrupt CSC LCT quality: changing " << new_tp.getCSCData().quality
73  << " to 1";
74  new_tp.accessCSCData().quality = 1;
75  }
76  }
77 
78  int selected_csc = select_csc(new_tp); // Returns CSC "link" index (0 - 53)
79 
80  if (selected_csc >= 0) {
81  emtf_assert(selected_csc < NUM_CSC_CHAMBERS);
82 
83  //FIXME
84  if (selected_csc_map[selected_csc].size() < 2) {
85  selected_csc_map[selected_csc].push_back(new_tp);
86  } else {
87  edm::LogWarning("L1T") << "\n******************* EMTF EMULATOR: SUPER-BIZZARE CASE *******************";
88  edm::LogWarning("L1T") << "Found 3 CSC trigger primitives in the same chamber";
89  for (int ii = 0; ii < 3; ii++) {
90  TriggerPrimitive tp_err = (ii < 2 ? selected_csc_map[selected_csc].at(ii) : new_tp);
91  edm::LogWarning("L1T") << "LCT #" << ii + 1 << ": BX " << tp_err.getBX() << ", endcap "
92  << tp_err.detId<CSCDetId>().endcap() << ", sector "
93  << tp_err.detId<CSCDetId>().triggerSector() << ", station "
94  << tp_err.detId<CSCDetId>().station() << ", ring " << tp_err.detId<CSCDetId>().ring()
95  << ", chamber " << tp_err.detId<CSCDetId>().chamber() << ", CSC ID "
96  << tp_err.getCSCData().cscID << ": strip " << tp_err.getStrip() << ", wire "
97  << tp_err.getWire();
98  }
99  edm::LogWarning("L1T") << "************************* ONLY KEEP FIRST TWO *************************\n\n";
100  }
101 
102  } // End conditional: if (selected_csc >= 0)
103  } // End loop: for (; tp_it != tp_end; ++tp_it)
104 
105  // Duplicate CSC muon primitives
106  // If there are 2 LCTs in the same chamber with (strip, wire) = (s1, w1) and (s2, w2)
107  // make all combinations with (s1, w1), (s2, w1), (s1, w2), (s2, w2)
108  if (duplicateTheta_) {
109  std::map<int, TriggerPrimitiveCollection>::iterator map_tp_it = selected_csc_map.begin();
110  std::map<int, TriggerPrimitiveCollection>::iterator map_tp_end = selected_csc_map.end();
111 
112  for (; map_tp_it != map_tp_end; ++map_tp_it) {
113  int selected = map_tp_it->first;
114  TriggerPrimitiveCollection& tmp_primitives = map_tp_it->second; // pass by reference
115 
116  if (tmp_primitives.size() >= 4) {
117  edm::LogWarning("L1T") << "EMTF found 4 or more CSC LCTs in one chamber: keeping only two";
118  tmp_primitives.erase(tmp_primitives.begin() + 4, tmp_primitives.end()); // erase 5th element++
119  tmp_primitives.erase(tmp_primitives.begin() + 2); // erase 3rd element
120  tmp_primitives.erase(tmp_primitives.begin() + 1); // erase 2nd element
121  } else if (tmp_primitives.size() == 3) {
122  edm::LogWarning("L1T") << "EMTF found 3 CSC LCTs in one chamber: keeping only two";
123  tmp_primitives.erase(tmp_primitives.begin() + 2); // erase 3rd element
124  }
125  emtf_assert(tmp_primitives.size() <= 2); // at most 2 hits
126 
127  if (tmp_primitives.size() == 2) {
128  if ((tmp_primitives.at(0).getStrip() != tmp_primitives.at(1).getStrip()) &&
129  (tmp_primitives.at(0).getWire() != tmp_primitives.at(1).getWire())) {
130  // Swap wire numbers
131  TriggerPrimitive tp0 = tmp_primitives.at(0); // (s1,w1)
132  TriggerPrimitive tp1 = tmp_primitives.at(1); // (s2,w2)
133  uint16_t tmp_keywire = tp0.accessCSCData().keywire;
134  tp0.accessCSCData().keywire = tp1.accessCSCData().keywire; // (s1,w2)
135  tp1.accessCSCData().keywire = tmp_keywire; // (s2,w1)
136 
137  tmp_primitives.insert(tmp_primitives.begin() + 1, tp1); // (s2,w1) at 2nd pos
138  tmp_primitives.insert(tmp_primitives.begin() + 2, tp0); // (s1,w2) at 3rd pos
139  }
140 
141  const bool is_csc_me11 = (0 <= selected && selected <= 2) || (9 <= selected && selected <= 11) ||
142  (selected == 45); // ME1/1 sub 1 or ME1/1 sub 2 or ME1/1 from neighbor
143 
144  if (bugME11Dupes_ && is_csc_me11) {
145  // For ME1/1, always make 4 LCTs without checking strip & wire combination
146  if (tmp_primitives.size() == 2) {
147  // Swap wire numbers
148  TriggerPrimitive tp0 = tmp_primitives.at(0); // (s1,w1)
149  TriggerPrimitive tp1 = tmp_primitives.at(1); // (s2,w2)
150  uint16_t tmp_keywire = tp0.accessCSCData().keywire;
151  tp0.accessCSCData().keywire = tp1.accessCSCData().keywire; // (s1,w2)
152  tp1.accessCSCData().keywire = tmp_keywire; // (s2,w1)
153 
154  tmp_primitives.insert(tmp_primitives.begin() + 1, tp1); // (s2,w1) at 2nd pos
155  tmp_primitives.insert(tmp_primitives.begin() + 2, tp0); // (s1,w2) at 3rd pos
156  }
157  emtf_assert(tmp_primitives.size() == 1 || tmp_primitives.size() == 4);
158  }
159 
160  } // end if tmp_primitives.size() == 2
161  } // end loop over selected_csc_map
162  } // end if duplicate theta
163 }
164 
165 // _____________________________________________________________________________
166 // Specialized process() for RPC
167 template <>
169  const TriggerPrimitiveCollection& muon_primitives,
170  std::map<int, TriggerPrimitiveCollection>& selected_rpc_map) const {
171  TriggerPrimitiveCollection::const_iterator tp_it = muon_primitives.begin();
172  TriggerPrimitiveCollection::const_iterator tp_end = muon_primitives.end();
173 
174  for (; tp_it != tp_end; ++tp_it) {
175  int selected_rpc = select_rpc(*tp_it); // Returns RPC "link" index
176 
177  if (selected_rpc >= 0) {
178  emtf_assert(selected_rpc < NUM_RPC_CHAMBERS);
179  selected_rpc_map[selected_rpc].push_back(*tp_it);
180  }
181  }
182 
183  // Apply truncation as in firmware: keep first 2 clusters, max cluster
184  // size = 3 strips.
185  // According to Karol Bunkowski, for one chamber (so 3 eta rolls) only up
186  // to 2 hits (cluster centres) are produced. First two 'first' clusters are
187  // chosen, and only after the cut on the cluster size is applied. So if
188  // there are 1 large cluster and 2 small clusters, it is possible that
189  // one of the two small clusters is discarded first, and the large cluster
190  // then is removed by the cluster size cut, leaving only one cluster.
191  // Note: this needs to be modified for Phase 2 with additional iRPC chambers.
192  bool apply_truncation = true;
193  if (apply_truncation) {
194  struct {
196  bool operator()(const value_type& x) const {
197  // Skip cluster size cut if primitives are from CPPF emulator or EMTF unpacker (already clustered)
198  if (x.getRPCData().isCPPF)
199  return false;
200 
201  int sz = x.getRPCData().strip_hi - x.getRPCData().strip_low + 1;
202 
203  const RPCDetId& tp_detId = x.detId<RPCDetId>();
204  int tp_station = tp_detId.station();
205  int tp_ring = tp_detId.ring();
206  const bool is_irpc = (tp_station == 3 || tp_station == 4) && (tp_ring == 1);
207  if (is_irpc)
208  return sz > 6; // iRPC strip pitch is 1.5 times smaller than traditional RPC
209  return sz > 3;
210  }
211  } cluster_size_cut;
212 
213  std::map<int, TriggerPrimitiveCollection>::iterator map_tp_it = selected_rpc_map.begin();
214  std::map<int, TriggerPrimitiveCollection>::iterator map_tp_end = selected_rpc_map.end();
215 
216  for (; map_tp_it != map_tp_end; ++map_tp_it) {
217  int selected = map_tp_it->first;
218  TriggerPrimitiveCollection& tmp_primitives = map_tp_it->second; // pass by reference
219 
220  //FIXME
221  // Check to see if unpacked CPPF digis have <= 2 digis per chamber, as expected
222  if (tmp_primitives.size() > 2 && tmp_primitives.at(0).getRPCData().isCPPF) {
223  edm::LogWarning("L1T") << "\n******************* EMTF EMULATOR: SUPER-BIZZARE CASE *******************";
224  edm::LogWarning("L1T") << "Found " << tmp_primitives.size() << " CPPF digis in the same chamber";
225  for (const auto& tp : tmp_primitives)
226  tp.print(std::cout);
227  edm::LogWarning("L1T") << "************************* ONLY KEEP FIRST TWO *************************\n\n";
228  }
229 
230  if ((selected % 10) == 8 || (selected % 10) == 9) { // RE3/1 or RE4/1 (iRPC)
231  // Keep the first 4 clusters
232  if (tmp_primitives.size() > 4)
233  tmp_primitives.erase(tmp_primitives.begin() + 4, tmp_primitives.end());
234  } else {
235  // Keep the first 2 clusters
236  if (tmp_primitives.size() > 2)
237  tmp_primitives.erase(tmp_primitives.begin() + 2, tmp_primitives.end());
238  }
239 
240  // Apply cluster size cut
241  tmp_primitives.erase(std::remove_if(tmp_primitives.begin(), tmp_primitives.end(), cluster_size_cut),
242  tmp_primitives.end());
243  }
244  } // end if apply_truncation
245 
246  // Map RPC subsector and chamber to CSC chambers
247  // Note: RE3/2 & RE3/3 are considered as one chamber; RE4/2 & RE4/3 too.
248  bool map_rpc_to_csc = true;
249  if (map_rpc_to_csc) {
250  std::map<int, TriggerPrimitiveCollection> tmp_selected_rpc_map;
251 
252  std::map<int, TriggerPrimitiveCollection>::iterator map_tp_it = selected_rpc_map.begin();
253  std::map<int, TriggerPrimitiveCollection>::iterator map_tp_end = selected_rpc_map.end();
254 
255  for (; map_tp_it != map_tp_end; ++map_tp_it) {
256  int selected = map_tp_it->first;
257  TriggerPrimitiveCollection& tmp_primitives = map_tp_it->second; // pass by reference
258 
259  int rpc_sub = selected / 10;
260  int rpc_chm = selected % 10;
261 
262  int pc_station = -1;
263  int pc_chamber = -1;
264 
265  if (rpc_sub != 6) { // native
266  if (rpc_chm == 0) { // RE1/2: 3-5, 12-14
267  if (0 <= rpc_sub && rpc_sub < 3) {
268  pc_station = 0;
269  pc_chamber = 3 + rpc_sub;
270  } else if (3 <= rpc_sub && rpc_sub < 6) {
271  pc_station = 1;
272  pc_chamber = 3 + (rpc_sub - 3);
273  }
274  } else if (rpc_chm == 6) { // RE1/3: 6-8, 15-17
275  if (0 <= rpc_sub && rpc_sub < 3) {
276  pc_station = 0;
277  pc_chamber = 6 + rpc_sub;
278  } else if (3 <= rpc_sub && rpc_sub < 6) {
279  pc_station = 1;
280  pc_chamber = 6 + (rpc_sub - 3);
281  }
282  } else if (rpc_chm == 1 || rpc_chm == 7) { // RE2/2, RE2/3: 21-26
283  pc_station = 2;
284  pc_chamber = 3 + rpc_sub;
285  } else if (2 <= rpc_chm && rpc_chm <= 3) { // RE3/2, RE3/3: 30-35
286  pc_station = 3;
287  pc_chamber = 3 + rpc_sub;
288  } else if (4 <= rpc_chm && rpc_chm <= 5) { // RE4/2, RE4/3: 39-44
289  pc_station = 4;
290  pc_chamber = 3 + rpc_sub;
291  } else if (rpc_chm == 8) { // RE3/1: 27-29
292  pc_station = 3;
293  pc_chamber = rpc_sub;
294  } else if (rpc_chm == 9) { // RE4/1: 36-38
295  pc_station = 4;
296  pc_chamber = rpc_sub;
297  }
298 
299  } else { // neighbor
300  pc_station = 5;
301  if (rpc_chm == 0) { // RE1/2: 46
302  pc_chamber = 1;
303  } else if (rpc_chm == 6) { // RE1/3: 47
304  pc_chamber = 2;
305  } else if (rpc_chm == 1 || rpc_chm == 7) { // RE2/2, RE2/3: 49
306  pc_chamber = 4;
307  } else if (2 <= rpc_chm && rpc_chm <= 3) { // RE3/2, RE3/3: 51
308  pc_chamber = 6;
309  } else if (4 <= rpc_chm && rpc_chm <= 5) { // RE4/2, RE4/3: 53
310  pc_chamber = 8;
311  } else if (rpc_chm == 8) { // RE3/1: 50
312  pc_chamber = 5;
313  } else if (rpc_chm == 9) { // RE4/1: 52
314  pc_chamber = 7;
315  }
316  }
317  emtf_assert(pc_station != -1 && pc_chamber != -1);
318  emtf_assert(pc_station < 6 && pc_chamber < 9);
319 
320  selected = (pc_station * 9) + pc_chamber;
321 
322  bool ignore_this_rpc_chm = false;
323  if (rpc_chm == 3 || rpc_chm == 5) { // special case of RE3,4/2 and RE3,4/3 chambers
324  // if RE3,4/2 exists, ignore RE3,4/3. In C++, this assumes that the loop
325  // over selected_rpc_map will always find RE3,4/2 before RE3,4/3
326  if (tmp_selected_rpc_map.find(selected) != tmp_selected_rpc_map.end())
327  ignore_this_rpc_chm = true;
328  }
329 
330  if (rpc_chm == 6 || rpc_chm == 7) { // RE1/3 and RE2/3 chambers are not part of EMTF
331  ignore_this_rpc_chm = true;
332  }
333 
334  if (rpc_chm == 8 || rpc_chm == 9) { // RE3/1 and RE4/1 chambers are not available until Phase-2
335  ignore_this_rpc_chm = true;
336  }
337 
338  if (ignore_this_rpc_chm) {
339  // Set RPC stubs as invalid, but we keep them
340  for (auto&& tp : tmp_primitives) {
341  tp.accessRPCData().valid = 0;
342  }
343  }
344 
345  // Keep the stubs in the temporary map
346  if (tmp_selected_rpc_map.find(selected) == tmp_selected_rpc_map.end()) {
347  tmp_selected_rpc_map[selected] = tmp_primitives;
348  } else {
349  tmp_selected_rpc_map[selected].insert(
350  tmp_selected_rpc_map[selected].end(), tmp_primitives.begin(), tmp_primitives.end());
351  }
352  } // end loop over selected_rpc_map
353 
354  std::swap(selected_rpc_map, tmp_selected_rpc_map); // replace the original map
355  } // end if map_rpc_to_csc
356 }
357 
358 // _____________________________________________________________________________
359 // Specialized process() for GEM
360 template <>
362  const TriggerPrimitiveCollection& muon_primitives,
363  std::map<int, TriggerPrimitiveCollection>& selected_gem_map) const {
364  TriggerPrimitiveCollection::const_iterator tp_it = muon_primitives.begin();
365  TriggerPrimitiveCollection::const_iterator tp_end = muon_primitives.end();
366 
367  for (; tp_it != tp_end; ++tp_it) {
368  int selected_gem = select_gem(*tp_it); // Returns GEM "link" index
369 
370  if (selected_gem >= 0) {
371  emtf_assert(selected_gem < NUM_GEM_CHAMBERS);
372  selected_gem_map[selected_gem].push_back(*tp_it);
373  }
374  }
375 
376  // Apply truncation: max cluster size = 8 pads, keep first 8 clusters.
377  bool apply_truncation = true;
378  if (apply_truncation) {
379  struct {
381  bool operator()(const value_type& x) const {
382  int sz = x.getGEMData().pad_hi - x.getGEMData().pad_low + 1;
383  return sz > 8;
384  }
385  } cluster_size_cut;
386 
387  std::map<int, TriggerPrimitiveCollection>::iterator map_tp_it = selected_gem_map.begin();
388  std::map<int, TriggerPrimitiveCollection>::iterator map_tp_end = selected_gem_map.end();
389 
390  for (; map_tp_it != map_tp_end; ++map_tp_it) {
391  //int selected = map_tp_it->first;
392  TriggerPrimitiveCollection& tmp_primitives = map_tp_it->second; // pass by reference
393 
394  // Apply cluster size cut
395  tmp_primitives.erase(std::remove_if(tmp_primitives.begin(), tmp_primitives.end(), cluster_size_cut),
396  tmp_primitives.end());
397 
398  // Keep the first 8 clusters
399  if (tmp_primitives.size() > 8)
400  tmp_primitives.erase(tmp_primitives.begin() + 8, tmp_primitives.end());
401  }
402  } // end if apply_truncation
403 }
404 
405 // _____________________________________________________________________________
406 // Specialized process() for ME0
407 template <>
409  const TriggerPrimitiveCollection& muon_primitives,
410  std::map<int, TriggerPrimitiveCollection>& selected_me0_map) const {
411  TriggerPrimitiveCollection::const_iterator tp_it = muon_primitives.begin();
412  TriggerPrimitiveCollection::const_iterator tp_end = muon_primitives.end();
413 
414  for (; tp_it != tp_end; ++tp_it) {
415  int selected_me0 = select_me0(*tp_it); // Returns ME0 "link" index
416 
417  if (selected_me0 >= 0) {
418  emtf_assert(selected_me0 < NUM_GEM_CHAMBERS);
419  selected_me0_map[selected_me0].push_back(*tp_it);
420  }
421  }
422 
423  // Apply truncation
424  bool apply_truncation = true;
425  if (apply_truncation) {
426  std::map<int, TriggerPrimitiveCollection>::iterator map_tp_it = selected_me0_map.begin();
427  std::map<int, TriggerPrimitiveCollection>::iterator map_tp_end = selected_me0_map.end();
428 
429  for (; map_tp_it != map_tp_end; ++map_tp_it) {
430  //int selected = map_tp_it->first;
431  TriggerPrimitiveCollection& tmp_primitives = map_tp_it->second; // pass by reference
432 
433  // Keep the first 20 clusters
434  if (tmp_primitives.size() > 20)
435  tmp_primitives.erase(tmp_primitives.begin() + 20, tmp_primitives.end());
436  }
437  }
438 }
439 
440 // _____________________________________________________________________________
441 // Specialized process() for DT
442 template <>
444  const TriggerPrimitiveCollection& muon_primitives,
445  std::map<int, TriggerPrimitiveCollection>& selected_dt_map) const {
446  TriggerPrimitiveCollection::const_iterator tp_it = muon_primitives.begin();
447  TriggerPrimitiveCollection::const_iterator tp_end = muon_primitives.end();
448 
449  for (; tp_it != tp_end; ++tp_it) {
450  int selected_dt = select_dt(*tp_it); // Returns DT "link" index
451 
452  if (selected_dt >= 0) {
453  emtf_assert(selected_dt < NUM_DT_CHAMBERS);
454  selected_dt_map[selected_dt].push_back(*tp_it);
455  }
456  }
457 
458  // Duplicate DT muon primitives
459  if (duplicateTheta_) {
460  std::map<int, TriggerPrimitiveCollection>::iterator map_tp_it = selected_dt_map.begin();
461  std::map<int, TriggerPrimitiveCollection>::iterator map_tp_end = selected_dt_map.end();
462 
463  for (; map_tp_it != map_tp_end; ++map_tp_it) {
464  //int selected = map_tp_it->first;
465  TriggerPrimitiveCollection& tmp_primitives = map_tp_it->second; // pass by reference
466 
467  emtf_assert(tmp_primitives.size() <= 2); // at most 2 hits
468 
469  if (tmp_primitives.size() == 2) {
470  if ((tmp_primitives.at(0).getStrip() != tmp_primitives.at(1).getStrip()) &&
471  (tmp_primitives.at(0).getWire() != tmp_primitives.at(1).getWire())) {
472  // Swap wire numbers
473  TriggerPrimitive tp0 = tmp_primitives.at(0); // (s1,w1)
474  TriggerPrimitive tp1 = tmp_primitives.at(1); // (s2,w2)
475  uint16_t tmp_keywire = tp0.accessDTData().theta_bti_group;
476  tp0.accessDTData().theta_bti_group = tp1.accessDTData().theta_bti_group; // (s1,w2)
477  tp1.accessDTData().theta_bti_group = tmp_keywire; // (s2,w1)
478 
479  tmp_primitives.insert(tmp_primitives.begin() + 1, tp1); // (s2,w1) at 2nd pos
480  tmp_primitives.insert(tmp_primitives.begin() + 2, tp0); // (s1,w2) at 3rd pos
481  }
482  } // end if tmp_primitives.size() == 2
483  } // end loop over selected_dt_map
484  } // end if duplicate theta
485 }
486 
487 // _____________________________________________________________________________
488 // Put the hits from DT, CSC, RPC, GEM, ME0 together in one collection
489 
490 // Notes from Alex (2017-03-28):
491 //
492 // The RPC inclusion logic is very simple currently:
493 // - each CSC is analyzed for having track stubs in each BX
494 // - IF a CSC chamber is missing at least one track stub,
495 // AND there is an RPC overlapping with it in phi and theta,
496 // AND that RPC has hits,
497 // THEN RPC hit is inserted instead of missing CSC stub.
498 //
499 // This is done at the output of coord_delay module, so such
500 // inserted RPC hits can be matched to patterns by match_ph_segments
501 // module, just like any CSC stubs. Note that substitution of missing
502 // CSC stubs with RPC hits happens regardless of what's going on in
503 // other chambers, regardless of whether a pattern has been detected
504 // or not, basically regardless of anything. RPCs are treated as a
505 // supplemental source of stubs for CSCs.
506 
507 void PrimitiveSelection::merge(const std::map<int, TriggerPrimitiveCollection>& selected_dt_map,
508  const std::map<int, TriggerPrimitiveCollection>& selected_csc_map,
509  const std::map<int, TriggerPrimitiveCollection>& selected_rpc_map,
510  const std::map<int, TriggerPrimitiveCollection>& selected_gem_map,
511  const std::map<int, TriggerPrimitiveCollection>& selected_me0_map,
512  std::map<int, TriggerPrimitiveCollection>& selected_prim_map) const {
513  // First, put CSC hits
514  std::map<int, TriggerPrimitiveCollection>::const_iterator map_tp_it = selected_csc_map.begin();
515  std::map<int, TriggerPrimitiveCollection>::const_iterator map_tp_end = selected_csc_map.end();
516 
517  for (; map_tp_it != map_tp_end; ++map_tp_it) {
518  int selected_csc = map_tp_it->first;
519  const TriggerPrimitiveCollection& csc_primitives = map_tp_it->second;
520  emtf_assert(csc_primitives.size() <= 4); // at most 4 hits, including duplicated hits
521 
522  // Insert all CSC hits
523  selected_prim_map[selected_csc] = csc_primitives;
524  }
525 
526  // Second, insert GEM stubs if there is no CSC hits
527  map_tp_it = selected_gem_map.begin();
528  map_tp_end = selected_gem_map.end();
529 
530  for (; map_tp_it != map_tp_end; ++map_tp_it) {
531  int selected_gem = map_tp_it->first;
532  const TriggerPrimitiveCollection& gem_primitives = map_tp_it->second;
533  if (gem_primitives.empty())
534  continue;
535  emtf_assert(gem_primitives.size() <= 8); // at most 8 hits
536 
537  bool found = (selected_prim_map.find(selected_gem) != selected_prim_map.end());
538  if (!found) {
539  // No CSC hits, insert all GEM hits
540  selected_prim_map[selected_gem] = gem_primitives;
541 
542  } else {
543  // Do nothing
544  }
545  }
546 
547  // Third, insert RPC stubs if there is no CSC/GEM hits
548  map_tp_it = selected_rpc_map.begin();
549  map_tp_end = selected_rpc_map.end();
550 
551  for (; map_tp_it != map_tp_end; ++map_tp_it) {
552  int selected_rpc = map_tp_it->first;
553  const TriggerPrimitiveCollection& rpc_primitives = map_tp_it->second;
554  if (rpc_primitives.empty())
555  continue;
556  emtf_assert(rpc_primitives.size() <= 4); // at most 4 hits
557 
558  bool found = (selected_prim_map.find(selected_rpc) != selected_prim_map.end());
559  if (!found) {
560  // No CSC/GEM hits, insert all RPC hits
561  //selected_prim_map[selected_rpc] = rpc_primitives;
562 
563  // No CSC/GEM hits, insert the valid RPC hits
564  TriggerPrimitiveCollection tmp_rpc_primitives;
565  for (const auto& tp : rpc_primitives) {
566  if (tp.getRPCData().valid != 0) {
567  tmp_rpc_primitives.push_back(tp);
568  }
569  }
570  emtf_assert(tmp_rpc_primitives.size() <= 2); // at most 2 hits
571 
572  selected_prim_map[selected_rpc] = tmp_rpc_primitives;
573 
574  } else {
575  // Initial FW in 2017; was disabled on June 7.
576  // If only one CSC/GEM hit, insert the first RPC hit
577  //TriggerPrimitiveCollection& tmp_primitives = selected_prim_map[selected_rpc]; // pass by reference
578 
579  //if (tmp_primitives.size() < 2) {
580  // tmp_primitives.push_back(rpc_primitives.front());
581  //}
582  }
583  }
584 }
585 
586 void PrimitiveSelection::merge_no_truncate(const std::map<int, TriggerPrimitiveCollection>& selected_dt_map,
587  const std::map<int, TriggerPrimitiveCollection>& selected_csc_map,
588  const std::map<int, TriggerPrimitiveCollection>& selected_rpc_map,
589  const std::map<int, TriggerPrimitiveCollection>& selected_gem_map,
590  const std::map<int, TriggerPrimitiveCollection>& selected_me0_map,
591  std::map<int, TriggerPrimitiveCollection>& selected_prim_map) const {
592  // First, put CSC hits
593  merge_map_into_map(selected_csc_map, selected_prim_map);
594 
595  // Second, insert ME0 hits
596  merge_map_into_map(selected_me0_map, selected_prim_map);
597 
598  // Third, insert GEM hits
599  merge_map_into_map(selected_gem_map, selected_prim_map);
600 
601  // Fourth, insert RPC hits
602  merge_map_into_map(selected_rpc_map, selected_prim_map);
603 
604  // Fifth, insert DT hits
605  merge_map_into_map(selected_dt_map, selected_prim_map);
606 }
607 
608 // _____________________________________________________________________________
609 // CSC functions
610 int PrimitiveSelection::select_csc(const TriggerPrimitive& muon_primitive) const {
611  int selected = -1;
612 
613  if (muon_primitive.subsystem() == TriggerPrimitive::kCSC) {
614  const CSCDetId& tp_detId = muon_primitive.detId<CSCDetId>();
615  const CSCData& tp_data = muon_primitive.getCSCData();
616 
617  int tp_endcap = tp_detId.endcap();
618  int tp_sector = tp_detId.triggerSector();
619  int tp_station = tp_detId.station();
620  int tp_ring = tp_detId.ring();
621  int tp_chamber = tp_detId.chamber();
622 
623  int tp_bx = tp_data.bx;
624  int tp_csc_ID = tp_data.cscID;
625 
626  int max_strip = 0; // halfstrip
627  int max_wire = 0; // wiregroup
628  emtf::get_csc_max_strip_and_wire(tp_station, tp_ring, max_strip, max_wire);
629 
630  if (endcap_ == 1 && sector_ == 1 && bx_ == -3) { // do assertion checks only once
631  emtf_assert(emtf::MIN_ENDCAP <= tp_endcap && tp_endcap <= emtf::MAX_ENDCAP);
632  emtf_assert(emtf::MIN_TRIGSECTOR <= tp_sector && tp_sector <= emtf::MAX_TRIGSECTOR);
633  emtf_assert(1 <= tp_station && tp_station <= 4);
634  emtf_assert(1 <= tp_csc_ID && tp_csc_ID <= 9);
635  emtf_assert(tp_data.strip < max_strip);
636  emtf_assert(tp_data.keywire < max_wire);
637  emtf_assert(tp_data.valid == true);
638  emtf_assert(tp_data.pattern <= 10);
639  //emtf_assert(tp_data.quality > 0);
640  }
641 
642  // LogWarning
643  if (!(tp_data.strip < max_strip)) {
644  edm::LogWarning("L1T") << "EMTF CSC format error in station " << tp_station << ", ring " << tp_ring
645  << ": tp_data.strip = " << tp_data.strip << " (max = " << max_strip - 1 << ")";
646  return selected;
647  }
648  if (!(tp_data.keywire < max_wire)) {
649  edm::LogWarning("L1T") << "EMTF CSC format error in station " << tp_station << ", ring " << tp_ring
650  << ": tp_data.keywire = " << tp_data.keywire << " (max = " << max_wire - 1 << ")";
651  return selected;
652  }
653 
654  // station 1 --> subsector 1 or 2
655  // station 2,3,4 --> subsector 0
656  int tp_subsector = (tp_station != 1) ? 0 : ((tp_chamber % 6 > 2) ? 1 : 2);
657 
658  // Check if the chamber belongs to this sector processor at this BX.
659  selected = get_index_csc(tp_endcap, tp_sector, tp_subsector, tp_station, tp_csc_ID, tp_bx);
660  }
661  return selected;
662 }
663 
664 bool PrimitiveSelection::is_in_sector_csc(int tp_endcap, int tp_sector) const {
665  return ((endcap_ == tp_endcap) && (sector_ == tp_sector));
666 }
667 
669  int tp_endcap, int tp_sector, int tp_subsector, int tp_station, int tp_csc_ID) const {
670  auto get_neighbor = [](int sector) { return (sector == 1) ? 6 : sector - 1; };
671 
672  if (includeNeighbor_) {
673  if ((endcap_ == tp_endcap) && (get_neighbor(sector_) == tp_sector)) {
674  if (tp_station == 1) {
675  if ((tp_subsector == 2) && (tp_csc_ID == 3 || tp_csc_ID == 6 || tp_csc_ID == 9))
676  return true;
677 
678  } else {
679  if (tp_csc_ID == 3 || tp_csc_ID == 9)
680  return true;
681  }
682  }
683  }
684  return false;
685 }
686 
687 bool PrimitiveSelection::is_in_bx_csc(int tp_bx) const {
688  tp_bx += bxShiftCSC_;
689  return (bx_ == tp_bx);
690 }
691 
692 // Returns CSC input "link". Index used by FW for unique chamber identification.
694  int tp_endcap, int tp_sector, int tp_subsector, int tp_station, int tp_csc_ID, int tp_bx) const {
695  int selected = -1;
696 
697  bool is_native = false;
698  bool is_neighbor = false;
699  if (is_in_bx_csc(tp_bx)) {
700  if (is_in_sector_csc(tp_endcap, tp_sector)) {
701  is_native = true;
702  } else if (is_in_neighbor_sector_csc(tp_endcap, tp_sector, tp_subsector, tp_station, tp_csc_ID)) {
703  is_neighbor = true;
704  }
705  }
706  if (!is_native && !is_neighbor)
707  return selected;
708 
709  if (!is_neighbor) {
710  if (tp_station == 1) { // ME1: 0 - 8, 9 - 17
711  selected = (tp_subsector - 1) * 9 + (tp_csc_ID - 1);
712  } else { // ME2,3,4: 18 - 26, 27 - 35, 36 - 44
713  selected = (tp_station)*9 + (tp_csc_ID - 1);
714  }
715 
716  } else {
717  if (tp_station == 1) { // ME1n: 45 - 47
718  selected = (5) * 9 + (tp_csc_ID - 1) / 3;
719  } else { // ME2n,3n,4n: 48 - 53
720  selected = (5) * 9 + (tp_station)*2 - 1 + (tp_csc_ID - 1 < 3 ? 0 : 1);
721  }
722  }
723  emtf_assert(selected != -1);
724  return selected;
725 }
726 
727 // _____________________________________________________________________________
728 // RPC functions
729 int PrimitiveSelection::select_rpc(const TriggerPrimitive& muon_primitive) const {
730  int selected = -1;
731 
732  if (muon_primitive.subsystem() == TriggerPrimitive::kRPC) {
733  const RPCDetId& tp_detId = muon_primitive.detId<RPCDetId>();
734  const RPCData& tp_data = muon_primitive.getRPCData();
735 
736  int tp_region = tp_detId.region(); // 0 for Barrel, +/-1 for +/- Endcap
737  int tp_endcap = (tp_region == -1) ? 2 : tp_region;
738  int tp_sector = tp_detId.sector(); // 1 - 6 (60 degrees in phi, sector 1 begins at -5 deg)
739  int tp_subsector = tp_detId.subsector(); // 1 - 6 (10 degrees in phi; staggered in z)
740  int tp_station = tp_detId.station(); // 1 - 4
741  int tp_ring = tp_detId.ring(); // 2 - 3 (increasing theta)
742  int tp_roll = tp_detId.roll(); // 1 - 3 (decreasing theta; aka A - C; space between rolls is 9 - 15 in theta_fp)
743  //int tp_layer = tp_detId.layer();
744 
745  int tp_bx = tp_data.bx;
746  int tp_strip = tp_data.strip;
747  int tp_emtf_sect = tp_data.emtf_sector;
748  bool tp_CPPF = tp_data.isCPPF;
749 
750  // In neighbor chambers, have two separate CPPFDigis for the two EMTF sectors
751  if (tp_CPPF && (tp_emtf_sect != sector_))
752  return selected;
753 
754  const bool is_irpc = (tp_station == 3 || tp_station == 4) && (tp_ring == 1);
755 
756  if (endcap_ == 1 && sector_ == 1 && bx_ == -3) { // do assertion checks only once
757  emtf_assert(tp_region != 0);
758  emtf_assert(emtf::MIN_ENDCAP <= tp_endcap && tp_endcap <= emtf::MAX_ENDCAP);
759  emtf_assert(emtf::MIN_TRIGSECTOR <= tp_sector && tp_sector <= emtf::MAX_TRIGSECTOR);
760  emtf_assert(1 <= tp_subsector && tp_subsector <= 6);
761  emtf_assert(1 <= tp_station && tp_station <= 4);
762  emtf_assert((!is_irpc && 2 <= tp_ring && tp_ring <= 3) || (is_irpc && tp_ring == 1));
763  emtf_assert((!is_irpc && 1 <= tp_roll && tp_roll <= 3) || (is_irpc && 1 <= tp_roll && tp_roll <= 5));
764  //emtf_assert((!is_irpc && (tp_CPPF || (1 <= tp_strip && tp_strip <= 32))) || (is_irpc && 1 <= tp_strip && tp_strip <= 96));
765  emtf_assert((!is_irpc && (tp_CPPF || (1 <= tp_strip && tp_strip <= 32))) ||
766  (is_irpc && 1 <= tp_strip && tp_strip <= 96 * 2)); // in CMSSW, the iRPC chamber has 192 strips
767  //emtf_assert(tp_station > 2 || tp_ring != 3); // stations 1 and 2 do not receive RPCs from ring 3
768  emtf_assert(tp_data.valid == true);
769  }
770 
771  // Check if the chamber belongs to this sector processor at this BX.
772  selected = get_index_rpc(tp_endcap, tp_station, tp_ring, tp_sector, tp_subsector, tp_bx);
773  }
774  return selected;
775 }
776 
778  int tp_endcap, int tp_station, int tp_ring, int tp_sector, int tp_subsector) const {
779  // RPC sector X, subsectors 1-2 correspond to CSC sector X-1
780  // RPC sector X, subsectors 3-6 correspond to CSC sector X
781  // iRPC sector X, subsectors 1 correspond to CSC sector X-1
782  // iRPC sector X, subsectors 2-3 correspind to CSC sector X
783  auto get_csc_sector = [](int tp_station, int tp_ring, int tp_sector, int tp_subsector) {
784  const bool is_irpc = (tp_station == 3 || tp_station == 4) && (tp_ring == 1);
785  if (is_irpc) {
786  // 20 degree chamber
787  int corr = (tp_subsector < 2) ? (tp_sector == 1 ? +5 : -1) : 0;
788  return tp_sector + corr;
789  } else {
790  // 10 degree chamber
791  int corr = (tp_subsector < 3) ? (tp_sector == 1 ? +5 : -1) : 0;
792  return tp_sector + corr;
793  }
794  };
795  return ((endcap_ == tp_endcap) && (sector_ == get_csc_sector(tp_station, tp_ring, tp_sector, tp_subsector)));
796 }
797 
799  int tp_endcap, int tp_station, int tp_ring, int tp_sector, int tp_subsector) const {
800  auto get_neighbor_subsector = [](int tp_station, int tp_ring) {
801  const bool is_irpc = (tp_station == 3 || tp_station == 4) && (tp_ring == 1);
802  if (is_irpc) {
803  // 20 degree chamber
804  return 1;
805  } else {
806  // 10 degree chamber
807  return 2;
808  }
809  };
810  return (includeNeighbor_ && (endcap_ == tp_endcap) && (sector_ == tp_sector) &&
811  (tp_subsector == get_neighbor_subsector(tp_station, tp_ring)));
812 }
813 
814 bool PrimitiveSelection::is_in_bx_rpc(int tp_bx) const {
815  tp_bx += bxShiftRPC_;
816  return (bx_ == tp_bx);
817 }
818 
820  int tp_endcap, int tp_station, int tp_ring, int tp_sector, int tp_subsector, int tp_bx) const {
821  int selected = -1;
822 
823  bool is_native = false;
824  bool is_neighbor = false;
825  if (is_in_bx_rpc(tp_bx)) {
826  if (is_in_sector_rpc(tp_endcap, tp_station, tp_ring, tp_sector, tp_subsector)) {
827  is_native = true;
828  } else if (is_in_neighbor_sector_rpc(tp_endcap, tp_station, tp_ring, tp_sector, tp_subsector)) {
829  is_neighbor = true;
830  }
831  }
832  if (!is_native && !is_neighbor)
833  return selected;
834 
835  // CPPF RX data come in 3 frames x 64 bits, for 7 links. Each 64-bit data
836  // carry 2 words of 32 bits. Each word carries phi (11 bits) and theta (5 bits)
837  // of 2 segments (x2).
838  //
839  // Firmware uses 'rpc_sub' as RPC subsector index and 'rpc_chm' as RPC chamber index
840  // rpc_sub [0,6] = RPC subsector 3, 4, 5, 6, 1 from neighbor, 2 from neighbor, 2. They correspond to
841  // CSC sector phi 0-10 deg, 10-20, 20-30, 30-40, 40-50, 50-60, 50-60 from neighbor
842  // rpc_chm [0,5] = RPC chamber RE1/2, RE2/2, RE3/2, RE3/3, RE4/2, RE4/3
843  // For Phase 2, add RE1/3, RE2/3, RE3/1, RE4/1 -> rpc_chm [0,9]
844  //
845  int rpc_sub = -1;
846  int rpc_chm = -1;
847 
848  const bool is_irpc = (tp_station == 3 || tp_station == 4) && (tp_ring == 1);
849 
850  if (!is_neighbor) {
851  if (!is_irpc) {
852  rpc_sub = ((tp_subsector + 3) % 6);
853  } else {
854  rpc_sub = ((tp_subsector + 1) % 3);
855  }
856  } else {
857  rpc_sub = 6;
858  }
859 
860  if (tp_station <= 2 && tp_ring == 2) { // RE1/2, RE2/2
861  rpc_chm = (tp_station - 1);
862  } else if (tp_station >= 3 && tp_ring >= 2) { // RE3/2, RE3/3, RE4/2, RE4/3
863  rpc_chm = 2 + (tp_station - 3) * 2 + (tp_ring - 2);
864  } else if (tp_station <= 2 && tp_ring == 3) { // RE1/3, RE2/3
865  rpc_chm = 6 + (tp_station - 1);
866  } else if (tp_station >= 3 && tp_ring == 1) { // RE3/1, RE4/1
867  rpc_chm = 8 + (tp_station - 3);
868  }
869 
870  selected = (rpc_sub * 10) + rpc_chm;
871  emtf_assert(selected != -1);
872  return selected;
873 }
874 
875 // _____________________________________________________________________________
876 // GEM functions
877 //
878 // According to what I know at the moment
879 // - GE1/1: 10 degree chamber, 8 rolls, 384 strips = 192 pads
880 // - GE2/1: 20 degree chamber, 8 rolls, 768 strips = 384 pads
881 int PrimitiveSelection::select_gem(const TriggerPrimitive& muon_primitive) const {
882  int selected = -1;
883 
884  if (muon_primitive.subsystem() == TriggerPrimitive::kGEM) {
885  const GEMDetId& tp_detId = muon_primitive.detId<GEMDetId>();
886  const GEMData& tp_data = muon_primitive.getGEMData();
887 
888  int tp_region = tp_detId.region(); // 0 for Barrel, +/-1 for +/- Endcap
889  int tp_endcap = (tp_region == -1) ? 2 : tp_region;
890  int tp_station = tp_detId.station();
891  int tp_ring = tp_detId.ring();
892  int tp_roll = tp_detId.roll();
893  int tp_layer = tp_detId.layer();
894  int tp_chamber = tp_detId.chamber();
895 
896  int tp_bx = tp_data.bx;
897  int tp_pad = ((tp_data.pad_low + tp_data.pad_hi) / 2);
898 
899  int tp_sector = emtf::get_trigger_sector(tp_ring, tp_station, tp_chamber);
900  int tp_csc_ID = emtf::get_trigger_csc_ID(tp_ring, tp_station, tp_chamber);
901 
902  // station 1 --> subsector 1 or 2
903  // station 2,3,4 --> subsector 0
904  int tp_subsector = (tp_station != 1) ? 0 : ((tp_chamber % 6 > 2) ? 1 : 2);
905 
906  if (endcap_ == 1 && sector_ == 1 && bx_ == -3) { // do assertion checks only once
907  emtf_assert(tp_region != 0);
908  emtf_assert(emtf::MIN_ENDCAP <= tp_endcap && tp_endcap <= emtf::MAX_ENDCAP);
909  emtf_assert(emtf::MIN_TRIGSECTOR <= tp_sector && tp_sector <= emtf::MAX_TRIGSECTOR);
910  emtf_assert(1 <= tp_station && tp_station <= 2);
911  emtf_assert(tp_ring == 1);
912  emtf_assert(1 <= tp_roll && tp_roll <= 8);
913  emtf_assert(1 <= tp_layer && tp_layer <= 2);
914  emtf_assert(1 <= tp_csc_ID && tp_csc_ID <= 3);
915  emtf_assert((tp_station == 1 && 0 <= tp_pad && tp_pad <= 191) || (tp_station != 1));
916  emtf_assert((tp_station == 2 && 0 <= tp_pad && tp_pad <= 383) || (tp_station != 2));
917  }
918 
919  // Check if the chamber belongs to this sector processor at this BX.
920  selected = get_index_gem(tp_endcap, tp_sector, tp_subsector, tp_station, tp_csc_ID, tp_bx);
921  }
922  return selected;
923 }
924 
925 bool PrimitiveSelection::is_in_sector_gem(int tp_endcap, int tp_sector) const {
926  // Identical to the corresponding CSC function
927  return is_in_sector_csc(tp_endcap, tp_sector);
928 }
929 
931  int tp_endcap, int tp_sector, int tp_subsector, int tp_station, int tp_csc_ID) const {
932  // Identical to the corresponding CSC function
933  return is_in_neighbor_sector_csc(tp_endcap, tp_sector, tp_subsector, tp_station, tp_csc_ID);
934 }
935 
936 bool PrimitiveSelection::is_in_bx_gem(int tp_bx) const {
937  tp_bx += bxShiftGEM_;
938  return (bx_ == tp_bx);
939 }
940 
942  int tp_endcap, int tp_sector, int tp_subsector, int tp_station, int tp_csc_ID, int tp_bx) const {
943  int selected = -1;
944 
945  bool is_native = false;
946  bool is_neighbor = false;
947  if (is_in_bx_gem(tp_bx)) {
948  if (is_in_sector_gem(tp_endcap, tp_sector)) {
949  is_native = true;
950  } else if (is_in_neighbor_sector_gem(tp_endcap, tp_sector, tp_subsector, tp_station, tp_csc_ID)) {
951  is_neighbor = true;
952  }
953  }
954  if (!is_native && !is_neighbor)
955  return selected;
956 
957  if (!is_neighbor) {
958  if (tp_station == 1) { // GE1/1: 0 - 5
959  selected = (tp_subsector - 1) * 3 + (tp_csc_ID - 1);
960  } else { // GE2/1: 6 - 8
961  selected = 6 + (tp_csc_ID - 1);
962  }
963 
964  } else {
965  if (tp_station == 1) { // GE1/1n: 12
966  selected = 12;
967  } else { // GE2/1n: 13
968  selected = 13;
969  }
970  }
971  emtf_assert(selected != -1);
972  return selected;
973 }
974 
975 // _____________________________________________________________________________
976 // ME0 functions
977 //
978 // According to what I know at the moment
979 // - ME0: 20 degree chamber, 8 rolls, 384 strips = 192 pads
980 int PrimitiveSelection::select_me0(const TriggerPrimitive& muon_primitive) const {
981  int selected = -1;
982 
983  if (muon_primitive.subsystem() == TriggerPrimitive::kME0) {
984  const ME0DetId& tp_detId = muon_primitive.detId<ME0DetId>();
985  const ME0Data& tp_data = muon_primitive.getME0Data();
986 
987  int tp_region = tp_detId.region(); // 0 for Barrel, +/-1 for +/- Endcap
988  int tp_endcap = (tp_region == -1) ? 2 : tp_region;
989  int tp_station = tp_detId.station();
990  int tp_ring = 1; // tp_detId.ring() does not exist
991  //int tp_roll = tp_detId.roll();
992  //int tp_layer = tp_detId.layer();
993  int tp_chamber = tp_detId.chamber();
994 
995  int tp_bx = tp_data.bx;
996  int tp_pad = tp_data.phiposition;
997  int tp_partition = tp_data.partition;
998 
999  // The ME0 geometry is similar to ME2/1, so I use tp_station = 2, tp_ring = 1
1000  // when calling get_trigger_sector() and get_trigger_csc_ID()
1001  int tp_sector = emtf::get_trigger_sector(1, 2, tp_chamber);
1002  int tp_csc_ID = emtf::get_trigger_csc_ID(1, 2, tp_chamber);
1003  int tp_subsector = 0;
1004 
1005  if (endcap_ == 1 && sector_ == 1 && bx_ == -3) { // do assertion checks only once
1006  emtf_assert(tp_region != 0);
1007  emtf_assert(emtf::MIN_ENDCAP <= tp_endcap && tp_endcap <= emtf::MAX_ENDCAP);
1008  emtf_assert(emtf::MIN_TRIGSECTOR <= tp_sector && tp_sector <= emtf::MAX_TRIGSECTOR);
1009  emtf_assert(tp_station == 1);
1010  emtf_assert(tp_ring == 1);
1011  //emtf_assert(1 <= tp_roll && tp_roll <= 8); // not set
1012  //emtf_assert(1 <= tp_layer && tp_layer <= 6); // not set
1013  emtf_assert(1 <= tp_csc_ID && tp_csc_ID <= 3);
1014  emtf_assert(0 <= tp_pad && tp_pad <= 767);
1015  emtf_assert(0 <= tp_partition && tp_partition <= 15);
1016  }
1017 
1018  // Check if the chamber belongs to this sector processor at this BX.
1019  selected = get_index_me0(tp_endcap, tp_sector, tp_subsector, tp_station, tp_csc_ID, tp_pad, tp_bx);
1020  }
1021  return selected;
1022 }
1023 
1024 bool PrimitiveSelection::is_in_sector_me0(int tp_endcap, int tp_sector, int tp_csc_ID, int tp_pad) const {
1025  // Similar to the corresponding CSC function, but requires a 5 deg shift
1026  // because the CSC chamber 1 starts at -5 deg, but the ME0 chamber 1 starts
1027  // at -10 deg.
1028  // This means that in sector 1, CSC chambers cover 15 to 75 deg, but ME0
1029  // chambers cover 10 to 70 deg. 5 deg (1/4 of chamber) needs to be added
1030  // to cover 70 to 75 deg, and 5 deg needs to be subtracted from 10 to 15 deg.
1031  auto get_other_neighbor = [](int sector) { return (sector == 6) ? 1 : sector + 1; };
1032 
1033  bool add5deg = false;
1034  bool sub5deg = false;
1035  if (includeNeighbor_) {
1036  if ((endcap_ == tp_endcap) && (get_other_neighbor(sector_) == tp_sector)) {
1037  if (tp_csc_ID == 1 && tp_endcap == 1 && tp_pad >= (767 - 192)) { // higher 1/4 of chamber
1038  add5deg = true;
1039  } else if (tp_csc_ID == 1 && tp_endcap == 2 && tp_pad <= 191) { // lower 1/4 of chamber
1040  add5deg = true;
1041  }
1042  }
1043  if ((endcap_ == tp_endcap) && (sector_ == tp_sector)) {
1044  if (tp_csc_ID == 1 && tp_endcap == 1 && tp_pad >= (767 - 192)) { // higher 1/4 of chamber
1045  sub5deg = true;
1046  } else if (tp_csc_ID == 1 && tp_endcap == 2 && tp_pad <= 191) { // lower 1/4 of chamber
1047  sub5deg = true;
1048  }
1049  }
1050  }
1051  return (is_in_sector_csc(tp_endcap, tp_sector) && !sub5deg) || add5deg;
1052 }
1053 
1054 bool PrimitiveSelection::is_in_neighbor_sector_me0(int tp_endcap, int tp_sector, int tp_csc_ID, int tp_pad) const {
1055  // Similar to the corresponding CSC function, but requires a 5 deg shift
1056  // because the CSC chamber 1 starts at -5 deg, but the ME0 chamber 1 starts
1057  // at -10 deg.
1058  // This means that in sector 1, CSC chamber from the neighbor sector
1059  // covers -5 to 15 deg, but ME0 chamber from the neighbor sector covers
1060  // -10 to 10 deg. 5 deg (1/4 of chamber) needs to be subtracted from
1061  // -10 to -5 deg, and 5 deg needs to be added to cover 10 to 15 deg.
1062  auto get_neighbor = [](int sector) { return (sector == 1) ? 6 : sector - 1; };
1063 
1064  bool add5deg = false;
1065  bool sub5deg = false;
1066  if (includeNeighbor_) {
1067  if ((endcap_ == tp_endcap) && (get_neighbor(sector_) == tp_sector)) {
1068  if (tp_csc_ID == 3 && tp_endcap == 1 && tp_pad >= (767 - 192)) { // higher 1/4 of chamber
1069  sub5deg = true;
1070  } else if (tp_csc_ID == 3 && tp_endcap == 2 && tp_pad <= 191) { // lower 1/4 of chamber
1071  sub5deg = true;
1072  }
1073  }
1074  if ((endcap_ == tp_endcap) && (sector_ == tp_sector)) {
1075  if (tp_csc_ID == 1 && tp_endcap == 1 && tp_pad >= (767 - 192)) { // higher 1/4 of chamber
1076  add5deg = true;
1077  } else if (tp_csc_ID == 1 && tp_endcap == 2 && tp_pad <= 191) { // lower 1/4 of chamber
1078  add5deg = true;
1079  }
1080  }
1081  }
1082  // (Note: use tp_subsector = 0, tp_station = 2)
1083  return (is_in_neighbor_sector_csc(tp_endcap, tp_sector, 0, 2, tp_csc_ID) && !sub5deg) || add5deg;
1084 }
1085 
1086 bool PrimitiveSelection::is_in_bx_me0(int tp_bx) const {
1087  tp_bx += bxShiftME0_;
1088  return (bx_ == tp_bx);
1089 }
1090 
1092  int tp_endcap, int tp_sector, int tp_subsector, int tp_station, int tp_csc_ID, int tp_pad, int tp_bx) const {
1093  int selected = -1;
1094 
1095  bool is_native = false;
1096  bool is_neighbor = false;
1097  if (is_in_bx_me0(tp_bx)) {
1098  if (is_in_sector_me0(tp_endcap, tp_sector, tp_csc_ID, tp_pad)) {
1099  is_native = true;
1100  } else if (is_in_neighbor_sector_me0(tp_endcap, tp_sector, tp_csc_ID, tp_pad)) {
1101  is_neighbor = true;
1102  }
1103  }
1104  if (!is_native && !is_neighbor)
1105  return selected;
1106 
1107  if (!is_neighbor) { // ME0: 9 - 11
1108  selected = 9 + (tp_csc_ID - 1);
1109  } else { // ME0n: 14
1110  selected = 14;
1111  }
1112  emtf_assert(selected != -1);
1113  return selected;
1114 }
1115 
1116 // _____________________________________________________________________________
1117 // DT functions
1118 int PrimitiveSelection::select_dt(const TriggerPrimitive& muon_primitive) const {
1119  int selected = -1;
1120 
1121  if (muon_primitive.subsystem() == TriggerPrimitive::kDT) {
1122  const DTChamberId& tp_detId = muon_primitive.detId<DTChamberId>();
1123  const DTData& tp_data = muon_primitive.getDTData();
1124 
1125  int tp_wheel = tp_detId.wheel();
1126  int tp_station = tp_detId.station();
1127  int tp_sector = tp_detId.sector(); // sectors are 1-12, starting at phi=0 and increasing with phi
1128 
1129  // In station 4, where the top and bottom sectors are made of two chambers,
1130  // two additional sector numbers are used, 13 (after sector 4, top)
1131  // and 14 (after sector 10, bottom).
1132  if (tp_station == 4) {
1133  if (tp_sector == 13)
1134  tp_sector = 4;
1135  else if (tp_sector == 14)
1136  tp_sector = 10;
1137  }
1138 
1139  int tp_bx = tp_data.bx;
1140  int tp_phi = tp_data.radialAngle;
1141  //int tp_phiB = tp_data.bendingAngle;
1142 
1143  // Mimic 10 deg CSC chamber. I use tp_station = 2, tp_ring = 2
1144  // when calling get_trigger_sector() and get_trigger_csc_ID()
1145  int tp_chamber =
1146  tp_sector * 3 - 1; // DT chambers are 30 deg. Multiply sector number by 3 to mimic 10 deg CSC chamber number
1147  int tp_endcap = (tp_wheel > 0) ? 1 : ((tp_wheel < 0) ? 2 : 0);
1148  int csc_tp_sector = emtf::get_trigger_sector(2, 2, tp_chamber);
1149  int tp_csc_ID = emtf::get_trigger_csc_ID(2, 2, tp_chamber);
1150  int tp_subsector = 0;
1151 
1152  if (endcap_ == 1 && sector_ == 1 && bx_ == -3) { // do assertion checks only once
1153  //emtf_assert(-2 <= tp_wheel && tp_wheel <= +2);
1154  emtf_assert(tp_wheel == -2 || tp_wheel == +2); // do not include wheels -1, 0, +1
1155  //emtf_assert(1 <= tp_station && tp_station <= 4);
1156  emtf_assert(1 <= tp_station && tp_station <= 3); // do not include MB4
1157  emtf_assert(1 <= tp_sector && tp_sector <= 12);
1158  emtf_assert(emtf::MIN_ENDCAP <= tp_endcap && tp_endcap <= emtf::MAX_ENDCAP);
1159  emtf_assert(emtf::MIN_TRIGSECTOR <= csc_tp_sector && csc_tp_sector <= emtf::MAX_TRIGSECTOR);
1160  //emtf_assert(4 <= tp_csc_ID && tp_csc_ID <= 9);
1161  emtf_assert(tp_csc_ID == 6 || tp_csc_ID == 9);
1162  emtf_assert(-2048 <= tp_phi && tp_phi <= 2047); // 12-bit
1163  //emtf_assert(-512 <= tp_phiB && tp_phiB <= 511); // 10-bit
1164  }
1165 
1166  // Check if the chamber belongs to this sector processor at this BX.
1167  selected = get_index_dt(tp_endcap, csc_tp_sector, tp_subsector, tp_station, tp_csc_ID, tp_bx);
1168  }
1169  return selected;
1170 }
1171 
1172 bool PrimitiveSelection::is_in_sector_dt(int tp_endcap, int tp_sector) const {
1173  // Identical to the corresponding CSC function
1174  return is_in_sector_csc(tp_endcap, tp_sector);
1175 }
1176 
1177 bool PrimitiveSelection::is_in_neighbor_sector_dt(int tp_endcap, int tp_sector, int tp_csc_ID) const {
1178  // Identical to the corresponding CSC function
1179  // (Note: use tp_subsector = 0, tp_station = 2)
1180  return is_in_neighbor_sector_csc(tp_endcap, tp_sector, 0, 2, tp_csc_ID);
1181 }
1182 
1183 bool PrimitiveSelection::is_in_bx_dt(int tp_bx) const {
1184  //tp_bx += bxShiftDT_;
1185  return (bx_ == tp_bx);
1186 }
1187 
1189  int tp_endcap, int csc_tp_sector, int tp_subsector, int tp_station, int tp_csc_ID, int tp_bx) const {
1190  int selected = -1;
1191 
1192  bool is_native = false;
1193  bool is_neighbor = false;
1194  if (is_in_bx_dt(tp_bx)) {
1195  if (is_in_sector_dt(tp_endcap, csc_tp_sector)) {
1196  is_native = true;
1197  } else if (is_in_neighbor_sector_dt(tp_endcap, csc_tp_sector, tp_csc_ID)) {
1198  is_neighbor = true;
1199  }
1200  }
1201  if (!is_native && !is_neighbor)
1202  return selected;
1203 
1204  if (!is_neighbor) { // MB1,2,3,4: 0-7
1205  selected = (tp_station - 1) * 2 + (tp_csc_ID - 6) / 3; // tp_csc_ID should be either 6 or 9
1206  } else { // ME1,2,3,4n: 8-11
1207  selected = 8 + (tp_station - 1);
1208  }
1209  emtf_assert(selected != -1);
1210  return selected;
1211 }
PrimitiveSelection::select_me0
int select_me0(const TriggerPrimitive &muon_primitive) const
Definition: PrimitiveSelection.cc:980
PrimitiveSelection::verbose_
int verbose_
Definition: PrimitiveSelection.h:110
PrimitiveSelection::duplicateTheta_
bool duplicateTheta_
Definition: PrimitiveSelection.h:114
PrimitiveSelection::is_in_bx_gem
bool is_in_bx_gem(int tp_bx) const
Definition: PrimitiveSelection.cc:936
L1TMuon::TriggerPrimitive::getWire
int getWire() const
Definition: MuonTriggerPrimitive.cc:377
RPCData
Definition: RPCData.h:42
emtf::CSCTag
Definition: EMTFSubsystemTag.h:31
PrimitiveSelection::get_index_rpc
int get_index_rpc(int tp_endcap, int tp_station, int tp_ring, int tp_sector, int tp_subsector, int tp_bx) const
Definition: PrimitiveSelection.cc:819
PrimitiveSelection::bxShiftME0_
int bxShiftME0_
Definition: PrimitiveSelection.h:112
PrimitiveSelection::is_in_bx_csc
bool is_in_bx_csc(int tp_bx) const
Definition: PrimitiveSelection.cc:687
RPCDetId::station
int station() const
Definition: RPCDetId.h:78
RPCDetId::region
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
GEMDetId::ring
constexpr int ring() const
Definition: GEMDetId.h:170
L1TMuon::TriggerPrimitive::accessCSCData
CSCData & accessCSCData()
Definition: MuonTriggerPrimitive.h:260
RPCDetId::subsector
int subsector() const
SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel,...
Definition: RPCDetId.h:88
PrimitiveSelection::bx_
int bx_
Definition: PrimitiveSelection.h:110
emtf::MIN_TRIGSECTOR
constexpr int MIN_TRIGSECTOR
Definition: Common.h:49
GEMDetId::layer
constexpr int layer() const
Definition: GEMDetId.h:184
PrimitiveSelection::endcap_
int endcap_
Definition: PrimitiveSelection.h:110
emtf::GEMTag
Definition: EMTFSubsystemTag.h:57
PrimitiveSelection::select_dt
int select_dt(const TriggerPrimitive &muon_primitive) const
Definition: PrimitiveSelection.cc:1118
GEMDetId::region
constexpr int region() const
Definition: GEMDetId.h:165
relativeConstraints.station
station
Definition: relativeConstraints.py:67
CSCDetId::ring
int ring() const
Definition: CSCDetId.h:68
PrimitiveSelection::is_in_sector_dt
bool is_in_sector_dt(int tp_endcap, int tp_sector) const
Definition: PrimitiveSelection.cc:1172
RPCDetId
Definition: RPCDetId.h:16
gather_cfg.cout
cout
Definition: gather_cfg.py:144
PrimitiveSelection::is_in_sector_me0
bool is_in_sector_me0(int tp_endcap, int tp_sector, int tp_csc_ID, int tp_pad) const
Definition: PrimitiveSelection.cc:1024
emtf::get_trigger_csc_ID
int get_trigger_csc_ID(int ring, int station, int chamber)
Definition: TrackTools.cc:100
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
L1TMuon::TriggerPrimitive::getRPCData
RPCData getRPCData() const
Definition: MuonTriggerPrimitive.h:255
L1TMuon::TriggerPrimitive::getCSCData
CSCData getCSCData() const
Definition: MuonTriggerPrimitive.h:254
emtf::MAX_ENDCAP
constexpr int MAX_ENDCAP
Definition: Common.h:46
NUM_RPC_CHAMBERS
#define NUM_RPC_CHAMBERS
Definition: PrimitiveSelection.cc:11
NUM_GEM_CHAMBERS
#define NUM_GEM_CHAMBERS
Definition: PrimitiveSelection.cc:13
PrimitiveSelection::get_index_dt
int get_index_dt(int tp_endcap, int csc_tp_sector, int tp_subsector, int tp_station, int tp_csc_ID, int tp_bx) const
Definition: PrimitiveSelection.cc:1188
PrimitiveSelection::select_gem
int select_gem(const TriggerPrimitive &muon_primitive) const
Definition: PrimitiveSelection.cc:881
DDAxes::x
makeMuonMisalignmentScenario.endcap
endcap
Definition: makeMuonMisalignmentScenario.py:320
PrimitiveSelection::process
void process(T tag, const TriggerPrimitiveCollection &muon_primitives, std::map< int, TriggerPrimitiveCollection > &selected_prim_map) const
L1TMuon::TriggerPrimitive::kCSC
Definition: MuonTriggerPrimitive.h:59
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
PrimitiveSelection::select_rpc
int select_rpc(const TriggerPrimitive &muon_primitive) const
Definition: PrimitiveSelection.cc:729
PrimitiveSelection.h
L1TMuon::TriggerPrimitive::CSCData::pattern
uint16_t pattern
Definition: MuonTriggerPrimitive.h:116
end
#define end
Definition: vmac.h:39
emtf::MAX_TRIGSECTOR
constexpr int MAX_TRIGSECTOR
Definition: Common.h:50
PrimitiveSelection::get_index_gem
int get_index_gem(int tp_endcap, int tp_sector, int tp_subsector, int tp_station, int tp_csc_ID, int tp_bx) const
Definition: PrimitiveSelection.cc:941
NUM_DT_CHAMBERS
#define NUM_DT_CHAMBERS
Definition: PrimitiveSelection.cc:15
std::swap
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
Definition: DataFrameContainer.h:209
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
PrimitiveSelection::bxShiftRPC_
int bxShiftRPC_
Definition: PrimitiveSelection.h:112
L1TMuon::TriggerPrimitive::kGEM
Definition: MuonTriggerPrimitive.h:59
L1TMuon::TriggerPrimitive::DTData::theta_bti_group
int theta_bti_group
Definition: MuonTriggerPrimitive.h:160
emtf::MIN_ENDCAP
constexpr int MIN_ENDCAP
Definition: Common.h:45
L1TMuon::TriggerPrimitive::kDT
Definition: MuonTriggerPrimitive.h:59
L1TMuon::TriggerPrimitive::accessDTData
DTData & accessDTData()
Definition: MuonTriggerPrimitive.h:259
verbose
static constexpr int verbose
Definition: HLTExoticaSubAnalysis.cc:25
PrimitiveSelection::bxShiftGEM_
int bxShiftGEM_
Definition: PrimitiveSelection.h:112
L1TMuon::TriggerPrimitive
Definition: MuonTriggerPrimitive.h:56
PrimitiveSelection::get_index_me0
int get_index_me0(int tp_endcap, int tp_sector, int tp_subsector, int tp_station, int tp_csc_ID, int tp_pad, int tp_bx) const
Definition: PrimitiveSelection.cc:1091
emtf::ME0Tag
Definition: EMTFSubsystemTag.h:62
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
L1TMuon::TriggerPrimitive::ME0Data
Definition: MuonTriggerPrimitive.h:176
edm::LogWarning
Definition: MessageLogger.h:141
CSCDetId::triggerSector
int triggerSector() const
Definition: CSCDetId.cc:3
RPCDetId::roll
int roll() const
Definition: RPCDetId.h:92
GEMDetId::chamber
constexpr int chamber() const
Definition: GEMDetId.h:177
emtf::RPCTag
Definition: EMTFSubsystemTag.h:38
L1TMuon::TriggerPrimitive::CSCData::quality
uint16_t quality
Definition: MuonTriggerPrimitive.h:113
PrimitiveSelection::is_in_neighbor_sector_csc
bool is_in_neighbor_sector_csc(int tp_endcap, int tp_sector, int tp_subsector, int tp_station, int tp_csc_ID) const
Definition: PrimitiveSelection.cc:668
TriggerPrimitiveCollection
L1TMuon::TriggerPrimitiveCollection TriggerPrimitiveCollection
Definition: Common.h:32
PrimitiveSelection::is_in_sector_gem
bool is_in_sector_gem(int tp_endcap, int tp_sector) const
Definition: PrimitiveSelection.cc:925
L1TMuon::TriggerPrimitive::DTData
Definition: MuonTriggerPrimitive.h:127
GEMDetId::roll
constexpr int roll() const
Definition: GEMDetId.h:188
GEMDetId
Definition: GEMDetId.h:17
CSCDetId
Definition: CSCDetId.h:26
emtf::get_csc_max_strip_and_wire
void get_csc_max_strip_and_wire(int station, int ring, int &max_strip, int &max_wire)
Definition: TrackTools.cc:141
PrimitiveSelection::sector_
int sector_
Definition: PrimitiveSelection.h:110
ME0DetId::station
int station() const
Definition: ME0DetId.h:58
L1TMuon::TriggerPrimitive::detId
IDType detId() const
Definition: MuonTriggerPrimitive.h:242
emtf::get_trigger_sector
int get_trigger_sector(int ring, int station, int chamber)
Definition: TrackTools.cc:85
L1TMuon::TriggerPrimitive::getDTData
DTData getDTData() const
Definition: MuonTriggerPrimitive.h:253
CSCDetId::chamber
int chamber() const
Definition: CSCDetId.h:62
ME0DetId
Definition: ME0DetId.h:16
emtf::DTTag
Definition: EMTFSubsystemTag.h:24
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
PrimitiveSelection::is_in_bx_rpc
bool is_in_bx_rpc(int tp_bx) const
Definition: PrimitiveSelection.cc:814
PrimitiveSelection::is_in_sector_csc
bool is_in_sector_csc(int tp_endcap, int tp_sector) const
Definition: PrimitiveSelection.cc:664
L1TMuon::TriggerPrimitive::subsystem
subsystem_type subsystem() const
Definition: MuonTriggerPrimitive.h:220
PrimitiveSelection::bugME11Dupes_
bool bugME11Dupes_
Definition: PrimitiveSelection.h:116
L1TMuon::TriggerPrimitive::CSCData::keywire
uint16_t keywire
Definition: MuonTriggerPrimitive.h:114
RPCDetId::ring
int ring() const
Definition: RPCDetId.h:59
L1TMuon::TriggerPrimitive::kME0
Definition: MuonTriggerPrimitive.h:59
L1TMuon::TriggerPrimitive::getGEMData
GEMData getGEMData() const
Definition: MuonTriggerPrimitive.h:256
DTChamberId::sector
int sector() const
Definition: DTChamberId.h:49
L1TMuon::TriggerPrimitive::CSCData::cscID
uint16_t cscID
Definition: MuonTriggerPrimitive.h:122
PrimitiveSelection::bxShiftCSC_
int bxShiftCSC_
Definition: PrimitiveSelection.h:112
PrimitiveSelection::is_in_neighbor_sector_dt
bool is_in_neighbor_sector_dt(int tp_endcap, int tp_sector, int tp_csc_ID) const
Definition: PrimitiveSelection.cc:1177
CSCDetId::endcap
int endcap() const
Definition: CSCDetId.h:85
PrimitiveSelection::merge_no_truncate
void merge_no_truncate(const std::map< int, TriggerPrimitiveCollection > &selected_dt_map, const std::map< int, TriggerPrimitiveCollection > &selected_csc_map, const std::map< int, TriggerPrimitiveCollection > &selected_rpc_map, const std::map< int, TriggerPrimitiveCollection > &selected_gem_map, const std::map< int, TriggerPrimitiveCollection > &selected_me0_map, std::map< int, TriggerPrimitiveCollection > &selected_prim_map) const
Definition: PrimitiveSelection.cc:586
RPCDetId::sector
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:81
L1TMuon::TriggerPrimitive::GEMData
Definition: MuonTriggerPrimitive.h:167
ME0DetId::chamber
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: ME0DetId.h:41
PrimitiveSelection::merge
void merge(const std::map< int, TriggerPrimitiveCollection > &selected_dt_map, const std::map< int, TriggerPrimitiveCollection > &selected_csc_map, const std::map< int, TriggerPrimitiveCollection > &selected_rpc_map, const std::map< int, TriggerPrimitiveCollection > &selected_gem_map, const std::map< int, TriggerPrimitiveCollection > &selected_me0_map, std::map< int, TriggerPrimitiveCollection > &selected_prim_map) const
Definition: PrimitiveSelection.cc:507
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
PrimitiveSelection::is_in_bx_me0
bool is_in_bx_me0(int tp_bx) const
Definition: PrimitiveSelection.cc:1086
PrimitiveSelection::is_in_neighbor_sector_rpc
bool is_in_neighbor_sector_rpc(int tp_endcap, int tp_station, int tp_ring, int tp_sector, int tp_subsector) const
Definition: PrimitiveSelection.cc:798
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
PrimitiveSelection::includeNeighbor_
bool includeNeighbor_
Definition: PrimitiveSelection.h:114
PrimitiveSelection::is_in_bx_dt
bool is_in_bx_dt(int tp_bx) const
Definition: PrimitiveSelection.cc:1183
emtf_assert
#define emtf_assert(expr)
Definition: DebugTools.h:18
PrimitiveSelection::get_index_csc
int get_index_csc(int tp_endcap, int tp_sector, int tp_subsector, int tp_station, int tp_csc_ID, int tp_bx) const
Definition: PrimitiveSelection.cc:693
PrimitiveSelection::configure
void configure(int verbose, int endcap, int sector, int bx, int bxShiftCSC, int bxShiftRPC, int bxShiftGEM, int bxShiftME0, bool includeNeighbor, bool duplicateTheta, bool bugME11Dupes)
Definition: PrimitiveSelection.cc:17
GEMDetId::station
constexpr int station() const
Definition: GEMDetId.h:173
DTChamberId
Definition: DTChamberId.h:14
helper.h
L1TMuon::TriggerPrimitive::getStrip
int getStrip() const
Definition: MuonTriggerPrimitive.cc:358
CSCDetId::station
int station() const
Definition: CSCDetId.h:79
L1TMuon::TriggerPrimitive::getBX
int getBX() const
Definition: MuonTriggerPrimitive.cc:339
L1TMuon::TriggerPrimitive::CSCData
Definition: MuonTriggerPrimitive.h:95
ME0DetId::region
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: ME0DetId.h:38
DTChamberId::wheel
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
cuy.ii
ii
Definition: cuy.py:590
PrimitiveSelection::is_in_sector_rpc
bool is_in_sector_rpc(int tp_endcap, int tp_station, int tp_ring, int tp_sector, int tp_subsector) const
Definition: PrimitiveSelection.cc:777
NUM_CSC_CHAMBERS
#define NUM_CSC_CHAMBERS
Definition: PrimitiveSelection.cc:7
DTChamberId::station
int station() const
Return the station number.
Definition: DTChamberId.h:42
L1TMuon::TriggerPrimitive::getME0Data
ME0Data getME0Data() const
Definition: MuonTriggerPrimitive.h:257
PrimitiveSelection::is_in_neighbor_sector_gem
bool is_in_neighbor_sector_gem(int tp_endcap, int tp_sector, int tp_subsector, int tp_station, int tp_csc_ID) const
Definition: PrimitiveSelection.cc:930
triggerSector
Int_t triggerSector(Int_t station, Int_t ring, Int_t chamber) const
Definition: triggerCscIdSector.h:3
PrimitiveSelection::select_csc
int select_csc(const TriggerPrimitive &muon_primitive) const
Definition: PrimitiveSelection.cc:610
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
PrimitiveSelection::is_in_neighbor_sector_me0
bool is_in_neighbor_sector_me0(int tp_endcap, int tp_sector, int tp_csc_ID, int tp_pad) const
Definition: PrimitiveSelection.cc:1054
L1TMuon::TriggerPrimitive::kRPC
Definition: MuonTriggerPrimitive.h:59