-
Notifications
You must be signed in to change notification settings - Fork 421
Add value clamping for RooRealVar parameters #1166
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
Conversation
Avoid error with silent clipping (make it explicit) when setting POI values in scan for upper limits.
WalkthroughClamp POI input values to the parameter's min/max before assignment in HybridNew::eval; update test CMake to redirect combine command output to a reference file for the LHC-limits test. Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as Evaluation driver
participant Hybrid as HybridNew::eval
participant POI as POI parameter (r)
rect rgb(235,245,255)
Caller->>Hybrid: provide rIn (value)
Hybrid->>POI: getMin(), getMax()
note right of Hybrid: clamp value to [min,max]
Hybrid->>POI: setVal(clamped_value)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (3)📓 Common learnings📚 Learning: 2025-11-05T10:16:10.017ZApplied to files:
📚 Learning: 2025-11-05T10:12:07.843ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
🔇 Additional comments (1)
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 |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/HybridNew.cc (1)
716-718: Consider adding logging when clamping occurs for better observability.The clamping logic is correct, but it operates silently. Since the PR aims to prevent "unexpected silent clipping," consider adding log messages when values are clamped. Additionally, line 717's comment states "this should never be the case"—if this condition truly shouldn't occur, consider adding a warning or assertion to catch unexpected behavior during development.
Apply this diff to add logging:
- if ( rIn->getVal() > r->getMax() ) r->setVal(r->getMax()); - else if ( rIn->getVal() < r->getMin() ) r->setVal(r->getMin()); // this should never be the case - else r->setVal(rIn->getVal()); + if ( rIn->getVal() > r->getMax() ) { + if (verbose > 0) CombineLogger::instance().log("HybridNew.cc",__LINE__,std::string(Form("Clamping %s from %g to max %g", rIn->GetName(), rIn->getVal(), r->getMax())),__func__); + r->setVal(r->getMax()); + } + else if ( rIn->getVal() < r->getMin() ) { + CombineLogger::instance().log("HybridNew.cc",__LINE__,std::string(Form("[WARNING] Unexpected: clamping %s from %g to min %g (this should not happen)", rIn->GetName(), rIn->getVal(), r->getMin())),__func__); + r->setVal(r->getMin()); + } + else r->setVal(rIn->getVal());
|
Hi, thanks a lot! Would you mind also enabling the comparison with the reference file for the test that was failing before with ROOT master? It's just commenting these 4 lines back in and removing the TODO: |
|
Sure, just pushed that too |
Avoid error with silent clipping (make it explicit) when setting POI values in scan for upper limits.
Summary by CodeRabbit