CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
launcher.py
Go to the documentation of this file.
1 #! /bin/env python
2 
3 # Rel val launcher
4 
5 import os
6 import sys
7 import time
8 
9 
10 if len(sys.argv)!=6:
11  print "Launcher:"
12  print "Usage: "+sys.argv[0]+" step numberOfEvents workdir queue cmssw_base\n\n"
13  raise "Too Few Parameters."
14 
15 step=sys.argv[1]
16 nevts=sys.argv[2]
17 my_workdir=sys.argv[3]
18 queue=sys.argv[4]
19 cmssw_base=sys.argv[5]
20 
21 qed_ene="10"
22 jet_en="50_120"
23 type_energy_dict={"MU+":qed_ene,
24  "MU-":qed_ene,
25  "E+":qed_ene,
26  "E-":qed_ene,
27  "GAMMA":qed_ene,
28  #"10MU+":qed_ene,
29  "10MU-":qed_ene,
30  #"10E+":qed_ene,
31  #"10E-":qed_ene,
32  #"10GAMMA":qed_ene,
33  "QCD":"380_470",
34  "B_JETS":jet_en,"C_JETS":jet_en,"UDS_JETS":jet_en,
35  "ZPJJ":"",
36  "HZZEEEE":"","HZZMUMUMUMU":"",
37  "TTBAR":"",
38  "BSJPSIPHI":"",
39  "TAU":"20_420"}
40 
41 #state the location of cmsDriver
42 
43 executable="$CMSSW_BASE/src/Configuration/PyReleaseValidation/data/cmsDriver.py"
44 
45 for evt_type in type_energy_dict.keys():
46  job_content=\
47 """#! /bin/sh
48 cd """+cmssw_base+"""
49 eval `scramv1 runtime -sh`
50 PYTHONPATH=$PYTHONPATH:$CMSSW_BASE/src/Configuration/PyReleaseValidation/data
51 cd """+my_workdir+"""/"""+evt_type+"""
52 """+executable+""" """+evt_type+""" -s """+step+""" -n """+nevts
53 
54  if not os.path.exists(evt_type):
55  os.mkdir(evt_type)
56  job_name=my_workdir+"/"+evt_type+"/test_job_"+evt_type+".sh"
57  job=file(job_name,"w")
58  job.write(job_content)
59  job.close()
60  os.system("chmod +x "+job_name)
61  os.system ("bsub -q "+queue+" "+job_name)