Skip to content

Adding exit for missing calibrations#4181

Merged
pinkenburg merged 1 commit intosPHENIX-Collaboration:masterfrom
bseidlit:master
Feb 18, 2026
Merged

Adding exit for missing calibrations#4181
pinkenburg merged 1 commit intosPHENIX-Collaboration:masterfrom
bseidlit:master

Conversation

@bseidlit
Copy link
Contributor

@bseidlit bseidlit commented Feb 17, 2026

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work for users)
  • Requiring change in macros repository (Please provide links to the macros pull request in the last section)
  • I am a member of GitHub organization of sPHENIX Collaboration, EIC, or ECCE (contact Chris Pinkenburg to join)

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 (CaloTowerCalib and CaloTowerStatus). 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):

    • Added three new public setter methods: set_doAbortNoEnergyCalib(), set_doAbortNoTimeCalib(), set_doAbortNoZSCalib()
    • Added composite setter set_doAbortMissingCalib() to enable all three simultaneously
    • Added private boolean flags (default false) for each abort condition
    • Modified InitRun() to call gSystem->Exit(1) when a calibration is unavailable and its corresponding abort flag is enabled
  • CaloTowerStatus (CaloTowerStatus.h/cc):

    • Added three new public setter methods: set_doAbortNoChi2(), set_doAbortNoTime(), set_doAbortMissingCalib()
    • Added private boolean flags for chi2 and time (hotMap flag already existed)
    • Composite setter set_doAbortMissingCalib() sets all three flags at once
    • Modified InitRun() to call gSystem->Exit(1) when required calibrations are unavailable and abort flags are enabled

Potential Risk Areas

  • Backward Compatibility: All abort flags default to 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.
  • Job Execution: Hard exit via gSystem->Exit(1) will terminate the job immediately. No graceful shutdown or error recovery is possible once triggered.
  • Calibration Availability: Operators must ensure calibrations are available before enabling these flags, or jobs will fail systematically.

Notes

⚠️ AI-generated analysis: please use best judgment when reviewing code logic and control flow paths, particularly around the abort flag conditions and error messages.

Future Improvements

  • Consider implementing a more sophisticated error handling/logging system rather than hard exit
  • Unify abort configuration across all calorimeter subsystems
  • Add detailed logging showing which specific calibration is missing before exiting

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 17, 2026

📝 Walkthrough

Walkthrough

The 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

Cohort / File(s) Summary
CaloTowerCalib Configuration
offline/packages/CaloReco/CaloTowerCalib.h, offline/packages/CaloReco/CaloTowerCalib.cc
Added three private boolean abort flags (m_doAbortNoEnergyCalib, m_doAbortNoTimeCalib, m_doAbortNoZSCalib) with corresponding public setters and a composite setter. InitRun now checks these flags and calls exit(1) with diagnostic messages when calibrations are missing and abort mode is enabled.
CaloTowerStatus Configuration
offline/packages/CaloReco/CaloTowerStatus.h, offline/packages/CaloReco/CaloTowerStatus.cc
Added two new private boolean abort flags (m_doAbortNoTime, m_doAbortNoChi2) alongside the existing m_doAbortNoHotMap. Added public setters for individual flags plus a composite setter that controls all three simultaneously. InitRun behavior updated to abort with diagnostic messages when calibrations are absent and corresponding abort flags are active.
✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Comment on lines +160 to 165
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;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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;
       ...
     }
   }

@sphenix-jenkins-ci
Copy link

Build & test report

Report for commit 09e88174e67d2280cc6f3c24d625cf746782791c:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@pinkenburg pinkenburg merged commit 762be3d into sPHENIX-Collaboration:master Feb 18, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments