forked from mhl0116/privateMC_gen
-
Notifications
You must be signed in to change notification settings - Fork 3
/
resonant_signals_chainpset.py
executable file
·227 lines (188 loc) · 8.29 KB
/
resonant_signals_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
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_graviton
from allconfig import *
years = ['2016', '2016_APV', '2017', '2018' ]
#years = ['2016', '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_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",
graviton_masses = [ '250', '300', '320', '350', '400', '450', '500', '600', '800', '1000', '2000' ]
#graviton_masses = [ '250']
def runall(special_dir, total_nevents, events_per_output):
for _ in range(2500):
proc_tag = "v1"
#Produce resonant samples for IC people
for proc in resonant_signals.keys() :
for year in years:
for graviton_mass in graviton_masses:
coupling = 'M'+str(graviton_mass)
tag = str(proc) + "_" + coupling + '_' + year
total_nevents_tmp = total_nevents
steps = []
if '2016' in year:
total_nevents_tmp /= 2
try:
cmssw_v_gen = resonant_signals[proc][year]["cmssw_v_gen"]
pset_gen = resonant_signals[proc][year]["pset_gen"]
pset_gen.replace('_1_cfg.py','_1_cfg_%s.py'%(coupling))
scram_arch_gen = resonant_signals[proc][year]["scram_arch_gen"]
edit_pset_graviton( coupling, 'M300' , year )
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/"+proc+"/" + pset_gen,
cmssw_version = cmssw_v_gen,
scram_arch = scram_arch_gen,
condor_submit_params = condor_submit_params
)
steps += [ step1 ]
except:
print("Could not process STEP1 for: " + proc + " for " + year )
try:
cmssw_v_sim = resonant_signals[proc][year]["cmssw_v_sim"]
pset_sim = resonant_signals[proc][year]["pset_sim"]
scram_arch_sim = resonant_signals[proc][year]["scram_arch_sim"]
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/"+proc+"/" + pset_sim,
cmssw_version = cmssw_v_sim,
scram_arch = scram_arch_sim,
condor_submit_params = condor_submit_params
)
steps += [ step2 ]
except:
print("Could not process STEP2 for: " + proc + " for " + year )
try:
cmssw_v_mix = resonant_signals[proc][year]["cmssw_v_mix"]
pset_mix = resonant_signals[proc][year]["pset_mix"]
scram_arch_mix = resonant_signals[proc][year]["scram_arch_mix"]
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/"+proc+"/" + pset_mix,
cmssw_version = cmssw_v_mix,
scram_arch = scram_arch_mix,
condor_submit_params = condor_submit_params
)
steps += [ step3 ]
except:
print("Could not process STEP3 for: " + proc + " for " + year )
try:
cmssw_v_hlt = resonant_signals[proc][year]["cmssw_v_hlt"]
pset_hlt = resonant_signals[proc][year]["pset_hlt"]
scram_arch_hlt = resonant_signals[proc][year]["scram_arch_hlt"]
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/"+proc+"/" + pset_hlt,
cmssw_version = cmssw_v_hlt,
scram_arch = scram_arch_hlt,
condor_submit_params = condor_submit_params
)
steps += [ step4 ]
except:
print("Could not process STEP4 for: " + proc + " for " + year )
try:
cmssw_v_reco = resonant_signals[proc][year]["cmssw_v_reco"]
pset_reco = resonant_signals[proc][year]["pset_reco"]
scram_arch_reco = resonant_signals[proc][year]["scram_arch_reco"]
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/"+proc+"/" + pset_reco,
cmssw_version = cmssw_v_reco,
scram_arch = scram_arch_reco,
condor_submit_params = condor_submit_params
)
steps += [ step5 ]
except:
print("Could not process STEP5 for: " + proc + " for " + year )
try:
cmssw_v_miniaodsim = resonant_signals[proc][year]["cmssw_v_miniaodsim"]
pset_miniaodsim = resonant_signals[proc][year]["pset_miniaodsim"]
scram_arch_miniaodsim = resonant_signals[proc][year]["scram_arch_miniaodsim"]
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/"+proc+"/" + pset_miniaodsim,
cmssw_version = cmssw_v_miniaodsim,
scram_arch = scram_arch_miniaodsim,
condor_submit_params = condor_submit_params
)
steps += [ step6 ]
except:
print("Could not process STEP6 for: " + proc + " for " + year )
if len(steps) == 0:
continue
total_summary = {}
for task in steps:
task.process()
summary = task.get_task_summary()
total_summary[task.get_sample().get_datasetname()] = summary
StatsParser(data=total_summary, webdir="~/public_html/dump/metis_miniAODv2/").do()
time.sleep(10*60)
runall("nanoAOD_runII_20UL", 400000, 250)
#runall("nanoAOD_runII_20UL_test", 5, 5)