Skip to content

Commit

Permalink
add memory configuration and load gen columns only when required
Browse files Browse the repository at this point in the history
  • Loading branch information
mafrahm committed Jan 9, 2025
1 parent bdb3a1d commit 99d81e6
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
6 changes: 3 additions & 3 deletions hbw/production/weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from hbw.production.normalized_weights import normalized_weight_factory
from hbw.production.normalized_btag import normalized_btag_weights
from hbw.production.dataset_normalization import dataset_normalization_weight
from hbw.util import has_tag
from hbw.util import has_tag, IF_DY, IF_TOP


np = maybe_import("numpy")
Expand All @@ -39,8 +39,8 @@


@producer(
uses={gen_parton_top, gen_v_boson, pu_weight},
produces={gen_parton_top, gen_v_boson, pu_weight},
uses={IF_TOP(gen_parton_top), IF_DY(gen_v_boson), pu_weight},
produces={IF_TOP(gen_parton_top), IF_DY(gen_v_boson), pu_weight},
mc_only=True,
)
def event_weights_to_normalize(self: Producer, events: ak.Array, results: SelectionResult, **kwargs) -> ak.Array:
Expand Down
24 changes: 24 additions & 0 deletions hbw/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,3 +663,27 @@ def IF_MC(self: ArrayFunction.DeferredColumn, func: ArrayFunction) -> Any | set[
return self.get()

return self.get() if func.dataset_inst.is_mc else None


@deferred_column
def IF_DY(self: ArrayFunction.DeferredColumn, func: ArrayFunction) -> Any | set[Any]:
if getattr(func, "dataset_inst", None) is None:
return self.get()

return self.get() if func.dataset_inst.has_tag("is_v_jets") else None


@deferred_column
def IF_TOP(self: ArrayFunction.DeferredColumn, func: ArrayFunction) -> Any | set[Any]:
if getattr(func, "dataset_inst", None) is None:
return self.get()

return self.get() if func.dataset_inst.has_tag("has_top") else None


@deferred_column
def IF_TT(self: ArrayFunction.DeferredColumn, func: ArrayFunction) -> Any | set[Any]:
if getattr(func, "dataset_inst", None) is None:
return self.get()

return self.get() if func.dataset_inst.has_tag("is_ttbar") else None
12 changes: 12 additions & 0 deletions law.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,18 @@ lfn_sources: local_desy_dcache, wlcg_fs_desy_store, wlcg_fs_infn_redirector, wlc
; c22post__cf.CalibrateEvents__nomin*: htcondor_memory=5GB
; cf.MLTraining: htcondor_memory=10GB, htcondor_gpus=1

# use cluster default for signals
# cf.SelectEvents__hh*: dummy=0
# cf.ReduceEvents__hh*: dummy=0
# DY and W needs more memory due to gen_v_boson Producer
cf.SelectEvents__dy*: htcondor_memory=3GB
cf.ReduceEvents__dy*: htcondor_memory=3GB
cf.SelectEvents__w_lnu: htcondor_memory=3GB
cf.ReduceEvents__w_lnu: htcondor_memory=3GB
# default resources for all other datasets
cf.SelectEvents: htcondor_memory=2GB
cf.ReduceEvents: htcondor_memory=2GB


[luigi_cf.DummyTask]
# To set defaults on a per-task basis
Expand Down

0 comments on commit 99d81e6

Please sign in to comment.