10import os,glob,argparse,sys
12parser = argparse.ArgumentParser(description=
'Create the Physics Validation web page:', usage=
'%(prog)s -i ROC/ ')
13parser.add_argument(
"-i",
"--input_dir", help=
"path to the folder holding the plots (default: ./)", default=os.getcwd())
14parser.add_argument(
"-n",
"--number_of_histo", help=
"number of histo per raw (default is 4)", default=4)
16parser.add_argument(
"-f",
"--format", help=
'format for the plots (default: "*.png")', default=
"*.png")
21 return [alist[i:i+sublen]
for i
in range(0, len(alist), sublen)]
24 numrows = (len(alist)+sublen-1) // sublen
25 return [alist[i::sublen]
for i
in range(numrows)]
34 string =
'<html><table>'
38 list_len = len(sublist)
42 idx = sublist.index(file)
43 print(
"Histo: " + sublist[idx])
44 list_end = list_len - idx
46 string +=
'<p style=\"color:#0000FF\";>'+ str(file)+
'<p> </th><th>'
49 string +=
'<p style=\"color:#0000FF\";>'+ str(file)+
'<p> </th></tr> '
54 idx = sublist.index(file)
55 list_end = list_len - idx
57 string +=
'<a href="'+str(file)+
'"> <img alt="'+str(file)+
'" src="'+str(file)+
'" width="400" height="300"></a> </td><th>'
59 string +=
'<a href="'+str(file)+
'"> <img alt="'+str(file)+
'" src="'+str(file)+
'" width="400" height="300"></a> </td><tr>'
63 string +=
'</table></html>'
76args = parser.parse_args()
77folder = os.path.abspath(args.input_dir)
79if not os.path.isdir(folder):
80 print(
"The folder " + folder +
" doesn't exist !")
85nHisto = int(args.number_of_histo)
93files = glob.glob(format)
97print(
"=================================================")
98print(
"Processing histo in directory "+folder)
99print(
"=================================================")
103hs = open(
"FTAG_PhysValWebPage.html",
'w')
106print(
"See "+folder+
"/FTAG_PhysValWebPage.html")
108folder_eff= folder+
"/eff_vs_Lxy"
109if (os.path.isdir(folder_eff)):
111 files = glob.glob(format)
113 hs = open(
"FTAG_PhysValWebPage.html",
'w')
114 hs.write(my_htm_page)
118 print(
"There is no Efficiency vs Lxy directory: " + folder_eff)
121folder_pt= folder+
"/eff_vs_pt_ttbar"
123if (os.path.isdir(folder_pt)):
125 files = glob.glob(format)
127 hs = open(
"FTAG_PhysValWebPage.html",
'w')
128 hs.write(my_htm_page)
133 folder_pt= folder+
"/eff_vs_pt_Zprime"
134 if (os.path.isdir(folder_pt)):
136 files = glob.glob(format)
138 hs = open(
"FTAG_PhysValWebPage.html",
'w')
139 hs.write(my_htm_page)
143 print(
"There is no Efficiency vs pT directory (ttbar or Z'): " + folder_pt)
147mypage =
"<html><table>"
148mypage +=
'<tr><th><p style=\"color:#0000FF\";> FTAG Physics validation web page <p> </th> </tr>'
149mypage +=
'<tr><td> <a href="FTAG_PhysValWebPage.html">' +str(args.input_dir)+
'</a> </td></tr> '
150mypage +=
'<tr><td> <ul> <li> <a href="eff_vs_Lxy/FTAG_PhysValWebPage.html"> Efficiency versus Lxy </a> </li> '
152 mypage +=
' <li> <a href="eff_vs_pt_ttbar/FTAG_PhysValWebPage.html"> Efficiency versus pT </a> </li> </td></tr> '
154 mypage +=
' <li> <a href="eff_vs_pt_Zprime/FTAG_PhysValWebPage.html"> Efficiency versus pT </a> </li> </td></tr> '
155mypage +=
"</table></html>"
158hs = open(
"FTAG_PhysVal.html",
'w')
160print(
"See "+folder+
"/FTAG_PhysVal.html")
void print(char *figname, TCanvas *c1)
list_to_html_table(alist, sublength, column_major=False)