Revision: | 1.1 |
Committed: | Thu Feb 16 16:25:58 2012 UTC (13 years, 2 months ago) by amott |
Content type: | text/x-python |
Branch: | MAIN |
CVS Tags: | V00-02-06, V00-02-05, V00-02-04, V00-02-03, V00-02-01, V00-01-10, V-00-01-10, V00-01-09, V00-01-08, V00-01-07, V00-01-06, V00-01-05, V00-01-04, V00-01-03, V00-01-02, V00-01-01, V00-00-34, V00-00-33, MenuAnalyzer_V00-00-02, MenuAnalyzer_V00-00-01, MenuAnalyzer_V1, V00-00-32, V00-00-31, V00-00-30, V00-00-29, V00-00-28, V00-00-27, V00-00-26, V00-00-24, V00-00-23, V00-00-22, V00-00-21, V00-00-20, V00-00-19, V00-00-18, V00-00-17, V00-00-16, V00-00-15, V00-00-14, V00-00-13, V00-00-12, V00-00-11, V00-00-10, V00-00-09, V00-00-08, V00-00-07, V00-00-05, HEAD |
Branch point for: | V00-00-06 |
Log Message: | Added ability to predict L1 rates |
# | Content |
---|---|
1 | from DatabaseParser import * |
2 | |
3 | RUN = 180250 |
4 | |
5 | def DumpCSV(dat,filename): |
6 | [x,y]=dat |
7 | if not len(x)==len(y): |
8 | return |
9 | outfile = open(filename,'w') |
10 | outfile.write("lumi/F:Rate/F\n") |
11 | for xa,ya in zip(x,y): |
12 | outfile.write("%f %f\n" % (xa,ya,) ) |
13 | outfile.close() |
14 | |
15 | def GetL1(): |
16 | parser = DatabaseParser() |
17 | parser.RunNumber = RUN |
18 | parser.ParseRunSetup() |
19 | return [parser.GetTotalL1Rates(),parser.GetLSRange(1,9999)] |
20 | |
21 | def GetPSColumns(rateDict): |
22 | psc=[] |
23 | for rate,ps,lumi in rateDict.itervalues(): |
24 | psc.append(ps) |
25 | return set(psc) |
26 | |
27 | def MakeXY(rateDict,psCol,mask,xsec=False): |
28 | x=[] |
29 | y=[] |
30 | for ls,val in rateDict.iteritems(): |
31 | [rate,ps,lumi] = val |
32 | if ls in mask and ps==psCol: |
33 | x.append(lumi) |
34 | if xsec: |
35 | y.append(rate/lumi) |
36 | return [x,y] |
37 | |
38 | if __name__ == '__main__': |
39 | [rates,mask] = GetL1() |
40 | print "Prescale Columns:" |
41 | for column in GetPSColumns(rates): |
42 | print column |
43 | DumpCSV(MakeXY(rates,column,mask),"RateByLumi_Col%d.txt" % column) |
44 | DumpCSV(MakeXY(rates,column,mask,True),"RateByXsec_Col%d.txt" % column) |