1 |
|
#! /usr/bin/env python |
2 |
– |
import os,shutil,sys,pickle,subprocess,ROOT |
2 |
|
from optparse import OptionParser |
3 |
< |
from BetterConfigParser import BetterConfigParser |
5 |
< |
from samplesclass import sample |
6 |
< |
import getpass |
3 |
> |
import sys |
4 |
|
|
5 |
|
parser = OptionParser() |
6 |
|
parser.add_option("-T", "--tag", dest="tag", default="", |
12 |
|
parser.add_option("-S","--samples",dest="samples",default="", |
13 |
|
help="samples you want to run on") |
14 |
|
|
18 |
– |
|
15 |
|
(opts, args) = parser.parse_args(sys.argv) |
16 |
+ |
|
17 |
+ |
import os,shutil,pickle,subprocess,ROOT |
18 |
+ |
ROOT.gROOT.SetBatch(True) |
19 |
+ |
from myutils import BetterConfigParser, Sample, ParseInfo |
20 |
+ |
import getpass |
21 |
+ |
|
22 |
|
if opts.tag == "": |
23 |
|
print "Please provide tag to run the analysis with, example '-T 8TeV' uses config8TeV and pathConfig8TeV to run the analysis." |
24 |
|
sys.exit(123) |
31 |
|
samplesList=opts.samples.split(",") |
32 |
|
|
33 |
|
en = opts.tag |
34 |
< |
configs = ['config%s'%(en),'pathConfig%s'%(en)] |
34 |
> |
configs = ['%sconfig/general'%(en),'%sconfig/paths'%(en),'%sconfig/plots'%(en),'%sconfig/training'%(en),'%sconfig/datacards'%(en),'%sconfig/cuts'%(en)] |
35 |
|
|
36 |
|
print configs |
37 |
|
config = BetterConfigParser() |
55 |
|
repDict = {'en':en,'logpath':logPath,'job':'','task':opts.task,'queue': 'all.q'} |
56 |
|
def submit(job,repDict): |
57 |
|
repDict['job'] = job |
58 |
< |
command = 'qsub -V -cwd -q %(queue)s -N %(job)s_%(en)s%(task)s -o %(logpath)s/%(job)s_%(en)s_%(task)s.out -e %(logpath)s/%(job)s_%(en)s_%(task)s.err runAll.sh %(job)s %(en)s ' %(repDict) + opts.task |
58 |
> |
command = 'qsub -V -cwd -q %(queue)s -l h_vmem=6G -N %(job)s_%(en)s%(task)s -o %(logpath)s/%(job)s_%(en)s_%(task)s.out -e %(logpath)s/%(job)s_%(en)s_%(task)s.err runAll.sh %(job)s %(en)s ' %(repDict) + opts.task |
59 |
|
print command |
60 |
|
subprocess.call([command], shell=True) |
61 |
|
|
69 |
|
|
70 |
|
if not opts.task == 'prep': |
71 |
|
path = config.get("Directories","samplepath") |
72 |
< |
infofile = open(path+'/env/samples.info','r') |
73 |
< |
info = pickle.load(infofile) |
72 |
< |
infofile.close() |
73 |
< |
|
72 |
> |
samplesinfo = config.get("Directories","samplesinfo") |
73 |
> |
info = ParseInfo(samplesinfo,path) |
74 |
|
|
75 |
|
if opts.task == 'plot': |
76 |
< |
repDict['queue'] = 'short.q' |
76 |
> |
repDict['queue'] = 'all.q' |
77 |
|
for item in Plot_vars: |
78 |
|
submit(item,repDict) |
79 |
|
|
80 |
|
elif opts.task == 'dc': |
81 |
< |
repDict['queue'] = 'short.q' |
81 |
> |
repDict['queue'] = 'all.q' |
82 |
|
for item in DC_vars: |
83 |
< |
if 'ZH%s'%opts.mass in item and opts.tag in item: |
83 |
> |
if 'ZH%s'%opts.mass in item: |
84 |
|
submit(item,repDict) |
85 |
< |
elif 'ZH' in item and opts.tag in item and opts.mass == 'all': |
85 |
> |
elif 'ZH' in item and opts.mass == 'all': |
86 |
|
submit(item,repDict) |
87 |
|
|
88 |
|
elif opts.task == 'prep': |