Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jackaraz opened this issue May 26, 2022 · 0 comments
Open
Assignees
Labels

Comments

@jackaraz
Copy link
Member

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.

@jackaraz jackaraz added the bug label May 26, 2022
@jackaraz jackaraz self-assigned this May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant