Skip to content

[6.40] [RF][HF] Support setting ShapeFactor value and range#22642

Merged
guitargeek merged 2 commits into
root-project:v6-40-00-patchesfrom
root-project-bot:BP_6.40_pull_20723
Jun 17, 2026
Merged

[6.40] [RF][HF] Support setting ShapeFactor value and range#22642
guitargeek merged 2 commits into
root-project:v6-40-00-patchesfrom
root-project-bot:BP_6.40_pull_20723

Conversation

@root-project-bot

Copy link
Copy Markdown

Backport of #20723, requested by @guitargeek.

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)
@guitargeek guitargeek merged commit ed101fb into root-project:v6-40-00-patches Jun 17, 2026
30 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants