ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/TWikiIB/chkpy.py
Revision: 1.5
Committed: Tue Sep 8 10:04:03 2009 UTC (15 years, 7 months ago) by geonmo
Content type: text/x-python
Branch: MAIN
CVS Tags: HEAD
Changes since 1.4: +0 -2 lines
Log Message:
remove temp print

File Contents

# Content
1 #!/usr/bin/env python
2 import urllib2, re, os, sys
3 from ROOT import gROOT, TCanvas, TPie, TH1F, TLegend
4 class makePyCheck(object) :
5 def __init__(self,tday,arch,packagename) :
6 self.tday = tday
7 self.arch = arch
8 self.packagename = packagename
9 self.summary = self.packagename[6]+'.'+self.packagename[8]+'-'+self.tday+'-'+self.packagename[23:25]
10 url = 'http://cms-service-sdtweb.web.cern.ch/cms-service-sdtweb/rc/'+self.arch+'/www/'+self.tday+'/'+self.summary+'/'+self.packagename+'/testLogs/chkPyConf.log'
11 self.contents = os.popen('wget --no-check-certificate -nv -o /dev/null -O- '+url)
12
13 def makecanvas(self,name, xlen, ylen):
14 can = TCanvas(name,name,0,0,xlen,ylen)
15 can.SetFillColor(0)
16 can.SetFrameFillColor(0)
17 can.SetFrameLineWidth(2)
18 return can
19
20 def mkPyCheck(self) :
21
22 gROOT.Reset()
23
24 contents = self.contents
25 countpac = 0
26 title = []
27 countfiles = []
28 countfile = 0
29 countline = 0
30 while 1:
31 l = contents.readline()
32 if not l:
33 countfiles.append(countfile)
34 break
35 m1 = re.search('------',l)
36 if m1:
37 countpac = countpac + 1
38 countfiles.append(countfile)
39 countfile = 0
40 countline = countline + 1
41 m2 = re.search('Package',l)
42 if m2:
43 splitedline = l.split()
44 title.append(splitedline[1])
45 countfile = countfile + 1
46 c1 = self.makecanvas("c1",300,200)
47 c2 = self.makecanvas("c2",600,400)
48 colors = [6,4,2,8,10,12]
49 num = []
50 for i in range(0,countline):
51 num.append(countfiles[i+1]-2)
52
53 his1 = TH1F("pyCfgCheck","pyCfgCheck",countline,0,countline)
54 for j in range(0,countline):
55 titlenum = title[j]+' ('+str(num[j])+')'
56 his1.Fill(titlenum,float(num[j]))
57
58 pie = TPie(his1)
59 pie.SetRadius(0.35)
60 for j in range(0,countline):
61 pie.SetEntryFillColor(j,colors[j])
62 pie.SetTextSize(0.02)
63 pie.SetY(0.5)
64 pie.SetLabelsOffset(-.1)
65
66 pieleg = pie.MakeLegend()
67 pieleg.SetY1(0.80)
68 pieleg.SetY2(0.95)
69 pieleg.SetX1(0.5)
70 pieleg.SetX2(0.98)
71 pieleg.SetFillColor(0)
72 c1.cd()
73 pie.Draw("3d")
74 pieleg.Draw()
75 c1.Update()
76 c1.Print("pie_thum.png")
77 c2.cd()
78 pie.Draw("3d")
79 pieleg.Draw()
80 c2.Update()
81 c2.Print("pie.png")