Skip to content

Commit a99bdd8

Browse files
authored
Merge branch 'master' into ff_method_minimal_stable
2 parents b3cc09f + da70a68 commit a99bdd8

29 files changed

Lines changed: 1574 additions & 513 deletions

analysis_templates/cms_minimal/law.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ default_keep_reduced_events: True
4949
# slightly to the left to avoid them being excluded from the last bin; None leads to automatic mode
5050
default_histogram_last_edge_inclusive: None
5151

52-
# boolean flag that, if True, sets the *hists* output of cf.SelectEvents and cf.MergeSelectionStats to optional
53-
default_selection_hists_optional: True
52+
# boolean flag that, if True, configures cf.SelectEvents to create statistics histograms
53+
default_create_selection_hists: False
5454

5555
# wether or not the ensure_proxy decorator should be skipped, even if used by task's run methods
5656
skip_ensure_proxy: False

columnflow/calibration/cms/egamma.py

Lines changed: 613 additions & 0 deletions
Large diffs are not rendered by default.

columnflow/columnar_util.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import multiprocessing
2121
import multiprocessing.pool
2222
from functools import partial
23-
from collections import namedtuple, OrderedDict, deque
23+
from collections import namedtuple, OrderedDict, deque, defaultdict
2424

2525
import law
2626
import order as od
@@ -1848,6 +1848,9 @@ def __init__(
18481848
f"to set: {e.args[0]}",
18491849
)
18501850
raise e
1851+
1852+
# remove keyword from further processing
1853+
kwargs.pop(attr)
18511854
else:
18521855
try:
18531856
deps = set(law.util.make_list(getattr(self.__class__, attr)))
@@ -1862,11 +1865,15 @@ def __init__(
18621865
# also register a set for storing instances, filled in create_dependencies
18631866
setattr(self, f"{attr}_instances", set())
18641867

1868+
# set all other keyword arguments as instance attributes
1869+
for attr, value in kwargs.items():
1870+
setattr(self, attr, value)
1871+
18651872
# dictionary of dependency class to instance, set in create_dependencies
18661873
self.deps = DotDict()
18671874

18681875
# dictionary of keyword arguments mapped to dependenc classes to be forwarded to their init
1869-
self.deps_kwargs = DotDict()
1876+
self.deps_kwargs = defaultdict(dict) # TODO: avoid using `defaultdict`
18701877

18711878
# deferred part of the initialization
18721879
if deferred_init:
@@ -1931,8 +1938,15 @@ def deferred_init(self, instance_cache: dict | None = None) -> dict:
19311938
self.init_func()
19321939

19331940
# instantiate dependencies again, but only perform updates
1934-
self.create_dependencies(instance_cache, only_update=True)
1941+
# self.create_dependencies(instance_cache, only_update=True)
1942+
1943+
# NOTE: the above does not correctly propagate `deps_kwargs` to the dependencies.
1944+
# As a workaround, instantiate all dependencies fully a second time by
1945+
# invalidating the instance cache and setting `only_update` to False
1946+
instance_cache = {}
1947+
self.create_dependencies(instance_cache, only_update=False)
19351948

1949+
# NOTE: return value currently not being used anywhere -> remove?
19361950
return instance_cache
19371951

19381952
def create_dependencies(

columnflow/hist_util.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
from __future__ import annotations
88

9+
__all__ = []
10+
911
import law
1012
import order as od
1113

0 commit comments

Comments
 (0)