4 from __future__
import print_function
16 from ROOT
import gSystem
20 gSystem.Load(
'libDataQualityUtils')
21 from ROOT
import dqutils
24 def handi( name, resultsFile, htmlDir ):
26 if ( htmlDir.rfind(
"/")!=(len(htmlDir)-1) ):
31 dirsstring = of.stringListSystemPaths(htmlDir)
32 dirs = dirsstring.rsplit()
33 for subHtmlDir
in dirs:
34 if(
not os.access(subHtmlDir,os.F_OK) ):
36 os.makedirs(subHtmlDir)
38 print(
'Cannot create directory "' + subHtmlDir +
'"; exiting.')
41 total=of.stringAllHistograms()
42 of.saveAllHistograms(htmlDir,
False)
47 if (len(s[number-1])<1):
50 list, namelist =
makeAllDirsFile( htmlDir, name, s, number, resultsFile )
52 for x
in range(0,len(list)):
60 cmdi = sys.argv[0].rfind(
"/")
61 cmd = sys.argv[0][cmdi+1:]
62 print(
"Usage: ", cmd,
"<imput_file> <html_output_directory>")
65 g=
open(htmlDir+
'index.html',
'w')
66 g.write(
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n')
67 g.write(
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n')
69 g.write(
'<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />\n')
70 g.write(
'<title>'+ name+
'</title>\n')
71 g.write(
'<link rel="stylesheet" href="AutomChecks.css" type="text/css" />\n')
74 g.write(
'<font class="DQGroup">[<a href="../index.html">Back</a>]</font>\n')
75 g.write(
'<h1>' + name +
': Monitoring</h1>\n')
86 g.write(
'<table>\n<tr valign="top">\n<td width="500">\n')
87 for x
in range(0,number):
91 shortNameDir = namedir
92 namediri = namedir.rfind(
"/")
94 shortNameDir = namedir[namediri+1:]
95 if namedir==
'<top_level>':
96 shortNameDir=
'Overall Status'
97 spaces_new=s[x].
find(sp[0][0])
98 if spaces_new > spaces:
101 elif spaces_new==spaces:
102 g.write(
'</li>\n<li>')
105 diff = spaces - spaces_new
107 g.write(
'</ul></li>\n')
111 if namedir!=
'<top_level>':
112 g.write(
'<img src="pixel.png" width="0" height="13" alt="" />')
113 if ( (x<number-1)
and (s[x+1].rsplit())[3]==
'ass' ):
114 if namedir==
'<top_level>':
116 g.write(
'<font class="DQGroup"><a href="'+namedir +
'/toplevel.html">'+shortNameDir+
'</a></font>')
118 g.write(
'<font class="DQGroup"><a href="'+namedir +
'/index.html" >'+shortNameDir+
'</a></font>')
120 namelist.append(namedir)
122 g.write(
'<font class="DQGroup">'+shortNameDir+
'</font>')
126 for x
in range(0,num_lists-1):
127 g.write(
'</ul></li>\n')
130 g.write(
'</td>\n<td><font class="Info">From file:</font><br/><font class="Note">' + resultsFile +
'</font></td>\n</tr>\n</table>')
131 g.write(
'</body>\n</html>')
133 return list, namelist
138 if( subname ==
'.' ):
139 h=
open(htmlDir+
'/'+subname+
'/toplevel.html',
'w')
140 subnameTitle =
'Top Level'
142 h=
open(htmlDir+
'/'+subname+
'/index.html',
'w')
143 subnameTitle = subname
144 h.write(
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n')
145 h.write(
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n')
147 h.write(
'<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />\n')
148 h.write(
'<title>'+ name +
' ' + subnameTitle +
'</title>\n')
149 h.write(
'<link rel="stylesheet" href="AutomChecks.css" type="text/css" />\n')
152 h.write(
'<font class="DQGroup">[<a href="')
153 for x
in range(subname.count(
"/")):
155 h.write(
'../index.html">Back</a>]</font>\n')
157 h.write(
'<table>\n<tr valign="top">\n<td width="250"></td>\n')
158 h.write(
'<td width="300"><h2>'+name+
' '+subnameTitle+
'</h2></td>\n')
159 h.write(
'<td width="250">\n<font class="Note">Click on images for details and full size.</font>\n')
160 h.write(
'</td>\n</tr>\n</table>\n')
161 h.write(
'<table cellpadding="4" cellspacing="20">\n')
165 while(sp[3]==
'ass' and y<number):
169 h.write(
'<tr>\n<td class="' + sp[1] +
'"><a href="'+sp[0]+
'.html"><img src="'+ sp[0] +
'.png" height="200" alt="' + name +
' ' + subname+
'/'+sp[0]+
'.png" /></a></td>\n')
171 h.write(
'<td class="' + sp[1] +
'"><a href="'+sp[0]+
'.html"><img src="'+ sp[0] +
'.png" height="200" alt="' + name +
' ' + subname+
'/'+sp[0]+
'.png" /></a></td>\n</tr>\n')
174 h.write(
'<td class="' + sp[1] +
'"><a href="'+sp[0]+
'.html"><img src="'+ sp[0] +
'.png" height="200" alt="' + name +
' ' + subname+
'/'+sp[0]+
'.png" /></a></td>\n')
181 h.write(
'</table>\n</center>\n</body>\n</html>\n')
186 k=
open(htmlDir+
'/'+subname+
'/'+sp[0]+
'.html',
'w')
187 k.write(
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n')
188 k.write(
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n')
190 k.write(
'<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />\n')
191 k.write(
'<title>'+name+
' ' + subname+
' ' + sp[0]+
'</title>\n')
192 k.write(
'<link rel="stylesheet" href="AutomChecks.css" type="text/css" />\n')
195 k.write(
'<center>\n')
196 k.write(
'<table>\n<tr valign="top">\n')
198 k.write(
'<td width="250"><font class="DQGroup">[<a href="toplevel.html">Back</a></font>]</td>\n')
200 k.write(
'<td width="250"><font class="DQGroup">[<a href="index.html">Back</a></font>]</td>\n')
201 k.write(
'<td width="500"><h2>'+name +
' ' + subname+
'/'+sp[0]+
'</h2></td>\n')
202 k.write(
'<td width="250"></td>\n</tr></table>\n')
203 k.write(
'<table cellpadding="10">\n<tr>\n')
204 k.write(
'<td>\n<table width="400">\n')
205 k.write(
'<tr><td colspan="2"><font class="Heading">Details:</font></td></tr>\n')
206 k.write(
'<tr><td> </td></tr>\n')
207 k.write(
'<tr><td align="right"><font class="DatumName">Name:</font></td>')
208 k.write(
'<td>' +sp[0] +
'</td></tr>\n' )
209 k.write(
'</table>\n</td>\n')
211 k.write(
'<td><a href="toplevel.html"><img src="'+ sp[0] +
'.png" alt="' + name +
' ' + subname+
'/'+sp[0]+
'.png" /></a></td>\n')
213 k.write(
'<td><a href="index.html"><img src="'+ sp[0] +
'.png" alt="' + name +
' ' + subname+
'/'+sp[0]+
'.png" /></a></td>\n')
214 k.write(
'</tr></table>\n')
215 k.write(
'</center>\n</body>\n</html>\n')
220 k=
open(htmlDir+
'index.html',
'w')
221 k.write(
'<html>\n<frameset rows="200,*">\n')
222 k.write(
'<frame src="'+name+
'AllDirs.html">\n')
225 k.write(
'<frame src="'+subname+
'/index.html" name="showframe"> \n')
227 k.write(
'<frame src="'+subname+
'/toplevel.html" name="showframe"> \n')
228 k.write(
'</frameset>\n</html> \n')
233 css=
open(htmlDir+
'/'+subname+
'/'+name+
'AutomChecks.css',
'w')
234 css.write(
'BODY\n{\n background: #E6E6FA;\n color: #000000;\n font-family: helvetica,sans-serif;\n}\n')
235 css.write(
'H1\n{\n font-family: helvetica,sans-serif;\n font-size: x-large;\n text-align: left;\n}\n')
236 css.write(
'H2\n{\n font-family: helvetica,sans-serif;\n font-size: large;\n text-align: center;\n}\n')
237 css.write(
'H3\n{\n font-family: helvetica,sans-serif;\n font-size: medium;\n text-align: left;\n}\n')
238 css.write(
'FONT.Info\n{\n color: black;\n font-style: italic;\n}\n')
239 css.write(
'FONT.Heading\n{\n color: black;\n font-weight: bold;\n font-size: large;\n}\n')
240 css.write(
'FONT.DatumName\n{\n color: black;\n font-weight: bold;\n}\n')
241 css.write(
'FONT.Note\n{\n color: black;\n font-size: small;\n}\n')
242 css.write(
'FONT.DQGroup\n{\n font-size: small;\n}\n')
243 css.write(
'FONT.Red\n{\n color: red;\n font-weight: bold;\n}\n')
244 css.write(
'FONT.Yellow\n{\n color: #ffd700;\n font-weight: bold;\n}\n')
245 css.write(
'FONT.Green\n{\n color: green;\n font-weight: bold;\n}\n')
246 css.write(
'FONT.Undef\n{\n color: gray;\n font-weight: bold;\n}\n')
247 css.write(
'FONT.NoCheck\n{\n color: black;\n font-weight: bold;\n}\n')
248 css.write(
'TD.Red\n{\n background-color: red;\n}\n')
249 css.write(
'TD.Yellow\n{\n background-color: #ffd700;\n}\n')
250 css.write(
'TD.Green\n{\n background-color: green;\n}\n')
251 css.write(
'TD.Undef\n{\n background-color: gray;\n}\n')
252 css.write(
'TD.NoCheck\n{\n background-color: #E6E6FA;\n}\n')
260 if __name__ ==
"__main__":
262 if len(sys.argv) != 3:
267 resultsFile = sys.argv[1]
270 handi( name, resultsFile, html_dir )