forked from mhl0116/privateMC_gen
-
Notifications
You must be signed in to change notification settings - Fork 3
/
signal_20UL_chainpset.py
executable file
·438 lines (383 loc) · 17.5 KB
/
signal_20UL_chainpset.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
import os
from metis.CMSSWTask import CMSSWTask
from metis.Sample import DirectorySample, DummySample
from metis.Path import Path
from metis.StatsParser import StatsParser
import time
import sys
sys.path.append("/home/users/fsetti/public_html/privateMC_gen")
from update_pset_NMSSM import edit_pset_NMSSM, edit_pset_gghh, edit_pset_gghh_WW
from allconfig import *
#years = ['2016', '2016_APV', '2017', '2018' ]
years = ['2016_APV']
condor_submit_params={
#"sites": "SDSC-PRP", # other_sites can be good_sites, your own list, etc.
"sites": "T2_US_UCSD,T2_US_CALTECH,T2_US_MIT,T2_US_WISCONSIN,T2_US_Vanderbilt,T2_US_Florida", # other_sites can be good_sites, your own list, etc.
"classads": [
["RequestK8SNamespace", "cms-ucsd-t2"],
["SingularityImage", "/cvmfs/singularity.opensciencegrid.org/cmssw/cms:rhel7"]
],
#"requirements_line": 'requirements = (HasSingularity==True)',
"requirements_line": 'requirements = (HAS_SINGULARITY=?=True) && (TARGET.K8SNamespace =!= "abc")',
#"use_xrootd":True
}
#condor_submit_params = {"sites" : "T2_US_UCSD,T2_US_CALTECH,T2_US_MIT,T2_US_WISCONSIN,T2_US_Nebraska,T2_US_Purdue,T2_US_Vanderbilt,T2_US_Florida",
couplings = [ 'cHHH0' , 'cHHH1' , 'cHHH2p45' , 'cHHH5' ]
decays = [ 'dileptonic' , 'semileptonic' ]
def runall(special_dir, total_nevents, events_per_output):
for _ in range(2500):
proc_tag = "v1"
for coupling in couplings:
for year in years:
cmssw_v_gen = signal_UL20[year]["cmssw_v_gen"]
pset_gen = signal_UL20[year]["pset_gen"]
pset_gen.replace('_1_cfg.py','_1_cfg_%s.py'%(coupling))
scram_arch_gen = signal_UL20[year]["scram_arch_gen"]
cmssw_v_sim = signal_UL20[year]["cmssw_v_sim"]
pset_sim = signal_UL20[year]["pset_sim"]
scram_arch_sim = signal_UL20[year]["scram_arch_sim"]
cmssw_v_mix = signal_UL20[year]["cmssw_v_mix"]
pset_mix = signal_UL20[year]["pset_mix"]
scram_arch_mix = signal_UL20[year]["scram_arch_mix"]
cmssw_v_hlt = signal_UL20[year]["cmssw_v_hlt"]
pset_hlt = signal_UL20[year]["pset_hlt"]
scram_arch_hlt = signal_UL20[year]["scram_arch_hlt"]
cmssw_v_reco = signal_UL20[year]["cmssw_v_reco"]
pset_reco = signal_UL20[year]["pset_reco"]
scram_arch_reco = signal_UL20[year]["scram_arch_reco"]
cmssw_v_miniaodsim = signal_UL20[year]["cmssw_v_miniaodsim"]
pset_miniaodsim = signal_UL20[year]["pset_miniaodsim"]
scram_arch_miniaodsim = signal_UL20[year]["scram_arch_miniaodsim"]
#cmssw_v_nanoaodsim = signal_UL20[year]["cmssw_v_nanoaodsim"]
#pset_nanoaodsim = signal_UL20[year]["pset_nanoaodsim"]
#scram_arch_nanoaodsim = signal_UL20[year]["scram_arch_nanoaodsim"]
tag = 'GluGluToHHTo2G2Tau_node_' + coupling + '_TuneCP5_13TeV-powheg-pythia8_' + year
#for some reason the directories are not created in the script :(
os.system("mkdir -p /hadoop/cms/store/user/fsetti/%s/%s_STEP1_%s"%(special_dir,tag,proc_tag))
os.system("mkdir -p /hadoop/cms/store/user/fsetti/%s/%s_STEP2_%s"%(special_dir,tag,proc_tag))
os.system("mkdir -p /hadoop/cms/store/user/fsetti/%s/%s_STEP3_%s"%(special_dir,tag,proc_tag))
os.system("mkdir -p /hadoop/cms/store/user/fsetti/%s/%s_STEP4_%s"%(special_dir,tag,proc_tag))
os.system("mkdir -p /hadoop/cms/store/user/fsetti/%s/%s_STEP5_%s"%(special_dir,tag,proc_tag))
os.system("mkdir -p /hadoop/cms/store/user/fsetti/%s/%s_STEP6_%s"%(special_dir,tag,proc_tag))
os.system("mkdir -p /hadoop/cms/store/user/fsetti/%s/%s_STEP7_%s"%(special_dir,tag,proc_tag))
edit_pset_gghh( coupling, 'cHHH1' , year )
total_nevents_tmp = total_nevents
if '2016' in year:
total_nevents_tmp /= 2
'''
step1 = CMSSWTask(
# Change dataset to something more meaningful (but keep STEP1, as we use this
# for string replacement later); keep N=1
sample = DummySample(N=1, dataset="/"+ tag+ "_STEP1"),
# A unique identifier
tag = proc_tag,
special_dir = special_dir,
# Probably want to beef up the below two numbers to control splitting,
# but note that step2 is the bottleneck, so don't put too many events
# in one output file here
events_per_output = events_per_output,
total_nevents = total_nevents_tmp,
# We have one input dummy file, so this must be True
split_within_files = True,
pset = "cmsDrivers/UL20/ggf/" + pset_gen,
cmssw_version = cmssw_v_gen,
scram_arch = scram_arch_gen,
condor_submit_params = condor_submit_params
)
step2 = CMSSWTask(
sample = DirectorySample(
location = step1.get_outputdir(),
dataset = step1.get_sample().get_datasetname().replace("STEP1","STEP2"),
),
tag = proc_tag,
special_dir = special_dir,
open_dataset = True,
files_per_output = 1,
pset = "cmsDrivers/UL20/ggf/" + pset_sim,
cmssw_version = cmssw_v_sim,
scram_arch = scram_arch_sim,
condor_submit_params = condor_submit_params
)
step3 = CMSSWTask(
sample = DirectorySample(
location = step2.get_outputdir(),
dataset = step2.get_sample().get_datasetname().replace("STEP2","STEP3"),
),
tag = proc_tag,
special_dir = special_dir,
open_dataset = True,
files_per_output = 1,
pset = "cmsDrivers/UL20/ggf/" + pset_mix,
cmssw_version = cmssw_v_mix,
scram_arch = scram_arch_mix,
condor_submit_params = condor_submit_params
)
step4 = CMSSWTask(
sample = DirectorySample(
location = step3.get_outputdir(),
dataset = step3.get_sample().get_datasetname().replace("STEP3","STEP4"),
),
tag = proc_tag,
special_dir = special_dir,
open_dataset = True,
#files_per_output = 1,
files_per_output = 2,
#output_name = "step4.root",
pset = "cmsDrivers/UL20/ggf/" + pset_hlt,
cmssw_version = cmssw_v_hlt,
scram_arch = scram_arch_hlt,
condor_submit_params = condor_submit_params
)
step5 = CMSSWTask(
sample = DirectorySample(
location = step4.get_outputdir(),
dataset = step4.get_sample().get_datasetname().replace("STEP4","STEP5"),
),
tag = proc_tag,
special_dir = special_dir,
open_dataset = True,
#files_per_output = 1,
files_per_output = 2,
pset = "cmsDrivers/UL20/ggf/" + pset_reco,
cmssw_version = cmssw_v_reco,
scram_arch = scram_arch_reco,
condor_submit_params = condor_submit_params
)
step6 = CMSSWTask(
sample = DirectorySample(
location = step5.get_outputdir(),
dataset = step5.get_sample().get_datasetname().replace("STEP5","STEP6"),
),
tag = proc_tag,
special_dir = special_dir,
open_dataset = True,
#files_per_output = 1,
files_per_output = 2,
#output_name = "step6.root",
pset = "cmsDrivers/UL20/ggf/" + pset_miniaodsim,
cmssw_version = cmssw_v_miniaodsim,
scram_arch = scram_arch_miniaodsim,
condor_submit_params = condor_submit_params
)
step7 = CMSSWTask(
sample = DirectorySample(
location = step6.get_outputdir(),
dataset = step6.get_sample().get_datasetname().replace("STEP6","STEP7"),
),
tag = proc_tag,
special_dir = special_dir,
open_dataset = True,
files_per_output = 2,
#output_name = "step7.root",
pset = "cmsDrivers/UL20/ggf/" + pset_nanoaodsim,
cmssw_version = cmssw_v_nanoaodsim,
scram_arch = scram_arch_nanoaodsim,
condor_submit_params = condor_submit_params
)
'''
dat_s6 = '/' + tag + '_STEP6'
loc_s6 = '/hadoop/cms/store/user/fsetti/nanoAOD_runII_20UL' + '/' + tag + '_STEP5' + '_' + proc_tag
step6 = CMSSWTask(
sample = DirectorySample(
location = loc_s6,
dataset = dat_s6,
),
tag = proc_tag,
special_dir = special_dir,
open_dataset = True,
#files_per_output = 1,
files_per_output = 2,
#output_name = "step6.root",
pset = "cmsDrivers/UL20/ggf/" + pset_miniaodsim,
cmssw_version = cmssw_v_miniaodsim,
scram_arch = scram_arch_miniaodsim,
condor_submit_params = condor_submit_params
)
total_summary = {}
#for task in [step1,step2,step3,step4,step5,step6]:
for task in [step6]:
task.process()
summary = task.get_task_summary()
total_summary[task.get_sample().get_datasetname()] = summary
StatsParser(data=total_summary, webdir="~/public_html/dump/metis/").do()
#Start of HH->ggWW dileptonic & semileptonic
for decay in decays:
for year in years:
cmssw_v_gen = signal_UL20[year]["cmssw_v_gen"]
pset_gen = signal_UL20[year]["pset_gen"]
pset_gen.replace('_1_cfg.py','_1_cfg_%s.py'%(coupling))
scram_arch_gen = signal_UL20[year]["scram_arch_gen"]
cmssw_v_sim = signal_UL20[year]["cmssw_v_sim"]
pset_sim = signal_UL20[year]["pset_sim"]
scram_arch_sim = signal_UL20[year]["scram_arch_sim"]
cmssw_v_mix = signal_UL20[year]["cmssw_v_mix"]
pset_mix = signal_UL20[year]["pset_mix"]
scram_arch_mix = signal_UL20[year]["scram_arch_mix"]
cmssw_v_hlt = signal_UL20[year]["cmssw_v_hlt"]
pset_hlt = signal_UL20[year]["pset_hlt"]
scram_arch_hlt = signal_UL20[year]["scram_arch_hlt"]
cmssw_v_reco = signal_UL20[year]["cmssw_v_reco"]
pset_reco = signal_UL20[year]["pset_reco"]
scram_arch_reco = signal_UL20[year]["scram_arch_reco"]
cmssw_v_miniaodsim = signal_UL20[year]["cmssw_v_miniaodsim"]
pset_miniaodsim = signal_UL20[year]["pset_miniaodsim"]
scram_arch_miniaodsim = signal_UL20[year]["scram_arch_miniaodsim"]
#cmssw_v_nanoaodsim = signal_UL20[year]["cmssw_v_nanoaodsim"]
#pset_nanoaodsim = signal_UL20[year]["pset_nanoaodsim"]
#scram_arch_nanoaodsim = signal_UL20[year]["scram_arch_nanoaodsim"]
edit_pset_gghh_WW( coupling, 'cHHH1' , year, decay )
tag = ''
if coupling == 'cHHH1':
tag = 'GluGluToHHTo2G2W_' + decay + '_node_SM_'+ year
else :
tag = 'GluGluToHHTo2G2W_' + decay + '_node_' + str(coupling) + '_'+ year
#for some reason the directories are not created in the script :(
os.system("mkdir -p /hadoop/cms/store/user/fsetti/%s/%s_STEP1_%s"%(special_dir,tag,proc_tag))
os.system("mkdir -p /hadoop/cms/store/user/fsetti/%s/%s_STEP2_%s"%(special_dir,tag,proc_tag))
os.system("mkdir -p /hadoop/cms/store/user/fsetti/%s/%s_STEP3_%s"%(special_dir,tag,proc_tag))
os.system("mkdir -p /hadoop/cms/store/user/fsetti/%s/%s_STEP4_%s"%(special_dir,tag,proc_tag))
os.system("mkdir -p /hadoop/cms/store/user/fsetti/%s/%s_STEP5_%s"%(special_dir,tag,proc_tag))
os.system("mkdir -p /hadoop/cms/store/user/fsetti/%s/%s_STEP6_%s"%(special_dir,tag,proc_tag))
os.system("mkdir -p /hadoop/cms/store/user/fsetti/%s/%s_STEP7_%s"%(special_dir,tag,proc_tag))
total_nevents_tmp = total_nevents
if '2016' in year:
total_nevents_tmp /= 2
'''
step1 = CMSSWTask(
# Change dataset to something more meaningful (but keep STEP1, as we use this
# for string replacement later); keep N=1
sample = DummySample(N=1, dataset="/"+ tag+ "_STEP1"),
# A unique identifier
tag = proc_tag,
special_dir = special_dir,
# Probably want to beef up the below two numbers to control splitting,
# but note that step2 is the bottleneck, so don't put too many events
# in one output file here
events_per_output = events_per_output,
total_nevents = total_nevents_tmp,
# We have one input dummy file, so this must be True
split_within_files = True,
pset = "cmsDrivers/UL20/HHTo2G2l2nu/"+decay+"/" + pset_gen,
cmssw_version = cmssw_v_gen,
scram_arch = scram_arch_gen,
condor_submit_params = condor_submit_params
)
step2 = CMSSWTask(
sample = DirectorySample(
location = step1.get_outputdir(),
dataset = step1.get_sample().get_datasetname().replace("STEP1","STEP2"),
),
tag = proc_tag,
special_dir = special_dir,
open_dataset = True,
files_per_output = 1,
pset = "cmsDrivers/UL20/ggf/" + pset_sim,
cmssw_version = cmssw_v_sim,
scram_arch = scram_arch_sim,
condor_submit_params = condor_submit_params
)
step3 = CMSSWTask(
sample = DirectorySample(
location = step2.get_outputdir(),
dataset = step2.get_sample().get_datasetname().replace("STEP2","STEP3"),
),
tag = proc_tag,
special_dir = special_dir,
open_dataset = True,
files_per_output = 1,
pset = "cmsDrivers/UL20/ggf/" + pset_mix,
cmssw_version = cmssw_v_mix,
scram_arch = scram_arch_mix,
condor_submit_params = condor_submit_params
)
step4 = CMSSWTask(
sample = DirectorySample(
location = step3.get_outputdir(),
dataset = step3.get_sample().get_datasetname().replace("STEP3","STEP4"),
),
tag = proc_tag,
special_dir = special_dir,
open_dataset = True,
#files_per_output = 1,
files_per_output = 2,
#output_name = "step4.root",
pset = "cmsDrivers/UL20/ggf/" + pset_hlt,
cmssw_version = cmssw_v_hlt,
scram_arch = scram_arch_hlt,
condor_submit_params = condor_submit_params
)
step5 = CMSSWTask(
sample = DirectorySample(
location = step4.get_outputdir(),
dataset = step4.get_sample().get_datasetname().replace("STEP4","STEP5"),
),
tag = proc_tag,
special_dir = special_dir,
open_dataset = True,
#files_per_output = 1,
files_per_output = 2,
pset = "cmsDrivers/UL20/ggf/" + pset_reco,
cmssw_version = cmssw_v_reco,
scram_arch = scram_arch_reco,
condor_submit_params = condor_submit_params
)
step6 = CMSSWTask(
sample = DirectorySample(
location = step5.get_outputdir(),
dataset = step5.get_sample().get_datasetname().replace("STEP5","STEP6"),
),
tag = proc_tag,
special_dir = special_dir,
open_dataset = True,
#files_per_output = 1,
files_per_output = 2,
#output_name = "step6.root",
pset = "cmsDrivers/UL20/ggf/" + pset_miniaodsim,
cmssw_version = cmssw_v_miniaodsim,
scram_arch = scram_arch_miniaodsim,
condor_submit_params = condor_submit_params
)
step7 = CMSSWTask(
sample = DirectorySample(
location = step6.get_outputdir(),
dataset = step6.get_sample().get_datasetname().replace("STEP6","STEP7"),
),
tag = proc_tag,
special_dir = special_dir,
open_dataset = True,
files_per_output = 2,
#output_name = "step7.root",
pset = "cmsDrivers/UL20/ggf/" + pset_nanoaodsim,
cmssw_version = cmssw_v_nanoaodsim,
scram_arch = scram_arch_nanoaodsim,
condor_submit_params = condor_submit_params
)
'''
dat_s6 = '/' + tag + '_STEP6'
loc_s6 = '/hadoop/cms/store/user/fsetti/nanoAOD_runII_20UL' + '/' + tag + '_STEP5' + '_' + proc_tag
step6 = CMSSWTask(
sample = DirectorySample(
location = loc_s6,
dataset = dat_s6,
),
tag = proc_tag,
special_dir = special_dir,
open_dataset = True,
#files_per_output = 1,
files_per_output = 2,
#output_name = "step6.root",
pset = "cmsDrivers/UL20/ggf/" + pset_miniaodsim,
cmssw_version = cmssw_v_miniaodsim,
scram_arch = scram_arch_miniaodsim,
condor_submit_params = condor_submit_params
)
total_summary = {}
#for task in [step1,step2,step3,step4,step5,step6]:
for task in [step6]:
task.process()
summary = task.get_task_summary()
total_summary[task.get_sample().get_datasetname()] = summary
StatsParser(data=total_summary, webdir="~/public_html/dump/metis/").do()
time.sleep(60*60)
runall("nanoAOD_runII_20UL", 400000, 250)
#runall("nanoAOD_runII_20UL_test", 10000, 250)