Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CondFormats/HGCalObjects/interface/HGCalConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// @short configuration for ECON eRX (one half of HGROC)
struct HGCalROCConfig {
uint32_t charMode; // characterization mode; determines data fields in ROC dataframe
int32_t muxMode; // multiplexing mode; determines routing of eRx between the ROCs and ECON-Ds
COND_SERIALIZABLE;
};

Expand Down
13 changes: 8 additions & 5 deletions EventFilter/HGCalRawToDigi/src/HGCalUnpacker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,13 @@ uint16_t HGCalUnpacker::parseFEDData(unsigned fedId,
<< erxHeader << ", cmSum = " << std::dec << cmSum;
iword += 2;

const auto mux = fedConfig.econds[globalECONDIdx].rocs[erxIdx].muxMode;
Copy link
Copy Markdown
Contributor

@pfs pfs Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not making the static_cast directly here, or simple declaring const int32_t mux, that would avoid the repetition in the line below

int32_t delta = (static_cast<int>(mux) == -1) ? 0 : (static_cast<int>(mux) - static_cast<int>(erxIdx)) * 37;

// parse erx body (channel data)
uint32_t iBit = 0;
for (uint32_t channelIdx = 0; channelIdx < HGCalMappingCellIndexer::maxChPerErx_; channelIdx++) {
uint32_t denseIdx = moduleIndexer.getIndexForModuleData(fedId, globalECONDIdx, erxIdx, channelIdx);

uint32_t denseIdx = moduleIndexer.getIndexForModuleData(fedId, globalECONDIdx, erxIdx, channelIdx) + delta;
// check if the channel has data
if (((erxHeader >> channelIdx) & 1) == 0) {
continue;
Expand Down Expand Up @@ -396,15 +398,16 @@ uint16_t HGCalUnpacker::parseFEDData(unsigned fedId,
<< erxHeader << ", cmSum = " << std::dec << cmSum;
iword += 2;

const auto mux = fedConfig.econds[globalECONDIdx].rocs[erxIdx].muxMode;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as above, maybe use const int32_t directly?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated it.

int32_t delta = (static_cast<int>(mux) == -1) ? 0 : (static_cast<int>(mux) - static_cast<int>(erxIdx)) * 37;

// parse erx body (channel data)
for (uint32_t channelIdx = 0; channelIdx < HGCalMappingCellIndexer::maxChPerErx_; channelIdx++) {
uint32_t denseIdx = moduleIndexer.getIndexForModuleData(fedId, globalECONDIdx, erxIdx, channelIdx);

uint32_t denseIdx = moduleIndexer.getIndexForModuleData(fedId, globalECONDIdx, erxIdx, channelIdx) + delta;
// check if the channel has data
if (((erxHeader >> channelIdx) & 1) == 0) {
continue;
}

// check if in characterization mode
if (fedConfig.econds[globalECONDIdx].rocs[erxIdx / 2].charMode) {
//characterization mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ class HGCalConfigurationESProducer : public edm::ESProducer, public edm::EventSe
const auto modkey = hgcal::search_modkey(typecode, mod_config_data, modjsonurl); // search matching key
hgcal::check_keys(
mod_config_data, modkey, modkeys, modjsonurl); // check required keys are in the JSON, warn otherwise

if (mod_config_data[modkey].count("MultiPlex") == 0) {
edm::LogWarning("HGCalConfigurationESProducer") << "Missing MultiPlex key for module " << typecode << " in "
<< modjsonurl << ". Setting muxMode = -1 for all ROCs.";
}

if (imod >= fed.econds.size())
fed.econds.resize(imod + 1);

Expand Down Expand Up @@ -157,6 +163,10 @@ class HGCalConfigurationESProducer : public edm::ESProducer, public edm::EventSe
ntot_rocs++;
HGCalROCConfig roc;
roc.charMode = getint(mod_config_data[modkey]["CalibrationSC"][iroc], charMode_);
roc.muxMode = -1;
if (mod_config_data[modkey].count("MultiPlex") > 0 && iroc < mod_config_data[modkey]["MultiPlex"].size()) {
roc.muxMode = getint(mod_config_data[modkey]["MultiPlex"][iroc], -1);
}
mod.rocs[iroc] = roc; // add to ECON-D's vector<HGCalROCConfig> of eRx half-ROCs
}
fed.econds[imod] = mod; // add to FED's vector<HGCalECONDConfig> of ECON-D modules
Expand Down