diff --git a/hbw/production/weights.py b/hbw/production/weights.py index 4fa4b49..7b3b658 100644 --- a/hbw/production/weights.py +++ b/hbw/production/weights.py @@ -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") @@ -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: diff --git a/hbw/util.py b/hbw/util.py index 261ed3f..09ee8f6 100644 --- a/hbw/util.py +++ b/hbw/util.py @@ -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 diff --git a/law.cfg b/law.cfg index edebd04..3f50a3c 100644 --- a/law.cfg +++ b/law.cfg @@ -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