Skip to content

Commit

Permalink
solve merge conflit
Browse files Browse the repository at this point in the history
  • Loading branch information
aalvesan committed Nov 28, 2024
2 parents 6c294e1 + 5f24b37 commit 70b8e12
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 163 deletions.
9 changes: 6 additions & 3 deletions hbt/calibration/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@
# derive calibrators to add settings
jec_full = jec.derive("jec_full", cls_dict={"mc_only": True, "nominal_only": True})

# version of jer that uses the first random number from deterministic_seeds
deterministic_jer = jer.derive("deterministic_jer", cls_dict={"deterministic_seed_index": 0})


@calibrator(
uses={
mc_weight, jec_nominal, jec_full, jer, tec_nominal, tec, deterministic_seeds,
mc_weight, deterministic_seeds, jec_nominal, jec_full, deterministic_jer, tec_nominal, tec,
IF_RUN_2(met_phi),
},
produces={
mc_weight, jec_nominal, jec_full, jer, tec_nominal, tec, deterministic_seeds,
mc_weight, deterministic_seeds, jec_nominal, jec_full, deterministic_jer, tec_nominal, tec,
IF_RUN_2(met_phi),
},
)
Expand All @@ -40,7 +43,7 @@ def default(self: Calibrator, events: ak.Array, **kwargs) -> ak.Array:
events = self[jec_nominal](events, **kwargs)
else:
events = self[jec_full](events, **kwargs)
events = self[jer](events, **kwargs)
events = self[deterministic_jer](events, **kwargs)

if self.config_inst.campaign.x.run == 2:
events = self[met_phi](events, **kwargs)
Expand Down
6 changes: 6 additions & 0 deletions hbt/config/configs_hbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,12 @@ def if_era(
dataset = cfg.add_dataset(campaign.get_dataset(dataset_name))

# add tags to datasets
if dataset.name.startswith("data_e_"):
dataset.add_tag({"etau", "emu"})
if dataset.name.startswith("data_mu_"):
dataset.add_tag({"mutau", "emu", "mumu"})
if dataset.name.startswith("data_tau_"):
dataset.add_tag({"tautau"})
if dataset.name.startswith("tt_"):
dataset.add_tag({"has_top", "ttbar", "tt"})
if dataset.name.startswith("st_"):
Expand Down
215 changes: 68 additions & 147 deletions hbt/config/triggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,23 +809,13 @@ def add_triggers_2022(config: od.Config) -> None:
trigger_bits=2,
),
],
applies_to_dataset=(
lambda dataset_inst: dataset_inst.is_mc or
dataset_inst.has_tag("etau") or
dataset_inst.has_tag("emu")
),
tags={"single_trigger", "single_e", "channel_e_tau"},
),
# Currently disabled
# Trigger(
# name="HLT_Ele35_WPTight_Gsf",
# id=203,
# legs=[
# TriggerLeg(
# pdg_id=11,
# # min_pt=36.0,
# # filter names:
# # hltEle35noerWPTightGsfTrackIsoFilter (Single e WPTight)
# trigger_bits=2,
# ),
# ],
# tags={"single_trigger", "single_e", "channel_e_tau"},
# ),

#
# single muon
Expand All @@ -842,23 +832,14 @@ def add_triggers_2022(config: od.Config) -> None:
trigger_bits=2 + 8,
),
],
applies_to_dataset=(
lambda dataset_inst: dataset_inst.is_mc or
dataset_inst.has_tag("mutau") or
dataset_inst.has_tag("emu") or
dataset_inst.has_tag("mumu")
),
tags={"single_trigger", "single_mu", "channel_mu_tau"},
),
# Currently disabled
# Trigger(
# name="HLT_IsoMu27",
# id=102,
# legs=[
# TriggerLeg(
# pdg_id=13,
# # min_pt=28.0,
# # filter names:
# # hltL3crIsoL1sMu22Or25L1f0L2f10QL3f27QL3trkIsoFiltered0p08 (1mu + Iso)
# trigger_bits=2 + 8,
# ),
# ],
# tags={"single_trigger", "single_mu", "channel_mu_tau"},
# ),

#
# e tauh
Expand All @@ -884,6 +865,11 @@ def add_triggers_2022(config: od.Config) -> None:
trigger_bits=8 + 32,
),
],
applies_to_dataset=(
lambda dataset_inst: dataset_inst.is_mc or
dataset_inst.has_tag("etau") or
dataset_inst.has_tag("emu")
),
tags={"cross_trigger", "cross_e_tau", "channel_e_tau"},
),

Expand Down Expand Up @@ -911,6 +897,12 @@ def add_triggers_2022(config: od.Config) -> None:
trigger_bits=8 + 32,
),
],
applies_to_dataset=(
lambda dataset_inst: dataset_inst.is_mc or
dataset_inst.has_tag("mutau") or
dataset_inst.has_tag("emu") or
dataset_inst.has_tag("mumu")
),
tags={"cross_trigger", "cross_mu_tau", "channel_mu_tau"},
),

Expand All @@ -936,52 +928,12 @@ def add_triggers_2022(config: od.Config) -> None:
trigger_bits=8 + 32,
),
],
applies_to_dataset=(
lambda dataset_inst: dataset_inst.is_mc or
dataset_inst.has_tag("tautau")
),
tags={"cross_trigger", "cross_tau_tau", "channel_tau_tau"},
),
# Currently disabled
# Trigger(
# name="HLT_DoubleMediumChargedIsoPFTauHPS40_Trk1_eta2p1",
# id=506,
# legs=[
# TriggerLeg(
# pdg_id=15,
# # min_pt=45.0,
# # filter names:
# trigger_bits=2 + 32 + 64,
# ),
# TriggerLeg(
# pdg_id=15,
# # min_pt=45.0,
# # filter names:
# trigger_bits=2 + 32 + 64,
# ),
# ],
# applies_to_dataset=(lambda dataset_inst: dataset_inst.is_mc or dataset_inst.x.era >= "E"),
# tags={"cross_trigger", "cross_tau_tau", "channel_tau_tau"},
# ),

# Trigger(
# name="HLT_DoubleMediumChargedIsoDisplacedPFTauHPS32_Trk1_eta2p1",
# id=507,
# legs=[
# TriggerLeg(
# pdg_id=15,
# # min_pt=45.0,
# # filter names:
# # hltHpsDoubleMediumChargedIsoDisplPFTau32Dxy0p005
# trigger_bits=2 + 32 + 64 + 32768,
# ),
# TriggerLeg(
# pdg_id=15,
# # min_pt=45.0,
# # filter names:
# # hltHpsDoubleMediumChargedIsoDisplPFTau32Dxy0p005
# trigger_bits=2 + 32 + 64 + 32768,
# ),
# ],
# applies_to_dataset=(lambda dataset_inst: dataset_inst.is_data and dataset_inst.x.era < "E"),
# tags={"cross_trigger", "cross_tau_tau", "channel_tau_tau"},
# ),

#
# vbf
Expand Down Expand Up @@ -1020,49 +972,13 @@ def add_triggers_2022(config: od.Config) -> None:
# trigger_bits=1,
# ),
],
# applies_to_dataset=(lambda dataset_inst: dataset_inst.is_data and config.has_tag("pre")),
applies_to_dataset=(
lambda dataset_inst: dataset_inst.is_mc or
dataset_inst.has_tag("tautau")
),
tags={"cross_trigger", "cross_tau_tau_vbf", "channel_tau_tau"},
),

# currently disabled
# Trigger(
# name="HLT_VBF_DoubleLooseChargedIsoPFTauHPS20_Trk1_eta2p1",
# id=602,
# legs=[
# TriggerLeg(
# pdg_id=15,
# # min_pt=25.0,
# # filter names:
# # hltMatchedVBFOnePFJet2CrossCleanedFromDoubleLooseChargedIsoPFTauHPS20 (LooseChargedIso + HPS + run 3 VBF+ditau) # noqa
# # hltMatchedVBFTwoPFJets2CrossCleanedFromDoubleLooseChargedIsoPFTauHPS20
# # hltHpsDoublePFTau20TrackLooseChargedIso
# trigger_bits=1 + 32 + 4096,
# ),
# TriggerLeg(
# pdg_id=15,
# # min_pt=25.0,
# # filter names:
# # hltMatchedVBFOnePFJet2CrossCleanedFromDoubleLooseChargedIsoPFTauHPS20 (LooseChargedIso + HPS + run 3 VBF+ditau) # noqa
# # hltMatchedVBFTwoPFJets2CrossCleanedFromDoubleLooseChargedIsoPFTauHPS20
# # hltHpsDoublePFTau20TrackLooseChargedIso
# trigger_bits=1 + 32 + 4096,
# ),
# # additional leg infos for vbf jets
# TriggerLeg( # TODO
# # min_pt=115.0,
# # filter names:
# trigger_bits=None,
# ),
# TriggerLeg(
# # min_pt=40.0,
# # filter names:
# trigger_bits=None,
# ),
# ],
# applies_to_dataset=(lambda dataset_inst: dataset_inst.is_mc and config.has_tag("pre")),
# tags={"cross_trigger", "cross_tau_tau_vbf", "channel_tau_tau"},
# ),

# Currently disabled since it may not be needed
# Trigger(
# name="HLT_DoublePFJets40_Mass500_MediumDeepTauPFTauHPS45_L2NN_MediumDeepTauPFTauHPS20_eta2p1",
Expand Down Expand Up @@ -1112,40 +1028,12 @@ def add_triggers_2022(config: od.Config) -> None:
# trigger_bits=1,
# ),
],
applies_to_dataset=(
lambda dataset_inst: dataset_inst.is_mc or
dataset_inst.has_tag("tautau")
),
tags={"cross_trigger", "cross_tau_tau_jet", "channel_tau_tau"},
),
# Currently disabled
# Trigger(
# name="HLT_DoubleMediumDeepTauPFTauHPS30_L2NN_eta2p1_PFJet75",
# id=702,
# legs=[
# TriggerLeg(
# pdg_id=15,
# # min_pt=35.0,
# # filter names:
# # hltHpsOverlapFilterDeepTauDoublePFTau30PFJet75 (Deeptau + HPS + di-tau + PFJet)
# # hltHpsDoublePFTau30MediumDitauWPDeepTauL1HLTMatchedDoubleTauJet
# # hlt1PFJet75L1HLTMatched
# trigger_bits=8 + 32 + 16384,
# ),
# TriggerLeg(
# pdg_id=15,
# # min_pt=35.0,
# # filter names:
# # hltHpsOverlapFilterDeepTauDoublePFTau30PFJet75
# # hltHpsDoublePFTau30MediumDitauWPDeepTauL1HLTMatchedDoubleTauJet
# # hlt1PFJet75L1HLTMatched
# trigger_bits=8 + 32 + 16384,
# ),
# TriggerLeg(
# # min_pt=75.0,
# # filter names:
# # hltHpsOverlapFilterDeepTauDoublePFTau30PFJet75
# trigger_bits=None,
# ),
# ],
# tags={"cross_trigger", "cross_tau_tau_jet", "channel_tau_tau"},
# ),
])


Expand All @@ -1170,6 +1058,11 @@ def add_triggers_2023(config: od.Config) -> None:
trigger_bits=2,
),
],
applies_to_dataset=(
lambda dataset_inst: dataset_inst.is_mc or
dataset_inst.has_tag("etau") or
dataset_inst.has_tag("emu")
),
tags={"single_trigger", "single_e", "channel_e_tau"},
),

Expand All @@ -1188,6 +1081,12 @@ def add_triggers_2023(config: od.Config) -> None:
trigger_bits=2 + 8,
),
],
applies_to_dataset=(
lambda dataset_inst: dataset_inst.is_mc or
dataset_inst.has_tag("mutau") or
dataset_inst.has_tag("emu") or
dataset_inst.has_tag("mumu")
),
tags={"single_trigger", "single_mu", "channel_mu_tau"},
),

Expand Down Expand Up @@ -1215,6 +1114,11 @@ def add_triggers_2023(config: od.Config) -> None:
trigger_bits=8 + 32,
),
],
applies_to_dataset=(
lambda dataset_inst: dataset_inst.is_mc or
dataset_inst.has_tag("etau") or
dataset_inst.has_tag("emu")
),
tags={"cross_trigger", "cross_e_tau", "channel_e_tau"},
),

Expand Down Expand Up @@ -1242,6 +1146,12 @@ def add_triggers_2023(config: od.Config) -> None:
trigger_bits=8 + 32,
),
],
applies_to_dataset=(
lambda dataset_inst: dataset_inst.is_mc or
dataset_inst.has_tag("mutau") or
dataset_inst.has_tag("emu") or
dataset_inst.has_tag("mumu")
),
tags={"cross_trigger", "cross_mu_tau", "channel_mu_tau"},
),

Expand All @@ -1267,6 +1177,10 @@ def add_triggers_2023(config: od.Config) -> None:
trigger_bits=8 + 32,
),
],
applies_to_dataset=(
lambda dataset_inst: dataset_inst.is_mc or
dataset_inst.has_tag("tautau")
),
tags={"cross_trigger", "cross_tau_tau", "channel_tau_tau"},
),

Expand Down Expand Up @@ -1297,7 +1211,10 @@ def add_triggers_2023(config: od.Config) -> None:
trigger_bits=8 + 32 + 4096,
),
],
# applies_to_dataset=(lambda dataset_inst: dataset_inst.is_data and config.has_tag("pre")),
applies_to_dataset=(
lambda dataset_inst: dataset_inst.is_mc or
dataset_inst.has_tag("tautau")
),
tags={"cross_trigger", "cross_tau_tau_vbf", "channel_tau_tau"},
),

Expand All @@ -1324,6 +1241,10 @@ def add_triggers_2023(config: od.Config) -> None:
trigger_bits=16 + 16384,
),
],
applies_to_dataset=(
lambda dataset_inst: dataset_inst.is_mc or
dataset_inst.has_tag("tautau")
),
tags={"cross_trigger", "cross_tau_tau_jet", "channel_tau_tau"},
),
])
2 changes: 2 additions & 0 deletions hbt/config/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ def legs(
@typed
def applies_to_dataset(self, func: Callable | bool | Any) -> Callable:
if not callable(func):
if func is not None:
raise TypeError(f"invalid applies_to_dataset: {func}")
decision = True if func is None else bool(func)
func = lambda dataset_inst: decision

Expand Down
Loading

0 comments on commit 70b8e12

Please sign in to comment.