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

Comparing UserCode/VHbb/python/evaluateMVA.py (file contents):
Revision 1.9 by nmohr, Thu Aug 9 13:03:29 2012 UTC vs.
Revision 1.12 by nmohr, Thu Sep 20 13:08:07 2012 UTC

# Line 21 | Line 21 | from printcolor import printc
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(opts.config)
41   anaTag = config.get("Analysis","tag")
42  
43   #get locations:
44   Wdir=config.get('Directories','Wdir')
38
45   MVAdir=config.get('Directories','MVAdir')
46  
47   #systematics
# Line 51 | Line 57 | systematics=systematics.split(' ')
57   ######################
58   #Evaluate multi: Must Have same treeVars!!!
59  
60 < Apath=sys.argv[1]
60 > Apath=opts.path
61   infofile = open(Apath+'/samples.info','r')
62   info = pickle.load(infofile)
63   infofile.close()
64 < arglist=sys.argv[2] #RTight_blavla,bsbsb
64 > arglist=opts.discr #RTight_blavla,bsbsb
65  
66 < namelistIN=sys.argv[3]
66 > namelistIN=opts.names
67   namelist=namelistIN.split(',')
68  
69 < doinfo=bool(int(sys.argv[4]))
69 > doinfo=bool(int(opts.update))
70  
71   MVAlist=arglist.split(',')
72 + MVAdir=config.get('Directories','vhbbpath')
73  
74   #CONFIG
75   #factory
# Line 76 | Line 83 | factoryname=config.get('factory','factor
83   #MVAinfofiles=[]
84   MVAinfos=[]
85   for MVAname in MVAlist:
86 <    MVAinfofile = open(Wdir+'/weights/'+factoryname+'_'+MVAname+'.info','r')
86 >    MVAinfofile = open(MVAdir+'/data/'+factoryname+'_'+MVAname+'.info','r')
87      MVAinfos.append(pickle.load(MVAinfofile))
88      MVAinfofile.close()
89      
# Line 115 | Line 122 | for i in range(len( MVA_Vars['Nominal'])
122   #        reader.AddSpectator(spectators[i],MVA_spectator_buffer[i])
123   #Load raeder
124   for i in range(0,len(readers)):
125 <    readers[i].BookMVA(MVAinfos[i].MVAname,MVAinfos[i].getweightfile())
125 >    readers[i].BookMVA(MVAinfos[i].MVAname,MVAdir+'/data/'+MVAinfos[i].getweightfile())
126   #--> Now the MVA is booked
127  
128   #Apply samples
# Line 128 | Line 135 | for job in Ainfo:
135      if eval(job.active):
136          if job.name in namelist:
137              #get trees:
138 <            input = TFile.Open(job.getpath(),'read')
138 >            input = TFile.Open(Apath+'/'+job.getpath(),'read')
139              outfile = TFile.Open(job.path+'/'+MVAdir+job.prefix+job.identifier+'.root','recreate')
140              input.cd()
141              obj = ROOT.TObject

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines