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.23 by nmohr, Fri Feb 1 10:47:38 2013 UTC vs.
Revision 1.27 by bortigno, Sun Feb 24 01:51:10 2013 UTC

# Line 12 | Line 12 | warnings.filterwarnings( action='ignore'
12   from optparse import OptionParser
13   import pickle
14  
15 +
16   #CONFIGURE
17   ROOT.gROOT.SetBatch(True)
18   print('hello')
# Line 87 | Line 88 | for mva in MVAinfos:
88   #eval
89  
90   samples = info.get_samples(namelist)
91 + print(samples)
92   for job in samples:
93      #get trees:
94      print(INpath+'/'+job.prefix+job.identifier+'.root')
# Line 105 | Line 107 | for job in samples:
107          #print key.GetName()
108          obj.Write(key.GetName())
109      tree = input.Get(job.tree)
108    nEntries = tree.GetEntries()
110      outfile.cd()
111 <    newtree = tree.CloneTree(0)
111 >    newtree = tree.CopyTree('V.pt > 100') #hard skim to get faster
112 >    nEntries = newtree.GetEntries()
113 >    input.Close()
114              
115      #Set branch adress for all vars
116      for i in range(0,len(theMVAs)):
117 <        theMVAs[i].setVariables(tree,job)
117 >        theMVAs[i].setVariables(newtree,job)
118      outfile.cd()
119      #Setup Branches
120      mvaVals=[]
# Line 124 | Line 127 | for job in samples:
127              newtree.Branch(theMVAs[i].MVAname,mvaVals[i],'nominal:JER_up:JER_down:JES_up:JES_down:beff_up:beff_down:bmis_up:bmis_down:beff1_up:beff1_down/F')
128          MVA_formulas_Nominal = []
129          print('\n--> ' + job.name +':')
127    #progbar setup
128    if nEntries >= longe:
129        step=long(nEntries/longe)
130        long=longe
131    else:
132        long=nEntries
133        step = 1
134    bar=progbar(long)
130      #Fill event by event:
131      for entry in range(0,nEntries):
132 <        if entry % step == 0:
138 <            bar.move()
139 <        #load entry
140 <        tree.GetEntry(entry)
132 >        newtree.GetEntry(entry)
133                              
134          for i in range(0,len(theMVAs)):
135              theMVAs[i].evaluate(mvaVals[i],job)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines