Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
7e88c55
Arg error in QCD mode
Somhammer Mar 4, 2020
17f7bf3
Remove old configs
Somhammer Mar 5, 2020
c817ed1
Update configs
Somhammer Mar 5, 2020
40c6023
Update sample info
Somhammer Mar 5, 2020
33f72ed
Modify wrong direction, axis format
Somhammer Mar 5, 2020
2831ca4
Ignore sources
Somhammer Mar 5, 2020
4b95500
output location
Somhammer Mar 5, 2020
2b70632
rm duplication
Somhammer Mar 5, 2020
c46cd20
Fill PV for lep+jet channel
Somhammer May 6, 2020
5263977
Move files
Somhammer May 13, 2020
a9b26a9
Move histBook and save syst list in histBook
Somhammer May 13, 2020
68078c7
Useless
Somhammer May 13, 2020
c42488e
Simple pdf maker
Somhammer May 13, 2020
0155033
change include path
Somhammer May 13, 2020
f6e112d
Change postProcess path
Somhammer May 13, 2020
6ed93b4
Move directory, it make bin acceptance
Somhammer May 13, 2020
c83338f
Move directory, it uses postfit distribution
Somhammer May 13, 2020
23cc1b9
Move directory
Somhammer May 13, 2020
2b497d8
Move directory
Somhammer May 13, 2020
d91baf8
Move directory
Somhammer May 13, 2020
20f6228
Unfold arguments
Somhammer May 13, 2020
fea9ea8
Tau option
Somhammer May 13, 2020
a7244e5
Clear README.md
Somhammer May 22, 2020
37501f7
draw unfold hist and syst table
Somhammer May 25, 2020
fd8560a
merge
Somhammer May 25, 2020
c8eb5fb
Calculate background unc.
Somhammer May 25, 2020
63501af
Modify arguments
Somhammer May 25, 2020
b0feef1
Only drawing stat unc. in output histogram
Somhammer May 26, 2020
2abd512
Set syst input as data
Somhammer May 26, 2020
4517727
write_envelope run if h_in is 2D
Somhammer May 26, 2020
d1ef5e0
Add qcd systematics
Somhammer Jun 10, 2020
65b8ab7
Save syst hist
Somhammer Jun 10, 2020
9a20c1f
Add syst
Somhammer Jun 10, 2020
e68d1a3
Modify table format
Somhammer Jun 10, 2020
86b3994
Add syst
Somhammer Jun 10, 2020
8e5c7b2
Debug
Somhammer Jun 10, 2020
24bc023
debug subprocess call
Somhammer Jun 10, 2020
72fe205
Postfit plot configs for plotIt
Somhammer Jun 10, 2020
d6c68a4
Add input distribution for fitting
Somhammer Jul 1, 2020
c0d98ae
use slurm
Somhammer Aug 11, 2020
090b358
Write systematic sample list
Somhammer Aug 28, 2020
1088f5f
Arrange ntuple files
Somhammer Aug 31, 2020
24cc7f4
Merge two python script
Somhammer Aug 31, 2020
fb7695b
Merge two python scripts
Somhammer Aug 31, 2020
67c9aa2
Update jet CSV SF systematics
Somhammer Aug 31, 2020
0c6c171
Use only split samples
Somhammer Aug 31, 2020
a2fbc9d
Merged samples are not used
Somhammer Aug 31, 2020
e709ce9
Draw systematic plots for each syst source
Somhammer Nov 4, 2020
e9cd664
Minor update
Somhammer Nov 4, 2020
b269e12
Useless
Somhammer Nov 4, 2020
0ea6eee
Minor update
Somhammer Nov 5, 2020
715a8c0
Make class
Somhammer Nov 10, 2020
ad14ec9
Unify
Somhammer Nov 10, 2020
e0ec29c
Make Gui
Somhammer Nov 19, 2020
e14c850
useless
Somhammer Nov 19, 2020
0ebe662
Merge root files
Somhammer Nov 20, 2020
a92e8bb
Post process - debug: bSF, remove old tune
Somhammer Nov 20, 2020
84d1978
Respond to post in ui/action.py
Somhammer Nov 20, 2020
28df3d1
Init
Somhammer Nov 25, 2020
b847b63
Init
Somhammer Nov 25, 2020
4474a30
last update
Somhammer Mar 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 3 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,67 +1,3 @@
1. Searching additional two b jets using DNN

First, you need to make pandas arrays to train and evaluate. You can do it using runAna.py in deepAna directory.

In runAna.py, there are several options.
~~~
array # If you turn on this option and run, runAna.py make arrays.
array_test # For test. If you turn on this, runAna.py make only test set.
array_train # If you turn on this option with array, runAna.py make training input.
array_syst # If you turn on this option with array, runAna.py make systematic array sets.
~~~

Run as follows,

~~~
$ python runAna.py
~~~

If you make pandas arrays successfully, then you can make model file using model.py

Run as follows,

~~~
$ python model.py
~~~

Then, you can make histogram using runAna.py with analysis option.
~~~
analysis # If you turn on this option, runAna.py make histogram root files.
ana_test # For test.
ana_syst # For systematics
~~~

Run as follows,

~~~
$ python runAna.py
~~~

Then, final root files are made.

2. Differential cross section measurement.

All the codes for measurement are in ttbbDiffXsec directory.

You need to made acceptance distribution first.

~~~
$ root -l -b -q makeCriteria.C
~~~

Then, stability, purity and acceptance plots are made in output/post directory.
And then you can run runUnfold.py. If you run this, you can get unfolding results.

~~~
$ python runUnfold.py
~~~

you can control unfolding option in ttbbDiffXsec.C

3. Control plots

If you want to make control plots, you can get this by running runAnalysis.py




1. runAnalysis.py
2. runPostProcess.py
3. runUnfold.py
File renamed without changes.
121 changes: 121 additions & 0 deletions func/cutflow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import os
import sys

import ROOT

import saveAndLoadSamples as sls

strTableTemplate = """
\\begin{table}[htb]
\\rotatebox{90}{
\\footnotesize
\\begin{center}
\\caption{%(year)s yields table}
\\begin{tabular}{%(nRows)s}
\\hline\\hline
Sample & Ch0S0 & Ch0S1 & Ch0S2 & Ch1S0 & Ch1S1 & Ch1S2 & Ch2S0 & Ch2S1 & Ch2S2 \\\\
\\hline
%(mcNevts)s
\\hline
%(dataNevts)s
%(totalMC)s
%(ratio)s
\\hline\\hline
\\end{tabular}
\\end{center}
}
\\end{table}
"""

class DrawYieldsTable(sls.LoadSamples):
def __init__(self, year, lumi, root_path, output_path, hist_name='h_nJets'):
self.year = year
self.lumi = float(lumi)
self.root_path = root_path
self.output_path = output_path
self.hist_name = hist_name

self.data = {}
self.samples = {}
self.xsecs = {}
self.genevt = {}

if not os.path.exists(self.output_path):
os.makedirs(self.output_path)

self._get_root_files()

def _get_root_files(self):
self.get_sample_info()

self.data['Muon'] = ROOT.TFile(os.path.join(self.root_path, 'hist_DataSingleMu.root'))
self.data['Electron'] = ROOT.TFile(os.path.join(self.root_path, 'hist_DataSingleEG.root'))
for sample in self.xsecs.values():
self.samples[sample[0]] = ROOT.TFile(os.path.join(self.root_path, 'hist_'+sample[0]+'.root'))

def draw_yields(self):
for ich in range(0,3):
steps = [1,3,4,6,7,8,9]

data_nevts = []
data_str = ' Data '
for istep in steps:
if ich == 0:
TH1 = self.data['Muon'].Get(self.hist_name+'_Ch0_S'+str(istep))
elif ich == 1:
TH1 = self.data['Electron'].Get(self.hist_name+'_Ch1_S'+str(istep))
else:
TH1 = self.data['Muon'].Get(self.hist_name+'_Ch0_S'+str(istep))
TH1temp = self.data['Electron'].Get(self.hist_name+'_Ch1_S'+str(istep))
TH1.Add(TH1temp)

error = ROOT.Double()
nevts = TH1.IntegralAndError(1, TH1.GetNbinsX()+1, error)
data_str += '& $%.1f $ ' % (nevts)
data_nevts.append(nevts)
data_str += '\\\\\n'

mc_nevts = [0.0 for i in range(len(steps))]
mc_error = [0.0 for i in range(len(steps))]
mc_dicts = {}
for item in self.xsecs.items():
sample_name = item[1][0]
xsec = item[1][1]
sample = self.samples[sample_name]
scale = (self.lumi*xsec/self.genevt[sample_name])

temp = ' %s ' % (sample_name)
for idx, istep in enumerate(steps):
TH1 = sample.Get(self.hist_name+'_Ch'+str(ich)+'_S'+str(istep))
TH1.Scale(scale)

#nevts = hist_tmp.Integral(0, hist_tmp.GetNbinsX()+1)
error = ROOT.Double()
nevts = TH1.IntegralAndError(1, TH1.GetNbinsX()+1, error)

temp += '& $%.1f {\scriptstyle\ \pm\ %.1f}$ ' % (nevts, error)
mc_nevts[idx] += nevts
import math
mc_error[idx] = math.sqrt(pow(mc_error[idx],2) + pow(error,2))
temp += '\\\\\n'
mc_dicts[item[0]] = temp

totalMC = ' TotalMC '
ratio = ' Ratio '
for idx, value in enumerate(mc_nevts):
temp = float(data_nevts[idx])/float(value)
totalMC += '& $%.1f {\scriptstyle\ \pm\ %.1f}$ ' % (value, mc_error[idx])
ratio += ' & $%.2f$ ' % temp
totalMC += '\\\\'
ratio += '\\\\'

str_dict = {}
str_dict['year'] = str(self.year)
str_dict['nRows'] = '|'+'c|'*len(steps)
str_dict['mcNevts'] = '\n'.join(value for value in mc_dicts.values())
str_dict['dataNevts'] = data_str
str_dict['totalMC'] = totalMC
str_dict['ratio'] = ratio

strOut = strTableTemplate % str_dict
with open(self.output_path+"/yields"+str(self.year)+'_ch'+str(ich)+".tex", 'w') as f: f.write(strOut)
Loading