ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Jeng/scripts/make_table.py
(Generate patch)

Comparing UserCode/Jeng/scripts/make_table.py (file contents):
Revision 1.1 by jengbou, Fri Oct 30 17:45:51 2009 UTC vs.
Revision 1.2 by jengbou, Fri Oct 30 22:08:56 2009 UTC

# Line 22 | Line 22 | def get_list_files(directory,pattern = "
22  
23  
24   def main():
25 +    format = 'all' ## 'html' or 'all' for html+twiki
26      
27      if len(sys.argv) < 2:
28          print "[usage] make_table.py <dir> <weight=true/false> or"
# Line 35 | Line 36 | def main():
36      files = []
37      files.append(path+'TTbar_mcatnlo_Summer09_2_all.root')
38      files.append(path+'TTbar_madgraph_Summer09_2_all.root')
39 <    files.append(path+'TTbar_pythia_7TeV_Summer09_all.root')
39 >    files.append(path+'TTbar_pythia_Summer09_all.root')
40 > #    files.append(path+'TTbar_Summer09_all.root') ## 10 TeV
41      files.append(path+'WJets_madgraph_Summer09_2_all.root')
42      files.append(path+'Zjets_madgraph_Summer09_2_all.root')
43      files.append(path+'WcJets_madgraph_Summer09_2_all.root')
44 <    files.append(path+'AstarJets_madgraph_Summer09_2_all.root')
44 >    files.append(path+'AstarJets_madgraph_Summer09_3_all.root')
45  
46 <    sampleNames = ['TTbar_mcatnlo','TTbar_madgraph','TTbar_Pythia','WJets','ZJets','WcJets','Astar']
46 >    sampleNames = ['ttbar mc@nlo','ttbar madgraph','ttbar pythia', 'W+Jets','Z+Jets','Wc+Jets','Astar']
47      weightList = [0.0321, 0.0169, 0.006, 0.1817, 0.1012, 0.0026, 0.0277]
48 +
49 + ##    sampleNames = ['ttbar mc@nlo','ttbar madgraph','ttbar pythia', 'ttbar pythia(10 TeV)', 'W+Jets','Z+Jets','Wc+Jets','Astar']
50 + ##    weightList = [0.0321, 0.0169, 0.006, 0.0156, 0.1817, 0.1012, 0.0026, 0.0277]
51   ##    print len(sys.argv)
52      
53      if len(sys.argv) == 5: ## actually 4 arguments
# Line 57 | Line 62 | def main():
62          files = get_list_files(path, sys.argv[3])
63   ##        print files
64  
65 <    nfiles = 0    
65 >    nfiles = 0
66      hlist = []
67      
68      
# Line 89 | Line 94 | def main():
94      outfile.write("<table border=\"1\">\n")
95      outfile.write("<tr>")
96      outfile.write("<th>Selection</th>")
97 <    
97 >
98 >    if format == 'all':
99 >        outfile1 = open('TWiki_cut_flow.txt', 'w')
100 >        outfile1.write("| *Selection step* |")
101 >        
102      i_sample = 0
103      for s in sampleNames:
104          if i_sample < nfiles:
105 <            outfile.write("<th>")
106 <            outfile.write(s)
107 <            outfile.write("</th>")
105 >            outfile.write("<th>"+s+"</th>")
106 >            if format == 'all':
107 >                outfile1.write(" *"+s+"* |")
108 >            
109          i_sample += 1
110      outfile.write("</tr>\n")
111 +    if format == 'all':
112 +        outfile1.write("\n")
113      
114      for cut in select:
115  
# Line 120 | Line 132 | def main():
132                  ibin = ibin + 1
133  
134          line = "<tr><th>" + cut + "</th>"
135 +        if format == 'all':
136 +            line1 = "| " + cut + " |"
137          
138          for ev in events:
125            
139              line = line + "<td class=\"alr\">" + str(int(round(ev,0))) + "</td>"
140 +            if format == 'all':
141 +                line1 = line1 + " " + str(int(round(ev,0))) + " |"
142              
143          outfile.write(line+"</tr>\n")
144 +        if format == 'all':
145 +            outfile1.write(line1+"\n")
146  
147      outfile.write("</table>")
148   ##        print line
149  
150      outfile.close()
151 +    if format == 'all':
152 +        outfile1.close()
153  
154   if __name__ =='__main__':
155      sys.exit(main())

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines