Skip to content

Commit ed101fb

Browse files
committed
[RF][HF] Persist ShapeFactor const-ness to XML
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)
1 parent 18fbd3f commit ed101fb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

roofit/histfactory/src/Measurement.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1769,7 +1769,8 @@ void ShapeFactor::PrintXML(std::ostream &xml) const
17691769
}
17701770
xml << " Val=\"" << GetVal() << "\" "
17711771
<< " High=\"" << GetHigh() << "\" "
1772-
<< " Low=\"" << GetLow() << "\" ";
1772+
<< " Low=\"" << GetLow() << "\" "
1773+
<< " Const=\"" << (IsConstant() ? std::string("True") : std::string("False")) << "\" ";
17731774
xml << " /> " << std::endl;
17741775
}
17751776

0 commit comments

Comments
 (0)