CMS 3D CMS Logo

RPCTPSelector.cc
Go to the documentation of this file.
2 
11 
13 
14 using namespace emtf::phase2;
15 
17  : context_(context), endcap_(endcap), sector_(sector) {}
18 
19 void RPCTPSelector::select(const TriggerPrimitive& tp, TPInfo tp_info, ILinkTPCMap& ilink_tpc_map) const {
20  emtf_assert(tp.subsystem() == L1TMuon::kRPC);
21 
22  // Map RPC trigger primitives to input links
23  int ilink = getInputLink(tp, tp_info); // Returns RPC "link" index
24 
25  // Short-Circuit: Link not found (ilink = -1)
26  if (ilink < 0) {
27  return;
28  }
29 
30  ilink_tpc_map[ilink].emplace_back(tp, tp_info);
31 }
32 
33 // ===========================================================================
34 // Utils
35 // ===========================================================================
37  int ilink = -1;
38 
39  // Unpack detector info
40  const int tp_endcap = tp_info.endcap;
41  const int tp_sector = tp_info.sector;
42  const int tp_subsector = tp_info.subsector;
43  const int tp_station = tp_info.station;
44  const int tp_ring = tp_info.ring;
45  const int tp_csc_id = tp_info.csc_id;
46 
47  const RPCData& tp_data = tp.getRPCData();
48  const int tp_emtf_sect = tp_data.emtf_sector;
49  const bool tp_is_CPPF = tp_data.isCPPF;
50 
51  // Short-Circuit: In neighbor chambers, have two separate CPPFDigis for the two EMTF sectors
52  if (tp_is_CPPF && (tp_emtf_sect != sector_))
53  return ilink;
54 
55  // Find selection type
56  auto tp_selection = TPSelection::kNone;
57 
58  if (csc::isTPInSector(endcap_, sector_, tp_endcap, tp_sector)) {
59  tp_selection = TPSelection::kNative;
60  } else if (this->context_.config_.include_neighbor_en_ &&
61  csc::isTPInNeighborSector(endcap_, sector_, tp_endcap, tp_sector, tp_subsector, tp_station, tp_csc_id)) {
62  tp_selection = TPSelection::kNeighbor;
63  } else { // Short-Circuit: tp_selection = TPSelection::kNone
64  return ilink;
65  }
66 
67  // Get chamber input link for this sector processor
68  ilink = calcInputLink(tp_subsector, tp_station, tp_ring, tp_csc_id, tp_selection);
69 
70  // Add selection info
71  tp_info.ilink = ilink;
72  tp_info.selection = tp_selection;
73 
74  return ilink;
75 }
76 
77 int RPCTPSelector::calcInputLink(const int& tp_subsector,
78  const int& tp_station,
79  const int& tp_ring,
80  const int& tp_csc_id,
81  const TPSelection& tp_selection) const {
82  int ilink = -1;
83 
84  // Links
85  // RE1,2,3,4 + GE1,2 : 54..71, 72..80, 81..89, 90..98
86  // RE1,2,3,4 + GE1,2 (N) : 99..101, 102..103, 104..105, 106..107
87 
88  if (tp_selection == TPSelection::kNative) {
89  const int ilink_offset = 54;
90 
91  if (tp_station == 1) {
92  ilink = ilink_offset + (tp_subsector - 1) * 9 + (tp_csc_id - 1);
93  } else {
94  ilink = ilink_offset + tp_station * 9 + (tp_csc_id - 1);
95  }
96 
97  emtf_assert((54 <= ilink) && (ilink < 99));
98  } else {
99  const int ilink_offset = 99;
100 
101  if (tp_station == 1) {
102  ilink = ilink_offset + ((tp_station - 1) * 2) + ((tp_csc_id - 1) / 3);
103  } else if (tp_ring == 1) {
104  ilink = ilink_offset + ((tp_station - 1) * 2) + 1;
105  } else {
106  ilink = ilink_offset + ((tp_station - 1) * 2) + 2;
107  }
108 
109  emtf_assert((99 <= ilink) && (ilink < 108));
110  }
111 
112  return ilink;
113 }
bool isTPInSector(int match_endcap, int match_sector, int tp_endcap, int tp_sector)
Definition: CSCUtils.cc:17
void select(const TriggerPrimitive &, TPInfo, ILinkTPCMap &) const final
RPCTPSelector(const EMTFContext &, const int &, const int &)
std::map< int, TPCollection > ILinkTPCMap
Definition: EMTFTypes.h:23
TPSelection selection
Definition: TPrimitives.h:21
#define emtf_assert(expr)
Definition: DebugTools.h:18
const EMTFContext & context_
Definition: RPCTPSelector.h:21
bool isTPInNeighborSector(int match_endcap, int match_sector, int tp_endcap, int tp_sector, int tp_subsector, int tp_station, int tp_id)
Definition: CSCUtils.cc:21
int getInputLink(const TriggerPrimitive &, TPInfo &) const
int calcInputLink(const int &, const int &, const int &, const int &, const TPSelection &) const
EMTFConfiguration config_
Definition: EMTFContext.h:39