Skip to content

Commit 5e971dd

Browse files
committed
upup
1 parent 28998fd commit 5e971dd

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

boostedhiggs/hwwprocessor.py

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -89,37 +89,29 @@ def __init__(
8989
):
9090
self._year = year
9191
self._yearmod = yearmod
92-
self._channels = channels
92+
self._channels = channels or ["ele", "mu"]
93+
9394
self._systematics = systematics
9495
self._getLPweights = getLPweights
9596
self._uselooselep = uselooselep
9697
self._fakevalidation = fakevalidation
97-
9898
self._apply_trigger = not no_trigger
9999
self._apply_selection = not no_selection
100-
101100
self._output_location = output_location
101+
self._inference = inference
102102

103-
# trigger paths
104-
with importlib.resources.path("boostedhiggs.data", "triggers.json") as path:
105-
with open(path, "r") as f:
106-
self._HLTs = json.load(f)[self._year]
103+
def load_json_config(file_name):
104+
with importlib.resources.path("boostedhiggs.data", file_name) as path:
105+
with open(path, "r") as f:
106+
return json.load(f)[self._year]
107107

108-
# https://twiki.cern.ch/twiki/bin/view/CMS/MissingETOptionalFiltersRun2
109-
with importlib.resources.path("boostedhiggs.data", "metfilters.json") as path:
110-
with open(path, "r") as f:
111-
self._metfilters = json.load(f)[self._year]
108+
self._HLTs = load_json_config("triggers.json")
109+
self._metfilters = load_json_config("metfilters.json")
112110

113-
if self._year == "2018":
114-
self.dataset_per_ch = {
115-
"ele": "EGamma",
116-
"mu": "SingleMuon",
117-
}
118-
else:
119-
self.dataset_per_ch = {
120-
"ele": "SingleElectron",
121-
"mu": "SingleMuon",
122-
}
111+
self.dataset_per_ch = {
112+
"ele": "EGamma" if self._year == "2018" else "SingleElectron",
113+
"mu": "SingleMuon",
114+
}
123115

124116
self.jecs = {
125117
"JES": "JES_jes",
@@ -139,9 +131,7 @@ def __init__(
139131
"JES_Total": "JES_Total",
140132
}
141133

142-
# for tagger inference
143-
self._inference = inference
144-
self.tagger_resources_path = str(pathlib.Path(__file__).parent.resolve()) + "/tagger_resources/"
134+
self.tagger_resources_path = os.path.join(str(pathlib.Path(__file__).parent.resolve()), "tagger_resources")
145135

146136
@property
147137
def accumulator(self):

0 commit comments

Comments
 (0)