Skip to content

Commit b841fdc

Browse files
committed
adding CombineHarvester tH analysis example script
1 parent 3639cfc commit b841fdc

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#!/usr/bin/env python
2+
3+
import combineharvester as ch
4+
import os
5+
6+
cb = ch.CombineHarvester()
7+
8+
auxiliaries = os.environ['CMSSW_BASE'] + '/src/auxiliaries/'
9+
aux_shapes = auxiliaries +'shapes/'
10+
11+
procs = {
12+
'sig' : ['tH_YtMinus', 'tHW'],
13+
'sim' : ['WZ', 'ZZ', 'ttW', 'ttZ', 'ttH'],
14+
'bkg' : ['WZ','ZZ','ttW','ttZ','ttH','reducible']
15+
}
16+
17+
cats = [(0, 'emt'), (1, 'mmt')]
18+
19+
masses = ['125']
20+
21+
cb.AddObservations( ['*'], ['htt'], ["8TeV"], ['th'], cats )
22+
cb.AddProcesses( ['*'], ['htt'], ["8TeV"], ['th'], procs['bkg'], cats, False )
23+
cb.AddProcesses( masses, ['htt'], ["8TeV"], ['th'], procs['sig'], cats, True )
24+
25+
print '>> Adding systematic uncertainties...'
26+
27+
cb.cp().process(procs['sig'] + procs['sim']).AddSyst(
28+
cb, 'lumi_$ERA', 'lnN', ch.SystMap()(1.026))
29+
30+
cb.cp().process(procs['sig']).AddSyst(
31+
cb, 'CMS_th_sig_trigger_$BIN_$ERA', 'lnN', ch.SystMap('bin')(['emt'], 1.05)(['mmt'], 1.06))
32+
33+
cb.cp().process(procs['sig'] + procs['sim']).AddSyst(
34+
cb, 'CMS_th_eff_e_$ERA', 'lnN', ch.SystMap('bin')(['emt'], 1.051))
35+
36+
cb.cp().process(procs['sig'] + procs['sim']).AddSyst(
37+
cb, 'CMS_th_eff_m_$ERA', 'lnN', ch.SystMap('bin')(['emt'], 1.051)(['mmt'], 1.102))
38+
39+
cb.cp().process(procs['sig'] + procs['sim']).AddSyst(
40+
cb, 'CMS_th_eff_t_$ERA', 'lnN', ch.SystMap()(1.06))
41+
42+
cb.cp().process(procs['sig'] + procs['sim']).AddSyst(
43+
cb, 'CMS_th_scale_t_$ERA', 'lnN', ch.SystMap()(1.03))
44+
45+
cb.cp().process(procs['sig'] + ['ttW', 'ttH', 'ZZ', 'WZ']).AddSyst(
46+
cb, 'CMS_scale_j_$ERA', 'lnN', ch.SystMap()(1.01))
47+
48+
cb.cp().AddSyst(
49+
cb, 'CMS_th_mc_stats_$PROCESS_$BIN_$ERA', 'lnN', ch.SystMap('bin', 'process')
50+
(['emt'], ['ttZ'], 1.18)
51+
(['emt'], ['ttW'], 1.14)
52+
(['emt'], ['ttH'], 1.06)
53+
(['emt'], ['ZZ'], 1.10)
54+
(['emt'], ['WZ'], 1.12)
55+
(['mmt'], ['ttZ'], 1.27)
56+
(['mmt'], ['ttW'], 1.18)
57+
(['mmt'], ['ttH'], 1.09)
58+
(['mmt'], ['ZZ'], 1.15)
59+
(['mmt'], ['WZ'], 1.18))
60+
61+
cb.cp().AddSyst(
62+
cb, 'CMS_eff_b_$ERA', 'lnN', ch.SystMap('process')
63+
(procs['sig'], 1.05)
64+
(['ttH', 'ttW', 'ttZ'], 1.03))
65+
66+
cb.cp().AddSyst(
67+
cb, 'CMS_fake_b_$ERA', 'lnN', ch.SystMap('process')
68+
(['WZ', 'ZZ'], 1.20))
69+
70+
cb.cp().process(['reducible']).AddSyst(
71+
cb, 'CMS_th_reducible_$BIN_$ERA', 'lnN', ch.SystMap('bin')
72+
(['emt'], 1.50)(['mmt'], 1.50))
73+
74+
cb.cp().process(procs['sig']).AddSyst(cb, 'QCDscale_tHq', 'lnN', ch.SystMap()(1.019))
75+
cb.cp().process(['ttH']).AddSyst(cb, 'QCDscale_ttH', 'lnN', ch.SystMap()(1.067))
76+
cb.cp().process(['ttW']).AddSyst(cb, 'QCDscale_ttW', 'lnN', ch.SystMap()(1.105))
77+
cb.cp().process(['ttZ']).AddSyst(cb, 'QCDscale_ttW', 'lnN', ch.SystMap()(1.116))
78+
cb.cp().process(['WW', 'ZZ']).AddSyst(cb, 'QCDscale_VV', 'lnN', ch.SystMap()(1.036))
79+
80+
cb.cp().AddSyst(
81+
cb, 'pdf_gg', 'lnN', ch.SystMap('process')
82+
(['ttZ'], 0.919)(['ttH'], 0.926))
83+
84+
cb.cp().AddSyst(
85+
cb, 'pdf_qqbar', 'lnN', ch.SystMap('process')
86+
(['tH_YtMinus'], 1.048)(['ttW'], 1.072)(['WZ','ZZ'], 1.040))
87+
88+
cb.cp().AddSyst(
89+
cb, 'pdf_qg', 'lnN', ch.SystMap('process')
90+
(['tHW'], 1.048))
91+
92+
93+
print '>> Extracting histograms from input root files...'
94+
file = aux_shapes + 'CERN/htt_th.inputs-sm-8TeV.root'
95+
cb.cp().backgrounds().ExtractShapes(
96+
file, '$BIN/$PROCESS', '$BIN/$PROCESS_$SYSTEMATIC')
97+
cb.cp().signals().ExtractShapes(
98+
file, '$BIN/$PROCESS$MASS', '$BIN/$PROCESS$MASS_$SYSTEMATIC')
99+
100+
101+
print '>> Generating bbb uncertainties...'
102+
bbb = ch.BinByBinFactory()
103+
bbb.SetAddThreshold(0.1).SetFixNorm(True)
104+
bbb.AddBinByBin(cb.cp().process(['reducible']), cb)
105+
106+
107+
print '>> Setting standardised bin names...'
108+
ch.SetStandardBinNames(cb)
109+
cb.PrintAll()
110+
111+
writer = ch.CardWriter('$TAG/$MASS/$ANALYSIS_$CHANNEL_$BINID_$ERA.txt',
112+
'$TAG/common/$ANALYSIS_$CHANNEL.input.root')
113+
writer.SetVerbosity(1)
114+
writer.WriteCards('output/sm_cards/LIMITS', cb)
115+
116+
print '>> Done!'

0 commit comments

Comments
 (0)