Skip to content

Commit 2410e46

Browse files
committed
add 3lepton category
1 parent 02a0584 commit 2410e46

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

hbw/categorization/categories.py

+18-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from columnflow.selection import SelectionResult
1414
from columnflow.columnar_util import has_ak_column, optional_column
1515

16-
from hbw.util import MET_COLUMN
16+
from hbw.util import MET_COLUMN, BTAG_COLUMN
1717

1818
np = maybe_import("numpy")
1919
ak = maybe_import("awkward")
@@ -125,6 +125,23 @@ def catid_lep(
125125
catid_emu = catid_lep.derive("catid_emu", cls_dict={"n_electron": 1, "n_muon": 1})
126126

127127

128+
@categorizer(
129+
uses={"{Muon,Electron}.pt"},
130+
)
131+
def catid_ge3lep(
132+
self: Categorizer, events: ak.Array, results: SelectionResult | None = None, **kwargs,
133+
) -> tuple[ak.Array, ak.Array]:
134+
if results:
135+
electron = events.Electron[results.objects.Electron.Electron]
136+
muon = events.Muon[results.objects.Muon.Muon]
137+
else:
138+
electron = events.Electron
139+
muon = events.Muon
140+
141+
mask = ak.sum(electron.pt > 0, axis=-1) + ak.sum(muon.pt > 0, axis=-1) >= 3
142+
return events, mask
143+
144+
128145
#
129146
# Categorizer for ABCD (either during cf.SelectEvents or cf.ProduceColumns)
130147
#
@@ -246,9 +263,6 @@ def catid_njet3(
246263
return events, mask
247264

248265

249-
from hbw.util import BTAG_COLUMN
250-
251-
252266
@categorizer(uses={BTAG_COLUMN("Jet")})
253267
def catid_1b(self: Categorizer, events: ak.Array, **kwargs) -> tuple[ak.Array, ak.Array]:
254268
btag_column = self.config_inst.x.btag_column

hbw/config/categories.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# coding: utf-8
23

34
"""
@@ -136,7 +137,7 @@ def add_mll_categories(config: od.Config) -> None:
136137
def add_lepton_categories(config: od.Config) -> None:
137138
config.x.lepton_channels = {
138139
"sl": ("1e", "1mu"),
139-
"dl": ("2e", "2mu", "emu"),
140+
"dl": ("2e", "2mu", "emu", "ge3lep"),
140141
}[config.x.lepton_tag]
141142

142143
cat_1e = config.add_category( # noqa: F841
@@ -174,6 +175,13 @@ def add_lepton_categories(config: od.Config) -> None:
174175
label="1 Electron 1 Muon",
175176
)
176177

178+
cat_emu = config.add_category( # noqa: F841
179+
name="ge3lep",
180+
id=60,
181+
selection="catid_ge3lep",
182+
label=r"$N_{lep} \geq 3$",
183+
)
184+
177185

178186
@call_once_on_config()
179187
def add_njet_categories(config: od.Config) -> None:

0 commit comments

Comments
 (0)