20 fill_counters_(
config.getParameter<
bool>(
"fillAMCCounters")),
21 bx_min_(
config.getParameter<
int>(
"bxMin")),
22 bx_max_(
config.getParameter<
int>(
"bxMax")) {
35 feds.insert(cppf_link.first.getFED());
43 std::map<RPCAMCLink, rpcamc13::AMCPayload>
const& amc_payload) {
48 std::set<std::pair<RPCDetId, RPCDigi> > rpc_digis;
52 for (std::pair<RPCAMCLink const, rpcamc13::AMCPayload>
const&
payload : amc_payload) {
57 std::sort(rpc_cppf_digis->begin(), rpc_cppf_digis->end());
60 event.put(
std::move(counters),
"RPCAMCUnpacker");
67 std::set<std::pair<RPCDetId, RPCDigi> >& rpc_digis,
69 LogDebug(
"RPCCPPFRawToDigi") <<
"RPCCPPF " <<
link <<
", size " <<
payload.getData().size();
75 std::vector<std::uint64_t>::const_iterator
word(
payload.getData().begin());
81 std::vector<std::uint64_t>::const_iterator word_end(
payload.getData().end());
83 unsigned int bx_counter(
header.getBXCounter());
84 unsigned int bx_counter_mod(bx_counter % 27);
89 unsigned int pos(0), length(0);
90 unsigned int caption_id(0);
91 bool zs_per_bx(
false), have_bx_header(
false);
92 unsigned int bx_words(0);
93 unsigned int block_id(0);
94 std::uint32_t records[2];
96 records[0] = *
word & 0xffffffff;
97 records[1] = (*
word >> 32) & 0xffffffff;
102 <<
" caption id " << block_header.
getCaptionId() <<
" zs per bx "
110 have_bx_header =
false;
112 block_id = block_header.
getId();
113 }
else if (zs_per_bx && !have_bx_header) {
115 have_bx_header =
true;
117 if (caption_id == 0x01) {
119 }
else if (caption_id == 0x02) {
132 unsigned int bx_counter_mod,
135 std::set<std::pair<RPCDetId, RPCDigi> >& rpc_digis,
139 unsigned int fed(
link.getFED());
140 unsigned int amc_number(
link.getAMCNumber());
143 int bx_offset = (
int)(
record.getBXCounterMod() + 31 - bx_counter_mod) % 27 - 4;
149 LogDebug(
"RPCCPPFRawToDigi") <<
"Link in error for " <<
link;
151 }
else if (!
record.isAcknowledge()) {
155 LogDebug(
"RPCCPPFRawToDigi") <<
"Link without acknowledge for " <<
link;
164 int bx(bx_offset - (
int)(
record.getDelay()));
165 LogDebug(
"RPCCPPFRawToDigi") <<
"RPC BX " <<
bx <<
" for offset " << bx_offset;
176 LogDebug(
"RPCCPPFRawToDigi") <<
"Skipping unknown RPCCPPFLink " <<
link;
186 LogDebug(
"RPCCPPFRawToDigi") <<
"Skipping invalid LinkBoard " <<
record.getLinkBoard() <<
" for record " <<
link
196 LogDebug(
"RPCCPPFRawToDigi") <<
"Skipping invalid Connector " <<
record.getConnector() <<
" for record " <<
link
198 <<
") from " <<
link;
210 LogDebug(
"RPCCPPFRawToDigi") <<
"Could not find " << lb_link <<
" for record " <<
link <<
" (" << std::hex
215 if (bx < bx_min || bx > bx_max) {
225 unsigned int channel_offset(
record.getPartition() ? 9 : 1);
227 for (
unsigned int channel = 0; channel < 8; ++channel) {
228 if (
data & (0
x1 << channel)) {
229 unsigned int strip(feb_connector.
getStrip(channel + channel_offset));
231 rpc_digis.insert(std::pair<RPCDetId, RPCDigi>(det_id,
RPCDigi(
strip,
bx)));
232 LogDebug(
"RPCCPPFRawToDigi") <<
"RPCDigi " << det_id.rawId() <<
", " <<
strip <<
", " <<
bx;
251 static int const ring[6] = {2, 2, 2, 3, 2, 3};
252 static int const station[6] = {1, 2, 3, 3, 4, 4};
254 unsigned int endcap_sector((35 + (
link.getAMCNumber() - (
region > 0 ? 3 : 7)) * 9 + (
block >> 1)) % 36 + 1);
260 (endcap_sector / 6) + 1
264 (endcap_sector - 1) % 6 + 1
279 std::vector<RPCDigi> local_rpc_digis;
280 for (std::pair<RPCDetId, RPCDigi>
const& rpc_digi : rpc_digis) {
281 LogDebug(
"RPCCPPFRawToDigi") <<
"RPCDigi " << rpc_digi.first.rawId() <<
", " << rpc_digi.second.strip() <<
", "
282 << rpc_digi.second.bx();
283 if (rpc_digi.first != rpc_det_id) {
284 if (!local_rpc_digis.empty()) {
286 local_rpc_digis.clear();
288 rpc_det_id = rpc_digi.first;
290 local_rpc_digis.push_back(rpc_digi.second);
292 if (!local_rpc_digis.empty()) {
296 event.put(
std::move(rpc_digi_collection));