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

Comparing UserCode/VHbb/python/gethistofromtree.py (file contents):
Revision 1.1 by peller, Fri May 25 13:07:06 2012 UTC vs.
Revision 1.5 by peller, Mon Jun 25 11:43:56 2012 UTC

# Line 5 | Line 5 | import ROOT
5   from ROOT import TFile, TTree
6   import ROOT
7   from array import array
8 < from ConfigParser import SafeConfigParser
8 > from BetterConfigParser import BetterConfigParser
9   import sys
10  
11  
12   #load config
13 < config = SafeConfigParser()
13 > config = BetterConfigParser()
14   config.read('./config')
15  
16   #get locations:
# Line 24 | Line 24 | def getScale(job,rescale):
24      CountWithPU = input.Get("CountWithPU")
25      CountWithPU2011B = input.Get("CountWithPU2011B")
26      #print lumi*xsecs[i]/hist.GetBinContent(1)
27 <    return float(job.lumi)*float(job.xsec)*float(job.sf)/(0.46502*CountWithPU.GetBinContent(1)+0.53498*CountWithPU2011B.GetBinContent(1))*rescale/float(job.split)
27 >    return float(job.lumi)*float(job.xsec)*float(job.sf)/(CountWithPU.GetBinContent(1))*rescale/float(job.split)
28  
29  
30   def getHistoFromTree(job,options,rescale=1):
# Line 37 | Line 37 | def getHistoFromTree(job,options,rescale
37  
38      if job.type != 'DATA':
39          cutcut=config.get('Cuts',options[7])
40 <        treeCut='%s & EventForTraining == 0'%cutcut
40 >        treeCut='%s & EventForTraining == 0'%(cutcut)
41  
42      elif job.type == 'DATA':
43 <        treeCut=config.get('Cuts',options[8])
43 >        cutcut=config.get('Cuts',options[8])
44 >        treeCut='%s & EventForTraining == 0'%(cutcut)
45 >
46  
47      input = TFile.Open(job.getpath(),'read')
48  
# Line 102 | Line 104 | def orderandadd(histos,typs,setup):
104      num=[0]*len(setup)
105      for i in range(0,len(setup)):
106          for j in range(0,len(histos)):
107 <            if typs[j] == setup[i]:
107 >            if typs[j] in setup[i]:
108                  num[i]+=1
109                  ordnung.append(histos[j])
110                  ordnungtyp.append(typs[j])
# Line 119 | Line 121 | def orderandadd(histos,typs,setup):
121              
122                  #add
123                  histos[k].Add(histos[k+1],1)
124 <                #printc('red','','\t--> added %s to %s'%(typs[k],typs[k+1]))
124 >                printc('magenta','','\t--> added %s to %s'%(typs[k],typs[k+1]))
125                  del histos[k+1]
126                  del typs[k+1]
127  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines