1 |
bortigno |
1.1 |
#!/afs/cern.ch/cms/slc5_amd64_gcc434/cms/cmssw/CMSSW_4_2_8/external/slc5_amd64_gcc434/bin/python2.6
|
2 |
|
|
|
3 |
|
|
import os
|
4 |
|
|
import ROOT
|
5 |
|
|
|
6 |
|
|
|
7 |
nmohr |
1.3 |
files = [ 'vhbb_TH_BDT_M125_ZeeHighPt_8TeV.root' ]
|
8 |
nmohr |
1.2 |
histos=[ 'TT','ZjLF','ZjHF', 'VV','s_Top' ]
|
9 |
|
|
masses = [110,115,120,125,130,135]
|
10 |
|
|
dictNr = {'QCD': '--','WjHF': '--','WjLF': '--','WH110':'--','WH115':'--','WH120':'--','WH125':'--','WH130':'--','WH135':'--'}
|
11 |
bortigno |
1.1 |
|
12 |
|
|
def dc_tex_converter(rootFile):
|
13 |
nmohr |
1.2 |
def getNr(th1):
|
14 |
|
|
error = ROOT.Double()
|
15 |
|
|
integral = th1.IntegralAndError(0,1000,error)
|
16 |
|
|
return integral,error
|
17 |
|
|
if 'Zee' in rootFile: dictNr['mode'] = 'ZeeH'
|
18 |
|
|
if 'Zmm' in rootFile: dictNr['mode'] = 'ZmmH'
|
19 |
|
|
|
20 |
|
|
for mass in masses:
|
21 |
|
|
infile = ROOT.TFile(rootFile.replace('M125','M%.0f'%mass),"READ")
|
22 |
|
|
th1 = infile.Get('VH')
|
23 |
|
|
integral,error = getNr(th1)
|
24 |
|
|
dictNr['ZH%.0f'%mass] = ' ' + '$%.2f' %(integral) + ' \pm ' + '%.2f$' %(error)
|
25 |
|
|
|
26 |
bortigno |
1.1 |
infile = ROOT.TFile(rootFile,"READ")
|
27 |
|
|
for histo in histos:
|
28 |
nmohr |
1.2 |
th1 = infile.Get(histo)
|
29 |
|
|
integral,error = getNr(th1)
|
30 |
|
|
dictNr[histo] = ' ' + '$%.2f' %(integral) + ' \pm ' + '%.2f$' %(error)
|
31 |
bortigno |
1.1 |
|
32 |
nmohr |
1.3 |
theString = '$\\%(mode)s$ & %(ZjLF)s & %(ZjHF)s & %(WjLF)s & %(WjLF)s & %(TT)s & %(s_Top)s & %(VV)s & %(ZH110)s & %(WH110)s & %(ZH115)s & %(WH115)s & %(ZH120)s & %(WH120)s & %(ZH125)s & %(WH125)s & %(ZH130)s & %(WH130)s & %(ZH135)s & %(WH135)s \\\\'%dictNr
|
33 |
nmohr |
1.2 |
outname = rootFile.replace('.root','.row')
|
34 |
|
|
f = open(outname,'w')
|
35 |
|
|
f.write(theString)
|
36 |
|
|
print outname
|
37 |
|
|
f.close()
|
38 |
bortigno |
1.1 |
|
39 |
|
|
if __name__ == "__main__":
|
40 |
|
|
dc_tex_converter(files[0])
|