[6.40] [RF][HF] Support setting ShapeFactor value and range#22642
Merged
guitargeek merged 2 commits intoJun 17, 2026
Merged
Conversation
Adds a Sample::AddShapeFactor overload that takes the initial value and the range of the ShapeFactor gammas, analogous to AddNormFactor. This is important e.g. for ABCD estimates, where the hard-coded default range can cause convergence problems. The value and range are persisted to and read back from both XML and ROOT files, and a dedicated test covers the full round trips as well as the resulting workspace parameters. The ShapeFactor element in the XML schema (HistFactorySchema.dtd) is updated accordingly. The value and range use the same 'Val' / 'Low' / 'High' attribute and accessor names as NormFactor for consistency. Closes root-project#20697. 🤖 Done with the help of AI for writing the tests. (cherry picked from commit ecb0adc)
Sample::PrintXML now writes the "Const" attribute for ShapeFactors, so a ShapeFactor that was marked constant via SetConstant() keeps that state when a Measurement is written to XML and read back. The read side and schema were already in place: **ConfigParser::MakeShapeFactor** parses the "Const" attribute, and the ShapeFactor element declares it in HistFactorySchema.dtd. Only the writer was missing it, so the const-ness was silently lost on a PrintXML round trip. The attribute is always emitted as "True"/"False", matching how other booleans (NormalizeByTheory, StatError's Activate) are written. Unlike NormFactor, whose const-ness is handled at the Measurement level via `<ParamSetting Const="True">`, ShapeFactor carries its own per-bin constant flag (wired into the gamma parameters in HistoToWorkspaceFactoryFast), which is why it needs to be persisted on the element itself. 🤖 Done by AI. (cherry picked from commit 3c8740f)
ed101fb
into
root-project:v6-40-00-patches
30 of 34 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #20723, requested by @guitargeek.