19 #define WWW_PUBLIC "https://ldas-jobs.ligo.caltech.edu/~waveburst/reports/" 20 #define WWW_LAG_MANUAL "https://gwburst.gitlab.io/documentation/latest/html/faq.html?highlight=lag#what-are-lags-and-how-to-use-them" 21 #define WWW_SLAG_MANUAL "https://gwburst.gitlab.io/documentation/latest/html/faq.html?highlight=lag#what-are-super-lags-and-how-to-use-them" 26 int ReadConfig(
TString ifconfig, vector<TString> &gwname, vector<TString> &wdir, vector<TString> &rdir, vector<TString> &sdir);
34 if(type==
"ced" || type==
"postprod") {
MakeHtmlRep(type, odir, label, ifconfig); btype=
true;}
35 if(type==
"full" || type==
"left" || type==
"right" || type==
"wave") {
MakeHtmlStat(type, odir, label, ifconfig);btype=
true;}
37 if(!btype) cout << endl <<
"MakeHtmlPE.C - Error: type parameter ( " << type <<
" ) not a valid value" << endl << endl;
44 cout<<
"MakeHtmlPE.C init ..."<<endl;
50 if(gSystem->Getenv(
"CWB_USER_URL")!=NULL) {
51 cwb_user_url=
TString(gSystem->Getenv(
"CWB_USER_URL"));
54 gSystem->Exec(
"date");
56 vector<TString> gwname;
60 int gwsize =
ReadConfig(ifconfig, gwname, wdir, rdir, sdir);
62 vector<TString> link(gwsize);
64 for(
int i=0;
i<gwsize;
i++) link[
i] = type.Contains(
"ced") ? cwb_user_url+
"/"+sdir[
i]+
"/" : cwb_user_url+
"/"+wdir[
i]+
"/";
67 vector<TString> gw_event_report;
71 if(type.Contains(
"ced")) {
72 title =
"cWB - O3 BBH CED Reports";
75 title =
"cWB - O3 BBH PostProduction Reports";
80 int high = type.Contains(
"ced") ? 6700 : 6200;
82 for(
int n=0;
n<gwsize;
n++) {
83 sprintf(options,
"--link %s --label %s --name %s --high %d",link[
n].Data(),gwname[
n].Data(),dir.Data(),high);
84 gw_event_report.push_back(options);
88 for(
int n=0;
n<gwsize;
n++) {
90 if(
set!=0) gw_event_report.push_back(
"--link </tab>/ --label dummy");
91 gw_event_report.push_back(TString::Format(
"--link <tab>/ --label SET%d",++
set));
93 sprintf(options,
"--link %s --label %s --name %s --high %d",link[
n].Data(),gwname[
n].Data(),dir.Data(),high);
94 gw_event_report.push_back(options);
96 gw_event_report.push_back(
"--link </tab>/ --label dummy");
106 cout<<
"MakeHtmlPE.C init ..."<<endl;
112 if(gSystem->Getenv(
"CWB_USER_URL")!=NULL) {
113 cwb_user_url=
TString(gSystem->Getenv(
"CWB_USER_URL"));
116 gSystem->Exec(
"date");
118 vector<TString> gwname;
119 vector<TString> wdir;
120 vector<TString> rdir;
121 vector<TString> sdir;
122 int gwsize =
ReadConfig(ifconfig, gwname, wdir, rdir, sdir);
124 vector<TString> link(gwsize);
126 if(type.Contains(
"wave")) {
127 if(odir.Contains(
"wave/time")) {
128 for(
int i=0;
i<gwsize;
i++) link[
i] = cwb_user_url+
"/"+wdir[
i]+
"/dump/"+rdir[
i]+
"/"+type+
"/time/png_html_index/";
129 }
else if(odir.Contains(
"wave/spectrum")) {
130 for(
int i=0;
i<gwsize;
i++) link[
i] = cwb_user_url+
"/"+wdir[
i]+
"/dump/"+rdir[
i]+
"/"+type+
"/spectrum/png_html_index/";
131 }
else if(odir.Contains(
"wave/envelope")) {
132 for(
int i=0;
i<gwsize;
i++) link[
i] = cwb_user_url+
"/"+wdir[
i]+
"/dump/"+rdir[
i]+
"/"+type+
"/envelope/png_html_index/";
135 for(
int i=0;
i<gwsize;
i++) link[
i] = cwb_user_url+
"/"+wdir[
i]+
"/dump/"+rdir[
i]+
"/"+type+
"/distributions/png_html_index/";
139 vector<TString> gw_event_report;
142 int high = type.Contains(
"wave") ? 4990 : 7900;
144 for(
int n=0;
n<gwsize;
n++) {
145 sprintf(options,
"--link %s --label %s --name index.html --high %d",link[
n].Data(),gwname[
n].Data(),high);
146 gw_event_report.push_back(options);
150 for(
int n=0;
n<gwsize;
n++) {
152 if(
set!=0) gw_event_report.push_back(
"--link </tab>/ --label dummy");
153 gw_event_report.push_back(TString::Format(
"--link <tab>/ --label SET%d",++
set));
155 sprintf(options,
"--link %s --label %s --name index.html --high %d",link[
n].Data(),gwname[
n].Data(),high);
156 gw_event_report.push_back(options);
158 gw_event_report.push_back(
"--link </tab>/ --label dummy");
162 if(type.Contains(
"wave")) {
163 title =
"cWB - O3 BBH Waveforms (" + label +
")";
165 title =
"cWB - O3 BBH Matching Factors / Residuals (" + label +
")";
182 sprintf(ofile,
"%s/index.html", odir.Data());
184 cout << endl <<
"make index html file : " << ofile << endl << endl;
186 if (!out.good()) {cout <<
"MakeHtmlPE::mkhtml_index : Error Opening File : " << ofile << endl;
exit(1);}
191 if(gSystem->Getenv(
"CWB_HTML_INDEX")==NULL) {
192 cout <<
"MakeHtmlPE::mkhtml_index: Error - environment CWB_HTML_INDEX is not defined!!!" << endl;
exit(1);
194 strcpy(html_index_template,gSystem->Getenv(
"CWB_HTML_INDEX"));
200 in.open(html_index_template,
ios::in);
202 cout <<
"MakeHtmlPE::mkhtml_index : Error Opening File : " << html_index_template << endl;
210 in.getline(istring,1024);
211 if (!in.good())
break;
213 if(ostring.Contains(
"<div")) ndiv_in++;
214 if(ostring.Contains(
"</div")) ndiv_out++;
215 if(ndiv_in>2 && ndiv_out<4)
continue;
216 out << ostring.Data() << endl;
220 out <<
"<html>" << endl;
221 out <<
"<br>" << endl;
222 out <<
"<div align=\"center\"><font color=\"red\"><h1>" << title <<
"</h1></font>" << endl;
223 out <<
"<br>" << endl;
227 char sbody_height[256];
228 sprintf(sbody_height,
"%d",1900);
229 out <<
"<div class=\"tabber\">" << endl;
230 for(
int i=0;
i<gw_event_report.size();
i++)
if(gw_event_report[
i]!=
"") {
233 if(gw_event_report_link==
"" && i!=0) {
234 cout<<
"MakeHtmlPE::mkhtml_index : Error : gw_event_report --link not defined"<<endl;
exit(1);}
237 if((gw_event_report_link!=
"</tab>/")&&(gw_event_report_label==
"")) {
238 cout<<
"MakeHtmlPE::mkhtml_index : Error : gw_event_report --label not defined"<<endl;
exit(1);}
241 if(gw_event_report_high==
"") gw_event_report_high=sbody_height;
242 int igw_event_report_high = gw_event_report_high.Atoi();
246 if(gw_event_report_link==
"<tab>/") {
247 out <<
"<div class=\"tabbertab\">" << endl;
248 out <<
" <h2>" << gw_event_report_label <<
"</h2>" << endl;
249 out <<
"<div class=\"tabber\">" << endl;
250 }
else if(gw_event_report_link==
"</tab>/") {
251 out <<
"</div>" << endl;
252 out <<
"</div>" << endl;
254 out <<
"<div class=\"tabbertab\">" << endl;
255 out <<
" <h2>" << gw_event_report_label <<
"</h2>" << endl;
257 if(gw_event_report_name==
"") {
258 out <<
" <iframe src=\"" << gw_event_report_link <<
"header.html\" width=\"100%\" height=\"900px\" " 259 <<
"marginwidth=\"15\" marginheight=\"15\" frameborder=\"0\"></iframe>" << endl;
261 out <<
" <iframe src=\"" << gw_event_report_link <<
"body.html\" width=\"100%\" " 262 <<
" height=\"" << igw_event_report_high <<
"px\" frameborder=\"0\"></iframe>" << endl;
264 out <<
" <iframe src=\"" << gw_event_report_link << gw_event_report_name <<
"\" width=\"100%\" " 265 <<
" height=\"" << igw_event_report_high <<
"px\" frameborder=\"0\"></iframe>" << endl;
268 out <<
"</div>" << endl;
271 out <<
"</div>" << endl;
273 out <<
"</html>" << endl;
280 sprintf(cmd,
"cp %s/html/etc/html/ROOT.css %s/",gSystem->ExpandPathName(
"$HOME_WAT"),odir.Data());
282 sprintf(cmd,
"cp %s/html/etc/html/ROOT.js %s/",gSystem->ExpandPathName(
"$HOME_WAT"),odir.Data());
284 sprintf(cmd,
"cp %s/html/etc/html/tabber.css %s/",gSystem->ExpandPathName(
"$HOME_WAT"),odir.Data());
286 sprintf(cmd,
"cp %s/html/etc/html/tabber.js %s/",gSystem->ExpandPathName(
"$HOME_WAT"),odir.Data());
295 in.open(tabber.Data(),
ios::in);
296 if (!in.good()) {cout <<
"MakeHtmlPE::ModifyFontSizeCSS - Error Opening File : " << tabber.Data() << endl;
exit(1);}
299 TString tabber_tmp = tabber+
".tmp";
301 if (!out.good()) {cout <<
"MakeHtmlPE::ModifyFontSizeCSS - Error Opening File : " << tabber_tmp << endl;
exit(1);}
305 in.getline(str,1024);
306 if (!in.good())
break;
308 ostr.ReplaceAll(
"0.8em",
"0.75em");
309 out << ostr.Data() << endl;
315 sprintf(cmd,
"mv %s %s",tabber_tmp.Data(),tabber.Data());
320 int ReadConfig(
TString ifconfig, vector<TString> &gwname, vector<TString> &wdir, vector<TString> &rdir, vector<TString> &sdir) {
323 in.open(ifconfig.Data(),
ios::in);
324 if (!in.good()) {cout <<
"MakeHtmlPE::ReadConfig - Error Opening File : " << ifconfig.Data() << endl;
exit(1);}
329 in.getline(log,1024);
330 if (!in.good())
break;
331 if(log[0]==
'#')
continue;
333 if(line.Contains(
"ifeq") && line.Contains(
"$(GW_NAME)")) {
335 TString gw =
line(line.Index(
',')+1, line.Last(
')')-line.Index(
',')-1);
336 gwname.push_back(gw);
339 if(line.Contains(
"endif") && start==
true) start=
false;
341 if(line.Contains(
"PE_OFFPATH")) {
342 TString dir =
line(line.Index(
'/')+1, line.Sizeof()-line.Index(
',')-1);
343 dir = gSystem->BaseName(dir);
346 if(line.Contains(
"PE_RDIR")) {
347 TString dir =
line(line.Index(
'=')+1, line.Sizeof()-line.Index(
',')-2);
348 dir.ReplaceAll(
" ",
"");
352 if(line.Contains(
"PE_ONPATH")) {
353 TString dir =
line(line.Index(
'/')+1, line.Sizeof()-line.Index(
',')-1);
354 dir = gSystem->BaseName(dir);
362 if((wdir.size() != gwname.size())) {
363 cout <<
"MakeHtmlPE::ReadConfig - missing PE_OFFPATH config declarations: MISSED = " 364 << gwname.size()-wdir.size() <<
" in file " << ifconfig << endl;
exit(1);
366 if((rdir.size() != gwname.size())) {
367 cout <<
"MakeHtmlPE::ReadConfig - missing PE_RDIR config declarations: MISSED = " 368 << gwname.size()-rdir.size() <<
" in file " << ifconfig << endl;
exit(1);
370 if((sdir.size() != gwname.size())) {
371 cout <<
"MakeHtmlPE::ReadConfig - missing PE_ONPATH config declarations: MISSED = " 372 << gwname.size()-sdir.size() <<
" in file " << ifconfig << endl;
exit(1);
375 for(
int i=0;
i<gwname.size();
i++) cout <<
i <<
"\t" << gwname[
i] << endl;
376 for(
int i=0;
i<gwname.size();
i++) cout <<
i <<
"\t" << wdir[
i] << endl;
377 for(
int i=0;
i<gwname.size();
i++) cout <<
i <<
"\t" << rdir[
i] << endl;
378 for(
int i=0;
i<gwname.size();
i++) cout <<
i <<
"\t" << sdir[
i] << endl;
380 return gwname.size();
void MakeHtmlPE(TString type, TString odir, TString label, TString ifconfig)
cout<< "baudline_FFL : "<< baudline_FFL<< endl;ofstream out;out.open(baudline_FFL, ios::out);if(!out.good()) {cout<< "Error Opening File : "<< baudline_FFL<< endl;exit(1);} ifstream in;in.open(frFiles[ifoID], ios::in);if(!in.good()) {cout<< "Error Opening File : "<< frFiles[ifoID]<< endl;exit(1);} TString pfile_path="";char istring[1024];while(1) { in > istring
char html_index_template[1024]
void MakeHtmlStat(TString type, TString odir, TString label, TString ifconfig)
void MakeHtmlRep(TString type, TString odir, TString label, TString ifconfig)
int ReadConfig(TString ifconfig, vector< TString > &gwname, vector< TString > &wdir, vector< TString > &rdir, vector< TString > &sdir)
strcpy(RunLabel, RUN_LABEL)
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
void ModifyFontSizeCSS(TString tabber)
void mkhtml_index(vector< TString > gw_event_report, TString odir, TString label, TString title)