Skip to content

Commit 09a06aa

Browse files
committed
add wrapper task for convenient plotting in SL
1 parent 4ecb94d commit 09a06aa

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

hbw/tasks/wrapper.py

+38-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77

88
import law
99

10+
# from columnflow.tasks.framework.base import ConfigTask
1011
from columnflow.tasks.framework.mixins import (
11-
CalibratorsMixin, # SelectorStepsMixin, ProducersMixin, MLModelsMixin,
12+
CalibratorsMixin, SelectorStepsMixin, ProducersMixin, # , MLModelsMixin,
1213
)
1314
from columnflow.tasks.plotting import PlotVariables1D
1415
from columnflow.tasks.framework.remote import RemoteWorkflow
@@ -17,15 +18,51 @@
1718
from columnflow.util import dev_sandbox
1819

1920

21+
class ControlPlotsSL(
22+
HBWTask,
23+
ProducersMixin,
24+
SelectorStepsMixin,
25+
CalibratorsMixin,
26+
):
27+
28+
def requires(self):
29+
reqs = {}
30+
31+
for l_channel in ("mu", "e"):
32+
for j_channel in ("resolved", "boosted"):
33+
reqs[f"control_plots_{l_channel}_{j_channel}"] = PlotVariables1D.req(
34+
self,
35+
processes=(f"d{l_channel}ch",),
36+
# processes=("ggHH_kl_1_kt_1_sl_hbbhww",),
37+
process_settings=[["scale_signal"]],
38+
variables=[f"sl_{j_channel}"],
39+
categories=(f"sl_{l_channel}ch_{j_channel}",),
40+
yscale="log",
41+
cms_label="pw",
42+
)
43+
44+
return reqs
45+
46+
def output(self):
47+
# use the input also as output
48+
# (makes it easier to fetch and delete outputs)
49+
return self.requires()
50+
51+
def run(self):
52+
pass
53+
54+
2055
class DefaultPlots(
2156
HBWTask,
2257
# MLModelsMixin,
2358
# ProducersMixin,
2459
# SelectorStepsMixin,
2560
CalibratorsMixin,
61+
# we only add workflow mixins to be able to directly pass --workflow instead of --cf.PlotVariables1d-workflow
2662
law.LocalWorkflow,
2763
RemoteWorkflow,
2864
):
65+
# TODO: this should be three separate tasks with one additional "wrapper"
2966
sandbox = dev_sandbox("bash::$CF_BASE/sandboxes/venv_columnar.sh")
3067

3168
def create_branch_map(self):

0 commit comments

Comments
 (0)