Skip to content

[RF] HS3 I/O for RooMultiPdf, RooMultiReal and the HS3 categorical function #24006

Open

Description

@cburgard

roofit/hs3 has no importer or exporter for RooMultiPdf and RooMultiReal: exporting a workspace that contains one fails with "no export keys available". HS3 PR #119 now defines the matching HS3 objects, category_conditional_dist (one of several sub-distributions, selected by the value of a categorical parameter and conditional on it) and the categorical function (a value selected by the value of a categorical variable). ROOT PR #24005 implements category_conditional_dist with RooSimultaneous in switch mode, which matches the HS3 semantics exactly, and leaves the two classes and the function out, for the following reasons.

  • RooMultiPdf and RooMultiReal select the element at the list position equal to the index of the category, and their constructors define the states _pdf<i> / model<i> on the category. HS3 selects by label, and the index of a category read from HS3 is its position in the domain's categories. An import is therefore only faithful if the components of the document cover every state of the category, in index order.
  • RooMultiPdf is selfNormalized(), is never extended, and adds a penalty term to the NLL (getCorrection(), by default 0.5 per free parameter, used by FitHelpers). HS3's category_conditional_dist is extended if its components are, and has no penalty.
  • RooMultiReal is the only RooFit class that implements the categorical function. The alternative, a RooFormulaVar on the category index, would be written back as a generic function.

Proposal:

  • Export RooMultiPdf as category_conditional_dist with the key of element i = the label of the category at index i (error if there is none), dropping the penalty term with a warning if getCorrection() != 0. It would come back as a RooSimultaneous (no penalty, extendable), i.e. the class does not survive a round trip.
  • Export RooMultiReal as categorical in the same way, and import categorical as a RooMultiReal when the keys cover every state of the category (otherwise an explicit error). Several categorical_variables would need a RooSuperCategory, which RooMultiReal does not accept (it takes a RooCategory).

Questions: is it acceptable that a RooMultiPdf comes back as a RooSimultaneous, or should RooMultiPdf grow the missing pieces (selection by label, extendedness) so that it can be the import target? Should RooMultiReal select by label rather than by index?

Found while implementing HS3 #119 in roofit/hs3 (design notes in that PR).

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