1 from __future__
import print_function
2 from __future__
import absolute_import
14 from builtins
import range
15 from os
import chdir,getcwd,listdir,makedirs
16 from os.path
import basename,join,exists
22 from ROOT
import TCanvas,gStyle,TH1F,TGaxis,gPad,kRed
28 from matplotlib.colors
import to_hex
30 if "RELMON_SA" in os.environ:
31 from .dirstructure
import Comparison,Directory
32 from .definitions
import *
33 from .utils
import unpickler
35 from Utilities.RelMon.dirstructure
import Comparison,Directory
37 from Utilities.RelMon.utils
import unpickler
42 for old,new
in url_encode_dict.items():
43 url=url.replace(old,new)
47 return "w=%s;h=%s" %(h,w)
51 obj_url=
"archive/%s/%s/%s/%s/" %(run,sample,version,tier)
53 while obj_url.endswith(slash):
55 while slash*2
in obj_url:
56 obj_url=obj_url.replace(slash*2,slash)
60 obj_url=
"obj=%s;" %
build_obj_addr(run,sample,version,plot_path,tier)
63 def fairy_url(run1,run2,sample1,sample2,version1,version2,plot_path,tier1,tier2,draw_opts="",h=250,w=200):
64 fairy_url =
"%s/%s/plotfairy/overlay?" %(server,base_url)
65 fairy_url+=
build_obj(run1,sample1,version1,plot_path,tier1)
66 fairy_url+=
build_obj(run2,sample2,version2,plot_path,tier2)
68 fairy_url+=
"drawopts=%s;" %draw_opts
70 fairy_url +=
";ref=ratiooverlay" 74 fairy_url =
"%s/%s/plotfairy/" %(server,base_url)
78 fairy_url+=
"drawopts=%s;" %draw_opts
82 style_location=
"/cms-service-reldqm" 84 style_location=
"/cms-service-reldqm" 86 style_location =
"https://raw.githubusercontent.com/cms-PdmV/RelMonService2/77c534ec93401ca5de222ac62a6422f02389dafc/report_website/" 92 if directory!=
None and len(directory.comparisons)>0:
94 style=
'img.fail {border:1px solid #ff0000;}\n'+\
95 'img.succes {border:1px solid #00ff00;}\n'+\
96 'img.null {border:1px solid #ffff00;}\n'+\
97 'img.skiped {border:1px solid #7a7a7a;}\n'+\
98 'a.black_link:link {color: #333333}\n'+\
99 'a.black_link:hover {color: #737373}\n'+\
100 'a.black_link:visited {color: #333333}\n'+\
101 'a.black_link:active {color: #333333}\n' 104 wrapper_h =
min(thead_h + (70 * len(directory.comparisons)),1800)
106 tablestyle =
'\n.wrapper { overflow: auto; height: %dpx;} \n'%(wrapper_h)
107 tablestyle +=
'table { position: relative; border-collapse: separate; border-spacing: 0;} \n' 108 tablestyle +=
'table { position: relative; border-collapse: separate; border-spacing: 0;} \n' 109 tablestyle +=
'table th, table td { width: 50px; padding: 5px; background-color: white;} \n' 110 tablestyle +=
'table th { position: sticky; top: 0; z-index: 2; height: %dpx;} \n'%(thead_h)
111 tablestyle +=
'table th:nth-child(1) { left:0; z-index:3;} \n' 112 tablestyle +=
'.sticky-col { position: sticky; background-color: #C9FFD1 ; width: 200px; left:0}\n' 113 tablestyle +=
'.center_head { position: absolute; top: 50%; left: 50%;} \n' 114 tablestyle +=
'.vertical_head {top: 60%; -webkit-transform: translateX(-50%) translateY(-50%) rotate(-90deg); -moz-transform: translateX(-50%) translateY(-50%) rotate(-90deg);} \n' 121 '<title>RelMon Summary</title>'+\
122 '<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script>' + \
123 '<link rel="stylesheet" href="%s/screen.css" type="text/css" media="screen, projection">'%style_location+\
124 '<link rel="stylesheet" href="%s/print.css" type="text/css" media="print">'%style_location+\
125 '<link rel="stylesheet" href="%s/fancy-type-screen.css" type="text/css" media="screen, projection">'%style_location+\
126 '<style type="text/css">'+\
127 '.rotation {display: block;-webkit-transform: rotate(-90deg);-moz-transform: rotate(-90deg); }'+\
132 '%s'%additional_header+\
135 '<div class="container">' 142 return '</div></body></html>' 148 mother_name=basename(directory.mother_dir)
151 mother_file_name=
"../RelMonSummary.html" 153 mother_file_name=
"%s.html" %(
hash_name(mother_name, hashing_flag))
155 mother_file_name=
"RelMonSummary.html" 158 mother_file_name=
"%s.html" %(
hash_name(mother_name, hashing_flag))
161 files = directory.mother_dir.split(
"/")
163 dir_name = files[-2]+files[-1]
166 dir_name = directory.mother_dir
167 mother_file_name=
"%s.html" %(
hash_name(dir_name, hashing_flag))
169 mother_file_name=
"%s.html" %directory.mother_dir.replace(
"/",
"_")
170 mother_file_name=mother_file_name.strip(
"_")
172 link_to_mother=
'<a href="%s">..</a>' %mother_file_name
173 html=
'<div class="span-20">'+\
174 '<h1>%s</h1>'%directory.name+\
176 '<div class="span-1">'+\
177 '<h1>%s</h1>'%link_to_mother+\
179 '<div class="span-3 last">'+\
180 '<img src="%s" class="top right" width="54" hight="54">'%cms_logo_url+\
183 if len(mother_name)>0:
184 html+=
'<h2 class="alt">%s</h2>'% directory.mother_dir+\
190 html=
'<p><span class="caps alt">%s comparisons:</span></p>'%directory.weight
192 if directory.n_successes>0:
193 html+=
'<li><span class="caps">Success: %.1f%% (%s)</span></li>'%(directory.get_success_rate(),directory.n_successes)
194 if directory.n_nulls>0:
195 html+=
'<li><span class="caps">Null: %.1f%% (%s)</span></li>'%(directory.get_null_rate(),directory.n_nulls)
196 if directory.n_fails>0:
197 html+=
'<li><span class="caps">Fail: %.1f%% (%s)</span></li>'%(directory.get_fail_rate(),directory.n_fails)
198 if directory.n_skiped>0:
199 html+=
'<li><span class="caps">Skipped: %.1f%% (%s)</span></li>'%(directory.get_skiped_rate(),directory.n_skiped)
200 if directory.n_missing_objs>0:
201 html+=
'<li><span class="caps">Unpaired: %s</span></li>'%(directory.n_missing_objs)
208 if len(directory.subdirs)==0:
210 html=
'<div class="span-20 colborder">' 211 html+=
'<h2 class="alt">Sub-Directories</h2>' 214 sorted_subdirs= sorted(directory.subdirs, key=
lambda subdir: subdir.name)
215 sorted_subdirs= sorted(sorted_subdirs, key=
lambda subdir: subdir.n_nulls, reverse=
True)
216 sorted_subdirs= sorted(sorted_subdirs, key=
lambda subdir: subdir.n_fails, reverse=
True)
217 for subdir
in sorted_subdirs:
220 link =
"%s.html" %(
hash_name(
join(directory.full_path,name), hashing_flag))
222 link=
"%s_%s_%s.html" %(directory.mother_dir.replace(
"/",
"_"),directory.name.replace(
"/",
"_"),name)
224 html+=
'<div class="span-4 prepend-2 colborder">' 225 html+=
'<h3>%s</h3>'%name
228 html+=
'<div class="span-7">' 232 html+=
'<div class="span-6 last">' 233 html+= subdir.get_piechart_js(120,link)
248 for comparison
in directory.comparisons:
249 test_name=comparison.test_name
250 test_threshold=comparison.test_thr
252 if len(test_name)==0:
253 for subdir
in directory.subdirs:
254 for comparison
in subdir.comparisons:
255 test_name=comparison.test_name
256 test_threshold=comparison.test_thr
258 if len(test_name)!=0:
break 259 if len(test_name)==0:
260 for subsubdir
in subdir.subdirs:
261 for comparison
in subsubdir.comparisons:
262 test_name=comparison.test_name
263 test_threshold=comparison.test_thr
265 if len(test_name)!=0:
break 266 if len(test_name)==0:
267 for subsubsubdir
in subsubdir.subdirs:
268 for comparison
in subsubsubdir.comparisons:
269 test_name=comparison.test_name
270 test_threshold=comparison.test_thr
272 if len(test_name)!=0:
break 277 html=
'<div class="span-6">'+\
280 html+=
'<a href="%s/%s/start?runnr=%s;dataset=/%s/%s/DQMIO;sampletype=offline_data;filter=all;referencepos=on-side;referenceshow=all;referencenorm=True;referenceobj1=other:%s:/%s/%s/DQMIO:;referenceobj2=none;referenceobj3=none;referenceobj4=none;search=;striptype=object;stripruns=;stripaxis=run;stripomit=none;workspace=Everything;size=M;focus=;zoom=no;">To the DQM GUI...</a>' %(server,base_url,meta.run1,meta.sample1,meta.release1,meta.run2,meta.sample2,meta.release2)
283 html+=
'<div class="span-7 colborder">'+\
284 '%s'%(directory.get_piechart_js(150)) +\
286 '<div class="span-9 last">' 288 html+=
'<h3>Sample:</h3>'+\
289 '<p class="caps">%s</p>'%meta.sample1+\
290 '<h3>Run1 and Run2:</h3>'+\
291 '<p class="caps">%s - %s</p>'%(meta.run1,meta.run2)
292 html+=
'<h3>Releases:</h3>'+\
293 '<ul><li><p>%s</p></li><li><p>%s</p></li></ul>'%(meta.release1,meta.release2)+\
294 '<h3>Statistical Test (Pvalue threshold):</h3>'+\
295 '<ul><li><p class="caps">%s (%s)</p></li></ul>'%(test_name,test_threshold)+\
303 """Prepare the comparisons between histograms and organise them in the page. 304 Moreover create separate pages with the overlay and the single plots. 310 comparisons= [comp
for comp
in directory.comparisons
if comp.status == cat_states[category]]
311 n_comparisons=len(comparisons)
316 comparisons=sorted(comparisons, key=
lambda comp:comp.rank, reverse=is_reverse)
319 dir_abs_path=
"%s/%s/" %(directory.mother_dir,directory.name)
321 for comparison
in comparisons:
322 plot_name=comparison.img_name
323 if "http://" not in plot_name:
324 plot_name= basename(comparison.img_name)
325 class_type=
"colborder" 326 if counter==3
or tot_counter==n_comparisons:
327 class_type=
" colborder last" 328 comp_abs_path=
"%s/%s" %(dir_abs_path,comparison.name)
331 if directory.do_pngs:
332 png_link=comparison.img_name
333 html_comparisons+=
'<div class="span-6 %s"><p>%s</p>' %(class_type,comparison.name)+\
334 '<p class="alt">%s: %.2E</p>' %(comparison.test_name,comparison.rank)+\
335 '<a href="%s"><img src="%s" width="250" height="200" class="top center %s"></a></div>'%(png_link,png_link,cat_classes[category])
339 directory.meta.sample1,
340 directory.meta.sample2,
341 directory.meta.release1,
342 directory.meta.release2,
344 directory.meta.tier1,
345 directory.meta.tier2,
347 small_fairy=
fairy_url(directory.meta.run1,
349 directory.meta.sample1,
350 directory.meta.sample2,
351 directory.meta.release1,
352 directory.meta.release2,
354 directory.meta.tier1,
355 directory.meta.tier2)
358 directory.meta.sample1,
359 directory.meta.release1,
361 directory.meta.tier1,
364 directory.meta.sample2,
365 directory.meta.release2,
367 directory.meta.tier2,
370 html_comparisons+=
'<div class="span-6 %s"><p>%s</p>' %(class_type,comparison.name)+\
371 '<p class="alt">%s: %.2E</p>' %(comparison.test_name,comparison.rank)+\
372 '<div><a class="black_link" href="%s">%s</a></div>'%(single_fairy1,directory.meta.release1)+\
373 '<div><a href="%s">%s</a></div>'%(single_fairy2,directory.meta.release2)+\
374 '<a href="%s"><img src="%s" class="top center %s"></a></div>'%(big_fairy,small_fairy,cat_classes[category])
377 html_comparisons+=
"<hr>" 382 if len(html_comparisons)!=0:
383 html=
'<div class="span-20"><h2 class="alt">%s Comparisons</h2></div>' %cat_names[category]
384 html+=html_comparisons
393 imgname=
"RankSummary.png" 394 gStyle.SetPadTickY(0)
395 c=TCanvas(
"ranks",
"ranks",500,400)
399 h=directory.rank_histo
400 rank_histof=TH1F(h.GetName(),
"",h.GetNbinsX(),h.GetXaxis().GetXmin(),h.GetXaxis().GetXmax())
401 rank_histof.SetLineWidth(2)
402 for i
in range(0,h.GetNbinsX()+1):
403 rank_histof.SetBinContent(i,h.GetBinContent(i))
404 h.SetTitle(
"Ranks Summary;Rank;Frequency")
407 rank_histof.ComputeIntegral()
408 integral = rank_histof.GetIntegral()
409 rank_histof.SetContent(integral)
411 rightmax = 1.1*rank_histof.GetMaximum()
412 scale = gPad.GetUymax()/rightmax
413 rank_histof.SetLineColor(kRed)
414 rank_histof.Scale(scale)
415 rank_histof.Draw(
"same")
418 axis = TGaxis(gPad.GetUxmax(),gPad.GetUymin(),gPad.GetUxmax(), gPad.GetUymax(),0,rightmax,510,
"+L")
419 axis.SetTitle(
"Cumulative")
420 axis.SetTitleColor(kRed)
421 axis.SetLineColor(kRed)
422 axis.SetLabelColor(kRed)
425 rank_histof.Draw(
"Same");
430 page_html=
'<div class="span-20"><h2 class="alt"><a name="rank_summary">Ranks Summary</a></h2>' 431 page_html+=
'<div class="span-19"><img src="%s"></div>' %imgname
432 page_html+=
'</div> <a href="#top">Top...</a><hr>' 440 """Method to get missing objects from directory: in case histogram/directory was in one ROOT file but not in other 442 page_html =
"Unpaired in %s</br>"%(directory.filename1)
443 for elem
in directory.different_histograms[
'file1']:
444 page_html +=
"name: %s type:%s </br>"%(elem,directory.different_histograms[
'file1'][elem])
446 page_html +=
"Unpaired in %s</br>"%(directory.filename2)
447 for elem
in directory.different_histograms[
'file2']:
448 page_html +=
"name: %s type:%s </br>"%(elem,directory.different_histograms[
'file2'][elem])
453 """Converts a directory tree into html pages, very nice ones. 464 for subdir
in directory.subdirs:
472 for do_cat,cat
in ((directory.n_comp_fails >0,FAIL ),
473 (directory.n_comp_nulls >0,NULL ),
475 (directory.n_comp_successes >0
and directory.draw_success,SUCCESS ),
476 (directory.n_comp_skiped >0,SKIPED)):
480 if (len(directory.different_histograms[
'file1']) >0)
or (len(directory.different_histograms[
'file2']) >0):
491 page_name=directory.name
493 if len(page_name)==0:
494 page_name=
"RelMonSummary" 496 if page_name !=
"RelMonSummary":
499 ofilename =
"%s.html" %(
hash_name(
join(directory.full_path), hashing))
501 ofilename =
"RelMonSummary.html" 503 ofilename=
"%s_%s.html" %(directory.mother_dir.replace(
"/",
"_"),page_name)
504 ofilename=ofilename.strip(
"_")
506 ofile=open(ofilename,
"w")
507 ofile.write(page_html)
516 gauge_max = 1. - rate
518 name = random.getrandbits(64)
520 html +=
'<canvas id="%s" style="width:100%%;max-width:%d"></canvas>'%(name,w)
523 html +=
'<script> new Chart("%s",'%(name)
524 html +=
'{ type: "doughnut",' 528 html +=
'labels: ["Success", "Failure"],' 529 html +=
'datasets: [{ backgroundColor: ["%s", "#C7C7C7"],'%(color)
530 html +=
'data: [%f,%f]}] },'%(rate,gauge_max)
533 html +=
'options: { responsive: true, rotation: -3.1415926536, circumference: 3.1415926536 ,' 534 html +=
' legend: { display: false }, tooltips: {enabled: false}, hover: {mode: null}},' 535 html +=
'}); </script>' 537 html +=
'<div style="width: 100%%; position: relative; left: %d; margin-top: -%dpx; font-align: center">'%(
int(2*w/7),font_size)
538 html +=
'<span style="color: %s; font-family: courier; font-size: %dpx;">%.2f%%</span></div>'%(color,font_size,rate*100.)
548 if the_aggr_pairs==[]:
549 for samplename,sampledir
in dir_dict.items():
550 for subsysdirname
in sorted(sampledir.get_subdirs_dict().
keys()):
551 if not subsysdirname
in list_of_names:
552 list_of_names.append(subsysdirname)
553 the_aggr_pairs.append((subsysdirname,[subsysdirname]))
556 for cat_name, subdir_list
in the_aggr_pairs:
558 total_directory_successes=0
563 for dirname, sampledir
in dir_dict.items():
565 for subdirname,subdir
in sampledir.get_subdirs_dict().
items():
566 if subdirname
in subdir_list:
567 nsucc=subdir.n_successes
568 total_successes+=nsucc
573 total_directory_successes+=
float(nsucc)/weight
574 if subdirname
in present_subdirs:
575 this_dir_dict=present_subdirs[subdirname]
576 this_dir_dict[
"nsucc"]+=nsucc
577 this_dir_dict[
"weight"]+=weight
579 present_subdirs[subdirname]={
"nsucc":nsucc,
"weight":weight}
581 for subsubdirname,subsubdir
in subdir.get_subdirs_dict().
items():
582 for pathname
in [name
for name
in subdir_list
if "/" in name]:
583 selected_subdirname,selected_subsubdirname = pathname.split(
"/")
584 if selected_subdirname == subdirname
and selected_subsubdirname==subsubdirname:
586 nsucc=subsubdir.n_successes
587 total_successes+=nsucc
588 weight=subsubdir.weight
591 total_directory_successes+=
float(nsucc)/weight
593 if subsubdirname
in present_subdirs:
594 this_dir_dict=present_subdirs[subsubdirname]
595 this_dir_dict[
"nsucc"]+=nsucc
596 this_dir_dict[
"weight"]+=weight
598 present_subdirs[subsubdirname]={
"nsucc":nsucc,
"weight":weight}
601 print(
"No directory of the category %s is present in the samples: skipping." %cat_name)
604 average_success_rate=total_directory_successes/(total_ndirs)
605 aggr_pairs_info.append((cat_name,present_subdirs,total_weight,average_success_rate))
607 return aggr_pairs_info
619 html=
'<div class="span-20 colborder">' 620 html+=
'<h2 class="alt"><a name="categories">Categories:</a></h2>' 622 for cat_name,present_subdirs,total_weight,average_success_rate
in aggr_pairs_info:
624 html+=
'<div class="span-3 prepend-0 colborder">' 625 html+=
'<h3>%s</h3>'%cat_name
626 html+=
'<div><span class="alt">Avg. Success rate:</span></div>' 627 html+=
'<div><span class="alt">%2.1f%%</span></div>'%(average_success_rate*100)
629 html+=
'<div class="span-9">' 631 html+=
'<div><p><span class="caps alt">DQM Directories (%i comparisons):</span></p></div>' %total_weight
632 html+=
'<div><p><span class="alt">name: succ. rate - rel. weight</span></p></div>' 634 for subdirname
in sorted(present_subdirs.keys()):
635 this_dir_dict=present_subdirs[subdirname]
636 nsucc=this_dir_dict[
"nsucc"]
637 weight=this_dir_dict[
"weight"]
638 html+=
'<li><span class="caps">%s: %2.1f%% - %2.1f%%</span></li>'%(subdirname,100*
float(nsucc)/weight,100*
float(weight)/total_weight)
642 html+=
'<div class="span-6 last">' 647 return html+
'<br><a href="#top">Top...</a> </div><hr>' 654 meta= list(dir_dict.items())[0][1].meta
655 releases=sorted([meta.release1,meta.release2])
656 latest_release=releases[1].
split(
"-")[0]
663 html=
'<div class="span-20 colborder">' 664 html+=
'<h2 class="alt"><a name="twiki_table">Twiki snipppet for release managers</a></h2>' 665 html+=
'<div>| Release | Comparison |' 666 for cat_name,present_subdirs,total_weight,average_success_rate
in aggr_pairs_info:
671 html+=
'<div>| %s | %%ICON{arrowdot}%% | '%latest_release
675 for cat_name,present_subdirs,total_weight,average_success_rate
in aggr_pairs_info:
680 html+=
'</div> <a href="#top">Top...</a>' 687 tooltip=
"%s\nS:%2.1f%% N:%2.1f%% F:%2.1f%% Sk:%2.1f%%" %(directory.name,directory.get_success_rate(),directory.get_null_rate(),directory.get_fail_rate(),directory.get_skiped_rate())
697 <script type="text/javascript" src="https://www.google.com/jsapi"></script> 698 <script type="text/javascript"> 699 google.load("visualization", "1", {packages:["corechart"]}); 700 google.setOnLoadCallback(drawChart); 701 function drawChart() { 702 var data = new google.visualization.DataTable(); 703 data.addColumn('string', 'DQM Directory'); 704 data.addColumn('number', 'Success Rate'); 706 script+=
"data.addRows(%i);\n"%len(aggr_pairs_info)
708 for subsystname,present_directories,weight,success_rate
in aggr_pairs_info:
710 script+=
"data.setValue(%i, 0, '%s');\n"%(counter,subsystname)
711 script+=
"data.setValue(%i, 1, %2.2f);\n"%(counter,success_rate)
714 var chart = new google.visualization.BarChart(document.getElementById('%s')); 715 chart.draw(data, {width: 1024, height: %i, title: 'Success Rate', 716 vAxis: {title: '%s', titleTextStyle: {color: 'red'},textStyle: {fontSize: 14}} 720 """%(name,35*counter,title)
726 def make_summary_table(indir,aggregation_rules,aggregation_rules_twiki, hashing_flag, standalone_flag):
727 """Create a table, with as rows the directories and as columns the samples. 728 Each box in the table will contain a pie chart linking to the directory. 734 if os.path.isabs(indir):
735 title = basename(indir)
738 title=title.strip(
".")
739 title=title.strip(
"/")
743 sample_pkls=[name
for name
in listdir(
"./")
if name.endswith(
".pkl")]
748 for sample_pkl
in sample_pkls:
750 dir_unpickler.start()
752 dir_unpicklers.append(dir_unpickler)
755 for dir_unpickler
in dir_unpicklers:
762 for dir_unpickler
in dir_unpicklers:
764 directory=dir_unpickler.directory
767 global_dir.meta=directory.meta
768 dir_dict[dir_unpickler.filename.replace(
".pkl",
"")]=directory
769 global_dir.subdirs.append(directory)
771 global_dir.calcStats()
776 page_html =
get_page_header(standalone=standalone_flag, additional_header=directories_barchart+categories_barchart)
780 rel1,rel2=title.split(
"VS")
782 rel1=global_dir.meta.release1.split(
"-")[0]
783 rel2=global_dir.meta.release2.split(
"-")[0]
784 global_dir.meta.release1=rel1
785 global_dir.meta.release2=rel2
789 for directory
in dir_dict.values():
790 for subdir_name
in directory.get_subdirs_names():
791 all_subdirs.append(subdir_name)
792 all_subdirs=sorted(list(set(all_subdirs)))
797 page_html+=
'<div class="span-20">'+\
798 '<h2><a name="top" href="https://twiki.cern.ch/twiki/bin/view/CMSPublic/RelMon">RelMon</a> Global Report: %s</h2>'%title+\
800 '<div class="span-1">'+\
801 '<h2><a href="%s">main...</a></h2>' %relmon_mainpage+\
804 page_html+=
'<div class="span-24"><p></p></div>\n'*3
810 page_html+=
'<div class="span-24">' 811 page_html+=
'<div class="span-20 colborder"><h2 class="alt">Sections:</h2>'+\
813 '<li><a href="#summary_barchart">Summary Barchart</a></li>'+\
814 '<li><a href="#categories">Categories</a></li>'+\
815 '<li><a href="#detailed_barchart">Detailed Barchart</a></li>'+\
816 '<li><a href="#summary_table">Summary Table</a></li>'+\
817 '<li><a href="#rank_summary">Ranks Summary</a></li>'+\
818 '<li><a href="#twiki_table">Twiki Table</a></li>'+\
824 page_html+=
'<div class="span-24"><h2 class="alt"><a name="summary_barchart">Summary Barchart</a></h2></div>' 825 page_html+=
'<div id="cat_chart"></div> <a href="#top">Top...</a><hr>' 831 page_html+=
'<div id="dir_chart"></div> <a href="#top">Top...</a><hr>' 835 page_html+=
'<div class="span-24"><p></p></div>\n' 839 page_html+=
'<div class="span-24"><h2 class="alt"><a name="summary_table">Summary Table</a></h2> <h4> <span class="alt"> (scrollable) </span> </h4> </div>' 841 div_width=
min(len(dir_dict.keys()) * 70 + 500,1500)
842 page_html+=
'<div class="wrapper" style = "width: %dpx;">'%(div_width)
847 <th> <p class = "vertical_head center_head"></p> </th> 852 <th> <p class = "vertical_head center_head">Summary</p></th>""" 854 sorted_samples=sorted(dir_dict.keys())
855 for sample
in sorted_samples:
856 if "_" in sample
and "Data" not in sample:
857 sample_nick=
"_".
join(sample.split(
"X_")[0].
split(
"_")[:-1])
859 elif "Data" in sample
and "RelVal" in sample:
860 sample_nick =
"".
join([sample.split(
"_")[0],sample.split(
"RelVal")[-1]])
866 <th> <p class = "vertical_head center_head">%s</th></p>"""%sample_nick
867 page_html+=
"</tr> \n </thead> \n </tbody> \n" 873 page_html+=
'<td class="sticky-col">' 875 page_html+=
'<b>Summary</b></td>' 876 page_html+=
'<td><div class="span-1"> %s </div></td>'%(global_dir.get_piechart_js(50))
877 for sample
in sorted_samples:
880 summary_page_name=
"RelMonSummary.html" 882 summary_page_name=
hash_name(col.name, hashing_flag)+
".html" 884 chart = col.get_piechart_js(50,sample+
"/"+summary_page_name)
886 page_html+=
'%s </a></td>' %(chart)
890 for subdir_name
in all_subdirs:
893 page_html+=
' <td class="sticky-col" style="font-weight:bold;">%s</td>\n' %subdir_name
897 n_samples=len(sorted_samples)
899 for sample
in sorted_samples:
900 subdirs_dict=directory.get_subdirs_dict()
901 directory=dir_dict[sample]
902 dir_is_there=subdir_name
in subdirs_dict
904 row_summary.subdirs.append(subdirs_dict[subdir_name])
907 row_summary.calcStats()
909 chart = row_summary.get_piechart_js(50)
910 page_html+=
'<td><div>' 911 page_html+= chart +
'</div></td>' 913 for sample
in sorted_samples:
916 directory=dir_dict[sample]
917 subdirs_dict=directory.get_subdirs_dict()
920 if directory.name!=
"":
925 summary_page=
join(sample,
"%s.html"%(
hash_name(directory.name+
"/"+subdir_name,hashing_flag)))
927 summary_page=
join(sample,
"%s.html"%(
hash_name(directory.name+
"_"+subdir_name,hashing_flag)))
931 summary_page=
join(sample,
"%s.html"%(
hash_name(directory.name+subdir_name,hashing_flag)))
932 dir_is_there=subdir_name
in subdirs_dict
934 img_link=
"https://upload.wikimedia.org/wikipedia/commons/a/a8/Circle_Davys-Grey_Solid.svg" 935 page_html+=
'<td><div class="span-1">' 939 chart=subdirs_dict[subdir_name].get_piechart_js(50,summary_page)
940 page_html+=
'%s'%chart
942 page_html+=
'<img src="%s" title="%s" height=50 width=50>' %(img_link,
"Unavailable")
943 page_html+=
'</div></td>' 945 page_html+=
" </tr>\n" 949 page_html+=
'</tbody> </table> </div> <a href="#top">Top...</a><hr>' 963 if (3,0,0) <= sys.version_info:
964 return hashlib.md5(file_name.encode(
'utf-8')).hexdigest()[:10]
965 return hashlib.md5(file_name).hexdigest()[:10]
static char to_hex(unsigned int i)
def hash_name(file_name, flag)
def get_comparisons(category, directory)
def get_subdirs_section(directory, hashing_flag)
def get_pie_tooltip(directory)
def build_obj(run, sample, version, plot_path, tier)
def build_gauge_js(rate, w=100, minrate=.80, add_rate=False)
def get_aggr_pairs_info(dir_dict, the_aggr_pairs=[])
def make_summary_table(indir, aggregation_rules, aggregation_rules_twiki, hashing_flag, standalone_flag)
def plot_size(h=250, w=200)
def get_page_header(directory=None, standalone=False, additional_header="")
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def get_title_section(directory, hashing_flag, standalone, depth=2)
def get_dir_stats(directory)
def make_barchart_summary(dir_dict, name="the_chart", title="DQM directory", the_aggr_pairs=[])
def get_summary_section(directory, matrix_page=True)
def split(sequence, size)
def directory2html(directory, hashing, standalone, depth=0)
def make_twiki_table(dir_dict, aggregation_rules)
static std::string join(char **cmd)
def make_categories_summary(dir_dict, aggregation_rules)
def fairy_url_single(run, sample, version, plot_path, tier, draw_opts="", h=250, w=200)
def fairy_url(run1, run2, sample1, sample2, version1, version2, plot_path, tier1, tier2, draw_opts="", h=250, w=200)
def build_obj_addr(run, sample, version, plot_path, tier)
def get_missing_objs_section(directory)
def get_rank_section(directory)