1 |
nmohr |
1.1 |
#! /usr/bin/env python
|
2 |
nmohr |
1.7 |
import os,shutil,sys,pickle,subprocess,ROOT
|
3 |
nmohr |
1.6 |
from optparse import OptionParser
|
4 |
|
|
from BetterConfigParser import BetterConfigParser
|
5 |
|
|
from samplesclass import sample
|
6 |
nmohr |
1.7 |
import getpass
|
7 |
|
|
|
8 |
peller |
1.8 |
Test=False
|
9 |
nmohr |
1.1 |
|
10 |
nmohr |
1.6 |
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 |
nmohr |
1.7 |
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 |
nmohr |
1.6 |
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 |
nmohr |
1.1 |
print command
|
37 |
|
|
subprocess.call([command], shell=True)
|
38 |
|
|
|
39 |
peller |
1.8 |
#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 |
nmohr |
1.6 |
path = config.get("Directories","samplepath")
|
53 |
|
|
infofile = open(path+'/env/samples.info','r')
|
54 |
|
|
info = pickle.load(infofile)
|
55 |
|
|
infofile.close()
|
56 |
nmohr |
1.1 |
|
57 |
peller |
1.8 |
#submit('prepare',repDict)
|
58 |
|
|
|
59 |
nmohr |
1.6 |
for job in info:
|
60 |
peller |
1.8 |
if Test and job.name == 'WZ':
|
61 |
|
|
submit(job.name,repDict)
|
62 |
|
|
elif not Test:
|
63 |
|
|
submit(job.name,repDict)
|