|
11 | 11 | from columnflow.production import Producer, producer
|
12 | 12 | from columnflow.util import maybe_import
|
13 | 13 | from columnflow.columnar_util import set_ak_column
|
14 |
| -from columnflow.production.categories import category_ids |
15 | 14 |
|
16 |
| -from hbw.production.weights import event_weights |
17 | 15 | from hbw.production.prepare_objects import prepare_objects
|
18 | 16 | from hbw.config.ml_variables import add_ml_variables
|
19 | 17 | from hbw.config.dl.variables import add_dl_ml_variables
|
20 | 18 | from hbw.config.sl_res.variables import add_sl_res_ml_variables
|
21 |
| -from hbw.config.categories import add_categories_production |
22 | 19 | from hbw.util import four_vec
|
23 | 20 | ak = maybe_import("awkward")
|
24 | 21 | np = maybe_import("numpy")
|
|
31 | 28 |
|
32 | 29 | @producer(
|
33 | 30 | uses={
|
34 |
| - category_ids, |
35 | 31 | prepare_objects,
|
36 | 32 | "HbbJet.msoftdrop",
|
37 | 33 | "Jet.btagDeepFlavB", "Bjet.btagDeepFlavB", "Lightjet.btagDeepFlavB",
|
38 | 34 | } | four_vec(
|
39 | 35 | {"Electron", "Muon", "MET", "Jet", "Bjet", "Lightjet", "HbbJet", "VBFJet"},
|
40 | 36 | ),
|
41 |
| - produces={ |
42 |
| - category_ids, |
43 |
| - # other produced columns set in the init function |
44 |
| - }, |
| 37 | + # produced columns set in the init function |
45 | 38 | )
|
46 | 39 | def sl_ml_inputs(self: Producer, events: ak.Array, **kwargs) -> ak.Array:
|
47 | 40 | # add behavior and define new collections (e.g. Lepton)
|
48 | 41 | events = self[prepare_objects](events, **kwargs)
|
49 | 42 |
|
50 |
| - # produce (new) category ids |
51 |
| - events = self[category_ids](events, **kwargs) |
52 |
| - |
53 | 43 | # object padding
|
54 | 44 | events = set_ak_column(events, "Lightjet", ak.pad_none(events.Lightjet, 2))
|
55 | 45 | events = set_ak_column(events, "Bjet", ak.pad_none(events.Bjet, 2))
|
@@ -202,39 +192,25 @@ def sl_ml_inputs_init(self: Producer) -> None:
|
202 | 192 | )
|
203 | 193 | self.produces |= self.ml_input_columns
|
204 | 194 |
|
205 |
| - # add categories to config |
206 |
| - add_categories_production(self.config_inst) |
207 |
| - |
208 | 195 | # add variable instances to config
|
209 | 196 | add_ml_variables(self.config_inst)
|
210 | 197 |
|
211 | 198 |
|
212 | 199 | @producer(
|
213 | 200 | uses={
|
214 |
| - category_ids, event_weights, |
215 | 201 | prepare_objects,
|
216 | 202 | "Electron.charge", "Muon.charge",
|
217 | 203 | "HbbJet.msoftdrop",
|
218 | 204 | "Jet.btagDeepFlavB", "Bjet.btagDeepFlavB",
|
219 | 205 | } | four_vec(
|
220 | 206 | {"Electron", "Muon", "MET", "Jet", "Bjet", "HbbJet"},
|
221 | 207 | ),
|
222 |
| - produces={ |
223 |
| - category_ids, event_weights, |
224 |
| - # other produced columns set in the init function |
225 |
| - }, |
| 208 | + # produced columns set in the init function |
226 | 209 | )
|
227 | 210 | def dl_ml_inputs(self: Producer, events: ak.Array, **kwargs) -> ak.Array:
|
228 |
| - # add event weights |
229 |
| - if self.dataset_inst.is_mc: |
230 |
| - events = self[event_weights](events, **kwargs) |
231 |
| - |
232 | 211 | # add behavior and define new collections (e.g. Lepton)
|
233 | 212 | events = self[prepare_objects](events, **kwargs)
|
234 | 213 |
|
235 |
| - # produce (new) category ids |
236 |
| - events = self[category_ids](events, **kwargs) |
237 |
| - |
238 | 214 | # object padding
|
239 | 215 | events = set_ak_column(events, "Bjet", ak.pad_none(events.Bjet, 2))
|
240 | 216 | # events = set_ak_column(events, "FatJet", ak.pad_none(events.FatJet, 1))
|
@@ -319,38 +295,25 @@ def dl_ml_inputs_init(self: Producer) -> None:
|
319 | 295 | )
|
320 | 296 | self.produces |= self.ml_columns
|
321 | 297 |
|
322 |
| - # add categories to config |
323 |
| - add_categories_production(self.config_inst) |
324 |
| - |
325 | 298 | # add variable instances to config
|
326 | 299 | add_dl_ml_variables(self.config_inst)
|
327 | 300 |
|
328 | 301 |
|
329 | 302 | @producer(
|
330 | 303 | uses={
|
331 |
| - category_ids, event_weights, |
332 | 304 | prepare_objects,
|
333 | 305 | "HbbJet.msoftdrop",
|
334 | 306 | "Jet.btagDeepFlavB", "Bjet.btagDeepFlavB", "Lightjet.btagDeepFlavB",
|
335 | 307 | } | four_vec(
|
336 | 308 | {"Electron", "Muon", "MET", "Jet", "Bjet", "Lightjet", "HbbJet", "VBFJet"},
|
337 | 309 | ),
|
338 |
| - produces={ |
339 |
| - category_ids, event_weights, |
340 |
| - # other produced columns set in the init function |
341 |
| - }, |
| 310 | + # produced columns set in the init function |
342 | 311 | )
|
343 | 312 | def sl_res_ml_inputs(self: Producer, events: ak.Array, **kwargs) -> ak.Array:
|
344 |
| - # add event weights |
345 |
| - if self.dataset_inst.is_mc: |
346 |
| - events = self[event_weights](events, **kwargs) |
347 | 313 |
|
348 | 314 | # add behavior and define new collections (e.g. Lepton)
|
349 | 315 | events = self[prepare_objects](events, **kwargs)
|
350 | 316 |
|
351 |
| - # produce (new) category ids |
352 |
| - events = self[category_ids](events, **kwargs) |
353 |
| - |
354 | 317 | # object padding
|
355 | 318 | events = set_ak_column(events, "Lightjet", ak.pad_none(events.Lightjet, 2))
|
356 | 319 | events = set_ak_column(events, "Bjet", ak.pad_none(events.Bjet, 2))
|
@@ -501,7 +464,6 @@ def sl_res_ml_inputs_init(self: Producer) -> None:
|
501 | 464 | for var in ["pt", "eta", "phi", "mass", "msoftdrop"]
|
502 | 465 | )
|
503 | 466 | self.produces |= self.ml_columns
|
504 |
| - # add categories to config |
505 |
| - add_categories_production(self.config_inst) |
| 467 | + |
506 | 468 | # add variable instances to config
|
507 | 469 | add_sl_res_ml_variables(self.config_inst)
|
0 commit comments