-
Notifications
You must be signed in to change notification settings - Fork 0
/
produce_mc_RunIISummer20UL16.SUS.seed.sh
executable file
·274 lines (232 loc) · 12.3 KB
/
produce_mc_RunIISummer20UL16.SUS.seed.sh
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
#!/bin/bash
# Requires below files
# - voms_proxy.txt : From voms-proxy-init --voms cms --out $(pwd)/voms_proxy.txt -valid 172:0
# - ENV_FILE : Sets names for Fragment_filename, AOD_NAME, MINIAOD_NAME, NANOAOD_NAME, BASE_TAG
# Fragment_filename="SMS-TChiHH_mChi-500_mLSP-1__RunIISummer16__fragment.py"
# AOD_NAME="SMS-TChiHH_mChi-500_mLSP-1_TuneCUETP8M1_13TeV-madgraphMLM-pythia8__RunIISummer16AOD__PUSummer16v3Fast_80X_mcRun2_asymptotic__privateProduction"
# MINIAOD_NAME="SMS-TChiHH_mChi-500_mLSP-1_TuneCUETP8M1_13TeV-madgraphMLM-pythia8__RunIISummer16MiniAODv3__PUSummer16v3Fast_94X_mcRun2_asymptotic_v3-v1__privateProduction"
# NANOAOD_NAME="SMS-TChiHH_mChi-500_mLSP-1_TuneCUETP8M1_13TeV-madgraphMLM-pythia8__RunIISummer16NanoAODv7__PUSummer16v3Fast_Nano02Apr2020_102X_mcRun2_asymptotic_v8-v1__privateProduction"
# BASE_TAG="SMS-TChiHH_mChi-500_mLSP-1__RunIISummer16"
# - fragment.py: Fragment should match the name in ENV_FILE. Will be copied to CMSSW/src/Configuration/GenProduction/python/
# Requires a job number and number of events
if [ $# -ne 3 ]; then
echo "[Usage] $0 JOB_NUMBER NUMBER_OF_EVENTS ENV_FILE"
echo " JOB_NUMBER is used for file names and run number to randomize between jobs"
echo " ENV_FILE is used to set names"
exit
fi
if [ ! -f "$3" ]; then
echo "ENV_FILE does not exist"
echo " ENV_FILE : Sets names for Fragment_filename, AOD_NAME, MINIAOD_NAME, NANOAOD_NAME, BASE_TAG"
echo ' Example'
echo ' Fragment_filename="SMS-TChiHH_mChi-500_mLSP-1__RunIISummer16__fragment.py"'
echo ' AOD_NAME="SMS-TChiHH_mChi-500_mLSP-1_TuneCUETP8M1_13TeV-madgraphMLM-pythia8__RunIISummer16AOD__PUSummer16v3Fast_80X_mcRun2_asymptotic__privateProduction"'
echo ' MINIAOD_NAME="SMS-TChiHH_mChi-500_mLSP-1_TuneCUETP8M1_13TeV-madgraphMLM-pythia8__RunIISummer16MiniAODv3__PUSummer16v3Fast_94X_mcRun2_asymptotic_v3-v1__privateProduction"'
echo ' NANOAOD_NAME="SMS-TChiHH_mChi-500_mLSP-1_TuneCUETP8M1_13TeV-madgraphMLM-pythia8__RunIISummer16NanoAODv7__PUSummer16v3Fast_Nano02Apr2020_102X_mcRun2_asymptotic_v8-v1__privateProduction"'
echo ' BASE_TAG="SMS-TChiHH_mChi-500_mLSP-1__RunIISummer16"'
exit
fi
source $3
echo "Set below variables with $3"
echo Fragment_filename \= $Fragment_filename
echo AOD_NAME \= $AOD_NAME
echo MINIAOD_NAME \= $MINIAOD_NAME
echo NANOAOD_NAME \= $NANOAOD_NAME
echo BASE_TAG \= $BASE_TAG
# Set variables
JOBNUM=$(($1+1)) #$1 will start from 0. Need to add at least 1.
NEVENTS=$2
TAG="$BASE_TAG""__job-"${JOBNUM}
#Fragment_filename="SUS-RunIISummer16FSPremix-00164-fragment_custom.py"
#AOD_NAME="SMS-TChiHH_mChi-500_mLSP-1_TuneCUETP8M1_13TeV-madgraphMLM-pythia8__RunIISummer16AOD__PUSummer16v3Fast_80X_mcRun2_asymptotic__privateProduction__"$JOBNUM".root"
#MINIAOD_NAME="SMS-TChiHH_mChi-500_mLSP-1_TuneCUETP8M1_13TeV-madgraphMLM-pythia8__RunIISummer16MiniAODv3__PUSummer16v3Fast_94X_mcRun2_asymptotic_v3-v1__privateProduction__"$JOBNUM".root"
#NANOAOD_NAME="SMS-TChiHH_mChi-500_mLSP-1_TuneCUETP8M1_13TeV-madgraphMLM-pythia8__RunIISummer16NanoAODv7__PUSummer16v3Fast_Nano02Apr2020_102X_mcRun2_asymptotic_v8-v1__privateProduction__"$JOBNUM".root"
mkdir config
mv $Fragment_filename config
if [ ! -f "config/${Fragment_filename}" ]; then
echo "config/${Fragment_filename} does not exist"
exit
fi
if [ ! -f "voms_proxy.txt" ]; then
echo "voms_proxy.txt does not exist"
echo "voms-proxy-init --voms cms --out $(pwd)/voms_proxy.txt -valid 172:0"
exit
fi
export X509_USER_PROXY=$(pwd)/voms_proxy.txt
mkdir job_scripts
cat <<EndOfTestFile > job_scripts/"$TAG"_cmd.sh
#!/bin/bash
date
echo "----GEN----"
# https://cms-pdmv-prod.web.cern.ch/mcm/public/restapi/requests/get_test/SUS-RunIISummer20UL16GEN-00034
echo "Setting up CMSSW"
export SCRAM_ARCH=slc7_amd64_gcc700
source /cvmfs/cms.cern.ch/cmsset_default.sh
if [ -r CMSSW_10_6_30_patch1/src ] ; then
echo release CMSSW_10_6_30_patch1 already exists
else
scram p CMSSW_10_6_30_patch1
fi
cd CMSSW_10_6_30_patch1/src
eval \`scram runtime -sh\`
# Setup custom fragment for CMSSW
mkdir -p Configuration/GenProduction/python
cp ../../config/${Fragment_filename} Configuration/GenProduction/python
scram b
cd ../..
echo "Make cmssw configuration file"
Output_filename=$AOD_NAME"__job-"${JOBNUM}"__GEN".root
cmsDriver.py Configuration/GenProduction/python/$Fragment_filename --python_filename "$TAG"__GEN__cfg.py --eventcontent RAWSIM --customise Configuration/DataProcessing/Utils.addMonitoring --datatier GEN --fileout file:\$Output_filename --conditions 106X_mcRun2_asymptotic_v13 --beamspot Realistic25ns13TeV2016Collision --customise_commands "from IOMC.RandomEngine.RandomServiceHelper import RandomNumberServiceHelper ; randSvc = RandomNumberServiceHelper(process.RandomNumberGeneratorService) ; randSvc.resetSeeds(${JOBNUM})\nprocess.source.numberEventsInLuminosityBlock = cms.untracked.uint32(200)" --step GEN --geometry DB:Extended --era Run2_2016 --no_exec --mc -n $NEVENTS
echo "Run cmssw with configuration file"
cmsRun "$TAG"__GEN__cfg.py
echo "----SIM----"
# https://cms-pdmv-prod.web.cern.ch/mcm/public/restapi/requests/get_test/SUS-RunIISummer20UL16SIM-00154
echo "Setting up CMSSW"
export SCRAM_ARCH=slc7_amd64_gcc700
source /cvmfs/cms.cern.ch/cmsset_default.sh
if [ -r CMSSW_10_6_17_patch1/src ] ; then
echo release CMSSW_10_6_17_patch1 already exists
else
scram p CMSSW CMSSW_10_6_17_patch1
fi
cd CMSSW_10_6_17_patch1/src
eval \`scram runtime -sh\`
# Setup custom fragment for CMSSW
scram b
cd ../..
echo "Make cmssw configuration file"
Input_filename=$AOD_NAME"__job-"${JOBNUM}"__GEN".root
Output_filename=$AOD_NAME"__job-"${JOBNUM}"__SIM".root
cmsDriver.py --python_filename "$TAG"__SIM__cfg.py --eventcontent RAWSIM --customise Configuration/DataProcessing/Utils.addMonitoring --datatier GEN-SIM --fileout file:\$Output_filename --conditions 106X_mcRun2_asymptotic_v13 --beamspot Realistic25ns13TeV2016Collision --step SIM --geometry DB:Extended --filein file:\$Input_filename --era Run2_2016 --runUnscheduled --no_exec --mc -n -1
echo "Run cmssw with configuration file"
cmsRun "$TAG"__SIM__cfg.py
echo "----DIGIPREMIX----"
# https://cms-pdmv-prod.web.cern.ch/mcm/public/restapi/requests/get_test/SUS-RunIISummer20UL16DIGIPremix-00154
echo "Setting up CMSSW"
export SCRAM_ARCH=slc7_amd64_gcc700
source /cvmfs/cms.cern.ch/cmsset_default.sh
if [ -r CMSSW_10_6_17_patch1/src ] ; then
echo release CMSSW_10_6_17_patch1 already exists
else
scram p CMSSW CMSSW_10_6_17_patch1
fi
cd CMSSW_10_6_17_patch1/src
eval \`scram runtime -sh\`
# Setup custom fragment for CMSSW
scram b
cd ../..
echo "Make cmssw configuration file"
Input_filename=$AOD_NAME"__job-"${JOBNUM}"__SIM".root
Output_filename=$AOD_NAME"__job-"${JOBNUM}"__DIGIPREMIX".root
cmsDriver.py --python_filename "$TAG"__DIGIPREMIX__cfg.py --eventcontent PREMIXRAW --customise Configuration/DataProcessing/Utils.addMonitoring --datatier GEN-SIM-DIGI --fileout file:\$Output_filename --pileup_input "dbs:/Neutrino_E-10_gun/RunIISummer20ULPrePremix-UL16_106X_mcRun2_asymptotic_v13-v1/PREMIX" --conditions 106X_mcRun2_asymptotic_v13 --step DIGI,DATAMIX,L1,DIGI2RAW --procModifiers premix_stage2 --geometry DB:Extended --filein file:\$Input_filename --datamix PreMix --era Run2_2016 --runUnscheduled --no_exec --mc -n -1
echo "Run cmssw with configuration file"
cmsRun "$TAG"__DIGIPREMIX__cfg.py
echo "----HLT----"
# https://cms-pdmv-prod.web.cern.ch/mcm/public/restapi/requests/get_test/SUS-RunIISummer20UL16HLT-00154
echo "Setting up CMSSW"
export SCRAM_ARCH=slc7_amd64_gcc530
source /cvmfs/cms.cern.ch/cmsset_default.sh
if [ -r CMSSW_8_0_33_UL/src ] ; then
echo release CMSSW_8_0_33_UL already exists
else
scram p CMSSW CMSSW_8_0_33_UL
fi
cd CMSSW_8_0_33_UL/src
eval \`scram runtime -sh\`
# Setup custom fragment for CMSSW
scram b
cd ../..
echo "Make cmssw configuration file"
Input_filename=$AOD_NAME"__job-"${JOBNUM}"__DIGIPREMIX".root
Output_filename=$AOD_NAME"__job-"${JOBNUM}"__HLT".root
cmsDriver.py --python_filename "$TAG"__HLT__cfg.py --eventcontent RAWSIM --outputCommand "keep *_mix_*_*,keep *_genPUProtons_*_*" --customise Configuration/DataProcessing/Utils.addMonitoring --datatier GEN-SIM-RAW --inputCommands "keep *","drop *_*_BMTF_*","drop *PixelFEDChannel*_*_*_*" --fileout file:\$Output_filename --conditions 80X_mcRun2_asymptotic_2016_TrancheIV_v6 --customise_commands 'process.source.bypassVersionCheck = cms.untracked.bool(True)' --step HLT:25ns15e33_v4 --geometry DB:Extended --filein file:\$Input_filename --era Run2_2016 --no_exec --mc -n -1
echo "Run cmssw with configuration file"
cmsRun "$TAG"__HLT__cfg.py
echo "----RECO----"
# https://cms-pdmv-prod.web.cern.ch/mcm/public/restapi/requests/get_test/SUS-RunIISummer20UL16RECO-00154
echo "Setting up CMSSW"
export SCRAM_ARCH=slc7_amd64_gcc700
source /cvmfs/cms.cern.ch/cmsset_default.sh
if [ -r CMSSW_10_6_17_patch1/src ] ; then
echo release CMSSW_10_6_17_patch1 already exists
else
scram p CMSSW CMSSW_10_6_17_patch1
fi
cd CMSSW_10_6_17_patch1/src
eval \`scram runtime -sh\`
# Setup custom fragment for CMSSW
scram b
cd ../..
echo "Make cmssw configuration file"
Input_filename=$AOD_NAME"__job-"${JOBNUM}"__HLT".root
Output_filename=$AOD_NAME"__job-"${JOBNUM}.root
cmsDriver.py --python_filename "$TAG"__AOD__cfg.py --eventcontent AODSIM --customise Configuration/DataProcessing/Utils.addMonitoring --datatier AODSIM --fileout file:\$Output_filename --conditions 106X_mcRun2_asymptotic_v13 --step RAW2DIGI,L1Reco,RECO,RECOSIM --geometry DB:Extended --filein file:\$Input_filename --era Run2_2016 --runUnscheduled --no_exec --mc -n -1
echo "Run cmssw with configuration file"
cmsRun "$TAG"__AOD__cfg.py
echo "----MiniAODv2----"
# https://cms-pdmv-prod.web.cern.ch/mcm/public/restapi/requests/get_test/SUS-RunIISummer20UL16MiniAODv2-00183
echo "Setting up CMSSW"
export SCRAM_ARCH=slc7_amd64_gcc700
source /cvmfs/cms.cern.ch/cmsset_default.sh
if [ -r CMSSW_10_6_25/src ] ; then
echo release CMSSW_10_6_25 already exists
else
scram p CMSSW CMSSW_10_6_25
fi
cd CMSSW_10_6_25/src
eval \`scram runtime -sh\`
scram b
cd ../..
echo "Make cmssw configuration file"
Input_filename=$AOD_NAME"__job-"${JOBNUM}.root
Output_filename=$MINIAOD_NAME"__job-"${JOBNUM}.root
cmsDriver.py --python_filename "$TAG"__MiniAODv2__cfg.py --eventcontent MINIAODSIM --customise Configuration/DataProcessing/Utils.addMonitoring --datatier MINIAODSIM --fileout file:\$Output_filename --conditions 106X_mcRun2_asymptotic_v17 --step PAT --procModifiers run2_miniAOD_UL --geometry DB:Extended --filein file:\$Input_filename --era Run2_2016 --runUnscheduled --no_exec --mc -n -1
echo "Run cmssw with configuration file"
cmsRun "$TAG"__MiniAODv2__cfg.py
echo "----NanoAODv9----"
# https://cms-pdmv-prod.web.cern.ch/mcm/public/restapi/requests/get_test/SUS-RunIISummer20UL16NanoAODv9-00210
echo "Setting up CMSSW"
export SCRAM_ARCH=slc7_amd64_gcc700
source /cvmfs/cms.cern.ch/cmsset_default.sh
if [ -r CMSSW_10_6_26/src ] ; then
echo release CMSSW_10_6_26 already exists
else
scram p CMSSW CMSSW_10_6_26
fi
cd CMSSW_10_6_26/src
eval \`scram runtime -sh\`
scram b
cd ../..
echo "Make cmssw configuration file"
Input_filename=$MINIAOD_NAME"__job-"${JOBNUM}.root
Output_filename=$NANOAOD_NAME"__job-"${JOBNUM}.root
cmsDriver.py --python_filename "$TAG"__NanoAODv9__cfg.py --eventcontent NANOAODSIM --customise Configuration/DataProcessing/Utils.addMonitoring --datatier NANOAODSIM --fileout file:\$Output_filename --conditions 106X_mcRun2_asymptotic_v17 --step NANO --filein file:\$Input_filename --era Run2_2016,run2_nanoAOD_106Xv2 --no_exec --mc -n -1
echo "Run cmssw with configuration file"
cmsRun "$TAG"__NanoAODv9__cfg.py
echo "Clean up files"
rm -f ${TAG}__GEN__cfg.py
rm -rf CMSSW_10_6_30_patch1
rm -f ${AOD_NAME}__job-${JOBNUM}__GEN.root
rm -f ${AOD_NAME}__job-${JOBNUM}__LHE_inLHE.root
rm -f ${TAG}__SIM__cfg.py
rm -rf CMSSW_10_6_17_patch1
rm -f ${AOD_NAME}__job-${JOBNUM}__SIM.root
rm -f "$TAG"__DIGIPREMIX__cfg.py
rm -f ${AOD_NAME}__job-${JOBNUM}__DIGIPREMIX.root
rm -rf CMSSW_8_0_33_UL
rm -f ${AOD_NAME}__job-${JOBNUM}__HLT.root
rm -f ${TAG}__HLT__cfg.py
rm -f ${TAG}__AOD__cfg.py
rm -f ${AOD_NAME}__job-${JOBNUM}.root
rm -rf CMSSW_10_6_25/
rm -f ${TAG}__MiniAODv2__cfg.py
rm -rf CMSSW_10_6_26/
rm -f ${TAG}__NanoAODv9__cfg.py
date
# End of "$TAG"_cmd.sh file
EndOfTestFile
echo "Made "$TAG"_cmd.sh"
chmod +x job_scripts/"$TAG"_cmd.sh
#export SINGULARITY_CACHEDIR="/tmp/$(whoami)/singularity"
#singularity run -B /cvmfs -B /etc/grid-security docker://cmssw/slc6:latest $(echo $(pwd)/"$TAG"_cmd.sh)
./job_scripts/${TAG}_cmd.sh