Skip to content

Replace RooRealVar::removeRange() usage#1243

Open
guitargeek wants to merge 1 commit intocms-analysis:mainfrom
guitargeek:removeRange
Open

Replace RooRealVar::removeRange() usage#1243
guitargeek wants to merge 1 commit intocms-analysis:mainfrom
guitargeek:removeRange

Conversation

@guitargeek
Copy link
Copy Markdown
Collaborator

@guitargeek guitargeek commented Mar 23, 2026

ROOT has deprecated the RooRealVar::removeRange() method, because the name was confusing:

root-project/root#21548

Instead, one should explicitly call removeMin() and removeMax().

Summary by CodeRabbit

  • Bug Fixes

    • Improved parameter bound handling across physics models and utility functions for better ROOT v6.30 compatibility.
    • Fixed parameter constraint removal logic to correctly handle unlimited parameter ranges in Higgs mass parameters and dummy variables.
  • Documentation

    • Updated tutorial documentation to reflect improved parameter bound handling procedures.

ROOT has deprecated the `RooRealVar::removeRange()` method, because the
name was confusing:

root-project/root#21548

Instead, one should explicitly call `removeMin()` and `removeMax()`.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 23, 2026

📝 Walkthrough

Walkthrough

This pull request refactors parameter range removal across physics model and utility code files. Instead of calling removeRange() to remove the entire range, the code now explicitly removes bounds separately using removeMin() and removeMax(). This change is applied consistently across Higgs mass handling, parameter configuration, and shape generation code.

Changes

Cohort / File(s) Summary
Python Physics Models
python/PhysicsModel.py, python/TwoHiggsModels.py, python/HiggsJPC.py, python/TagAndProbeModel.py, python/DegenerateMatrixRank.py
Replaced removeRange() calls with separate removeMin() and removeMax() calls in Higgs mass parameter handling. Added local variable caching for self.modelBuilder.out.var("MH") to optimize repeated lookups.
Utility/Tools Files
python/ModelTools.py, python/ShapeTools.py
Changed range removal for extension arguments and dummy weight variables from removeRange() to explicit removeMin() and removeMax() calls.
C++ Source Files
src/utils.cc, src/Combine.cc
Updated parameter range handling and comment documentation to reflect separation of bound removal: removeMin() and removeMax() instead of single removeRange() call for unlimited parameter ranges.
Documentation
docs/model_building_tutorial2024/model_building_exercise.md
Updated tutorial to show new parameter bound removal pattern using separate removeMin() and removeMax() calls.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 Bounds once removed in one swift call,
Now split apart, a cleaner fall—
Min and max their separate ways,
Parameters dance through better days!
Refactoring hops through every file,
Hopping makes the code more worthwhile! 🐇

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 56.25% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the main change: replacing RooRealVar::removeRange() calls with removeMin() and removeMax() across multiple files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Copy Markdown
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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/Combine.cc`:
- Line 510: Run git-clang-format on the source file containing the Combine
implementation (the file with the comment about removeMin() and removeMax());
specifically format the file named Combine.cc so that the clang-format CI job
passes, commit the resulting changes, and push them; this will correct the style
issues flagged for symbols like removeMin and removeMax.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 99aa0729-3387-4df9-8bbb-f6c5214184b0

📥 Commits

Reviewing files that changed from the base of the PR and between c5c3dc3 and 2284e00.

📒 Files selected for processing (10)
  • docs/model_building_tutorial2024/model_building_exercise.md
  • python/DegenerateMatrixRank.py
  • python/HiggsJPC.py
  • python/ModelTools.py
  • python/PhysicsModel.py
  • python/ShapeTools.py
  • python/TagAndProbeModel.py
  • python/TwoHiggsModels.py
  • src/Combine.cc
  • src/utils.cc

}
// look for parameters ranged [-1e+30, 1e+30], corresponding to the old definition of unlimited parameters,
// since ROOT v6.30 have to removeRange() to keep them unlimited
// since ROOT v6.30 have to removeMin() and removeMax() to keep them unlimited
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.

⚠️ Potential issue | 🟡 Minor

Run git-clang-format on this file before merge.

The clang-format job is already failing on src/Combine.cc, so this comment-only hunk is still blocking CI.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Combine.cc` at line 510, Run git-clang-format on the source file
containing the Combine implementation (the file with the comment about
removeMin() and removeMax()); specifically format the file named Combine.cc so
that the clang-format CI job passes, commit the resulting changes, and push
them; this will correct the style issues flagged for symbols like removeMin and
removeMax.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 20.89%. Comparing base (c5c3dc3) to head (2284e00).

Files with missing lines Patch % Lines
src/utils.cc 50.00% 2 Missing ⚠️

❌ Your patch check has failed because the patch coverage (50.00%) is below the target coverage (98.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1243   +/-   ##
=======================================
  Coverage   20.89%   20.89%           
=======================================
  Files         195      195           
  Lines       26310    26310           
  Branches     3947     3947           
=======================================
  Hits         5498     5498           
  Misses      20812    20812           
Files with missing lines Coverage Δ
src/Combine.cc 50.17% <ø> (ø)
src/utils.cc 41.40% <50.00%> (ø)
Files with missing lines Coverage Δ
src/Combine.cc 50.17% <ø> (ø)
src/utils.cc 41.40% <50.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant