Skip to content

Commit

Permalink
Merge branch 'uhh-cms:master' into run3_selection_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
haddadanas authored Jun 12, 2024
2 parents fc0ec86 + f478be3 commit c92f9be
Show file tree
Hide file tree
Showing 17 changed files with 1,189 additions and 234 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ law run cf.CreateDatacards \
- [Nano documentation](https://gitlab.cern.ch/cms-nanoAOD/nanoaod-doc)
- [Correctionlib files](https://gitlab.cern.ch/cms-nanoAOD/jsonpog-integration)
- [HLT info browser](https://cmshltinfo.app.cern.ch/path/HLT_MediumChargedIsoPFTau180HighPtRelaxedIso_Trk50_eta2p1_v)
- [HLT config browser](https://cmshltcfg.app.cern.ch/open?db=online&cfg=%2Fcdaq%2Fphysics%2FRun2018%2F2e34%2Fv2.1.5%2FHLT%2FV2)

### Development

Expand Down
99 changes: 99 additions & 0 deletions hbt/calibration/fake_triggers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# coding: utf-8

"""
Placeholder calibrator to produce missing single trigger columns.
Does not include default calibrations.
"""

from columnflow.calibration import Calibrator, calibrator
from columnflow.util import maybe_import
from columnflow.columnar_util import set_ak_column

np = maybe_import("numpy")
ak = maybe_import("awkward")


@calibrator(
uses={
"Electron.pt", "Electron.eta", "Muon.pt", "Muon.eta", "Tau.pt",
},
produces={
"HLT_Ele25_eta2p1_WPTight_Gsf", "HLT_IsoMu22", "HLT_IsoMu22_eta2p1", "HLT_IsoTkMu22", "HLT_IsoTkMu22_eta2p1",
"HLT_Ele24_eta2p1_WPLoose_Gsf_LooseIsoPFTau30", "HLT_Ele24_eta2p1_WPLoose_Gsf_LooseIsoPFTau20",
"HLT_Ele24_eta2p1_WPLoose_Gsf_LooseIsoPFTau20_SingleL1",
},
)
def fake_triggers(self: Calibrator, events: ak.Array, **kwargs) -> ak.Array:

HLT_Ele25_eta2p1_WPTight_Gsf = ak.any(
(events.Electron.pt >= 25.5) &
(events.Electron.eta <= 2.1),
axis=1,
)

HLT_IsoMu22 = ak.any(
(events.Muon.pt >= 22.5),
axis=1,
)

HLT_IsoMu22_eta2p1 = ak.any(
(events.Muon.pt >= 22.5) &
(events.Muon.eta <= 2.1),
axis=1,
)

HLT_Ele24_eta2p1_WPLoose_Gsf_LooseIsoPFTau30 = (
ak.any(
(events.Electron.pt >= 24.5) &
(events.Electron.eta <= 2.1),
axis=1,
) & ak.any(
(events.Tau.pt >= 30.5),
axis=1,
)
)

HLT_Ele24_eta2p1_WPLoose_Gsf_LooseIsoPFTau20 = (
ak.any(
(events.Electron.pt >= 24.5) &
(events.Electron.eta <= 2.1),
axis=1,
) & ak.any(
(events.Tau.pt >= 20.5),
axis=1,
)
)

HLT_Ele24_eta2p1_WPLoose_Gsf_LooseIsoPFTau20_SingleL1 = (
ak.any(
(events.Electron.pt >= 24.5) &
(events.Electron.eta <= 2.1),
axis=1,
) & ak.any(
(events.Tau.pt >= 20.5),
axis=1,
)
)

events = set_ak_column(events, "HLT_Ele25_eta2p1_WPTight_Gsf", HLT_Ele25_eta2p1_WPTight_Gsf)
events = set_ak_column(events, "HLT_IsoMu22", HLT_IsoMu22)
events = set_ak_column(events, "HLT_IsoMu22_eta2p1", HLT_IsoMu22_eta2p1)
events = set_ak_column(events, "HLT_IsoTkMu22", HLT_IsoMu22)
events = set_ak_column(events, "HLT_IsoTkMu22_eta2p1", HLT_IsoMu22_eta2p1)
events = set_ak_column(
events,
"HLT_Ele24_eta2p1_WPLoose_Gsf_LooseIsoPFTau30",
HLT_Ele24_eta2p1_WPLoose_Gsf_LooseIsoPFTau30,
)
events = set_ak_column(
events,
"HLT_Ele24_eta2p1_WPLoose_Gsf_LooseIsoPFTau20",
HLT_Ele24_eta2p1_WPLoose_Gsf_LooseIsoPFTau20,
)
events = set_ak_column(
events,
"HLT_Ele24_eta2p1_WPLoose_Gsf_LooseIsoPFTau20_SingleL1",
HLT_Ele24_eta2p1_WPLoose_Gsf_LooseIsoPFTau20_SingleL1,
)

return events
125 changes: 86 additions & 39 deletions hbt/config/analysis_hbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,50 +38,97 @@
# (used in wrapper_factory)
analysis_hbt.x.config_groups = {}

# named function hooks that can modify store_parts of task outputs if needed
analysis_hbt.x.store_parts_modifiers = {}


#
# load configs
#

# # 2017
# from hbt.config.configs_run2ul import add_config as add_config_run2ul
# from cmsdb.campaigns.run2_2017_nano_v9 import campaign_run2_2017_nano_v9
# from cmsdb.campaigns.run2_2017_nano_uhh_v11 import campaign_run2_2017_nano_uhh_v11


# # default v9 config
# add_config_run2ul(
# analysis_hbt,
# campaign_run2_2017_nano_v9.copy(),
# config_name=campaign_run2_2017_nano_v9.name,
# config_id=2,
# )

# # v9 config with limited number of files for faster prototyping
# add_config_run2ul(
# analysis_hbt,
# campaign_run2_2017_nano_v9.copy(),
# config_name=f"{campaign_run2_2017_nano_v9.name}_limited",
# config_id=12,
# limit_dataset_files=2,
# )

# # default v11 uhh config
# add_config_run2ul(
# analysis_hbt,
# campaign_run2_2017_nano_uhh_v11.copy(),
# config_name=campaign_run2_2017_nano_uhh_v11.name,
# config_id=31,
# )

# # v11 uhh config with limited number of files for faster prototyping
# add_config_run2ul(
# analysis_hbt,
# campaign_run2_2017_nano_uhh_v11.copy(),
# config_name=f"{campaign_run2_2017_nano_uhh_v11.name}_limited",
# config_id=32,
# limit_dataset_files=2,
# )
#
# Run 2 configs
#

from hbt.config.configs_run2ul import add_config as add_config_run2ul

# 2016 HIPM
from cmsdb.campaigns.run2_2016_HIPM_nano_uhh_v12 import campaign_run2_2016_HIPM_nano_uhh_v12

# default v12 config
add_config_run2ul(
analysis_hbt,
campaign_run2_2016_HIPM_nano_uhh_v12.copy(),
config_name=campaign_run2_2016_HIPM_nano_uhh_v12.name,
config_id=6, # random number here that is not repeated ?
)

# default v12 config with limited number of files for faster prototyping
add_config_run2ul(
analysis_hbt,
campaign_run2_2016_HIPM_nano_uhh_v12.copy(),
config_name=f"{campaign_run2_2016_HIPM_nano_uhh_v12.name}_limited",
config_id=16, # random number here that is not repeated ?
limit_dataset_files=2,
)

# 2016 post
from cmsdb.campaigns.run2_2016_nano_uhh_v12 import campaign_run2_2016_nano_uhh_v12

# v12 uhh config with full datasets
add_config_run2ul(
analysis_hbt,
campaign_run2_2016_nano_uhh_v12.copy(),
config_name=campaign_run2_2016_nano_uhh_v12.name,
config_id=3,
)

# v12 uhh config with limited number of files for faster prototyping
add_config_run2ul(
analysis_hbt,
campaign_run2_2016_nano_uhh_v12.copy(),
config_name=f"{campaign_run2_2016_nano_uhh_v12.name}_limited",
config_id=13,
limit_dataset_files=2,
)

# 2017
from cmsdb.campaigns.run2_2017_nano_v9 import campaign_run2_2017_nano_v9
from cmsdb.campaigns.run2_2017_nano_uhh_v11 import campaign_run2_2017_nano_uhh_v11

# default v9 config
add_config_run2ul(
analysis_hbt,
campaign_run2_2017_nano_v9.copy(),
config_name=campaign_run2_2017_nano_v9.name,
config_id=2,
)

# v9 config with limited number of files for faster prototyping
add_config_run2ul(
analysis_hbt,
campaign_run2_2017_nano_v9.copy(),
config_name=f"{campaign_run2_2017_nano_v9.name}_limited",
config_id=12,
limit_dataset_files=2,
)

# default v11 uhh config
add_config_run2ul(
analysis_hbt,
campaign_run2_2017_nano_uhh_v11.copy(),
config_name=campaign_run2_2017_nano_uhh_v11.name,
config_id=31,
)

# v11 uhh config with limited number of files for faster prototyping
add_config_run2ul(
analysis_hbt,
campaign_run2_2017_nano_uhh_v11.copy(),
config_name=f"{campaign_run2_2017_nano_uhh_v11.name}_limited",
config_id=32,
limit_dataset_files=2,
)


#
Expand Down
Loading

0 comments on commit c92f9be

Please sign in to comment.