Skip to content

Commit

Permalink
Merge pull request #38979 from mileva/cppfDelayFix_v12_4X
Browse files Browse the repository at this point in the history
fix the delay of the CPPF DAQ data for backport to 12_4_X
  • Loading branch information
cmsbuild authored Aug 12, 2022
2 parents 027fb10 + d545cc0 commit d69804c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions EventFilter/RPCRawToDigi/plugins/RPCAMCUnpacker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ void RPCAMCUnpacker::fillDescription(edm::ParameterSetDescription& desc) {
pset.add<bool>("fillAMCCounters", true);
pset.add<int>("bxMin", -2);
pset.add<int>("bxMax", +2);
pset.add<int>("cppfDaqDelay", 0);
desc.add<edm::ParameterSetDescription>("RPCAMCUnpackerSettings", pset);
}

Expand Down
17 changes: 11 additions & 6 deletions EventFilter/RPCRawToDigi/plugins/RPCCPPFUnpacker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ RPCCPPFUnpacker::RPCCPPFUnpacker(edm::ParameterSet const& config,
fill_counters_(config.getParameter<bool>("fillAMCCounters")),
bx_min_(config.getParameter<int>("bxMin")),
bx_max_(config.getParameter<int>("bxMax")),
cppfDaq_Delay_(config.getParameter<int>("cppfDaqDelay")),
es_cppf_link_map_br_token_(
consumesCollector.esConsumes<RPCAMCLinkMap, RPCCPPFLinkMapRcd, edm::Transition::BeginRun>()),
es_cppf_link_map_token_(consumesCollector.esConsumes<RPCAMCLinkMap, RPCCPPFLinkMapRcd>()),
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
Expand All @@ -139,7 +141,8 @@ void RPCCPPFUnpacker::processRXRecord(RPCAMCLink link,
RPCAMCLinkCounters& counters,
std::set<std::pair<RPCDetId, RPCDigi> >& 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());
Expand Down Expand Up @@ -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;
}

Expand All @@ -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<RPCDetId, RPCDigi>(det_id, RPCDigi(strip, bx)));
LogDebug("RPCCPPFRawToDigi") << "RPCDigi " << det_id.rawId() << ", " << strip << ", " << bx;
rpc_digis.insert(std::pair<RPCDetId, RPCDigi>(det_id, RPCDigi(strip, bx - cppfDaq_Delay_)));
LogDebug("RPCCPPFRawToDigi") << "RPCDigi " << det_id.rawId() << ", " << strip << ", " << bx << ", "
<< bx - cppfDaq_Delay_;
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions EventFilter/RPCRawToDigi/plugins/RPCCPPFUnpacker.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ class RPCCPPFUnpacker : public RPCAMCUnpacker {
RPCAMCLinkCounters& counters,
std::set<std::pair<RPCDetId, RPCDigi> >& 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,
Expand All @@ -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<RPCCPPFLinkMapRcd> es_cppf_link_map_watcher_;
edm::ESHandle<RPCAMCLinkMap> es_cppf_link_map_;
Expand Down
5 changes: 5 additions & 0 deletions EventFilter/RPCRawToDigi/python/RPCCPPFRawToDigi_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)

0 comments on commit d69804c

Please sign in to comment.