Skip to content

Commit

Permalink
consistent names
Browse files Browse the repository at this point in the history
  • Loading branch information
ikrommyd committed Jun 11, 2024
1 parent c6d44e2 commit 339b061
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions src/egamma_tnp/_base_tagnprobe.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,10 +442,10 @@ def _make_cutncount_histograms(
if events.metadata.get("isMC"):
from egamma_tnp.utils.pileup import create_correction, get_pileup_weight, load_correction

if "PU_json" in events.metadata:
pileup_corr = load_correction(events.metadata["PU_json"])
elif "PU_data" in events.metadata and "PU_mc" in events.metadata:
pileup_corr = create_correction(events.metadata["PU_data"], events.metadata["PU_mc"])
if "pileupJSON" in events.metadata:
pileup_corr = load_correction(events.metadata["pileupJSON"])
elif "pileupData" in events.metadata and "pileupMC" in events.metadata:
pileup_corr = create_correction(events.metadata["pileupData"], events.metadata["pileupMC"])

if "truePU" in events.fields:
vars.append("truePU")
Expand All @@ -454,7 +454,7 @@ def _make_cutncount_histograms(

passing_probes, failing_probes = self.find_probes(events, cut_and_count=True, mass_range=mass_range, vars=vars)

if events.metadata.get("isMC") and ("PU_json" in events.metadata or ("PU_data" in events.metadata and "PU_mc" in events.metadata)):
if events.metadata.get("isMC") and ("pileupJSON" in events.metadata or ("pileupData" in events.metadata and "pileupMC" in events.metadata)):
if "truePU" in passing_probes.fields and "truePU" in failing_probes.fields:
passing_probes["PU_weight"] = get_pileup_weight(passing_probes.truePU, pileup_corr)
failing_probes["PU_weight"] = get_pileup_weight(failing_probes.truePU, pileup_corr)
Expand Down Expand Up @@ -500,10 +500,10 @@ def _make_mll_histograms(
if events.metadata.get("isMC"):
from egamma_tnp.utils.pileup import create_correction, get_pileup_weight, load_correction

if "PU_json" in events.metadata:
pileup_corr = load_correction(events.metadata["PU_json"])
elif "PU_data" in events.metadata and "PU_mc" in events.metadata:
pileup_corr = create_correction(events.metadata["PU_data"], events.metadata["PU_mc"])
if "pileupJSON" in events.metadata:
pileup_corr = load_correction(events.metadata["pileupJSON"])
elif "pileupData" in events.metadata and "pileupMC" in events.metadata:
pileup_corr = create_correction(events.metadata["pileupData"], events.metadata["pileupMC"])

if "truePU" in events.fields:
vars.append("truePU")
Expand All @@ -512,7 +512,7 @@ def _make_mll_histograms(

passing_probes, failing_probes = self.find_probes(events, cut_and_count=False, mass_range=mass_range, vars=vars)

if events.metadata.get("isMC") and ("PU_json" in events.metadata or ("PU_data" in events.metadata and "PU_mc" in events.metadata)):
if events.metadata.get("isMC") and ("pileupJSON" in events.metadata or ("pileupData" in events.metadata and "pileupMC" in events.metadata)):
if "truePU" in passing_probes.fields and "truePU" in failing_probes.fields:
passing_probes["PU_weight"] = get_pileup_weight(passing_probes.truePU, pileup_corr)
failing_probes["PU_weight"] = get_pileup_weight(failing_probes.truePU, pileup_corr)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_pileup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ def test_pileup_ntuples(do_preprocess, allow_read_errors_with_report):
os.path.abspath("tests/samples/TnPNTuples_el.root"): "fitter_tree",
os.path.abspath("tests/samples/not_a_file.root"): "fitter_tree",
},
"metadata": {"isMC": True, "PU_json": os.path.abspath("tests/samples/test_pu_correction.json")},
"metadata": {"isMC": True, "pileupJSON": os.path.abspath("tests/samples/test_pu_correction.json")},
}
}
else:
fileset = {
"sample": {
"files": {os.path.abspath("tests/samples/TnPNTuples_el.root"): "fitter_tree"},
"metadata": {"isMC": True, "PU_json": os.path.abspath("tests/samples/test_pu_correction.json")},
"metadata": {"isMC": True, "pileupJSON": os.path.abspath("tests/samples/test_pu_correction.json")},
}
}

Expand Down Expand Up @@ -91,14 +91,14 @@ def test_pileup_nanoaod(do_preprocess, allow_read_errors_with_report):
os.path.abspath("tests/samples/DYto2E.root"): "Events",
os.path.abspath("tests/samples/not_a_file.root"): "Events",
},
"metadata": {"isMC": True, "PU_json": os.path.abspath("tests/samples/test_pu_correction.json")},
"metadata": {"isMC": True, "pileupJSON": os.path.abspath("tests/samples/test_pu_correction.json")},
}
}
else:
fileset = {
"sample": {
"files": {os.path.abspath("tests/samples/DYto2E.root"): "Events"},
"metadata": {"isMC": True, "PU_json": os.path.abspath("tests/samples/test_pu_correction.json")},
"metadata": {"isMC": True, "pileupJSON": os.path.abspath("tests/samples/test_pu_correction.json")},
}
}

Expand Down

0 comments on commit 339b061

Please sign in to comment.