21 , fill_counters_(config.getParameter<
bool>(
"fillAMCCounters"))
22 , bx_min_(config.getParameter<
int>(
"bxMin"))
23 , bx_max_(config.getParameter<
int>(
"bxMax"))
38 feds.insert(cppf_link.first.getFED());
40 feds_.assign(feds.begin(), feds.end());
45 , std::map<RPCAMCLink, rpcamc13::AMCPayload>
const & amc_payload)
51 std::set<std::pair<RPCDetId, RPCDigi> > rpc_digis;
55 for (std::pair<RPCAMCLink const, rpcamc13::AMCPayload>
const &
payload : amc_payload) {
57 , *counters, rpc_digis, *rpc_cppf_digis);
61 std::sort(rpc_cppf_digis->begin(), rpc_cppf_digis->end());
64 event.put(
std::move(counters),
"RPCAMCUnpacker");
70 , std::set<std::pair<RPCDetId, RPCDigi> > & rpc_digis
73 LogDebug(
"RPCCPPFRawToDigi") <<
"RPCCPPF " << link
74 <<
", size " << payload.
getData().size();
80 std::vector<std::uint64_t>::const_iterator word(payload.
getData().begin());
85 std::vector<std::uint64_t>::const_iterator word_end(payload.
getData().end());
87 unsigned int bx_counter(header.getBXCounter());
88 unsigned int bx_counter_mod(bx_counter % 27);
93 unsigned int pos(0), length(0);
94 unsigned int caption_id(0);
95 bool zs_per_bx(
false), have_bx_header(
false);
96 unsigned int bx_words(0);
97 unsigned int block_id(0);
98 std::uint32_t records[2];
99 for ( ; word != word_end ; ++word) {
100 records[0] = *word & 0xffffffff;
101 records[1] = (*word >> 32) & 0xffffffff;
109 <<
" length " << block_header.
getLength()
110 <<
" " << word_end - word;
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
141 ,
int bx_min,
int bx_max)
const 144 unsigned int fed(link.
getFED());
154 LogDebug(
"RPCCPPFRawToDigi") <<
"Link in error for " << link;
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;
192 <<
" for record " << link <<
" (" << std::hex << record.
getRecord()
203 <<
" for record " << link <<
" (" << std::hex << record.
getRecord()
205 <<
") from " << link;
217 LogDebug(
"RPCCPPFRawToDigi") <<
"Could not find " << lb_link
218 <<
" for record " << link <<
" (" << std::hex << record.
getRecord()
220 <<
") from " << link;
224 if (bx < bx_min || bx > 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));
240 rpc_digis.insert(std::pair<RPCDetId, RPCDigi>(det_id,
RPCDigi(
strip, bx)));
241 LogDebug(
"RPCCPPFRawToDigi") <<
"RPCDigi " << det_id.rawId()
242 <<
", " <<
strip <<
", " << bx;
262 static int const ring[6] = {2, 2, 2, 3, 2, 3};
263 static int const station[6] = {1, 2, 3, 3, 4, 4};
265 unsigned int endcap_sector((35 + (link.
getAMCNumber() - (region > 0 ? 3 : 7)) * 9 + (block >> 1)) % 36 + 1);
269 , (endcap_sector / 6) + 1
271 , (endcap_sector - 1) % 6 + 1
283 , std::set<std::pair<RPCDetId, RPCDigi> >
const & rpc_digis)
const 287 std::vector<RPCDigi> local_rpc_digis;
288 for (std::pair<RPCDetId, RPCDigi>
const & rpc_digi : rpc_digis) {
289 LogDebug(
"RPCCPPFRawToDigi") <<
"RPCDigi " << rpc_digi.first.rawId()
290 <<
", " << rpc_digi.second.strip() <<
", " << rpc_digi.second.bx();
291 if (rpc_digi.first != rpc_det_id) {
292 if (!local_rpc_digis.empty()) {
294 local_rpc_digis.clear();
296 rpc_det_id = rpc_digi.first;
298 local_rpc_digis.push_back(rpc_digi.second);
300 if (!local_rpc_digis.empty()) {
304 event.put(
std::move(rpc_digi_collection));
unsigned int getDelay() const
unsigned int getStrip(unsigned int channel) const
edm::ESHandle< RPCLBLinkMap > es_lb_link_map_
std::uint8_t getPartitionData() const
static unsigned int const input_connector_not_used_
bool isValid(unsigned int index) const
void produce(edm::Event &event, edm::EventSetup const &setup, std::map< RPCAMCLink, rpcamc13::AMCPayload > const &amc_payload)
edm::ESHandle< RPCAMCLinkMap > es_cppf_link_map_
unsigned int getBXCounterMod() const
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
static int const max_connector_
static unsigned int const input_link_error_
std::uint32_t const & getRecord() const
RPCAMCLink & setAMCInput(int amcinput=wildcard_)
static unsigned int const input_lb_invalid_
unsigned int getPartition() const
RPCLBLink & setConnector(int connector=wildcard_)
def setup(process, global_tag, zero_tesla=False)
std::vector< std::uint64_t > const & getData() const
static unsigned int const amc_link_invalid_
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) const
unsigned int getConnector() const
RPCCPPFUnpacker(edm::stream::EDProducerBase &producer, edm::ParameterSet const &config)
MuonDigiCollection< RPCDetId, RPCDigi > RPCDigiCollection
unsigned int getPhi(unsigned int index) const
unsigned int getTheta(unsigned int index) const
edm::ESWatcher< RPCCPPFLinkMapRcd > es_cppf_link_map_watcher_
static unsigned int const input_event_
void add(unsigned int event, RPCAMCLink const &link, unsigned int count=1)
void beginRun(edm::Run const &run, edm::EventSetup const &setup)
static unsigned int const input_link_ack_fail_
void putRPCDigis(edm::Event &event, std::set< std::pair< RPCDetId, RPCDigi > > const &digis) const
bool check(const edm::EventSetup &iSetup)
char data[epos_bytes_allocation]
unsigned int getLink() const
std::pair< const_iterator, const_iterator > Range
#define DEFINE_EDM_PLUGIN(factory, type, name)
RPCLBLink & setLinkBoard(int linkboard=wildcard_)
unsigned int getLinkBoard() const
bool isAcknowledge() const
std::vector< CPPFDigi > CPPFDigiCollection
void processTXRecord(RPCAMCLink link, unsigned int block, unsigned int word, rpccppf::TXRecord const &record, l1t::CPPFDigiCollection &rpc_cppf_digis) const
RPCDetId getRPCDetId() const
static int const max_linkboard_
static unsigned int const input_eod_
static unsigned int const input_connector_invalid_