15 if (max_bx - min_bx >= 128 || min_bx < -3564) {
16 throw cms::Exception(
"RPCLBPacker") <<
"Out-of-range input for min_bx, max_bx (" << min_bx <<
": " << max_bx <<
")";
19 std::map<RPCLBLink, std::vector<RPCLBRecord> > mlb_lbrecords;
25 std::pair<RPCInverseLBLinkMap::map_type::const_iterator, RPCInverseLBLinkMap::map_type::const_iterator> lookup_range(
26 lb_map.
getMap().equal_range(digi_range_value.first.rawId()));
30 if (digi->bx() < min_bx || digi->bx() > max_bx) {
34 for (RPCInverseLBLinkMap::map_type::const_iterator link_it = lookup_range.first; link_it != lookup_range.second;
36 if (link_it->second.second.hasStrip(digi->strip())) {
37 unsigned int channel(link_it->second.second.getChannel(digi->strip()));
41 mlb_lbrecords[mlb_link].push_back(
RPCLBRecord(digi->bx() - min_bx,
47 (channel > 8 ? 1 : 0),
48 0x01 << ((channel - 1) % 8)));
56 for (
std::map<
RPCLBLink, std::vector<RPCLBRecord> >::iterator mlb_lbrecords_it = mlb_lbrecords.begin();
57 mlb_lbrecords_it != mlb_lbrecords.end();
59 std::vector<RPCLBRecord>&
input(mlb_lbrecords_it->second);
60 std::sort(input.begin(), input.end());
62 std::vector<std::pair<int, RPCLBRecord> > bx_lbrecord;
63 bx_lbrecord.reserve(input.size());
67 for (std::vector<RPCLBRecord>::const_iterator input_it = input.begin() + 1; input_it <= input.end(); ++input_it) {
68 if (input_it != input.end() && ((last_lbrecord.getRecord() & ~
RPCLBRecord::partition_data_mask_) ==
69 (input_it->getRecord() & ~
RPCLBRecord::partition_data_mask_))) {
70 last_lbrecord.set(last_lbrecord.getRecord() | input_it->getRecord());
72 unsigned int last_bcn(last_lbrecord.getBCN());
76 unsigned int delay(idx - last_bcn);
77 if (ignore_eod && delay == 8) {
80 bx_lbrecord.back().second.setEOD(
true);
81 last_lbrecord.setEOD(
true);
84 last_lbrecord.setDelay(delay);
85 last_bcn = (3564 + bcn + min_bx +
idx) % 3564;
86 last_lbrecord.setBCN(last_bcn);
87 last_lbrecord.setBC0(last_bcn == 0);
88 bx_lbrecord.push_back(std::pair<int, RPCLBRecord>(min_bx + idx, last_lbrecord));
91 bx_lbrecord.back().second.setEOD(
true);
93 if (input_it != input.end()) {
94 last_lbrecord = *input_it;
100 mlb_lbrecords_it->first, bx_lbrecord));
RPCLBLink & setConnector(int connector=wildcard_)
static std::string const input
Container::value_type value_type
static void getRPCLBRecords(RPCInverseLBLinkMap const &lb_map, int min_bx, int max_bx, unsigned int bcn, RPCDigiCollection const &digis, std::map< RPCLBLink, std::vector< std::pair< int, RPCLBRecord > > > &mlb_bx_lbrecord, bool ignore_eod=false)
std::pair< IndexType, std::pair< DigiRangeIterator, DigiRangeIterator > > value_type
std::vector< RPCDigi >::const_iterator const_iterator
RPCLBLink & setLinkBoard(int linkboard=wildcard_)