Skip to content

Commit

Permalink
make list creation uniform
Browse files Browse the repository at this point in the history
  • Loading branch information
anmalara committed Mar 17, 2023
1 parent e747050 commit 895a93b
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions bucoffea/vbfhinv/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,12 @@ def vbfhinv_accumulator(cfg):
return processor.dict_accumulator(items)

def vbfhinv_regions(cfg):
def clean_lists(orig_list, to_remove):
return list(filter(lambda x: x not in to_remove, orig_list))

def add_lists(orig_list, to_add):
return list(orig_list+ to_add)

common_cuts = [
'filt_met',
'veto_ele',
Expand Down Expand Up @@ -314,7 +320,7 @@ def vbfhinv_regions(cfg):
common_cuts.append('mjj_tight')

regions = {}
# regions['inclusive'] = ['inclusive']
regions['inclusive'] = ['inclusive']

# Signal regions (v = mono-V, j = mono-jet)
regions['sr_vbf'] = ['trig_met','metphihemextveto','hornveto'] + common_cuts + ['dpfcalo_sr', 'eemitigation']
Expand All @@ -327,36 +333,30 @@ def vbfhinv_regions(cfg):
regions['sr_vbf'].remove('eemitigation')

if cfg.RUN.REGION_WITHOUT_DIJET_CUTS:
regions['sr_vbf_nodijetcut'] = [cut for cut in regions['sr_vbf'] if cut not in ['mjj','detajj','dphijj']]
regions['sr_vbf_nodijetcut'] = clean_lists(regions['sr_vbf'], ['mjj','detajj','dphijj'])

# SR without PU weights
# regions['sr_vbf_no_pu'] = copy.deepcopy(regions['sr_vbf'])


# SR without HEM veto
if cfg.RUN.HEMCHECK:
regions['sr_vbf_no_hem_veto'] = copy.deepcopy(regions['sr_vbf'])
regions['sr_vbf_no_hem_veto'].remove('metphihemextveto')
regions['sr_vbf_no_hem_veto'] = clean_lists(regions['sr_vbf'], ['metphihemextveto'])

# QCD CR with the HF shape cuts inverted
if cfg.RUN.QCD_ESTIMATION:
regions['cr_vbf_qcd'] = copy.deepcopy(regions['sr_vbf'])
to_remove = ['central_stripsize_cut', 'sigma_eta_minus_phi']
regions['cr_vbf_qcd'] = clean_lists(regions['sr_vbf'], to_remove)
if 'one_fifth_mask' in regions['cr_vbf_qcd']:
regions['cr_vbf_qcd'].remove('one_fifth_mask')
try:
regions['cr_vbf_qcd'].remove('central_stripsize_cut')
regions['cr_vbf_qcd'].remove('sigma_eta_minus_phi')
except:
pass
regions['cr_vbf_qcd'].append('fail_hf_cuts')

# QCD CR to check with deltaphi(jet,MET) cut inverted
# Will be used to compare the yields with the QCD template obtained from R&S
if cfg.RUN.REBSMEAR_CHECK:
regions['cr_vbf_qcd_rs'] = copy.deepcopy(regions['sr_vbf'])
regions['cr_vbf_qcd_rs'].remove('mindphijr')
regions['cr_vbf_qcd_rs'].append('mindphijr_inv')

regions['cr_vbf_qcd_rs'] = clean_lists(regions['sr_vbf'], ['mindphijr'])
regions['cr_vbf_qcd_rs'] = add_lists(regions['cr_vbf_qcd_rs'], ['mindphijr_inv'])

# For sync mode
if cfg and cfg.RUN.SYNC:
regions['cr_sync'] = [
Expand Down

0 comments on commit 895a93b

Please sign in to comment.