Skip to content

Commit

Permalink
determine run period from events.metadata[year]
Browse files Browse the repository at this point in the history
  • Loading branch information
andreypz committed Feb 15, 2024
1 parent 8f97d3a commit c5cdc92
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pocket_coffea/lib/jets.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ def jet_selection(events, jet_type, params, leptons_collection=""):
dR_jets_lep = jets.metric_table(events[leptons_collection])
mask_lepton_cleaning = ak.prod(dR_jets_lep > cuts["dr_lepton"], axis=2) == 1

if 'run_period' not in params or params['run_period']!='Run3': # puid does not exist for Run3 samples
# Selection on PUid. Only available in Run2 UL, thus we need to determine which sample we run over:
if events.metadata["year"] in ['2016_PreVFP', '2016_PostVFP','2017','2018']:
mask_jetpuid = (jets.puId >= cuts["puId"]["value"]) | (
jets.pt >= cuts["puId"]["maxpt"]
)
Expand Down
3 changes: 0 additions & 3 deletions pocket_coffea/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,11 +814,8 @@ def rescale_sumgenweights(self, output):
for var, vardata in output["variables"].items():
for sample, dataset_in_sample in vardata.items():
for dataset, histo in dataset_in_sample.items():
#print("Scaling", var, sample, dataset)
#print(self.cfg.weights_config)
# First, determine whether we must use the sum_signOf_genweights or sum_genweights for rescaling.
# This information is taken from a weights config file for each _sample_

wei = self.cfg.weights_config[sample]['inclusive']
if 'signOf_genWeight' in wei and 'genWeight' not in wei:
sumgenw_dict = output["sum_signOf_genweights"]
Expand Down

0 comments on commit c5cdc92

Please sign in to comment.