Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mafrahm committed Jan 7, 2025
1 parent 4eb31b7 commit 1172404
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions hbw/ml/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def __init__(

for param in self.settings_parameters:
# overwrite the default value with the value from the parameters
# TODO: this is quite dangerous, as it overwrites a class attribute instead of an instance attribute
setattr(self, param, self.parameters.get(param, getattr(self, param)))

# cast the ml parameters to the correct types if necessary
Expand Down
2 changes: 1 addition & 1 deletion hbw/production/neutrino.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def top_reconstruction(self: Producer, events: ak.Array, **kwargs) -> ak.Array:
# replace nan, none, and inf values with EMPTY_FLOAT
col = route.apply(events)
col = ak.fill_none(ak.nan_to_none(route.apply(events)), EMPTY_FLOAT)
col = ak.where(np.isinf(col), EMPTY_FLOAT, col)
col = ak.where(~np.isfinite(col), EMPTY_FLOAT, col)

events = set_ak_column(events, route.string_column, col)

Expand Down
7 changes: 6 additions & 1 deletion hbw/selection/dl_remastered.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ def dl_lepton_selection(

dilepton = ak.pad_none(lepton, 2)
dilepton = dilepton[:, 0] + dilepton[:, 1]
events = set_ak_column(events, "mll", ak.fill_none(dilepton.mass, EMPTY_FLOAT), value_type=np.float32)
events = set_ak_column(
events,
"mll",
ak.fill_none(ak.nan_to_none(dilepton.mass), EMPTY_FLOAT),
value_type=np.float32,
)
lepton_results.steps["DiLeptonMass81"] = ak.fill_none(dilepton.mass <= m_z.nominal - 10, False)
# lepton channel masks
lepton_results.steps["Lep_mm"] = mm_mask = (
Expand Down

0 comments on commit 1172404

Please sign in to comment.