Skip to content

[RF][HS3] Should the rf515_hfJSON tutorial document follow the recommended HS3 0.3 form (array_dist, listed constraint terms)? #24015

Open

Description

@cburgard

What the tutorial shows today

tutorials/roofit/roofit/rf515_hfJSON.json (used by rf515_hfJSON.py) is a hand-written HS3 document with one histfactory_dist channel, three normsys modifiers, a staterror modifier, and one constraint distribution per parameter:

  • the Poisson constraints of the two gammas give the observed value as a number ("x": 400, "mean": "gamma_bin_0_expected");
  • the Gaussian constraints of the alphas have the parameter as x and a number as mean ("x": "alpha_syst1", "mean": 0.0, "sigma": 1.0);
  • the likelihood lists only the channel; the constraint terms enter implicitly through the histfactory_dist.

This is valid HS3 0.3 and imports fine. It is also the most compact way to write the model.

Why the question comes up now

HS3 PR #109 adds array_dist, and after it HS3 PR #124 will recommend one array_dist of poisson_dist for the staterror constraints, with named global observables and the terms listed in the likelihood. #24013 implements this in RooFit: its export writes the constraints of a HistFactory model in that form, and lists them in the likelihood (aux_distributions, or paired with data sets of observed values). The tutorial document is now the one example in the repository that does not follow the recommended form, and RooFit's own export of it keeps its Poissons as individual distributions, since a number as observable cannot be a component of an array_dist or be paired with data.

Options

  1. Keep the tutorial as it is. It teaches the minimal hand-written form, which stays valid. The comment in rf515_hfJSON.py ("the result will be not completely identical to the JSON file you used as an input") already prepares for differences on export.
  2. Rewrite it in the recommended form. Named global observables (nom_gamma_bin_0 as constant parameters, or as axes of a one-entry unbinned data set), one array_dist for the Poisson constraints and one for the Gaussian constraints with the observable as x, and the constraint terms listed in the likelihood. Longer, but it is what RooFit writes and what the standard will recommend; a reader who copies from the tutorial gets the best-practice form.
  3. Both. Keep rf515_hfJSON.json minimal and add the recommended form as a second document (or as a second step of the tutorial that exports the imported workspace and shows the difference).

Which one depends on what the tutorial should teach, minimalism or best practice. The rewrite itself is small and can follow #24013 as a stacked PR once HS3 #109 is merged; the question is whether we want it.

Found while working on #24013.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions