Skip to content

Sigma Mu computation is not generic for JSON sterilised binned data #19

@jackaraz

Description

@jackaraz

This bug report is created as a TODO for the next iteration of the software

JSON sterilised data does not come with a Bkg tag. Hence the if condition below, which is looking for Bkg within samples, will never be invoked. @Ga0l said that the Bkg tag is added for simplified JSON. This does not generally exist; this is not future proof since it's not generic for any future simplified statistical model generator. A simple workaround can be implemented without the need to check sample names. Since JSON files are independent of the patches, one can go through the entire sample without merging them and extract the necessary information from a non-merged workspace.

The function in question can be found below:

def getSigmaMu(self, workspace):
"""given a workspace, compute a rough estimate of sigma_mu,
the uncertainty of mu_hat"""
obss, bgs, bgVars, nsig = {}, {}, {}, {}
channels = workspace.channels
for chdata in workspace["channels"]:
if not chdata["name"] in channels:
continue
bg = 0.0
var = 0.0
for sample in chdata["samples"]:
if sample["name"] == "Bkg":
tbg = sample["data"][0]
bg += tbg
hi = sample["modifiers"][0]["data"]["hi_data"][0]
lo = sample["modifiers"][0]["data"]["lo_data"][0]
delta = max((hi - bg, bg - lo))
var += delta**2
if sample["name"] == "bsm":
ns = sample["data"][0]
nsig[chdata["name"]] = ns
bgs[chdata["name"]] = bg
bgVars[chdata["name"]] = var

Thanks, @Ga0l and @WolfgangWaltenberger, for the explanations.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions