Adding exit for missing calibrations#4181
Adding exit for missing calibrations#4181pinkenburg merged 1 commit intosPHENIX-Collaboration:masterfrom
Conversation
📝 WalkthroughWalkthroughThe changes add configurable abort-on-missing-calibration flags to CaloTowerCalib and CaloTowerStatus classes. When critical calibrations (energy, time, ZS-cross, chi2, or hot-map) are unavailable during InitRun, the detector can now halt with an error message if the corresponding abort flag is enabled, or continue with defaults if disabled. Changes
✨ Finishing touches
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| if (m_doAbortNoTimeCalib) | ||
| { | ||
| std::cout << "CaloTowerCalib::InitRun: No time calibration found for " << m_calibName_time << " and abort mode is set. Exiting." << std::endl; | ||
| gSystem->Exit(1); | ||
| } | ||
| m_dotimecalib = false; |
There was a problem hiding this comment.
m_doAbortNoTimeCalib fires even when time calibration is intentionally disabled.
The ZS calibration block (line 178) is wrapped in if (m_doZScrosscalib), so its abort check is never reached when ZS is disabled. The time calibration block has no equivalent guard. If a user calls set_doCalibOnly(true) (which sets m_dotimecalib = false) and then set_doAbortMissingCalib(true), InitRun will still enter the time calibration block, find an empty CDB URL, and hit gSystem->Exit(1) — even though the time calibration was intentionally turned off.
🐛 Proposed fix: guard the time calibration block analogously to the ZS block
- if (m_giveDirectURL_time)
+ if (m_dotimecalib && m_giveDirectURL_time)
{
calibdir = m_directURL_time;
std::cout << "CaloTowerCalib::InitRun: Using setted url " << calibdir << std::endl;
cdbttree_time = new CDBTTree(calibdir);
}
- else
+ else if (m_dotimecalib)
{
calibdir = CDBInterface::instance()->getUrl(m_calibName_time);
if (!calibdir.empty())
{
cdbttree_time = new CDBTTree(calibdir);
...
}
else
{
if (m_doAbortNoTimeCalib)
{
...
}
m_dotimecalib = false;
...
}
}
Build & test reportReport for commit 09e88174e67d2280cc6f3c24d625cf746782791c:
Automatically generated by sPHENIX Jenkins continuous integration |



Types of changes
What kind of change does this PR introduce? (Bug fix, feature, ...)
TODOs (if applicable)
Links to other PRs in macros and calibration repositories (if applicable)
Summary
This PR adds optional abort-on-missing-calibration functionality to the calorimeter tower calibration and status modules (
CaloTowerCalibandCaloTowerStatus). When enabled, jobs will exit immediately if required calibration data cannot be loaded, providing early detection of configuration issues.Motivation
Previously, when calibrations were unavailable, the reconstruction code would silently continue with default values or skip certain processing steps. This PR allows operators to explicitly require calibrations to be present and configured correctly before processing begins, preventing silent failures or unintended behavior.
Key Changes
CaloTowerCalib (
CaloTowerCalib.h/cc):set_doAbortNoEnergyCalib(),set_doAbortNoTimeCalib(),set_doAbortNoZSCalib()set_doAbortMissingCalib()to enable all three simultaneouslyfalse) for each abort conditionInitRun()to callgSystem->Exit(1)when a calibration is unavailable and its corresponding abort flag is enabledCaloTowerStatus (
CaloTowerStatus.h/cc):set_doAbortNoChi2(),set_doAbortNoTime(),set_doAbortMissingCalib()set_doAbortMissingCalib()sets all three flags at onceInitRun()to callgSystem->Exit(1)when required calibrations are unavailable and abort flags are enabledPotential Risk Areas
false, so existing behavior is preserved unless explicitly enabled. However, if these flags are enabled in macro configurations, jobs will now fail hard if calibrations are missing rather than attempting recovery with defaults.gSystem->Exit(1)will terminate the job immediately. No graceful shutdown or error recovery is possible once triggered.Notes
Future Improvements