Skip to content

Commit

Permalink
adding BKG to observation
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew authored and Matthew committed Dec 6, 2019
1 parent 5c4b555 commit 746ac46
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Datacards/python/runLimits.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
Expand Down
12 changes: 10 additions & 2 deletions Datacards/python/writeDatacard_SUSYNano19.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 ------
Expand All @@ -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 = {}
Expand Down Expand Up @@ -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]))
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion Datacards/setup/SUSYNano19/values_unc_qcd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 746ac46

Please sign in to comment.