21 fill_counters_(
config.getParameter<
bool>(
"fillAMCCounters")),
22 bx_min_(
config.getParameter<
int>(
"bxMin")),
23 bx_max_(
config.getParameter<
int>(
"bxMax")),
24 cppfDaq_Delay_(
config.getParameter<
int>(
"cppfDaqDelay")),
25 es_cppf_link_map_br_token_(
40 for (
auto const& cppf_link : link_map->getMap()) {
41 feds.insert(cppf_link.first.getFED());
49 std::map<RPCAMCLink, rpcamc13::AMCPayload>
const& amc_payload) {
54 std::set<std::pair<RPCDetId, RPCDigi> > rpc_digis;
58 for (std::pair<RPCAMCLink const, rpcamc13::AMCPayload>
const&
payload : amc_payload) {
63 std::sort(rpc_cppf_digis->begin(), rpc_cppf_digis->end());
73 std::set<std::pair<RPCDetId, RPCDigi> >& rpc_digis,
75 LogDebug(
"RPCCPPFRawToDigi") <<
"RPCCPPF " << link <<
", size " <<
payload.getData().size();
81 std::vector<std::uint64_t>::const_iterator
word(
payload.getData().begin());
87 std::vector<std::uint64_t>::const_iterator word_end(
payload.getData().end());
89 unsigned int bx_counter(
header.getBXCounter());
90 unsigned int bx_counter_mod(bx_counter % 27);
95 unsigned int pos(0), length(0);
96 unsigned int caption_id(0);
97 bool zs_per_bx(
false), have_bx_header(
false);
98 unsigned int bx_words(0);
99 unsigned int block_id(0);
100 std::uint32_t records[2];
102 records[0] = *
word & 0xffffffff;
103 records[1] = (*
word >> 32) & 0xffffffff;
108 <<
" caption id " << block_header.
getCaptionId() <<
" zs per bx " 116 have_bx_header =
false;
118 block_id = block_header.
getId();
119 }
else if (zs_per_bx && !have_bx_header) {
121 have_bx_header =
true;
123 if (caption_id == 0x01) {
126 }
else if (caption_id == 0x02) {
139 unsigned int bx_counter_mod,
142 std::set<std::pair<RPCDetId, RPCDigi> >& rpc_digis,
145 int cppfDaq_Delay)
const {
147 unsigned int fed(link.
getFED());
151 int bx_offset = (
int)(
record.getBXCounterMod() + 31 - bx_counter_mod) % 27 - 4;
157 LogDebug(
"RPCCPPFRawToDigi") <<
"Link in error for " << link;
159 }
else if (!
record.isAcknowledge()) {
163 LogDebug(
"RPCCPPFRawToDigi") <<
"Link without acknowledge for " << link;
172 int bx(bx_offset - (
int)(
record.getDelay()));
173 LogDebug(
"RPCCPPFRawToDigi") <<
"RPC BX " <<
bx <<
" for offset " << bx_offset;
184 LogDebug(
"RPCCPPFRawToDigi") <<
"Skipping unknown RPCCPPFLink " << link;
194 LogDebug(
"RPCCPPFRawToDigi") <<
"Skipping invalid LinkBoard " <<
record.getLinkBoard() <<
" for record " << link
204 LogDebug(
"RPCCPPFRawToDigi") <<
"Skipping invalid Connector " <<
record.getConnector() <<
" for record " << link
206 <<
") from " << link;
218 LogDebug(
"RPCCPPFRawToDigi") <<
"Could not find " << lb_link <<
" for record " << link <<
" (" << std::hex
223 auto bx_corrected =
bx - cppfDaq_Delay;
224 if (bx_corrected < bx_min || bx_corrected > bx_max) {
234 unsigned int channel_offset(
record.getPartition() ? 9 : 1);
236 for (
unsigned int channel = 0; channel < 8; ++channel) {
237 if (
data & (0
x1 << channel)) {
238 unsigned int strip(feb_connector.
getStrip(channel + channel_offset));
241 LogDebug(
"RPCCPPFRawToDigi") <<
"RPCDigi " << det_id.rawId() <<
", " <<
strip <<
", " <<
bx <<
", " 261 static int const ring[6] = {2, 2, 2, 3, 2, 3};
262 static int const station[6] = {1, 2, 3, 3, 4, 4};
270 (endcap_sector / 6) + 1
274 (endcap_sector - 1) % 6 + 1
289 std::vector<RPCDigi> local_rpc_digis;
290 for (std::pair<RPCDetId, RPCDigi>
const& rpc_digi : rpc_digis) {
291 LogDebug(
"RPCCPPFRawToDigi") <<
"RPCDigi " << rpc_digi.first.rawId() <<
", " << rpc_digi.second.strip() <<
", " 292 << rpc_digi.second.bx();
293 if (rpc_digi.first != rpc_det_id) {
294 if (!local_rpc_digis.empty()) {
296 local_rpc_digis.clear();
298 rpc_det_id = rpc_digi.first;
300 local_rpc_digis.push_back(rpc_digi.second);
302 if (!local_rpc_digis.empty()) {
306 event.put(
std::move(rpc_digi_collection));
void produce(edm::Event &event, edm::EventSetup const &setup, std::map< RPCAMCLink, rpcamc13::AMCPayload > const &amc_payload) override
void processRXRecord(RPCAMCLink link, unsigned int bx_counter_mod, rpccppf::RXRecord const &record, RPCAMCLinkCounters &counters, std::set< std::pair< RPCDetId, RPCDigi > > &rpc_digis, int bx_min, int bx_max, int cppfDaq_Delay) const
edm::ESHandle< RPCLBLinkMap > es_lb_link_map_
static unsigned int const input_connector_not_used_
edm::ESHandle< RPCAMCLinkMap > es_cppf_link_map_
ProductRegistryHelper::BranchAliasSetterT< ProductType > produces()
void processTXRecord(RPCAMCLink link, unsigned int block, unsigned int word, rpccppf::TXRecord const &record, l1t::CPPFDigiCollection &rpc_cppf_digis) const
static int const max_connector_
static unsigned int const input_link_error_
RPCAMCLink & setAMCInput(int amcinput=wildcard_)
static unsigned int const input_lb_invalid_
RPCLBLink & setConnector(int connector=wildcard_)
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t uint32_t CAHitNtupletGeneratorKernelsGPU::Counters * counters
edm::ESGetToken< RPCAMCLinkMap, RPCCPPFLinkMapRcd > es_cppf_link_map_br_token_
void beginRun(edm::Run const &run, edm::EventSetup const &setup) override
static unsigned int const amc_link_invalid_
RPCDetId getRPCDetId() const
MuonDigiCollection< RPCDetId, RPCDigi > RPCDigiCollection
bool processCPPF(RPCAMCLink const &link, rpcamc13::AMCPayload const &payload, RPCAMCLinkCounters &counters, std::set< std::pair< RPCDetId, RPCDigi > > &rpc_digis, l1t::CPPFDigiCollection &rpc_cppf_digis) const
edm::ESWatcher< RPCCPPFLinkMapRcd > es_cppf_link_map_watcher_
edm::ESGetToken< RPCLBLinkMap, RPCLBLinkMapRcd > es_lb_link_map_token_
void putRPCDigis(edm::Event &event, std::set< std::pair< RPCDetId, RPCDigi > > const &digis) const
static unsigned int const input_event_
static unsigned int const input_link_ack_fail_
std::pair< const_iterator, const_iterator > Range
RPCCPPFUnpacker(edm::ParameterSet const &, edm::ConsumesCollector, edm::ProducesCollector)
bool check(const edm::EventSetup &iSetup)
char data[epos_bytes_allocation]
unsigned int getStrip(unsigned int channel) const
edm::ESGetToken< RPCAMCLinkMap, RPCCPPFLinkMapRcd > es_cppf_link_map_token_
#define DEFINE_EDM_PLUGIN(factory, type, name)
RPCLBLink & setLinkBoard(int linkboard=wildcard_)
std::vector< CPPFDigi > CPPFDigiCollection
static int const max_linkboard_
static unsigned int const input_eod_
static unsigned int const input_connector_invalid_