21 fill_counters_(
config.getParameter<
bool>(
"fillAMCCounters")),
22 bx_min_(
config.getParameter<
int>(
"bxMin")),
23 bx_max_(
config.getParameter<
int>(
"bxMax")),
24 es_cppf_link_map_br_token_(
39 for (
auto const& cppf_link : link_map->getMap()) {
40 feds.insert(cppf_link.first.getFED());
48 std::map<RPCAMCLink, rpcamc13::AMCPayload>
const& amc_payload) {
53 std::set<std::pair<RPCDetId, RPCDigi> > rpc_digis;
57 for (std::pair<RPCAMCLink const, rpcamc13::AMCPayload>
const&
payload : amc_payload) {
62 std::sort(rpc_cppf_digis->begin(), rpc_cppf_digis->end());
72 std::set<std::pair<RPCDetId, RPCDigi> >& rpc_digis,
74 LogDebug(
"RPCCPPFRawToDigi") <<
"RPCCPPF " <<
link <<
", size " <<
payload.getData().size();
80 std::vector<std::uint64_t>::const_iterator
word(
payload.getData().begin());
86 std::vector<std::uint64_t>::const_iterator word_end(
payload.getData().end());
88 unsigned int bx_counter(
header.getBXCounter());
89 unsigned int bx_counter_mod(bx_counter % 27);
94 unsigned int pos(0), length(0);
95 unsigned int caption_id(0);
96 bool zs_per_bx(
false), have_bx_header(
false);
97 unsigned int bx_words(0);
98 unsigned int block_id(0);
99 std::uint32_t records[2];
101 records[0] = *
word & 0xffffffff;
102 records[1] = (*
word >> 32) & 0xffffffff;
107 <<
" caption id " << block_header.
getCaptionId() <<
" zs per bx "
115 have_bx_header =
false;
117 block_id = block_header.
getId();
118 }
else if (zs_per_bx && !have_bx_header) {
120 have_bx_header =
true;
122 if (caption_id == 0x01) {
124 }
else if (caption_id == 0x02) {
137 unsigned int bx_counter_mod,
140 std::set<std::pair<RPCDetId, RPCDigi> >& rpc_digis,
144 unsigned int fed(
link.getFED());
145 unsigned int amc_number(
link.getAMCNumber());
148 int bx_offset = (
int)(
record.getBXCounterMod() + 31 - bx_counter_mod) % 27 - 4;
154 LogDebug(
"RPCCPPFRawToDigi") <<
"Link in error for " <<
link;
156 }
else if (!
record.isAcknowledge()) {
160 LogDebug(
"RPCCPPFRawToDigi") <<
"Link without acknowledge for " <<
link;
169 int bx(bx_offset - (
int)(
record.getDelay()));
170 LogDebug(
"RPCCPPFRawToDigi") <<
"RPC BX " <<
bx <<
" for offset " << bx_offset;
181 LogDebug(
"RPCCPPFRawToDigi") <<
"Skipping unknown RPCCPPFLink " <<
link;
191 LogDebug(
"RPCCPPFRawToDigi") <<
"Skipping invalid LinkBoard " <<
record.getLinkBoard() <<
" for record " <<
link
201 LogDebug(
"RPCCPPFRawToDigi") <<
"Skipping invalid Connector " <<
record.getConnector() <<
" for record " <<
link
203 <<
") from " <<
link;
215 LogDebug(
"RPCCPPFRawToDigi") <<
"Could not find " << lb_link <<
" for record " <<
link <<
" (" << std::hex
220 if (bx < bx_min || bx > bx_max) {
230 unsigned int channel_offset(
record.getPartition() ? 9 : 1);
232 for (
unsigned int channel = 0; channel < 8; ++channel) {
233 if (
data & (0
x1 << channel)) {
234 unsigned int strip(feb_connector.
getStrip(channel + channel_offset));
236 rpc_digis.insert(std::pair<RPCDetId, RPCDigi>(det_id,
RPCDigi(
strip,
bx)));
237 LogDebug(
"RPCCPPFRawToDigi") <<
"RPCDigi " << det_id.rawId() <<
", " <<
strip <<
", " <<
bx;
256 static int const ring[6] = {2, 2, 2, 3, 2, 3};
257 static int const station[6] = {1, 2, 3, 3, 4, 4};
259 unsigned int endcap_sector((35 + (
link.getAMCNumber() - (
region > 0 ? 3 : 7)) * 9 + (
block >> 1)) % 36 + 1);
265 (endcap_sector / 6) + 1
269 (endcap_sector - 1) % 6 + 1
284 std::vector<RPCDigi> local_rpc_digis;
285 for (std::pair<RPCDetId, RPCDigi>
const& rpc_digi : rpc_digis) {
286 LogDebug(
"RPCCPPFRawToDigi") <<
"RPCDigi " << rpc_digi.first.rawId() <<
", " << rpc_digi.second.strip() <<
", "
287 << rpc_digi.second.bx();
288 if (rpc_digi.first != rpc_det_id) {
289 if (!local_rpc_digis.empty()) {
291 local_rpc_digis.clear();
293 rpc_det_id = rpc_digi.first;
295 local_rpc_digis.push_back(rpc_digi.second);
297 if (!local_rpc_digis.empty()) {
301 event.put(
std::move(rpc_digi_collection));