21 |
|
|
22 |
|
#load config |
23 |
|
#os.mkdir(path+'/sys') |
24 |
< |
argv = sys.argv[5:] |
24 |
> |
argv = sys.argv |
25 |
|
parser = OptionParser() |
26 |
+ |
parser.add_option("-U", "--update", dest="update", default=0, |
27 |
+ |
help="update infofile") |
28 |
+ |
parser.add_option("-D", "--discr", dest="discr", default="", |
29 |
+ |
help="discriminators to be added") |
30 |
+ |
parser.add_option("-P", "--path", dest="path", default="", |
31 |
+ |
help="path to samples") |
32 |
+ |
parser.add_option("-S", "--samples", dest="names", default="", |
33 |
+ |
help="samples you want to run on") |
34 |
|
parser.add_option("-C", "--config", dest="config", default=[], action="append", |
35 |
< |
help="configuration defining the plots to make") |
35 |
> |
help="configuration file") |
36 |
|
(opts, args) = parser.parse_args(argv) |
37 |
< |
if opts.config ==[]: |
37 |
> |
if opts.config =="": |
38 |
|
opts.config = "config" |
31 |
– |
print opts.config |
39 |
|
config = BetterConfigParser() |
40 |
+ |
#config.read('./config7TeV_ZZ') |
41 |
|
config.read(opts.config) |
42 |
|
anaTag = config.get("Analysis","tag") |
43 |
|
|
44 |
|
#get locations: |
45 |
|
Wdir=config.get('Directories','Wdir') |
46 |
< |
|
39 |
< |
MVAdir=config.get('Directories','MVAdir') |
46 |
> |
MVASubdir=config.get('Directories','MVAdir') |
47 |
|
|
48 |
|
#systematics |
49 |
|
systematics=config.get('systematics','systematics') |
58 |
|
###################### |
59 |
|
#Evaluate multi: Must Have same treeVars!!! |
60 |
|
|
61 |
< |
Apath=sys.argv[1] |
61 |
> |
Apath=opts.path |
62 |
|
infofile = open(Apath+'/samples.info','r') |
63 |
|
info = pickle.load(infofile) |
64 |
|
infofile.close() |
65 |
< |
arglist=sys.argv[2] #RTight_blavla,bsbsb |
65 |
> |
arglist=opts.discr #RTight_blavla,bsbsb |
66 |
|
|
67 |
< |
namelistIN=sys.argv[3] |
67 |
> |
namelistIN=opts.names |
68 |
|
namelist=namelistIN.split(',') |
69 |
|
|
70 |
< |
doinfo=bool(int(sys.argv[4])) |
70 |
> |
doinfo=bool(int(opts.update)) |
71 |
|
|
72 |
|
MVAlist=arglist.split(',') |
73 |
+ |
MVAdir=config.get('Directories','vhbbpath') |
74 |
|
|
75 |
|
#CONFIG |
76 |
|
#factory |
84 |
|
#MVAinfofiles=[] |
85 |
|
MVAinfos=[] |
86 |
|
for MVAname in MVAlist: |
87 |
< |
MVAinfofile = open(Wdir+'/weights/'+factoryname+'_'+MVAname+'.info','r') |
87 |
> |
MVAinfofile = open(MVAdir+'/data/'+factoryname+'_'+MVAname+'.info','r') |
88 |
|
MVAinfos.append(pickle.load(MVAinfofile)) |
89 |
|
MVAinfofile.close() |
90 |
|
|
123 |
|
# reader.AddSpectator(spectators[i],MVA_spectator_buffer[i]) |
124 |
|
#Load raeder |
125 |
|
for i in range(0,len(readers)): |
126 |
< |
readers[i].BookMVA(MVAinfos[i].MVAname,MVAinfos[i].getweightfile()) |
126 |
> |
readers[i].BookMVA(MVAinfos[i].MVAname,MVAdir+'/data/'+MVAinfos[i].getweightfile()) |
127 |
|
#--> Now the MVA is booked |
128 |
|
|
129 |
|
#Apply samples |
136 |
|
if eval(job.active): |
137 |
|
if job.name in namelist: |
138 |
|
#get trees: |
139 |
< |
input = TFile.Open(job.getpath(),'read') |
140 |
< |
outfile = TFile.Open(job.path+'/'+MVAdir+job.prefix+job.identifier+'.root','recreate') |
139 |
> |
input = TFile.Open(Apath+'/'+job.getpath(),'read') |
140 |
> |
outfile = TFile.Open(Apath+'/'+MVASubdir+job.prefix+job.identifier+'.root','recreate') |
141 |
|
input.cd() |
142 |
|
obj = ROOT.TObject |
143 |
|
for key in ROOT.gDirectory.GetListOfKeys(): |