diff --git a/EventFilter/RPCRawToDigi/plugins/RPCAMCUnpacker.cc b/EventFilter/RPCRawToDigi/plugins/RPCAMCUnpacker.cc index 2e9a5713d1069..7920ef76716f2 100644 --- a/EventFilter/RPCRawToDigi/plugins/RPCAMCUnpacker.cc +++ b/EventFilter/RPCRawToDigi/plugins/RPCAMCUnpacker.cc @@ -10,6 +10,7 @@ void RPCAMCUnpacker::fillDescription(edm::ParameterSetDescription& desc) { pset.add("fillAMCCounters", true); pset.add("bxMin", -2); pset.add("bxMax", +2); + pset.add("cppfDaqDelay", 0); desc.add("RPCAMCUnpackerSettings", pset); } diff --git a/EventFilter/RPCRawToDigi/plugins/RPCCPPFUnpacker.cc b/EventFilter/RPCRawToDigi/plugins/RPCCPPFUnpacker.cc index ab893d3c55783..072eae4ba7a26 100644 --- a/EventFilter/RPCRawToDigi/plugins/RPCCPPFUnpacker.cc +++ b/EventFilter/RPCRawToDigi/plugins/RPCCPPFUnpacker.cc @@ -21,6 +21,7 @@ RPCCPPFUnpacker::RPCCPPFUnpacker(edm::ParameterSet const& config, fill_counters_(config.getParameter("fillAMCCounters")), bx_min_(config.getParameter("bxMin")), bx_max_(config.getParameter("bxMax")), + cppfDaq_Delay_(config.getParameter("cppfDaqDelay")), es_cppf_link_map_br_token_( consumesCollector.esConsumes()), es_cppf_link_map_token_(consumesCollector.esConsumes()), @@ -88,7 +89,7 @@ bool RPCCPPFUnpacker::processCPPF(RPCAMCLink const& link, unsigned int bx_counter(header.getBXCounter()); unsigned int bx_counter_mod(bx_counter % 27); - int bx_min(bx_min_), bx_max(bx_max_); + int bx_min(bx_min_), bx_max(bx_max_), cppfDaq_Delay(cppfDaq_Delay_); // no adjustable bx window implemented in readout yet unsigned int pos(0), length(0); @@ -120,7 +121,8 @@ bool RPCCPPFUnpacker::processCPPF(RPCAMCLink const& link, have_bx_header = true; } else { if (caption_id == 0x01) { // RX - processRXRecord(link, bx_counter_mod, rpccppf::RXRecord(*record), counters, rpc_digis, bx_min, bx_max); + processRXRecord( + link, bx_counter_mod, rpccppf::RXRecord(*record), counters, rpc_digis, bx_min, bx_max, cppfDaq_Delay); } else if (caption_id == 0x02) { // TX processTXRecord(link, block_id, 6 - bx_words, rpccppf::TXRecord(*record), rpc_cppf_digis); } @@ -139,7 +141,8 @@ void RPCCPPFUnpacker::processRXRecord(RPCAMCLink link, RPCAMCLinkCounters& counters, std::set >& rpc_digis, int bx_min, - int bx_max) const { + int bx_max, + int cppfDaq_Delay) const { LogDebug("RPCCPPFRawToDigi") << "RXRecord " << std::hex << record.getRecord() << std::dec << std::endl; unsigned int fed(link.getFED()); unsigned int amc_number(link.getAMCNumber()); @@ -217,7 +220,8 @@ void RPCCPPFUnpacker::processRXRecord(RPCAMCLink link, return; } - if (bx < bx_min || bx > bx_max) { + auto bx_corrected = bx - cppfDaq_Delay; + if (bx_corrected < bx_min || bx_corrected > bx_max) { return; } @@ -233,8 +237,9 @@ void RPCCPPFUnpacker::processRXRecord(RPCAMCLink link, if (data & (0x1 << channel)) { unsigned int strip(feb_connector.getStrip(channel + channel_offset)); if (strip) { - rpc_digis.insert(std::pair(det_id, RPCDigi(strip, bx))); - LogDebug("RPCCPPFRawToDigi") << "RPCDigi " << det_id.rawId() << ", " << strip << ", " << bx; + rpc_digis.insert(std::pair(det_id, RPCDigi(strip, bx - cppfDaq_Delay_))); + LogDebug("RPCCPPFRawToDigi") << "RPCDigi " << det_id.rawId() << ", " << strip << ", " << bx << ", " + << bx - cppfDaq_Delay_; } } } diff --git a/EventFilter/RPCRawToDigi/plugins/RPCCPPFUnpacker.h b/EventFilter/RPCRawToDigi/plugins/RPCCPPFUnpacker.h index 66b67830420fc..f2acd8a7f4c39 100644 --- a/EventFilter/RPCRawToDigi/plugins/RPCCPPFUnpacker.h +++ b/EventFilter/RPCRawToDigi/plugins/RPCCPPFUnpacker.h @@ -44,7 +44,8 @@ class RPCCPPFUnpacker : public RPCAMCUnpacker { RPCAMCLinkCounters& counters, std::set >& rpc_digis, int bx_min, - int bx_max) const; + int bx_max, + int cppfDaq_Delay) const; void processTXRecord(RPCAMCLink link, unsigned int block, unsigned int word, @@ -54,7 +55,7 @@ class RPCCPPFUnpacker : public RPCAMCUnpacker { protected: bool fill_counters_; - int bx_min_, bx_max_; + int bx_min_, bx_max_, cppfDaq_Delay_; edm::ESWatcher es_cppf_link_map_watcher_; edm::ESHandle es_cppf_link_map_; diff --git a/EventFilter/RPCRawToDigi/python/RPCCPPFRawToDigi_cfi.py b/EventFilter/RPCRawToDigi/python/RPCCPPFRawToDigi_cfi.py index f8dbdb8644429..9af218d794e07 100644 --- a/EventFilter/RPCRawToDigi/python/RPCCPPFRawToDigi_cfi.py +++ b/EventFilter/RPCRawToDigi/python/RPCCPPFRawToDigi_cfi.py @@ -5,3 +5,8 @@ RPCAMCUnpacker = 'RPCCPPFUnpacker', RPCAMCUnpackerSettings = dict() ) + +from Configuration.Eras.Modifier_run3_RPC_cff import run3_RPC +run3_RPC.toModify(rpcCPPFRawToDigi, + RPCAMCUnpackerSettings = dict(cppfDaqDelay = 2) +)