-
Notifications
You must be signed in to change notification settings - Fork 4
/
runSelectionsToPlots.py
102 lines (87 loc) · 7.22 KB
/
runSelectionsToPlots.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import subprocess
from datetime import date
if __name__=='__main__':
#steps to run
#assumes you have run the whole thing at the start of the day
#steps = {"selections":True,"uncs":True,"ratios":True,"opts":True}
steps = {"topiary":False,"selections":True,"uncs":False,"ratios":False,"opts":False,"cutflow":False}
#cut list, Zpt, Hpt, met,btagger,btagwp
cutlist = [['150.0','300.0','200.0','DeepMassDecorrelTagZHbbvsQCD','0.8'],
]
lumi = "41.53"
#year specifics, year as 2 digit end, integrated luminosity
eras = [["17","41.53"],
["18","59.74"]
]
plots = ['h_z_pt']#['h_h_pt','h_z_pt','h_met','h_nd_jigm','h_zp_jigm','h_h_sd','h_btag']
#topiary sample list: dateforfolder, samplename
samplelist = [['2021-06-17','Run2017B-31Mar2018-v1.SingleMuon'],
['2021-06-17','Run2017C-31Mar2018-v1.SingleMuon'],
['2021-06-17','Run2017D-31Mar2018-v1.SingleMuon'],
['2021-06-17','Run2017E-31Mar2018-v1.SingleMuon'],
['2021-06-17','Run2017F-31Mar2018-v1.SingleMuon'],
#['2021-06-17','ZpAnomalonHZ_UFO-Zp1200-ND175-NS1'],
#['2021-06-17','ZpAnomalonHZ_UFO-Zp2000-ND300-NS1'],
#['2021-06-17','ZpAnomalonHZ_UFO-Zp2000-ND500-NS200'],
#['2021-06-17','ZpAnomalonHZ_UFO-Zp2000-ND800-NS200'],
#['2021-06-17','ZpAnomalonHZ_UFO-Zp3000-ND1200-NS1'],
['2021-06-17','Fall17.TTTo2L2Nu_TuneCP5_13TeV-powheg-pythia8_new_pmx'],
['2021-06-17','Fall17.TTToHadronic_TuneCP5_13TeV-powheg-pythia8_new_pmx'],##ttbar bg
['2021-06-17','Fall17.TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8_new_pmx'],##ttbar bg
['2021-06-17','Fall17.WZTo2L2Q_13TeV_amcatnloFXFX_madspin_pythia8'],
['2021-06-17','Fall17.ZZTo2L2Q_13TeV_amcatnloFXFX_madspin_pythia8'],
['2021-06-17','Fall17.DYJetsToLL_M-50_HT-100to200_TuneCP5_13TeV-madgraphMLM-pythia8'],
['2021-06-17','Fall17.DYJetsToLL_M-50_HT-200to400_TuneCP5_13TeV-madgraphMLM-pythia8'],
['2021-06-17','Fall17.DYJetsToLL_M-50_HT-400to600_TuneCP5_13TeV-madgraphMLM-pythia8'],
['2021-06-17','Fall17.DYJetsToLL_M-50_HT-600to800_TuneCP5_13TeV-madgraphMLM-pythia8'],
['2021-06-17','Fall17.DYJetsToLL_M-50_HT-800to1200_TuneCP5_13TeV-madgraphMLM-pythia8'],
['2021-06-17','Fall17.DYJetsToLL_M-50_HT-1200to2500_TuneCP5_13TeV-madgraphMLM-pythia8'],
['2021-06-17','Fall17.DYJetsToLL_M-50_HT-2500toInf_TuneCP5_13TeV-madgraphMLM-pythia8'],
['2021-06-17','Run2018C-17Sep2018-v1.SingleMuon'],
['2021-06-17','Run2018B-17Sep2018-v1.SingleMuon'],
['2021-06-17','Run2018A-17Sep2018-v1.SingleMuon'],
['2021-06-17','Run2018D-22Jan2019-v2.SingleMuon'],#ttbar background
['2021-06-17','Autumn18.TTTo2L2Nu_TuneCP5_13TeV-powheg-pythia8'],##ttbar bg
['2021-06-17','Autumn18.TTToHadronic_TuneCP5_13TeV-powheg-pythia8'],##ttbar bg
['2021-06-17','Autumn18.TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8'],##ttbar bg
['2021-06-17','Autumn18.DYJetsToLL_M-50_HT-100to200_TuneCP5_PSweights_13TeV-madgraphMLM-pythia'],
['2021-06-17','Autumn18.DYJetsToLL_M-50_HT-200to400_TuneCP5_PSweights_13TeV-madgraphMLM-pythia'],
['2021-06-17','Autumn18.DYJetsToLL_M-50_HT-400to600_TuneCP5_PSweights_13TeV-madgraphMLM-pythia'],
['2021-06-17','Autumn18.DYJetsToLL_M-50_HT-600to800_TuneCP5_PSweights_13TeV-madgraphMLM-pythia'],
['2021-06-17','Autumn18.DYJetsToLL_M-50_HT-800to1200_TuneCP5_PSweights_13TeV-madgraphMLM-pythia'],
['2021-06-17','Autumn18.DYJetsToLL_M-50_HT-1200to2500_TuneCP5_PSweights_13TeV-madgraphMLM-pythia'],
['2021-06-17','Autumn18.DYJetsToLL_M-50_HT-2500toInf_TuneCP5_PSweights_13TeV-madgraphMLM-pythia'],
]
if steps["topiary"]:
for samp in samplelist:
subprocess.run(["python","runTopiary.py","-s",samp[1],"-y","2018"])
#subprocess.run(["python","runTopiary.py","-s",samp[1],"-y","2017"])
for cut in cutlist:
print("Doing ZpT cut {0}, HpT cut {1}, MET cut {2}, btag wp {3}".format(cut[0],cut[1],cut[2],cut[4]))
#do selections
if steps["selections"]:
for samp in samplelist:
subprocess.run(["python","doSelections.py","-f",samp[1],"-zpt",cut[0],"-hpt",cut[1],"-met",cut[2],"-sdm","30.0","-b",cut[3],"-wp",cut[4],"-date",samp[0]])
subprocess.run(["python","doSelections.py","-f",samp[1],"-zpt",cut[0],"-hpt",cut[1],"-met",cut[2],"-sdm","30.0","-b",cut[3],"-wp",cut[4],"-date",samp[0],"-sr","True"])
#subprocess.run(["python","doSelections.py","-f",samp[1],"-zpt",cut[0],"-hpt",cut[1],"-met",cut[2],"-sdm","30.0","-b",cut[3],"-wp",cut[4],"-date",samp[0],"-c","True"])
for era in eras:
print(" Beginning plottng and analysis for year {0}, with a luminosity of {1}".format(era[0],era[1]))
if steps["uncs"]:
#subprocess.run(["python","doStackedUncertainty.py","-m",cut[2],"-z",cut[0],"-j",cut[1],"-wp",cut[4],"-date",str(date.today()),"-y",era[0],"-r","totalr"])
subprocess.run(["python","doStackedUncertainty.py","-m",cut[2],"-z",cut[0],"-j",cut[1],"-wp",cut[4],"-date",str(date.today()),"-y",era[0],"-r","sideband"])
subprocess.run(["python","doStackedUncertainty.py","-m",cut[2],"-z",cut[0],"-j",cut[1],"-wp",cut[4],"-date",str(date.today()),"-y",era[0],"-r","signalr"])
#stack all
if steps["ratios"]:
#subprocess.run(["python","stackAll.py","-L",era[1],"-x","10.0","-m",cut[2],"-z",cut[0],"-j",cut[1],"-wp",cut[4],"-date",str(date.today()),"-y",era[0]])
subprocess.run(["python","stackAll.py","-x","10.0","-m",cut[2],"-z",cut[0],"-j",cut[1],"-wp",cut[4],"-date",str(date.today()),"-r","sideband"])#add -y for a specific year
#subprocess.run(["python","stackAll.py","-L","41.53","-x","10.0","-m",cut[2],"-z",cut[0],"-j",cut[1],"-wp",cut[4],"-date",str(date.today()),"-y","17")
#subprocess.run(["python","stackAll.py","-L",lumi,"-x","10.0","-m",cut[2],"-z",cut[0],"-j",cut[1],"-wp",cut[4],"-date",str(date.today())+'/signalregion_only/'])
#Optimization Plots
if steps["opts"]:
for plot in plots:
subprocess.run(["python","stackForOptimization.py","-L",era[1],"-x","10.0","-p",plot,"-m",cut[2],"-z",cut[0],"-j",cut[1],"-wp",cut[4],"-date",str(date.today()),"-y",era[0]])
#subprocess.run(["python","stackForOptimization.py","-L",lumi,"-x","100.0","-p",plot,"-m",cut[2],"-z",cut[0],"-j",cut[1],"-wp",cut[4],"-date",'2021-02-03'])
if steps["cutflow"]:
print("Creating cutflow table")
#subprocess.run(["python","doCutFlow.py","-L",era[1],"-x","10.0","-m",cut[2],"-z",cut[0],"-j",cut[1],"-wp",cut[4],"-date",str(date.today()),"-y",era[0]])
subprocess.run(["python","doCutFlowSig.py","-L",era[1],"-x","10.0","-m",cut[2],"-z",cut[0],"-j",cut[1],"-wp",cut[4],"-date",str(date.today()),"-y",era[0]])