Repository navigation
Commit dfc0edc
[RF][HS3] Bring the HS3 import and export closer to the HS3 standard
Fix several deviations of RooFit's HS3 layer from the HS3 standard
(hep-statistics-serialization-standard master at cb3e9eb). None of the
changes depend on pending HS3 PRs; the ones that do follow in #23840.
Stricter checks only apply to documents that declare a recent enough
hs3_version, so files written by older ROOT versions remain readable.
Metadata and names:
* hs3_version must be a string. Its MAJOR.MINOR is parsed, and a
warning is printed if it can't be parsed or is newer than what RooFit
writes. Importers can query it with
RooJSONFactoryWSTool::hs3VersionInput().
* Duplicate names of top-level objects are an error from HS3 0.3 on,
and only a warning for older documents.
* On export, likelihoods are named "<analysis>_likelihood", analyses are
named after their ModelConfig, and transformed helper functions that
several pdfs share are written only once.
Import:
* The "default_domain" is optional. Without it, variables get the range
of the first domain that lists them.
* Parameters that only appear in a parameter point are created. They
are constant if "const" is true or if no domain lists them. A string
value sets the label of a category. Index categories of combined
distributions are now created before the parameter points.
* Observables of unbinned data without a domain range take their range
from the "min"/"max" of the data axes. Infinite bounds (null) are
supported.
* "init" of an analysis is restored as the ModelConfig snapshot under
the same name. A missing parameter point is reported.
* An explicit "extended" flag of mixture_dist is checked against the
number of coefficients.
* Malformed input is rejected instead of being read out of bounds:
covariance and correlation matrices must be square, "errors" must have
as many entries as "contents", and "edges" must contain at least two
strictly ascending values.
* Errors of zero in binned data stay zero. Before, they could be read
as squared weight = content.
Export:
* Axes of unbinned data only carry "name", "min" and "max".
* The ModelConfig snapshot is written as "init" of the analysis, which
no longer has the side effect of loading the snapshot values.
* Ternaries in formulas are written as ifelse(c, a, b), and ifelse() is
translated back to a ternary on import.
Type keys (the old keys are still imported, with a deprecation
warning):
* ARGUS_dist -> argus_dist
* binsampling -> binsampling_dist. Before, RooFit could not read back
its own export.
* rate_extended_dist uses the fields "dist" and "rate" instead of "pdf"
and "norm".
HistFactory:
* "LogNormal" is accepted as a constraint type, alongside "Lognormal".
Log-normal constraints of gamma parameters are rejected instead of
silently becoming Gaussian.
* The parameter of a normfactor is named after "parameter". "name" is
only the label of the modifier.
* normsys/histosys modifiers without constraint are unconstrained from
HS3 0.2 on, with one warning per channel. Older documents, and objects
imported with importJSONElement(), keep the implicit unit Gaussian.
On export, unconstrained modifiers are allowed. A normsys with a
function as parameter is refused.
* The staterror constraint type is read from the modifier ("constraint",
or "constraint_type" as written by ROOT 6.38 and 6.40.00), with the
channel-level setting as fallback. It is written in both places, so
Gaussian stat errors are no longer lost in a round trip.
* A modifier without interpolation and without "default_interpolation"
is an error from HS3 0.3 on. Older documents keep code 4, with a
deprecation warning.
* Fix the export of normsys modifiers recognized from formulas like
1+0.1*alpha: hi/lo were written as 0.1/-0.1 instead of the absolute
factors 1.1/0.9, and the constraint was dropped.
Other:
* Warnings of RooJSONFactoryWSTool are logged on the ObjectHandling
topic. Before, they went to the IO topic, which no default stream
shows.
* Add ModelConfig::GetSnapshotName().
* Update the RooFitHS3 developer documentation.
* Make the constraints and interpolation of the rf515_hfJSON tutorial
explicit. The fit result is unchanged.
Files written with this version use the new type keys and ifelse(),
which ROOT 6.40 and older cannot read.
Assisted-by: claude-code:claude-opus-5-5
(cherry picked from commit d61fecf)1 parent 72d64b3 commit dfc0edc
13 files changed
Lines changed: 2108 additions & 246 deletions
File tree
- roofit
- doc/developers
- hs3
- inc/RooFitHS3
- src
- test
- roofitcore/inc/RooFit
- tutorials/roofit/roofit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
53 | 53 | | |
54 | | - | |
55 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
56 | 60 | | |
57 | 61 | | |
58 | 62 | | |
| |||
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
70 | | - | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| |||
82 | 86 | | |
83 | 87 | | |
84 | 88 | | |
85 | | - | |
| 89 | + | |
86 | 90 | | |
87 | 91 | | |
88 | 92 | | |
| |||
97 | 101 | | |
98 | 102 | | |
99 | 103 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
104 | 111 | | |
105 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
106 | 116 | | |
107 | 117 | | |
108 | 118 | | |
| |||
121 | 131 | | |
122 | 132 | | |
123 | 133 | | |
| 134 | + | |
| 135 | + | |
124 | 136 | | |
125 | 137 | | |
126 | | - | |
| 138 | + | |
127 | 139 | | |
128 | 140 | | |
129 | 141 | | |
| |||
145 | 157 | | |
146 | 158 | | |
147 | 159 | | |
148 | | - | |
149 | | - | |
150 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
151 | 167 | | |
152 | 168 | | |
153 | 169 | | |
154 | 170 | | |
155 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
156 | 178 | | |
157 | 179 | | |
158 | 180 | | |
| |||
189 | 211 | | |
190 | 212 | | |
191 | 213 | | |
192 | | - | |
| 214 | + | |
193 | 215 | | |
194 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
195 | 228 | | |
196 | 229 | | |
197 | 230 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
209 | 212 | | |
210 | 213 | | |
211 | 214 | | |
| |||
251 | 254 | | |
252 | 255 | | |
253 | 256 | | |
| 257 | + | |
254 | 258 | | |
255 | 259 | | |
256 | 260 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | 33 | | |
42 | 34 | | |
43 | 35 | | |
| |||
54 | 46 | | |
55 | 47 | | |
56 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
57 | 55 | | |
58 | 56 | | |
59 | 57 | | |
| |||
78 | 76 | | |
79 | 77 | | |
80 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
81 | 87 | | |
82 | 88 | | |
83 | 89 | | |
84 | 90 | | |
85 | 91 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
| 92 | + | |
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
| |||
0 commit comments