Skip to content

[RF][HF] Support setting ShapeFactor value and range#20723

Merged
guitargeek merged 2 commits into
root-project:masterfrom
guitargeek:issue-20697
Jun 17, 2026
Merged

[RF][HF] Support setting ShapeFactor value and range#20723
guitargeek merged 2 commits into
root-project:masterfrom
guitargeek:issue-20697

Conversation

@guitargeek

@guitargeek guitargeek commented Dec 15, 2025

Copy link
Copy Markdown
Contributor

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 #20697.

@github-actions

github-actions Bot commented Dec 16, 2025

Copy link
Copy Markdown

Test Results

    22 files      22 suites   3d 13h 59m 45s ⏱️
 3 849 tests  3 847 ✅  1 💤 1 ❌
76 910 runs  76 891 ✅ 18 💤 1 ❌

For more details on these failures, see this check.

Results for commit fcdcbbe.

♻️ This comment has been updated with latest results.

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

@lmoneta lmoneta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@guitargeek

Copy link
Copy Markdown
Contributor Author

Backporting also to 6.40 on request by ATLAS (@TomasDado)

@guitargeek guitargeek merged commit 3c8740f into root-project:master Jun 17, 2026
27 of 30 checks passed
@guitargeek guitargeek deleted the issue-20697 branch June 17, 2026 11:53
@guitargeek

Copy link
Copy Markdown
Contributor Author

/backport to 6.40

@root-project-bot

Copy link
Copy Markdown

Preparing to backport PR #20723 to branch 6.40 requested by guitargeek

@root-project-bot

Copy link
Copy Markdown

This PR has been backported to branch 6.40: #22642

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.

[RF] Add support to set the nominal value and limits for the ShapeFactor parameters in HistFactory

3 participants