-
Notifications
You must be signed in to change notification settings - Fork 4.7k
HD full module readout corrected #50644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
9351489
91a8b28
c97a23a
8501e33
32a156e
bf65c8d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -324,10 +324,12 @@ uint16_t HGCalUnpacker::parseFEDData(unsigned fedId, | |
| << erxHeader << ", cmSum = " << std::dec << cmSum; | ||
| iword += 2; | ||
|
|
||
| const auto mux = fedConfig.econds[globalECONDIdx].rocs[erxIdx].muxMode; | ||
| uint32_t delta = (mux - erxIdx) * 37; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic looks correct, but since the shift can be ±37, (mux - erxIdx) can be negative? When computed with uint32_t, which I understand cannot represent negative numbers, this wraps to a large positive value and may produce incorrect indices. A simple fix is to use signed arithmetic with int for the delta since both max and erxIdx are defined as uint32_t:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated the delta to be 0 if mux is -1 or else calculate the delta value by shifting the indices. |
||
| // 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) { | ||
|
|
@@ -396,9 +398,12 @@ uint16_t HGCalUnpacker::parseFEDData(unsigned fedId, | |
| << erxHeader << ", cmSum = " << std::dec << cmSum; | ||
| iword += 2; | ||
|
|
||
| const auto mux = fedConfig.econds[globalECONDIdx].rocs[erxIdx].muxMode; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same comment as above, maybe use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated it. |
||
| uint32_t delta = (mux - erxIdx) * 37; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated the delta to be 0 if mux is -1 or else calculate the delta value by shifting the indices. |
||
|
|
||
| // 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) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,7 +87,7 @@ class HGCalConfigurationESProducer : public edm::ESProducer, public edm::EventSe | |
| uint32_t nfeds = moduleMap.numFEDs(); | ||
| uint32_t ntot_mods = 0, ntot_rocs = 0; | ||
| const std::vector<std::string> fedkeys = {"mismatchPassthroughMode", "cbHeaderMarker", "slinkHeaderMarker"}; | ||
| const std::vector<std::string> modkeys = {"headerMarker", "CalibrationSC"}; | ||
| const std::vector<std::string> modkeys = {"headerMarker", "CalibrationSC", "MultiPlex"}; | ||
| if (nfeds != fed_config_data.size()) | ||
| edm::LogWarning("HGCalConfigurationESProducer") | ||
| << "Total number of FEDs found in JSON file " << fedjsonurl << " (" << fed_config_data.size() | ||
|
|
@@ -157,6 +157,7 @@ class HGCalConfigurationESProducer : public edm::ESProducer, public edm::EventSe | |
| ntot_rocs++; | ||
| HGCalROCConfig roc; | ||
| roc.charMode = getint(mod_config_data[modkey]["CalibrationSC"][iroc], charMode_); | ||
| roc.muxMode = getint(mod_config_data[modkey]["MultiPlex"][iroc], -1); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see a similar potential issue here. getint(..., -1) is assigned to muxMode, which is a uint32_t. If the value is missing, -1 will wrap to a large positive value, which could silently break the remapping logic. Could you clarify what getint should return and whether -1 is intended as an invalid case or for indexing purposes? Maybe consider using a signed type for muxMode, or explicitly validating this case here and throwing an exception.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated the muxMode to signed integer and throw a warning if MultiPlex key does not exist in config file and set the muxMode to -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 | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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