Skip to content

Commit

Permalink
ruff fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rkansal47 committed Nov 9, 2023
1 parent f450625 commit 237ee60
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ ignore = [
"F811", # redefinition of unused variable
"PGH001", # eval
"RET503",
"RET504", # unnecessary assignment before return
"RET505", # unnecessary else after return statement
]
isort.required-imports = ["from __future__ import annotations"]
Expand Down
15 changes: 5 additions & 10 deletions src/HH4b/processors/GenSelection.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import awkward as ak
import numpy as np
from coffea.analysis_tools import PackedSelection
from coffea.nanoevents.methods.base import NanoEventsArray
from coffea.nanoevents.methods.nanoaod import FatJetArray, JetArray

Expand Down Expand Up @@ -42,9 +41,7 @@ def gen_selection_HHbbbb(
events: NanoEventsArray,
jets: JetArray,
fatjets: FatJetArray,
selection: PackedSelection,
cutflow: dict,
signGenWeights: ak.Array,
selection_args: list,
skim_vars: dict,
):
"""Gets HH, bb 4-vectors"""
Expand All @@ -64,7 +61,7 @@ def gen_selection_HHbbbb(
has_4b = ak.sum(ak.flatten(is_bb, axis=2), axis=1) == 4

# only select events with 4 b's
add_selection("has_bbbb", has_4b, selection, cutflow, False, signGenWeights)
add_selection("has_bbbb", has_4b, *selection_args)

# children 4-vector
bs = ak.flatten(higgs_children[is_bb], axis=2)
Expand Down Expand Up @@ -144,9 +141,7 @@ def gen_selection_Hbb(
events: NanoEventsArray,
jets: JetArray, # noqa: ARG001
fatjets: FatJetArray,
selection: PackedSelection,
cutflow: dict,
signGenWeights: ak.Array,
selection_args: list, # noqa: ARG001
skim_vars: dict,
):
"""Gets H, bb, 4-vectors + Higgs children information"""
Expand All @@ -165,10 +160,10 @@ def gen_selection_Hbb(
GenbVars = {f"Genb{key}": pad_val(bs[var], 4, axis=1) for (var, key) in skim_vars.items()}

# match fatjets to bb
bs_unflat = higgs_children[is_bb]
# bs_unflat = higgs_children[is_bb]
# num_b_matched = ak.sum(fatjets.metric_table(bs_unflat) < 0.8, axis=2)
b_h1 = higgs_children[is_bb][:, 0]
b_h2 = higgs_children[is_bb][:, 1]
num_b_matched = ak.sum(fatjets.metric_table(bs_unflat) < 0.8, axis=2)
matched_to_higgs = fatjets.metric_table(higgs) < 0.8
is_fatjet_matched = ak.any(matched_to_higgs, axis=2)

Expand Down
4 changes: 1 addition & 3 deletions src/HH4b/processors/bbbbSkimmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,7 @@ def process(self, events: ak.Array):
genVars = {}
for d in gen_selection_dict:
if d in dataset:
vars_dict = gen_selection_dict[d](
events, jets, fatjets, selection, cutflow, gen_weights, P4
)
vars_dict = gen_selection_dict[d](events, jets, fatjets, selection_args, P4)
genVars = {**genVars, **vars_dict}

# Jet variables
Expand Down
4 changes: 1 addition & 3 deletions src/HH4b/processors/matchingSkimmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,7 @@ def process(self, events: ak.Array):
# gen variables
for d in gen_selection_dict:
if d in dataset:
vars_dict = gen_selection_dict[d](
events, jets, fatjets, selection, cutflow, gen_weights, P4
)
vars_dict = gen_selection_dict[d](events, jets, fatjets, selection_args, P4)
skimmed_events = {**skimmed_events, **vars_dict}

ak4GenJetVars = {}
Expand Down

0 comments on commit 237ee60

Please sign in to comment.