Skip to content

Commit

Permalink
remove events with pdf variations above 99%
Browse files Browse the repository at this point in the history
  • Loading branch information
mafrahm committed Nov 14, 2024
1 parent bde316e commit d0b9188
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 43 deletions.
83 changes: 42 additions & 41 deletions hbw/config/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,48 +244,49 @@ def add_variables(config: od.Config) -> None:
#

# TODO: implement tags in columnflow; meanwhile leave these variables commented out (as they only work for mc)
"""
config.add_variable(
name="mc_weight",
expression="mc_weight",
binning=list(np.logspace(1.2, 5, 200)),
log_x=True,
x_title="MC weight",
tags={"mc_only"},
)
config.add_variable(
name="normalization_weight",
binning=list(np.logspace(0, 6, 100)),
log_x=True,
x_title="normalization weight",
tags={"mc_only"},
)
config.add_variable(
name="event_weight",
binning=list(np.logspace(0, 6, 100)),
log_x=True,
x_title="event weight",
tags={"mc_only"},
)

for weight in ["pu", "pdf", "mur", "muf", "murf_envelope"]:
# NOTE: would be nice to not use the event weight for these variables
config.add_variable(
name=f"{weight}_weight",
expression=f"{weight}_weight",
binning=(40, -2, 2),
x_title=f"{weight} weight",
tags={"mc_only"},
)
config.add_variable(
name=f"{weight}_weight_log",
expression=f"{weight}_weight",
binning=list(np.logspace(-2, 2, 100)),
log_x=True,
x_title=f"{weight} weight",
tags={"mc_only"},
)
"""
# config.add_variable(
# name="mc_weight",
# expression="mc_weight",
# binning=list(np.logspace(1.2, 5, 200)),
# log_x=True,
# x_title="MC weight",
# tags={"mc_only"},
# )
# config.add_variable(
# name="normalization_weight",
# binning=list(np.logspace(0, 6, 100)),
# log_x=True,
# x_title="normalization weight",
# tags={"mc_only"},
# )
# config.add_variable(
# name="event_weight",
# binning=list(np.logspace(0, 6, 100)),
# log_x=True,
# x_title="event weight",
# tags={"mc_only"},
# )

# for weight in ["pu", "pdf", "mur", "muf", "murf_envelope"]:
# for shift in ("_up", "_down", ""):
# # NOTE: would be nice to not use the event weight for these variables
# config.add_variable(
# name=f"{weight}_weight{shift}",
# expression=f"{weight}_weight{shift}",
# binning=(40, -2, 2),
# x_title=f"{weight} weight {shift.replace('_', '')}",
# tags={"mc_only"},
# )
# config.add_variable(
# name=f"{weight}_weight{shift}_log",
# expression=f"{weight}_weight{shift}",
# binning=list(np.logspace(-2, 2, 100)),
# log_x=True,
# x_title=f"{weight} weight {shift.replace('_', '')}",
# tags={"mc_only"},
# )

config.add_variable(
name="npvs",
expression="PV.npvs",
Expand Down
4 changes: 2 additions & 2 deletions hbw/production/weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def event_weights_to_normalize(self: Producer, events: ak.Array, results: Select
# compute pdf weights
events = self[pdf_weights](
events,
outlier_threshold=0.5,
outlier_action="ignore",
outlier_threshold=0.99,
outlier_action="remove", #NOTE: change to "remove"?
outlier_log_mode="warning",
**kwargs,
)
Expand Down

0 comments on commit d0b9188

Please sign in to comment.