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::DTTag 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
 
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::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<>
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::CPPFTag tag, const GeometryTranslator *tp_geom, const edm::Event &iEvent, const edm::EDGetToken &token, 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::ME0Tag tag, const GeometryTranslator *tp_geom, const edm::Event &iEvent, const edm::EDGetToken &token, 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 363 of file EMTFSubsystemCollector.cc.

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

Referenced by extractPrimitives().

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

◆ extractPrimitives() [1/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.

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

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 }
L1MuDTChambThDigi const * chThetaSegm(int wheel, int stat, int sect, int bx) const
int position(const int i) const
int iEvent
Definition: GenABIO.cc:224
def unique(seq, keepstr=True)
Definition: tier0.py:24
L1MuDTChambPhDigi const * chPhiSegm2(int wheel, int stat, int sect, int bx) const
#define emtf_assert(expr)
Definition: DebugTools.h:18
L1TMuon::TriggerPrimitiveCollection TriggerPrimitiveCollection
Definition: Common.h:32
L1MuDTChambPhDigi const * chPhiSegm1(int wheel, int stat, int sect, int bx) const

◆ extractPrimitives() [2/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() [3/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

◆ extractPrimitives() [4/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.

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

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 }
int iEvent
Definition: GenABIO.cc:224

◆ extractPrimitives() [5/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.

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

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 }
void cluster_rpc(const TriggerPrimitiveCollection &muon_primitives, TriggerPrimitiveCollection &clus_muon_primitives) const
int iEvent
Definition: GenABIO.cc:224
L1TMuon::TriggerPrimitiveCollection TriggerPrimitiveCollection
Definition: Common.h:32

◆ extractPrimitives() [6/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.

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

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 }
int ring() const
Definition: RPCDetId.h:59
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
int iEvent
Definition: GenABIO.cc:224
const RPCGeometry & getRPCGeometry() const
int station() const
Definition: RPCDetId.h:78
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53

◆ extractPrimitives() [7/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.

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

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 }
void cluster_rpc(const TriggerPrimitiveCollection &muon_primitives, TriggerPrimitiveCollection &clus_muon_primitives) const
int iEvent
Definition: GenABIO.cc:224
L1TMuon::TriggerPrimitiveCollection TriggerPrimitiveCollection
Definition: Common.h:32

◆ extractPrimitives() [8/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.

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

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 }
int ring() const
Definition: RPCDetId.h:59
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
int iEvent
Definition: GenABIO.cc:224
const RPCGeometry & getRPCGeometry() const
int station() const
Definition: RPCDetId.h:78
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53

◆ extractPrimitives() [9/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.

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

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

◆ extractPrimitives() [10/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.

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

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  auto detid = (*chamber).first;
321  // temporarily ignore 16-partition GE2/1 clusters, because the EMTF
322  // is not yet adapted to handle these objects
323  if (detid.isGE21() and digi->nPartitions() == GEMPadDigi::GE21SplitStrip)
324  continue;
325  muon_primitives.emplace_back((*chamber).first, *digi);
326  }
327  }
328 
329  // Make GEM coincidence pads
330  TriggerPrimitiveCollection copad_muon_primitives;
331  make_copad_gem(muon_primitives, copad_muon_primitives);
332 
333  // Output
334  std::copy(copad_muon_primitives.begin(), copad_muon_primitives.end(), std::back_inserter(out));
335  return;
336 }
void make_copad_gem(const TriggerPrimitiveCollection &muon_primitives, TriggerPrimitiveCollection &copad_muon_primitives) const
int iEvent
Definition: GenABIO.cc:224
L1TMuon::TriggerPrimitiveCollection TriggerPrimitiveCollection
Definition: Common.h:32

◆ extractPrimitives() [11/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 341 of file EMTFSubsystemCollector.cc.

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

345  {
347  iEvent.getByToken(token, me0Digis);
348 
349  auto chamber = me0Digis->begin();
350  auto chend = me0Digis->end();
351  for (; chamber != chend; ++chamber) {
352  auto digi = (*chamber).second.first;
353  auto dend = (*chamber).second.second;
354  for (; digi != dend; ++digi) {
355  out.emplace_back((*chamber).first, *digi);
356  }
357  }
358  return;
359 }
int iEvent
Definition: GenABIO.cc:224

◆ make_copad_gem()

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

Definition at line 435 of file EMTFSubsystemCollector.cc.

References a, funct::abs(), b, GEMDetId::chamber(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), emtf_assert, newFWLiteAna::found, nano_mu_digi_cff::layer, GEMDetId::layer(), gemcscParams::maxDeltaBX, gemcscParams::maxDeltaRoll, AlCaHLTBitMon_ParallelJobs::p, DetId::rawId(), GEMDetId::region(), GEMDetId::ring(), nano_mu_digi_cff::roll, GEMDetId::roll(), and GEMDetId::station().

Referenced by extractPrimitives().

436  {
437  // Use the inner layer (layer 1) hit coordinates as output, and the outer
438  // layer (layer 2) as coincidence
439 
440  // Adapted from L1Trigger/CSCTriggerPrimitives/src/GEMCoPadProcessor.cc
441  constexpr unsigned int maxDeltaBX = 1;
442  constexpr unsigned int maxDeltaRoll = 1;
443  constexpr unsigned int maxDeltaPadGE11 = 3; // it was 2
444  constexpr unsigned int maxDeltaPadGE21 = 2;
445 
446  // Make sure that the difference is calculated using signed integer, and
447  // output the absolute difference (as unsigned integer)
448  auto calculate_delta = [](int a, int b) -> unsigned int { return std::abs(a - b); };
449 
450  // Create maps of GEM pads (key = detid), split by layer
451  std::map<uint32_t, TriggerPrimitiveCollection> in_pads_layer1, in_pads_layer2;
452 
453  auto tp_it = muon_primitives.begin();
454  auto tp_end = muon_primitives.end();
455 
456  for (; tp_it != tp_end; ++tp_it) {
457  GEMDetId detid = tp_it->detId<GEMDetId>();
458  emtf_assert(detid.layer() == 1 || detid.layer() == 2);
459  emtf_assert(1 <= detid.roll() && detid.roll() <= 8);
460  uint32_t layer = detid.layer();
461 
462  // Remove layer number and roll number from detid
463  detid = GEMDetId(detid.region(), detid.ring(), detid.station(), 0, detid.chamber(), 0);
464 
465  if (layer == 1) {
466  in_pads_layer1[detid.rawId()].push_back(*tp_it);
467  } else {
468  in_pads_layer2[detid.rawId()].push_back(*tp_it);
469  }
470  }
471 
472  // Build coincidences
473  copad_muon_primitives.clear();
474 
475  auto map_tp_it = in_pads_layer1.begin();
476  auto map_tp_end = in_pads_layer1.end();
477 
478  for (; map_tp_it != map_tp_end; ++map_tp_it) {
479  const GEMDetId& detid = map_tp_it->first;
480  const TriggerPrimitiveCollection& pads = map_tp_it->second;
481 
482  // find all corresponding ids with layer 2
483  auto found = in_pads_layer2.find(detid);
484 
485  // empty range = no possible coincidence pads
486  if (found == in_pads_layer2.end())
487  continue;
488 
489  // now let's correlate the pads in two layers of this partition
490  const TriggerPrimitiveCollection& co_pads = found->second;
491  for (auto p = pads.begin(); p != pads.end(); ++p) {
492  bool has_copad = false;
493 
494  for (auto co_p = co_pads.begin(); co_p != co_pads.end() && !has_copad; ++co_p) {
495  // check the match in pad
496  unsigned int deltaPad = calculate_delta(p->getGEMData().pad, co_p->getGEMData().pad);
497  if ((detid.station() == 1 && deltaPad > maxDeltaPadGE11) ||
498  (detid.station() == 2 && deltaPad > maxDeltaPadGE21))
499  continue;
500  // check the match in BX
501  unsigned int deltaBX = calculate_delta(p->getGEMData().bx, co_p->getGEMData().bx);
502  if (deltaBX > maxDeltaBX)
503  continue;
504  // check the match in roll
505  unsigned int deltaRoll = calculate_delta(p->detId<GEMDetId>().roll(), co_p->detId<GEMDetId>().roll());
506  if (deltaRoll > maxDeltaRoll)
507  continue;
508  has_copad = true;
509  } // end loop over co_pads
510 
511  // make a new coincidence pad digi
512  if (has_copad) {
513  copad_muon_primitives.push_back(*p);
514  }
515  } // end loop over pads
516  } // end loop over in_pads_layer1
517 }
constexpr int station() const
Definition: GEMDetId.h:179
constexpr int region() const
Definition: GEMDetId.h:171
constexpr int layer() const
Definition: GEMDetId.h:190
constexpr int chamber() const
Definition: GEMDetId.h:183
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr int ring() const
Definition: GEMDetId.h:176
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
#define emtf_assert(expr)
Definition: DebugTools.h:18
double b
Definition: hdecay.h:120
constexpr int roll() const
Definition: GEMDetId.h:194
double a
Definition: hdecay.h:121
L1TMuon::TriggerPrimitiveCollection TriggerPrimitiveCollection
Definition: Common.h:32