From 746ac462918607a013076d6332587a4c72602672 Mon Sep 17 00:00:00 2001 From: Matthew Date: Fri, 6 Dec 2019 00:10:49 -0600 Subject: [PATCH] adding BKG to observation --- Datacards/python/runLimits.py | 2 +- Datacards/python/writeDatacard_SUSYNano19.py | 12 ++++++++++-- Datacards/setup/SUSYNano19/values_unc_qcd.conf | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Datacards/python/runLimits.py b/Datacards/python/runLimits.py index e72051f..689646b 100755 --- a/Datacards/python/runLimits.py +++ b/Datacards/python/runLimits.py @@ -449,7 +449,7 @@ def calcLimit(config, signal): if (mstop<450 and 'fbd' not in sigtype) or (mstop >= 350 and mlsp < 350 and 'T2tt' in sigtype) : runLimitsCommand = 'combine -M AsymptoticLimits ' + combinedDatacard + ' --rMin 0 --rMax 10 -n ' + signal if ('T2tt' in sigtype and mstop>=350 and mlsp >= 350) : - runLimitsCommand = 'combine -M AsymptoticLimits ' + combinedDatacard + ' --rMin 0 --rMax 10 -n ' + signal + runLimitsCommand = 'combine -M AsymptoticLimits ' + combinedDatacard + ' --rMin 0 --rMax 5 -n ' + signal if ('fbd' in sigtype or '4bd' in sigtype) and (mstop<=250): runLimitsCommand = 'combine -M AsymptoticLimits ' + combinedDatacard + ' --rMin 0 --rMax 1 -n ' + signal if config.expectedonly : diff --git a/Datacards/python/writeDatacard_SUSYNano19.py b/Datacards/python/writeDatacard_SUSYNano19.py index fa3b5c8..49c0278 100644 --- a/Datacards/python/writeDatacard_SUSYNano19.py +++ b/Datacards/python/writeDatacard_SUSYNano19.py @@ -119,6 +119,7 @@ def sumBkgYields(process, signal, cr_description, yields_dict): if '<' in cr: sr, cr = cr, sr sr = sr.strip('<>') cr = cr.strip('()') + #print(cr) crdata = yields[crproc + '_data'][cr][0] srunit = yields_dict[process][sr][0] if 'ttbar' in process: @@ -133,7 +134,12 @@ def sumBkgYields(process, signal, cr_description, yields_dict): crunit+=yields['phocr_back'][cr][0] else: crunit+=1e-06 - total += crdata*srunit/crunit + #print("crdata: %f, srunit: %f, crunit: %f" %(crdata, srunit, crunit)) + if 'znunu' in process: + total += srunit*crunit + else: + total += crdata*srunit/crunit + #print("total: %f" %(total)) return total # ------ helper functions ------ @@ -158,6 +164,7 @@ def __init__(self, name, type, value, value2 = -999.): def averageUnc(up, down): sign = 1 if up >= 1 else -1 val = 0.5 * (abs(up - 1) + abs(1 - down)) + if abs(val) >= 1: val = 0.999 return (sign * val) unc_def = {} @@ -348,7 +355,7 @@ def writeSR(signal): expected += yields[proc][bin][0] else: expected += sumBkgYields(proc, signal, binMaps[processMap[proc]][bin], yields) - + print(expected) if not blind: cb.ForEachObs(lambda obs : obs.set_rate(yields['data'][bin][0])) else: cb.ForEachObs(lambda obs : obs.set_rate(expected)) cb.cp().process(['signal']).ForEachProc(lambda p : p.set_rate(sigYields[signal][bin][0])) @@ -386,6 +393,7 @@ def writeSR(signal): for unc in unc_dict[bin][proc].values(): procname_in_dc = proc if proc in bkgprocesses else 'signal' if unc.value2 > -100.: + #cb.cp().process([procname_in_dc]).AddSyst(cb, unc.name, unc.type, ch.SystMap()(unc.value)) cb.cp().process([procname_in_dc]).AddSyst(cb, unc.name, unc.type, ch.SystMap()((unc.value,unc.value2))) else: cb.cp().process([procname_in_dc]).AddSyst(cb, unc.name, unc.type, ch.SystMap()(unc.value)) diff --git a/Datacards/setup/SUSYNano19/values_unc_qcd.conf b/Datacards/setup/SUSYNano19/values_unc_qcd.conf index 58fae85..e4214b9 100644 --- a/Datacards/setup/SUSYNano19/values_unc_qcd.conf +++ b/Datacards/setup/SUSYNano19/values_unc_qcd.conf @@ -1240,7 +1240,7 @@ bin_hm_nb1_highmtb_ntgeq1_nrt0_nw0_htlt1000_MET_pt550to650 JES_up qcd 2 bin_hm_nb1_highmtb_ntgeq1_nrt0_nw0_htlt1000_MET_pt550to650 JES_down qcd 0.001 bin_hm_nb1_highmtb_ntgeq1_nrt0_nw0_htlt1000_MET_pt650toinf JES_up qcd 2 bin_hm_nb1_highmtb_ntgeq1_nrt0_nw0_htlt1000_MET_pt650toinf JES_down qcd 0.001 -bin_hm_nb1_highmtb_ntgeq1_nrt0_nw0_ht1000to1500_MET_pt250to550 JES_up qcd -0 +bin_hm_nb1_highmtb_ntgeq1_nrt0_nw0_ht1000to1500_MET_pt250to550 JES_up qcd 2 bin_hm_nb1_highmtb_ntgeq1_nrt0_nw0_ht1000to1500_MET_pt250to550 JES_down qcd 1.09543 bin_hm_nb1_highmtb_ntgeq1_nrt0_nw0_ht1000to1500_MET_pt550to650 JES_up qcd 2 bin_hm_nb1_highmtb_ntgeq1_nrt0_nw0_ht1000to1500_MET_pt550to650 JES_down qcd 0.001