CMS 3D CMS Logo

List of all members | Public Member Functions
EMTFSubsystemCollector Class Reference

#include <EMTFSubsystemCollector.h>

Public Member Functions

void cluster_rpc (const TriggerPrimitiveCollection &muon_primitives, TriggerPrimitiveCollection &clus_muon_primitives) const
 
template<>
void extractPrimitives (emtf::CPPFTag tag, const GeometryTranslator *tp_geom, const edm::Event &iEvent, const edm::EDGetToken &token, TriggerPrimitiveCollection &out) const
 
template<>
void extractPrimitives (emtf::CSCTag tag, const GeometryTranslator *tp_geom, const edm::Event &iEvent, const edm::EDGetToken &token, TriggerPrimitiveCollection &out) const
 
template<>
void extractPrimitives (emtf::DTTag tag, const GeometryTranslator *tp_geom, const edm::Event &iEvent, const edm::EDGetToken &token1, const edm::EDGetToken &token2, TriggerPrimitiveCollection &out) const
 
template<>
void extractPrimitives (emtf::GEMTag tag, const GeometryTranslator *tp_geom, const edm::Event &iEvent, const edm::EDGetToken &token, TriggerPrimitiveCollection &out) const
 
template<>
void extractPrimitives (emtf::IRPCTag tag, const GeometryTranslator *tp_geom, const edm::Event &iEvent, const edm::EDGetToken &token, TriggerPrimitiveCollection &out) const
 
template<>
void extractPrimitives (emtf::IRPCTag tag, const GeometryTranslator *tp_geom, const edm::Event &iEvent, const edm::EDGetToken &token1, const edm::EDGetToken &token2, TriggerPrimitiveCollection &out) const
 
template<>
void extractPrimitives (emtf::ME0Tag tag, const GeometryTranslator *tp_geom, const edm::Event &iEvent, const edm::EDGetToken &token, TriggerPrimitiveCollection &out) const
 
template<>
void extractPrimitives (emtf::RPCTag tag, const GeometryTranslator *tp_geom, const edm::Event &iEvent, const edm::EDGetToken &token, TriggerPrimitiveCollection &out) const
 
template<>
void extractPrimitives (emtf::RPCTag tag, const GeometryTranslator *tp_geom, const edm::Event &iEvent, const edm::EDGetToken &token1, const edm::EDGetToken &token2, TriggerPrimitiveCollection &out) const
 
template<typename T >
void extractPrimitives (T tag, const GeometryTranslator *tp_geom, const edm::Event &iEvent, const edm::EDGetToken &token, TriggerPrimitiveCollection &out) const
 
template<typename T >
void extractPrimitives (T tag, const GeometryTranslator *tp_geom, const edm::Event &iEvent, const edm::EDGetToken &token1, const edm::EDGetToken &token2, TriggerPrimitiveCollection &out) const
 
void make_copad_gem (const TriggerPrimitiveCollection &muon_primitives, TriggerPrimitiveCollection &copad_muon_primitives) const
 

Detailed Description

Definition at line 13 of file EMTFSubsystemCollector.h.

Member Function Documentation

◆ cluster_rpc()

void EMTFSubsystemCollector::cluster_rpc ( const TriggerPrimitiveCollection muon_primitives,
TriggerPrimitiveCollection clus_muon_primitives 
) const

Definition at line 358 of file EMTFSubsystemCollector.cc.

359  {
360  // Define operator to select RPC digis
361  struct {
363  bool operator()(const value_type& x) const { return (x.subsystem() == TriggerPrimitive::kRPC); }
364  } rpc_digi_select;
365 
366  // Define operator to sort the RPC digis prior to clustering.
367  // Use rawId, bx and strip as the sorting id. RPC rawId fully specifies
368  // sector, subsector, endcap, station, ring, layer, roll. Strip is used as
369  // the least significant sorting id.
370  struct {
372  bool operator()(const value_type& lhs, const value_type& rhs) const {
373  bool cmp = (std::make_pair(std::make_pair(lhs.rawId(), lhs.getRPCData().bx), lhs.getRPCData().strip) <
374  std::make_pair(std::make_pair(rhs.rawId(), rhs.getRPCData().bx), rhs.getRPCData().strip));
375  return cmp;
376  }
377  } rpc_digi_less;
378 
379  struct {
381  bool operator()(const value_type& lhs, const value_type& rhs) const {
382  bool cmp = (std::make_pair(std::make_pair(lhs.rawId(), lhs.getRPCData().bx), lhs.getRPCData().strip) ==
383  std::make_pair(std::make_pair(rhs.rawId(), rhs.getRPCData().bx), rhs.getRPCData().strip));
384  return cmp;
385  }
386  } rpc_digi_equal;
387 
388  // Define operators for the nearest-neighbor clustering algorithm.
389  // If two digis are next to each other (check strip_hi on the 'left', and
390  // strip_low on the 'right'), cluster them (increment strip_hi on the 'left')
391  struct {
393  bool operator()(const value_type& lhs, const value_type& rhs) const {
394  bool cmp = ((lhs.rawId() == rhs.rawId()) && (lhs.getRPCData().bx == rhs.getRPCData().bx) &&
395  (lhs.getRPCData().strip_hi + 1 == rhs.getRPCData().strip_low));
396  return cmp;
397  }
398  } rpc_digi_adjacent;
399 
400  struct {
402  void operator()(value_type& lhs, value_type& rhs) { // pass by reference
403  lhs.accessRPCData().strip_hi += 1;
404  }
405  } rpc_digi_cluster;
406 
407  // ___________________________________________________________________________
408  // Do clustering using C++ <algorithm> functions
409 
410  // 1. Select RPC digis
411  clus_muon_primitives.clear();
412  std::copy_if(
413  muon_primitives.begin(), muon_primitives.end(), std::back_inserter(clus_muon_primitives), rpc_digi_select);
414 
415  // 2. Sort
416  std::stable_sort(clus_muon_primitives.begin(), clus_muon_primitives.end(), rpc_digi_less);
417 
418  // 3. Remove duplicates
419  clus_muon_primitives.erase(std::unique(clus_muon_primitives.begin(), clus_muon_primitives.end(), rpc_digi_equal),
420  clus_muon_primitives.end());
421 
422  // 4. Cluster adjacent digis
423  clus_muon_primitives.erase(
424  adjacent_cluster(clus_muon_primitives.begin(), clus_muon_primitives.end(), rpc_digi_adjacent, rpc_digi_cluster),
425  clus_muon_primitives.end());
426 }

References fileCollector::cmp, L1TMuon::TriggerPrimitive::kRPC, tier0::unique(), and x.

Referenced by extractPrimitives().

◆ extractPrimitives() [1/11]

template<>
void EMTFSubsystemCollector::extractPrimitives ( emtf::CPPFTag  tag,
const GeometryTranslator tp_geom,
const edm::Event iEvent,
const edm::EDGetToken token,
TriggerPrimitiveCollection out 
) const

Definition at line 287 of file EMTFSubsystemCollector.cc.

291  {
293  iEvent.getByToken(token, cppfDigis);
294 
295  for (const auto& digi : *cppfDigis) {
296  out.emplace_back(digi.rpcId(), digi);
297  }
298  return;
299 }

References iEvent, MillePedeFileConverter_cfg::out, and unpackBuffers-CaloStage2::token.

◆ extractPrimitives() [2/11]

template<>
void EMTFSubsystemCollector::extractPrimitives ( emtf::CSCTag  tag,
const GeometryTranslator tp_geom,
const edm::Event iEvent,
const edm::EDGetToken token,
TriggerPrimitiveCollection out 
) const

Definition at line 114 of file EMTFSubsystemCollector.cc.

118  {
120  iEvent.getByToken(token, cscDigis);
121 
122  auto chamber = cscDigis->begin();
123  auto chend = cscDigis->end();
124  for (; chamber != chend; ++chamber) {
125  auto digi = (*chamber).second.first;
126  auto dend = (*chamber).second.second;
127  for (; digi != dend; ++digi) {
128  out.emplace_back((*chamber).first, *digi);
129  }
130  }
131  return;
132 }

References relativeConstraints::chamber, iEvent, MillePedeFileConverter_cfg::out, and unpackBuffers-CaloStage2::token.

◆ extractPrimitives() [3/11]

template<>
void EMTFSubsystemCollector::extractPrimitives ( emtf::DTTag  tag,
const GeometryTranslator tp_geom,
const edm::Event iEvent,
const edm::EDGetToken token1,
const edm::EDGetToken token2,
TriggerPrimitiveCollection out 
) const

Definition at line 13 of file EMTFSubsystemCollector.cc.

18  {
20  iEvent.getByToken(token1, phiContainer);
21 
23  iEvent.getByToken(token2, thetaContainer);
24 
25  TriggerPrimitiveCollection muon_primitives;
26 
27  // Adapted from L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelKalmanStubProcessor.cc
28  constexpr int minPhiQuality = 0;
29  constexpr int minBX = -3;
30  constexpr int maxBX = 3;
31 
32  for (int bx = minBX; bx <= maxBX; bx++) {
33  for (int wheel = -2; wheel <= 2; wheel++) {
34  for (int sector = 0; sector < 12; sector++) {
35  for (int station = 1; station < 5; station++) {
36  if (wheel == -1 || wheel == 0 || wheel == 1)
37  continue; // do not include wheels -1, 0, +1
38  if (station == 4)
39  continue; // do not include MB4
40 
41  // According to Michalis, in legacy BMTF, the second stub was coming as BXNUM=-1.
42  // This is a code convention now, but you need bx-1 to get the proper second stub.
43  emtf::DTTag::theta_digi_type const* theta_segm = thetaContainer->chThetaSegm(wheel, station, sector, bx);
44  emtf::DTTag::digi_type const* phi_segm_high = phiContainer->chPhiSegm1(wheel, station, sector, bx);
45  emtf::DTTag::digi_type const* phi_segm_low = phiContainer->chPhiSegm2(wheel, station, sector, bx - 1);
46 
47  // Find theta BTI group(s)
48  bool has_theta_segm = false;
49  int bti_group1 = -1;
50  int bti_group2 = -1;
51 
52  // Case with theta segment
53  if (theta_segm != nullptr) {
54  has_theta_segm = true;
55 
56  for (unsigned int i = 0; i < 7; ++i) {
57  if (theta_segm->position(i) != 0) {
58  if (bti_group1 < 0) {
59  bti_group1 = i;
60  bti_group2 = i;
61  } else {
62  bti_group2 = i;
63  }
64  }
65  }
66  emtf_assert(bti_group1 != -1 && bti_group2 != -1);
67  }
68 
69  // 1st phi segment
70  if (phi_segm_high != nullptr) {
71  if (phi_segm_high->code() >= minPhiQuality) {
72  DTChamberId detid(phi_segm_high->whNum(), phi_segm_high->stNum(), phi_segm_high->scNum() + 1);
73  if (has_theta_segm) {
74  muon_primitives.emplace_back(detid, *phi_segm_high, *theta_segm, bti_group1);
75  } else {
76  muon_primitives.emplace_back(detid, *phi_segm_high, 1);
77  }
78  }
79  }
80 
81  // 2nd phi segment
82  if (phi_segm_low != nullptr) {
83  if (phi_segm_low->code() >= minPhiQuality) {
84  DTChamberId detid(phi_segm_low->whNum(), phi_segm_low->stNum(), phi_segm_low->scNum() + 1);
85  if (has_theta_segm) {
86  muon_primitives.emplace_back(detid, *phi_segm_low, *theta_segm, bti_group2);
87  } else {
88  muon_primitives.emplace_back(detid, *phi_segm_low, 2);
89  }
90  }
91  }
92 
93  // Duplicate DT muon primitives, if more than one theta segment, but only one phi segment
94  if (phi_segm_high != nullptr && phi_segm_low == nullptr && bti_group1 != bti_group2) {
95  DTChamberId detid(phi_segm_high->whNum(), phi_segm_high->stNum(), phi_segm_high->scNum() + 1);
96  muon_primitives.emplace_back(detid, *phi_segm_high, *theta_segm, bti_group2);
97  }
98 
99  } // end loop over station
100  } // end loop over sector
101  } // end loop over wheel
102  } // end loop over bx
103 
104  // Remove duplicates using erase-remove idiom,
105  // assuming the vector is already sorted
106  muon_primitives.erase(std::unique(muon_primitives.begin(), muon_primitives.end()), muon_primitives.end());
107  std::copy(muon_primitives.begin(), muon_primitives.end(), std::back_inserter(out));
108  return;
109 }

References l1GtPatternGenerator_cfi::bx, L1MuDTChambPhContainer::chPhiSegm1(), L1MuDTChambPhContainer::chPhiSegm2(), L1MuDTChambThContainer::chThetaSegm(), L1MuDTChambPhDigi::code(), filterCSVwithJSON::copy, emtf_assert, mps_fire::i, iEvent, simKBmtfStubs_cfi::maxBX, simKBmtfStubs_cfi::minBX, simKBmtfStubs_cfi::minPhiQuality, MillePedeFileConverter_cfg::out, L1MuDTChambThDigi::position(), L1MuDTChambPhDigi::scNum(), relativeConstraints::station, L1MuDTChambPhDigi::stNum(), tier0::unique(), makeMuonMisalignmentScenario::wheel, and L1MuDTChambPhDigi::whNum().

◆ extractPrimitives() [4/11]

template<>
void EMTFSubsystemCollector::extractPrimitives ( emtf::GEMTag  tag,
const GeometryTranslator tp_geom,
const edm::Event iEvent,
const edm::EDGetToken token,
TriggerPrimitiveCollection out 
) const

Definition at line 304 of file EMTFSubsystemCollector.cc.

308  {
310  iEvent.getByToken(token, gemDigis);
311 
312  TriggerPrimitiveCollection muon_primitives;
313 
314  auto chamber = gemDigis->begin();
315  auto chend = gemDigis->end();
316  for (; chamber != chend; ++chamber) {
317  auto digi = (*chamber).second.first;
318  auto dend = (*chamber).second.second;
319  for (; digi != dend; ++digi) {
320  muon_primitives.emplace_back((*chamber).first, *digi);
321  }
322  }
323 
324  // Make GEM coincidence pads
325  TriggerPrimitiveCollection copad_muon_primitives;
326  make_copad_gem(muon_primitives, copad_muon_primitives);
327 
328  // Output
329  std::copy(copad_muon_primitives.begin(), copad_muon_primitives.end(), std::back_inserter(out));
330  return;
331 }

References relativeConstraints::chamber, filterCSVwithJSON::copy, iEvent, make_copad_gem(), MillePedeFileConverter_cfg::out, and unpackBuffers-CaloStage2::token.

◆ extractPrimitives() [5/11]

template<>
void EMTFSubsystemCollector::extractPrimitives ( emtf::IRPCTag  tag,
const GeometryTranslator tp_geom,
const edm::Event iEvent,
const edm::EDGetToken token,
TriggerPrimitiveCollection out 
) const

Definition at line 214 of file EMTFSubsystemCollector.cc.

218  {
220  iEvent.getByToken(token, irpcDigis);
221 
222  TriggerPrimitiveCollection muon_primitives;
223 
224  auto chamber = irpcDigis->begin();
225  auto chend = irpcDigis->end();
226  for (; chamber != chend; ++chamber) {
227  auto digi = (*chamber).second.first;
228  auto dend = (*chamber).second.second;
229  for (; digi != dend; ++digi) {
230  if ((*chamber).first.region() != 0) { // 0 is barrel
231  if (!((*chamber).first.station() >= 3 && (*chamber).first.ring() == 1))
232  continue; // only RE3/1, RE4/1 (iRPC)
233 
234  muon_primitives.emplace_back((*chamber).first, *digi);
235  }
236  }
237  }
238 
239  // Cluster the iRPC digis
240  TriggerPrimitiveCollection clus_muon_primitives;
241  cluster_rpc(muon_primitives, clus_muon_primitives);
242 
243  // Output
244  std::copy(clus_muon_primitives.begin(), clus_muon_primitives.end(), std::back_inserter(out));
245  return;
246 }

References relativeConstraints::chamber, cluster_rpc(), filterCSVwithJSON::copy, iEvent, MillePedeFileConverter_cfg::out, and unpackBuffers-CaloStage2::token.

◆ extractPrimitives() [6/11]

template<>
void EMTFSubsystemCollector::extractPrimitives ( emtf::IRPCTag  tag,
const GeometryTranslator tp_geom,
const edm::Event iEvent,
const edm::EDGetToken token1,
const edm::EDGetToken token2,
TriggerPrimitiveCollection out 
) const

Definition at line 250 of file EMTFSubsystemCollector.cc.

255  {
256  constexpr int maxClusterSize = 6;
257 
258  //edm::Handle<emtf::IRPCTag::digi_collection> irpcDigis;
259  //iEvent.getByToken(token1, irpcDigis);
260 
262  iEvent.getByToken(token2, irpcRecHits);
263 
264  auto rechit = irpcRecHits->begin();
265  auto rhend = irpcRecHits->end();
266  for (; rechit != rhend; ++rechit) {
267  const RPCDetId& detid = rechit->rpcId();
268  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(tp_geom->getRPCGeometry().roll(detid));
269  if (roll == nullptr)
270  continue;
271 
272  if (detid.region() != 0) { // 0 is barrel
273  if (!(detid.station() >= 3 && detid.ring() == 1))
274  continue; // only RE3/1, RE4/1 (iRPC)
275 
276  if (rechit->clusterSize() <= maxClusterSize) {
277  out.emplace_back(detid, *rechit);
278  }
279  }
280  }
281  return;
282 }

References L1TMuon::GeometryTranslator::getRPCGeometry(), iEvent, phase2TrackerClusterizer_cfi::maxClusterSize, MillePedeFileConverter_cfg::out, RPCDetId::region(), RPCDetId::ring(), RPCGeometry::roll(), and RPCDetId::station().

◆ extractPrimitives() [7/11]

template<>
void EMTFSubsystemCollector::extractPrimitives ( emtf::ME0Tag  tag,
const GeometryTranslator tp_geom,
const edm::Event iEvent,
const edm::EDGetToken token,
TriggerPrimitiveCollection out 
) const

Definition at line 336 of file EMTFSubsystemCollector.cc.

340  {
342  iEvent.getByToken(token, me0Digis);
343 
344  auto chamber = me0Digis->begin();
345  auto chend = me0Digis->end();
346  for (; chamber != chend; ++chamber) {
347  auto digi = (*chamber).second.first;
348  auto dend = (*chamber).second.second;
349  for (; digi != dend; ++digi) {
350  out.emplace_back((*chamber).first, *digi);
351  }
352  }
353  return;
354 }

References relativeConstraints::chamber, iEvent, MillePedeFileConverter_cfg::out, and unpackBuffers-CaloStage2::token.

◆ extractPrimitives() [8/11]

template<>
void EMTFSubsystemCollector::extractPrimitives ( emtf::RPCTag  tag,
const GeometryTranslator tp_geom,
const edm::Event iEvent,
const edm::EDGetToken token,
TriggerPrimitiveCollection out 
) const

Definition at line 137 of file EMTFSubsystemCollector.cc.

141  {
143  iEvent.getByToken(token, rpcDigis);
144 
145  TriggerPrimitiveCollection muon_primitives;
146 
147  auto chamber = rpcDigis->begin();
148  auto chend = rpcDigis->end();
149  for (; chamber != chend; ++chamber) {
150  auto digi = (*chamber).second.first;
151  auto dend = (*chamber).second.second;
152  for (; digi != dend; ++digi) {
153  if ((*chamber).first.region() != 0) { // 0 is barrel
154  if ((*chamber).first.station() <= 2 && (*chamber).first.ring() == 3)
155  continue; // do not include RE1/3, RE2/3
156  if ((*chamber).first.station() >= 3 && (*chamber).first.ring() == 1)
157  continue; // do not include RE3/1, RE4/1 (iRPC)
158 
159  muon_primitives.emplace_back((*chamber).first, *digi);
160  }
161  }
162  }
163 
164  // Cluster the RPC digis
165  TriggerPrimitiveCollection clus_muon_primitives;
166  cluster_rpc(muon_primitives, clus_muon_primitives);
167 
168  // Output
169  std::copy(clus_muon_primitives.begin(), clus_muon_primitives.end(), std::back_inserter(out));
170  return;
171 }

References relativeConstraints::chamber, cluster_rpc(), filterCSVwithJSON::copy, iEvent, MillePedeFileConverter_cfg::out, and unpackBuffers-CaloStage2::token.

◆ extractPrimitives() [9/11]

template<>
void EMTFSubsystemCollector::extractPrimitives ( emtf::RPCTag  tag,
const GeometryTranslator tp_geom,
const edm::Event iEvent,
const edm::EDGetToken token1,
const edm::EDGetToken token2,
TriggerPrimitiveCollection out 
) const

Definition at line 175 of file EMTFSubsystemCollector.cc.

180  {
181  constexpr int maxClusterSize = 3;
182 
183  //edm::Handle<RPCTag::digi_collection> rpcDigis;
184  //iEvent.getByToken(token1, rpcDigis);
185 
187  iEvent.getByToken(token2, rpcRecHits);
188 
189  auto rechit = rpcRecHits->begin();
190  auto rhend = rpcRecHits->end();
191  for (; rechit != rhend; ++rechit) {
192  const RPCDetId& detid = rechit->rpcId();
193  const RPCRoll* roll = dynamic_cast<const RPCRoll*>(tp_geom->getRPCGeometry().roll(detid));
194  if (roll == nullptr)
195  continue;
196 
197  if (detid.region() != 0) { // 0 is barrel
198  if (detid.station() <= 2 && detid.ring() == 3)
199  continue; // do not include RE1/3, RE2/3
200  if (detid.station() >= 3 && detid.ring() == 1)
201  continue; // do not include RE3/1, RE4/1 (iRPC)
202 
203  if (rechit->clusterSize() <= maxClusterSize) {
204  out.emplace_back(detid, *rechit);
205  }
206  }
207  }
208  return;
209 }

References L1TMuon::GeometryTranslator::getRPCGeometry(), iEvent, phase2TrackerClusterizer_cfi::maxClusterSize, MillePedeFileConverter_cfg::out, RPCDetId::region(), RPCDetId::ring(), RPCGeometry::roll(), dtTriggerPhase2PrimitiveDigis_cfi::rpcRecHits, and RPCDetId::station().

◆ extractPrimitives() [10/11]

template<typename T >
void EMTFSubsystemCollector::extractPrimitives ( T  tag,
const GeometryTranslator tp_geom,
const edm::Event iEvent,
const edm::EDGetToken token,
TriggerPrimitiveCollection out 
) const

Referenced by TrackFinder::process().

◆ extractPrimitives() [11/11]

template<typename T >
void EMTFSubsystemCollector::extractPrimitives ( T  tag,
const GeometryTranslator tp_geom,
const edm::Event iEvent,
const edm::EDGetToken token1,
const edm::EDGetToken token2,
TriggerPrimitiveCollection out 
) const

◆ make_copad_gem()

void EMTFSubsystemCollector::make_copad_gem ( const TriggerPrimitiveCollection muon_primitives,
TriggerPrimitiveCollection copad_muon_primitives 
) const

Definition at line 430 of file EMTFSubsystemCollector.cc.

431  {
432  // Use the inner layer (layer 1) hit coordinates as output, and the outer
433  // layer (layer 2) as coincidence
434 
435  // Adapted from L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc
436  constexpr unsigned int maxDeltaBX = 1;
437  constexpr unsigned int maxDeltaRoll = 1;
438  constexpr unsigned int maxDeltaPadGE11 = 3; // it was 2
439  constexpr unsigned int maxDeltaPadGE21 = 2;
440 
441  // Make sure that the difference is calculated using signed integer, and
442  // output the absolute difference (as unsigned integer)
443  auto calculate_delta = [](int a, int b) -> unsigned int { return std::abs(a - b); };
444 
445  // Create maps of GEM pads (key = detid), split by layer
446  std::map<uint32_t, TriggerPrimitiveCollection> in_pads_layer1, in_pads_layer2;
447 
448  auto tp_it = muon_primitives.begin();
449  auto tp_end = muon_primitives.end();
450 
451  for (; tp_it != tp_end; ++tp_it) {
452  GEMDetId detid = tp_it->detId<GEMDetId>();
453  emtf_assert(detid.layer() == 1 || detid.layer() == 2);
454  emtf_assert(1 <= detid.roll() && detid.roll() <= 8);
455  uint32_t layer = detid.layer();
456 
457  // Remove layer number and roll number from detid
458  detid = GEMDetId(detid.region(), detid.ring(), detid.station(), 0, detid.chamber(), 0);
459 
460  if (layer == 1) {
461  in_pads_layer1[detid.rawId()].push_back(*tp_it);
462  } else {
463  in_pads_layer2[detid.rawId()].push_back(*tp_it);
464  }
465  }
466 
467  // Build coincidences
468  copad_muon_primitives.clear();
469 
470  auto map_tp_it = in_pads_layer1.begin();
471  auto map_tp_end = in_pads_layer1.end();
472 
473  for (; map_tp_it != map_tp_end; ++map_tp_it) {
474  const GEMDetId& detid = map_tp_it->first;
475  const TriggerPrimitiveCollection& pads = map_tp_it->second;
476 
477  // find all corresponding ids with layer 2
478  auto found = in_pads_layer2.find(detid);
479 
480  // empty range = no possible coincidence pads
481  if (found == in_pads_layer2.end())
482  continue;
483 
484  // now let's correlate the pads in two layers of this partition
485  const TriggerPrimitiveCollection& co_pads = found->second;
486  for (auto p = pads.begin(); p != pads.end(); ++p) {
487  bool has_copad = false;
488  int bend = 999999;
489 
490  for (auto co_p = co_pads.begin(); co_p != co_pads.end(); ++co_p) {
491  unsigned int deltaPad = calculate_delta(p->getGEMData().pad, co_p->getGEMData().pad);
492  unsigned int deltaBX = calculate_delta(p->getGEMData().bx, co_p->getGEMData().bx);
493  unsigned int deltaRoll = calculate_delta(p->detId<GEMDetId>().roll(), co_p->detId<GEMDetId>().roll());
494 
495  // check the match in pad
496  if ((detid.station() == 1 && deltaPad > maxDeltaPadGE11) ||
497  (detid.station() == 2 && deltaPad > maxDeltaPadGE21))
498  continue;
499 
500  // check the match in BX
501  if (deltaBX > maxDeltaBX)
502  continue;
503 
504  // check the match in roll
505  if (deltaRoll > maxDeltaRoll)
506  continue;
507 
508  has_copad = true;
509 
510  // recover the bend sign
511  if (static_cast<unsigned int>(std::abs(bend)) > deltaPad) {
512  if (co_p->getGEMData().pad >= p->getGEMData().pad)
513  bend = deltaPad;
514  else
515  bend = -deltaPad;
516  }
517  } // end loop over co_pads
518 
519  // Need to flip the bend sign depending on the parity
520  bool isEven = (detid.chamber() % 2 == 0);
521  if (!isEven) {
522  bend = -bend;
523  }
524 
525  // make a new coincidence pad digi
526  if (has_copad) {
527  copad_muon_primitives.push_back(*p);
528  }
529  } // end loop over pads
530  } // end loop over in_pads_layer1
531 }

References a, funct::abs(), b, trklet::bend(), GEMDetId::chamber(), emtf_assert, newFWLiteAna::found, GEMDetId::layer(), cscTriggerPrimitiveDigis_cfi::maxDeltaBX, cscTriggerPrimitiveDigis_cfi::maxDeltaRoll, AlCaHLTBitMon_ParallelJobs::p, DetId::rawId(), GEMDetId::region(), GEMDetId::ring(), GEMDetId::roll(), and GEMDetId::station().

Referenced by extractPrimitives().

RPCRoll
Definition: RPCRoll.h:12
simKBmtfStubs_cfi.minBX
minBX
Definition: simKBmtfStubs_cfi.py:9
mps_fire.i
i
Definition: mps_fire.py:355
cscTriggerPrimitiveDigis_cfi.maxDeltaRoll
maxDeltaRoll
Definition: cscTriggerPrimitiveDigis_cfi.py:335
L1MuDTChambThDigi::position
int position(const int i) const
Definition: L1MuDTChambThDigi.cc:90
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
L1MuDTChambPhDigi::stNum
int stNum() const
Definition: L1MuDTChambPhDigi.cc:72
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
GEMDetId::layer
constexpr int layer() const
Definition: GEMDetId.h:184
L1MuDTChambPhContainer::chPhiSegm1
L1MuDTChambPhDigi const * chPhiSegm1(int wheel, int stat, int sect, int bx) const
Definition: L1MuDTChambPhContainer.cc:67
phase2TrackerClusterizer_cfi.maxClusterSize
maxClusterSize
Definition: phase2TrackerClusterizer_cfi.py:6
GEMDetId::region
constexpr int region() const
Definition: GEMDetId.h:165
relativeConstraints.station
station
Definition: relativeConstraints.py:67
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
RPCDetId
Definition: RPCDetId.h:16
L1MuDTChambPhDigi::whNum
int whNum() const
Definition: L1MuDTChambPhDigi.cc:70
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
RPCGeometry::roll
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
DDAxes::x
simKBmtfStubs_cfi.minPhiQuality
minPhiQuality
Definition: simKBmtfStubs_cfi.py:7
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
edm::Handle
Definition: AssociativeIterator.h:50
cscTriggerPrimitiveDigis_cfi.maxDeltaBX
maxDeltaBX
Definition: cscTriggerPrimitiveDigis_cfi.py:336
L1TMuon::GeometryTranslator::getRPCGeometry
const RPCGeometry & getRPCGeometry() const
Definition: GeometryTranslator.h:56
L1TMuon::TriggerPrimitive
Definition: MuonTriggerPrimitive.h:56
b
double b
Definition: hdecay.h:118
EMTFSubsystemCollector::make_copad_gem
void make_copad_gem(const TriggerPrimitiveCollection &muon_primitives, TriggerPrimitiveCollection &copad_muon_primitives) const
Definition: EMTFSubsystemCollector.cc:430
GEMDetId::chamber
constexpr int chamber() const
Definition: GEMDetId.h:177
a
double a
Definition: hdecay.h:119
TriggerPrimitiveCollection
L1TMuon::TriggerPrimitiveCollection TriggerPrimitiveCollection
Definition: Common.h:32
L1MuDTChambPhContainer::chPhiSegm2
L1MuDTChambPhDigi const * chPhiSegm2(int wheel, int stat, int sect, int bx) const
Definition: L1MuDTChambPhContainer.cc:78
GEMDetId::roll
constexpr int roll() const
Definition: GEMDetId.h:188
GEMDetId
Definition: GEMDetId.h:17
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
iEvent
int iEvent
Definition: GenABIO.cc:224
simKBmtfStubs_cfi.maxBX
maxBX
Definition: simKBmtfStubs_cfi.py:10
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
L1MuDTChambPhDigi::scNum
int scNum() const
Definition: L1MuDTChambPhDigi.cc:71
L1MuDTChambThContainer::chThetaSegm
L1MuDTChambThDigi const * chThetaSegm(int wheel, int stat, int sect, int bx) const
Definition: L1MuDTChambThContainer.cc:65
RPCDetId::ring
int ring() const
Definition: RPCDetId.h:59
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
EMTFSubsystemCollector::cluster_rpc
void cluster_rpc(const TriggerPrimitiveCollection &muon_primitives, TriggerPrimitiveCollection &clus_muon_primitives) const
Definition: EMTFSubsystemCollector.cc:358
tier0.unique
def unique(seq, keepstr=True)
Definition: tier0.py:24
fileCollector.cmp
cmp
Definition: fileCollector.py:125
L1MuDTChambThDigi
Definition: L1MuDTChambThDigi.h:33
dtTriggerPhase2PrimitiveDigis_cfi.rpcRecHits
rpcRecHits
Definition: dtTriggerPhase2PrimitiveDigis_cfi.py:39
trklet::bend
double bend(double r, double rinv, double stripPitch)
Definition: Util.h:160
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
emtf_assert
#define emtf_assert(expr)
Definition: DebugTools.h:18
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
GEMDetId::station
constexpr int station() const
Definition: GEMDetId.h:173
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DTChamberId
Definition: DTChamberId.h:14
L1MuDTChambPhDigi::code
int code() const
Definition: L1MuDTChambPhDigi.cc:78
L1MuDTChambPhDigi
Definition: L1MuDTChambPhDigi.h:31
unpackBuffers-CaloStage2.token
token
Definition: unpackBuffers-CaloStage2.py:316
L1TMuon::TriggerPrimitive::kRPC
Definition: MuonTriggerPrimitive.h:59