20 auto chamber = cscDigis->begin();
21 auto chend = cscDigis->end();
23 auto digi = (*chamber).second.first;
24 auto dend = (*chamber).second.second;
25 for( ; digi != dend; ++digi ) {
27 out.emplace_back((*chamber).first,*digi);
46 auto chamber = rpcDigis->begin();
47 auto chend = rpcDigis->end();
49 auto digi = (*chamber).second.first;
50 auto dend = (*chamber).second.second;
51 for( ; digi != dend; ++digi ) {
52 if ((*chamber).first.region() != 0) {
53 if ((*chamber).first.station() <= 2 && (*chamber).first.ring() == 3)
continue;
54 if ((*chamber).first.station() >= 3 && (*chamber).first.ring() == 1)
continue;
56 muon_primitives.emplace_back((*chamber).first,*digi);
66 std::copy(clus_muon_primitives.begin(), clus_muon_primitives.end(), std::back_inserter(out));
82 for (
auto digi : *cppfDigis) {
83 out.emplace_back(digi.rpcId(), digi);
102 auto chamber = gemDigis->begin();
103 auto chend = gemDigis->end();
105 auto digi = (*chamber).second.first;
106 auto dend = (*chamber).second.second;
107 for( ; digi != dend; ++digi ) {
108 muon_primitives.emplace_back((*chamber).first,*digi);
117 cluster_gem(copad_muon_primitives, clus_muon_primitives);
120 std::copy(clus_muon_primitives.begin(), clus_muon_primitives.end(), std::back_inserter(out));
131 bool operator()(
const value_type&
x)
const {
142 bool operator()(
const value_type& lhs,
const value_type& rhs)
const {
144 std::make_pair(std::make_pair(lhs.rawId(), lhs.getRPCData().bx), lhs.getRPCData().strip) <
145 std::make_pair(std::make_pair(rhs.rawId(), rhs.getRPCData().bx), rhs.getRPCData().strip)
153 bool operator()(
const value_type& lhs,
const value_type& rhs)
const {
155 std::make_pair(std::make_pair(lhs.rawId(), lhs.getRPCData().bx), lhs.getRPCData().strip) ==
156 std::make_pair(std::make_pair(rhs.rawId(), rhs.getRPCData().bx), rhs.getRPCData().strip)
167 bool operator()(
const value_type& lhs,
const value_type& rhs)
const {
169 (lhs.rawId() == rhs.rawId()) &&
170 (lhs.getRPCData().bx == rhs.getRPCData().bx) &&
171 (lhs.getRPCData().strip_hi+1 == rhs.getRPCData().strip_low)
179 void operator()(value_type& lhs, value_type& rhs) {
180 lhs.accessRPCData().strip_hi += 1;
188 std::copy_if(muon_primitives.begin(), muon_primitives.end(), std::back_inserter(clus_muon_primitives), rpc_digi_select);
191 std::stable_sort(clus_muon_primitives.begin(), clus_muon_primitives.end(), rpc_digi_less);
194 clus_muon_primitives.erase(
195 std::unique(clus_muon_primitives.begin(), clus_muon_primitives.end(), rpc_digi_equal),
196 clus_muon_primitives.end()
200 clus_muon_primitives.erase(
201 adjacent_cluster(clus_muon_primitives.begin(), clus_muon_primitives.end(), rpc_digi_adjacent, rpc_digi_cluster),
202 clus_muon_primitives.end()
214 const unsigned int maxDeltaBX = 1;
215 const unsigned int maxDeltaPadGE11 = 2;
216 const unsigned int maxDeltaPadGE21 = 2;
218 std::map<int, TriggerPrimitiveCollection> in_pads_layer1, in_pads_layer2;
220 TriggerPrimitiveCollection::const_iterator tp_it = muon_primitives.begin();
221 TriggerPrimitiveCollection::const_iterator tp_end = muon_primitives.end();
223 for (; tp_it != tp_end; ++tp_it) {
229 assert(tp_detId.
layer() == 1 || tp_detId.
layer() == 2);
230 if (tp_detId.
layer() == 1) {
231 in_pads_layer1[tp_detId.
rawId()].push_back(muon_primitive);
233 in_pads_layer2[tp_detId.
rawId()].push_back(muon_primitive);
237 bool modified_copad_logic =
false;
238 if (modified_copad_logic) {
239 if (tp_detId.
layer() == 1) {
244 in_pads_layer2[co_detId.
rawId()].push_back(co_muon_primitive);
250 in_pads_layer1[co_detId.
rawId()].push_back(co_muon_primitive);
256 std::map<int, TriggerPrimitiveCollection>::iterator map_tp_it = in_pads_layer1.begin();
257 std::map<int, TriggerPrimitiveCollection>::iterator map_tp_end = in_pads_layer1.end();
259 for (; map_tp_it != map_tp_end; ++map_tp_it) {
260 const GEMDetId&
id = map_tp_it->first;
262 assert(
id.layer() == 1);
268 auto found = in_pads_layer2.find(co_id);
269 if (
found == in_pads_layer2.end())
continue;
273 for (TriggerPrimitiveCollection::const_iterator
p = pads.begin();
p != pads.end(); ++
p) {
274 for (TriggerPrimitiveCollection::const_iterator co_p = co_pads.begin(); co_p != co_pads.end(); ++co_p) {
275 unsigned int deltaPad =
std::abs(
p->getGEMData().pad - co_p->getGEMData().pad);
276 unsigned int deltaBX =
std::abs(
p->getGEMData().bx - co_p->getGEMData().bx);
279 if ((
id.
station() == 1 && deltaPad > maxDeltaPadGE11) || (
id.station() == 2 && deltaPad > maxDeltaPadGE21))
283 if (deltaBX > maxDeltaBX)
287 copad_muon_primitives.push_back(*
p);
297 bool operator()(
const value_type&
x)
const {
308 bool operator()(
const value_type& lhs,
const value_type& rhs)
const {
310 std::make_pair(std::make_pair(lhs.rawId(), lhs.getGEMData().bx), lhs.getGEMData().pad) <
311 std::make_pair(std::make_pair(rhs.rawId(), rhs.getGEMData().bx), rhs.getGEMData().pad)
319 bool operator()(
const value_type& lhs,
const value_type& rhs)
const {
321 std::make_pair(std::make_pair(lhs.rawId(), lhs.getGEMData().bx), lhs.getGEMData().pad) ==
322 std::make_pair(std::make_pair(rhs.rawId(), rhs.getGEMData().bx), rhs.getGEMData().pad)
333 bool operator()(
const value_type& lhs,
const value_type& rhs)
const {
335 (lhs.rawId() == rhs.rawId()) &&
336 (lhs.getGEMData().bx == rhs.getGEMData().bx) &&
337 (lhs.getGEMData().pad_hi+1 == rhs.getGEMData().pad_low)
345 void operator()(value_type& lhs, value_type& rhs) {
346 lhs.accessGEMData().pad_hi += 1;
354 std::copy_if(muon_primitives.begin(), muon_primitives.end(), std::back_inserter(clus_muon_primitives), gem_digi_select);
357 std::stable_sort(clus_muon_primitives.begin(), clus_muon_primitives.end(), gem_digi_less);
360 clus_muon_primitives.erase(
361 std::unique(clus_muon_primitives.begin(), clus_muon_primitives.end(), gem_digi_equal),
362 clus_muon_primitives.end()
366 clus_muon_primitives.erase(
367 adjacent_cluster(clus_muon_primitives.begin(), clus_muon_primitives.end(), gem_digi_adjacent, gem_digi_cluster),
368 clus_muon_primitives.end()
void cluster_rpc(const TriggerPrimitiveCollection &muon_primitives, TriggerPrimitiveCollection &clus_muon_primitives) const
const subsystem_type subsystem() const
const GEMData getGEMData() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
constexpr uint32_t rawId() const
get the raw id
void extractPrimitives(T tag, const edm::Event &iEvent, const edm::EDGetToken &token, TriggerPrimitiveCollection &out) const
Container::value_type value_type
def unique(seq, keepstr=True)
int layer() const
Layer id: each station have two layers of chambers: layer 1 is the inner chamber and layer 2 is the o...
Abs< T >::type abs(const T &t)
void make_copad_gem(const TriggerPrimitiveCollection &muon_primitives, TriggerPrimitiveCollection &copad_muon_primitives) const
L1TMuon::TriggerPrimitiveCollection TriggerPrimitiveCollection
void cluster_gem(const TriggerPrimitiveCollection &muon_primitives, TriggerPrimitiveCollection &clus_muon_primitives) const