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 |
> |
Test=False |
9 |
> |
|
10 |
> |
parser = OptionParser() |
11 |
> |
parser.add_option("-T", "--tag", dest="tag", default="", |
12 |
> |
help="Tag to run the analysis with, example '8TeV' uses config8TeV and pathConfig8TeV to run the analysis") |
13 |
> |
|
14 |
> |
(opts, args) = parser.parse_args(sys.argv) |
15 |
> |
if opts.tag == "": |
16 |
> |
print "Please provide tag to run the analysis with, example '-T 8TeV' uses config8TeV and pathConfig8TeV to run the analysis." |
17 |
> |
sys.exit(123) |
18 |
> |
en = opts.tag |
19 |
> |
configs = ['config%s'%(en),'pathConfig%s'%(en)] |
20 |
> |
print configs |
21 |
> |
config = BetterConfigParser() |
22 |
> |
config.read(configs) |
23 |
> |
btagLibrary = config.get('BTagReshaping','library') |
24 |
> |
submitDir = os.getcwd() |
25 |
> |
os.chdir(os.path.dirname(btagLibrary)) |
26 |
> |
if not os.path.exists(btagLibrary): |
27 |
> |
ROOT.gROOT.LoadMacro('%s+'%btagLibrary.replace('_h.so','.h')) |
28 |
> |
shutil.copyfile(os.path.basename(btagLibrary),'/scratch/%s/%s'%(getpass.getuser(),os.path.basename(btagLibrary))) |
29 |
> |
shutil.copyfile('/scratch/%s/%s'%(getpass.getuser(),os.path.basename(btagLibrary)),btagLibrary) |
30 |
> |
os.chdir(submitDir) |
31 |
> |
logPath = config.get("Directories","logpath") |
32 |
> |
repDict = {'en':en,'logpath':logPath,'job':''} |
33 |
> |
def submit(job,repDict): |
34 |
> |
repDict['job'] = job |
35 |
> |
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 |
36 |
|
print command |
37 |
|
subprocess.call([command], shell=True) |
38 |
|
|
39 |
< |
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'] |
40 |
< |
if energy=='8TeV': |
41 |
< |
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'] |
39 |
> |
#theJobs = ['STbar_tW','ST_tW'] |
40 |
> |
#theJobs = ['ZH110','ZH125','ZH120','Zudsg','Zbb','Zcc','ZH115','ZH130','ZZ','Zudsg70100','Zbb70100','Zcc70100','Zudsg5070','Zbb5070','Zcc5070','Zmm','Zudsg100','Zbb100','Zcc100','ST_s','TT','Zee','STbar_s','STbar_t','WZ','WW','STbar_tW','ST_tW'] |
41 |
> |
#theJobs = ['ZH110','ZH125'] |
42 |
> |
#theJobs = ['ST_t'] |
43 |
> |
#theJobs = ['ZH110','ZH115','ZH120','ZH125','ZH130','ZH135','DY','DY120','TT','ZZ','WZ','WW','ST_s','ST_t','STbar_s','STbar_t','STbar_tW','ST_tW','Zee','Zmm'] |
44 |
> |
|
45 |
> |
#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'] |
46 |
> |
#if energy=='8TeV': |
47 |
> |
# 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'] |
48 |
> |
#if Test: |
49 |
> |
# theJobs = ['WZ'] |
50 |
> |
|
51 |
> |
|
52 |
> |
path = config.get("Directories","samplepath") |
53 |
> |
infofile = open(path+'/env/samples.info','r') |
54 |
> |
info = pickle.load(infofile) |
55 |
> |
infofile.close() |
56 |
|
|
57 |
+ |
#submit('prepare',repDict) |
58 |
|
|
59 |
< |
for job in theJobs: |
60 |
< |
submit(job,energy) |
61 |
< |
#time.sleep(10) |
59 |
> |
for job in info: |
60 |
> |
if Test and job.name == 'WZ': |
61 |
> |
submit(job.name,repDict) |
62 |
> |
elif not Test: |
63 |
> |
submit(job.name,repDict) |