ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbb/python/submitThem.py
(Generate patch)

Comparing UserCode/VHbb/python/submitThem.py (file contents):
Revision 1.4 by nmohr, Mon Sep 17 19:20:19 2012 UTC vs.
Revision 1.7 by nmohr, Fri Sep 21 14:50:48 2012 UTC

# Line 1 | Line 1
1   #! /usr/bin/env python
2 < import os,time,subprocess
3 < energy='8TeV'
4 < #energy='7TeV'
2 > import os,shutil,sys,pickle,subprocess,ROOT
3 > from optparse import OptionParser
4 > from BetterConfigParser import BetterConfigParser
5 > from samplesclass import sample
6 > import getpass
7  
8 < def submit(job,en):
9 <        command = 'qsub -cwd -q all.q -N %s_%s -o /shome/nmohr/VHbbAnalysis/LOG/%s.out -e /shome/nmohr/VHbbAnalysis/LOG/%s.err runAll.sh %s %s' %(job,en,job,job,job,en)
8 >
9 > parser = OptionParser()
10 > parser.add_option("-T", "--tag", dest="tag", default="",
11 >                      help="Tag to run the analysis with, example '8TeV' uses config8TeV and pathConfig8TeV to run the analysis")
12 >
13 > (opts, args) = parser.parse_args(sys.argv)
14 > if opts.tag == "":
15 >        print "Please provide tag to run the analysis with, example '-T 8TeV' uses config8TeV and pathConfig8TeV to run the analysis."
16 >        sys.exit(123)
17 > en = opts.tag
18 > configs = ['config%s'%(en),'pathConfig%s'%(en)]
19 > print configs
20 > config = BetterConfigParser()
21 > config.read(configs)
22 > btagLibrary = config.get('BTagReshaping','library')
23 > submitDir = os.getcwd()
24 > os.chdir(os.path.dirname(btagLibrary))
25 > if not os.path.exists(btagLibrary):
26 >    ROOT.gROOT.LoadMacro('%s+'%btagLibrary.replace('_h.so','.h'))
27 > shutil.copyfile(os.path.basename(btagLibrary),'/scratch/%s/%s'%(getpass.getuser(),os.path.basename(btagLibrary)))
28 > shutil.copyfile('/scratch/%s/%s'%(getpass.getuser(),os.path.basename(btagLibrary)),btagLibrary)
29 > os.chdir(submitDir)
30 > logPath = config.get("Directories","logpath")
31 > repDict = {'en':en,'logpath':logPath,'job':''}
32 > def submit(job,repDict):
33 >        repDict['job'] = job
34 >        command = 'qsub -V -cwd -q all.q -N %(job)s_%(en)s -o %(logpath)s/%(job)s_%(en)s.out -e %(logpath)s/%(job)s_%(en)s.err runAll.sh %(job)s %(en)s' %repDict
35          print command
36          subprocess.call([command], shell=True)
37  
38 < theJobs = ['ZH110','ZH125','ZH120','DY','ZH115','ZH130','ZH135','ZZ','DY120','Zmm','ST_s','TT','Zee','STbar_s','STbar_t','WZ','WW','STbar_tW','ST_tW']
39 < if energy=='8TeV':
40 <        theJobs = ['ZH110','ZH125','ZH120','DY','DY5070','DY70100','DY100','ZH115','ZH130','ZH135','ZZ','DY120','Zmm','ST_s','TT','Zee','STbar_s','STbar_t','WZ','WW','STbar_tW','ST_tW']
41 <
38 > path = config.get("Directories","samplepath")
39 > infofile = open(path+'/env/samples.info','r')
40 > info = pickle.load(infofile)
41 > infofile.close()
42  
43 < for job in theJobs:
44 <        submit(job,energy)
18 <        #time.sleep(10)
43 > for job in info:
44 >        submit(job.name,repDict)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines