diff --git a/bucoffea/vbfhinv/definitions.py b/bucoffea/vbfhinv/definitions.py index 2bde4b1a..9726156a 100644 --- a/bucoffea/vbfhinv/definitions.py +++ b/bucoffea/vbfhinv/definitions.py @@ -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', @@ -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'] @@ -327,7 +333,7 @@ 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']) @@ -335,28 +341,22 @@ def vbfhinv_regions(cfg): # 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'] = [