CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/Configuration/PyReleaseValidation/examples/launcher.py

Go to the documentation of this file.
00001 #! /bin/env python
00002 
00003 # Rel val launcher
00004 
00005 import os
00006 import sys
00007 import time
00008 
00009 
00010 if len(sys.argv)!=6:
00011     print "Launcher:"
00012     print "Usage: "+sys.argv[0]+" step numberOfEvents workdir queue cmssw_base\n\n"
00013     raise "Too Few Parameters."
00014 
00015 step=sys.argv[1]
00016 nevts=sys.argv[2]
00017 my_workdir=sys.argv[3]
00018 queue=sys.argv[4]
00019 cmssw_base=sys.argv[5]
00020 
00021 qed_ene="10"
00022 jet_en="50_120"
00023 type_energy_dict={"MU+":qed_ene,
00024                   "MU-":qed_ene,
00025                   "E+":qed_ene,
00026                   "E-":qed_ene,
00027                   "GAMMA":qed_ene,
00028                   #"10MU+":qed_ene,
00029                   "10MU-":qed_ene,
00030                   #"10E+":qed_ene,
00031                   #"10E-":qed_ene,
00032                   #"10GAMMA":qed_ene,
00033                   "QCD":"380_470",
00034                   "B_JETS":jet_en,"C_JETS":jet_en,"UDS_JETS":jet_en,
00035                   "ZPJJ":"",
00036                   "HZZEEEE":"","HZZMUMUMUMU":"",
00037                   "TTBAR":"",
00038                   "BSJPSIPHI":"",
00039                   "TAU":"20_420"}
00040                   
00041 #state the location of cmsDriver
00042 
00043 executable="$CMSSW_BASE/src/Configuration/PyReleaseValidation/data/cmsDriver.py"  
00044 
00045 for evt_type in type_energy_dict.keys():                             
00046     job_content=\
00047 """#! /bin/sh
00048 cd """+cmssw_base+"""
00049 eval `scramv1 runtime -sh`
00050 PYTHONPATH=$PYTHONPATH:$CMSSW_BASE/src/Configuration/PyReleaseValidation/data
00051 cd """+my_workdir+"""/"""+evt_type+"""
00052 """+executable+""" """+evt_type+""" -s """+step+""" -n """+nevts
00053     
00054     if not os.path.exists(evt_type):
00055         os.mkdir(evt_type)
00056     job_name=my_workdir+"/"+evt_type+"/test_job_"+evt_type+".sh"
00057     job=file(job_name,"w")
00058     job.write(job_content)
00059     job.close()
00060     os.system("chmod +x "+job_name)
00061     os.system ("bsub -q "+queue+" "+job_name)