20 iEvent.getByToken(token1, phiContainer);
23 iEvent.getByToken(token2, thetaContainer);
29 constexpr
int minBX = -3;
30 constexpr
int maxBX = 3;
34 for (
int sector = 0; sector < 12; sector++) {
48 bool has_theta_segm =
false;
53 if (theta_segm !=
nullptr) {
54 has_theta_segm =
true;
56 for (
unsigned int i = 0;
i < 7; ++
i) {
70 if (phi_segm_high !=
nullptr) {
74 muon_primitives.emplace_back(detid, *phi_segm_high, *theta_segm, bti_group1);
76 muon_primitives.emplace_back(detid, *phi_segm_high, 1);
82 if (phi_segm_low !=
nullptr) {
86 muon_primitives.emplace_back(detid, *phi_segm_low, *theta_segm, bti_group2);
88 muon_primitives.emplace_back(detid, *phi_segm_low, 2);
94 if (phi_segm_high !=
nullptr && phi_segm_low ==
nullptr && bti_group1 != bti_group2) {
96 muon_primitives.emplace_back(detid, *phi_segm_high, *theta_segm, bti_group2);
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));
122 auto chamber = cscDigis->begin();
123 auto chend = cscDigis->end();
125 auto digi = (*chamber).second.first;
126 auto dend = (*chamber).second.second;
127 for (; digi != dend; ++digi) {
128 out.emplace_back((*chamber).first, *digi);
147 auto chamber = rpcDigis->begin();
148 auto chend = rpcDigis->end();
150 auto digi = (*chamber).second.first;
151 auto dend = (*chamber).second.second;
152 for (; digi != dend; ++digi) {
153 if ((*chamber).first.region() != 0) {
154 if ((*chamber).first.station() <= 2 && (*chamber).first.ring() == 3)
156 if ((*chamber).first.station() >= 3 && (*chamber).first.ring() == 1)
159 muon_primitives.emplace_back((*chamber).first, *digi);
166 cluster_rpc(muon_primitives, clus_muon_primitives);
169 std::copy(clus_muon_primitives.begin(), clus_muon_primitives.end(), std::back_inserter(
out));
191 for (; rechit != rhend; ++rechit) {
192 const RPCDetId& detid = rechit->rpcId();
197 if (detid.
region() != 0) {
204 out.emplace_back(detid, *rechit);
224 auto chamber = irpcDigis->begin();
225 auto chend = irpcDigis->end();
227 auto digi = (*chamber).second.first;
228 auto dend = (*chamber).second.second;
229 for (; digi != dend; ++digi) {
230 if ((*chamber).first.region() != 0) {
231 if (!((*chamber).first.station() >= 3 && (*chamber).first.ring() == 1))
234 muon_primitives.emplace_back((*chamber).first, *digi);
241 cluster_rpc(muon_primitives, clus_muon_primitives);
244 std::copy(clus_muon_primitives.begin(), clus_muon_primitives.end(), std::back_inserter(
out));
262 iEvent.getByToken(token2, irpcRecHits);
264 auto rechit = irpcRecHits->begin();
265 auto rhend = irpcRecHits->end();
266 for (; rechit != rhend; ++rechit) {
267 const RPCDetId& detid = rechit->rpcId();
272 if (detid.
region() != 0) {
277 out.emplace_back(detid, *rechit);
295 for (
const auto& digi : *cppfDigis) {
296 out.emplace_back(digi.rpcId(), digi);
314 auto chamber = gemDigis->begin();
315 auto chend = gemDigis->end();
317 auto digi = (*chamber).second.first;
318 auto dend = (*chamber).second.second;
319 for (; digi != dend; ++digi) {
320 auto detid = (*chamber).first;
325 muon_primitives.emplace_back((*chamber).first, *digi);
334 std::copy(copad_muon_primitives.begin(), copad_muon_primitives.end(), std::back_inserter(
out));
349 auto chamber = me0Digis->begin();
350 auto chend = me0Digis->end();
352 auto digi = (*chamber).second.first;
353 auto dend = (*chamber).second.second;
354 for (; digi != dend; ++digi) {
355 out.emplace_back((*chamber).first, *digi);
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));
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));
399 bool cmp = ((lhs.rawId() == rhs.rawId()) && (lhs.getRPCData().bx == rhs.getRPCData().bx) &&
400 (lhs.getRPCData().strip_hi + 1 == rhs.getRPCData().strip_low));
408 lhs.accessRPCData().strip_hi += 1;
416 clus_muon_primitives.clear();
418 muon_primitives.begin(), muon_primitives.end(), std::back_inserter(clus_muon_primitives), rpc_digi_select);
421 std::stable_sort(clus_muon_primitives.begin(), clus_muon_primitives.end(), rpc_digi_less);
424 clus_muon_primitives.erase(
std::unique(clus_muon_primitives.begin(), clus_muon_primitives.end(), rpc_digi_equal),
425 clus_muon_primitives.end());
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());
443 constexpr
unsigned int maxDeltaPadGE11 = 3;
444 constexpr
unsigned int maxDeltaPadGE21 = 2;
448 auto calculate_delta = [](
int a,
int b) ->
unsigned int {
return std::abs(
a -
b); };
451 std::map<uint32_t, TriggerPrimitiveCollection> in_pads_layer1, in_pads_layer2;
453 auto tp_it = muon_primitives.begin();
454 auto tp_end = muon_primitives.end();
456 for (; tp_it != tp_end; ++tp_it) {
466 in_pads_layer1[detid.
rawId()].push_back(*tp_it);
468 in_pads_layer2[detid.
rawId()].push_back(*tp_it);
473 copad_muon_primitives.clear();
475 auto map_tp_it = in_pads_layer1.begin();
476 auto map_tp_end = in_pads_layer1.end();
478 for (; map_tp_it != map_tp_end; ++map_tp_it) {
479 const GEMDetId& detid = map_tp_it->first;
483 auto found = in_pads_layer2.find(detid);
486 if (
found == in_pads_layer2.end())
491 for (
auto p = pads.begin();
p != pads.end(); ++
p) {
492 bool has_copad =
false;
495 for (
auto co_p = co_pads.begin(); co_p != co_pads.end(); ++co_p) {
496 unsigned int deltaPad = calculate_delta(
p->getGEMData().pad, co_p->getGEMData().pad);
497 unsigned int deltaBX = calculate_delta(
p->getGEMData().bx, co_p->getGEMData().bx);
498 unsigned int deltaRoll = calculate_delta(
p->detId<
GEMDetId>().
roll(), co_p->detId<
GEMDetId>().roll());
501 if ((detid.
station() == 1 && deltaPad > maxDeltaPadGE11) ||
502 (detid.
station() == 2 && deltaPad > maxDeltaPadGE21))
516 if (static_cast<unsigned int>(
std::abs(
bend)) > deltaPad) {
517 if (co_p->getGEMData().pad >=
p->getGEMData().pad)
525 bool isEven = (detid.
chamber() % 2 == 0);
532 copad_muon_primitives.push_back(*
p);