Skip to content

[RF] Fix implementation of HS3 importers#18209

Merged
guitargeek merged 1 commit into
root-project:masterfrom
maxgalli:fix_hs3_rooprodpdf_2
Mar 31, 2025
Merged

[RF] Fix implementation of HS3 importers#18209
guitargeek merged 1 commit into
root-project:masterfrom
maxgalli:fix_hs3_rooprodpdf_2

Conversation

@maxgalli
Copy link
Copy Markdown
Contributor

Fix by @guitargeek.
The RooWSFactoryTool expression handler was not correctly matching branckets, leading to failures when importing valid JSON filed with RooProdPdf objects.

Can be tested with the following reproducer:
python3 dump_json_to_workspace.py datacard_part1_nosys.json

where dump_json_to_workspace.py is

import ROOT
import sys
import os

# Check if the user provided an input file
if len(sys.argv) != 2:
    print("Usage: python script.py <input_json_file>")
    sys.exit(1)

# Get the input file from command line
input_file = sys.argv[1]

# Ensure the file exists
if not os.path.isfile(input_file):
    print(f"Error: File '{input_file}' not found.")
    sys.exit(1)

# Extract the base name without extension
base_name = os.path.splitext(os.path.basename(input_file))[0]
output_file = f"{base_name}_imported.root"

ws = ROOT.RooWorkspace("w")
tool = ROOT.RooJSONFactoryWSTool(ws)
tool.importJSON(input_file)
ws.writeToFile(output_file)

and datacard_part1_nosys.json is

{"distributions":[{"factors":[],"name":"nuisancePdf","type":"product_dist"}],"metadata":{"hs3_version":"0.2","packages":[{"name":"ROOT","version":"6.30.07"}]}}

Fix by @guitargeek.
The RooWSFactoryTool expression handler was not correctly matching branckets, leading to failures when importing
valid JSON filed with RooProdPdf objects.
@github-actions
Copy link
Copy Markdown

Test Results

    16 files      16 suites   5d 8h 33m 43s ⏱️
 2 735 tests  2 732 ✅ 0 💤 3 ❌
42 372 runs  42 369 ✅ 0 💤 3 ❌

For more details on these failures, see this check.

Results for commit 4cc6030.

Copy link
Copy Markdown
Contributor

@guitargeek guitargeek left a comment

Choose a reason for hiding this comment

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

Thank you very much!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants