Logo coherent WaveBurst  
Library Reference Guide
Logo
cwb_mkhtml_header.C
Go to the documentation of this file.
1 /*
2 # Copyright (C) 2019 Gabriele Vedovato, Marco Drago
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17 
18 
19 // make the html header for simulation/production reports : used by the cwb_report command
20 
21 {
22  #include <unistd.h>
23  #include <stdio.h>
24 
25  // check if files exist
26  CWB::Toolbox::checkFile(gSystem->Getenv("CWB_ROOTLOGON_FILE"));
27  CWB::Toolbox::checkFile(gSystem->Getenv("CWB_PARAMETERS_FILE"));
28  CWB::Toolbox::checkFile(gSystem->Getenv("CWB_UPARAMETERS_FILE"));
29  CWB::Toolbox::checkFile(gSystem->Getenv("CWB_PPARAMETERS_FILE"));
30  CWB::Toolbox::checkFile(gSystem->Getenv("CWB_UPPARAMETERS_FILE"));
31  CWB::Toolbox::checkFile(gSystem->Getenv("CWB_EPPARAMETERS_FILE"));
32 
33  char html_footer[1024];
34  sprintf(html_footer,"%s/html/etc/html/footer.html",gSystem->Getenv("HOME_WAT"));
35  if(gSystem->AccessPathName(html_footer)) {
36  cout << endl;
37  cout << "Please do : " << endl;
38  cout << "cd $HOME_WAT" << endl;
39  cout << "make html_footer" << endl;
40  cout << endl;
41  exit(1);
42  }
43 
44  // if CWB_DOC_URL is define then man infos are added to web pages
46  if(gSystem->Getenv("CWB_DOC_URL")!=NULL) {
47  cwb_doc_url=TString(gSystem->Getenv("CWB_DOC_URL"));
48  }
49 
50  // get site cluster name
52  if(gSystem->Getenv("SITE_CLUSTER")==NULL) {
53  cout << "Error : environment SITE_CLUSTER is not defined!!!" << endl;exit(1);
54  } else {
55  site_cluster=TString(gSystem->Getenv("SITE_CLUSTER"));
56  }
57 
58  // get the number of jobs in the merged list
59  int iversion;
61  if(gSystem->Getenv("CWB_MERGE_LABEL")==NULL) {
62  cout << "Error : environment CWB_MERGE_LABEL is not defined!!!" << endl;exit(1);
63  } else {
64  cwb_merge_label=TString(gSystem->Getenv("CWB_MERGE_LABEL"));
65  }
66  TObjArray* token = TString(cwb_merge_label).Tokenize(TString("."));
67  TString merge_label=((TObjString*)token->At(0))->GetString();
68  // check if label has the correct format (M#)
69  if(merge_label[0]!='M') {
70  cout << "Error : label " << merge_label.Data() << " has bad format (M#)" << endl;exit(1);
71  } else {
72  TString lcheck=merge_label;
73  lcheck.Remove(0,1);
74  if(!lcheck.IsDigit()) {
75  cout << "Error : label " << merge_label.Data() << " has bad format (M#)" << endl;exit(1);
76  } else {
77  iversion=lcheck.Atoi();
78  }
79  }
80  char ilstfname[1024];
81  sprintf(ilstfname,"%s/merge_%s.%s.lst",merge_dir,data_label,cwb_merge_label.Data());
82  vector<TString> merge_jobFileList;
83  vector<int> merge_jobList = CWB::Toolbox::getMergeJobList(ilstfname,merge_jobFileList);
84  cout << "Number of jobs in the merged lists : " << merge_jobList.size() << endl;
85 
86  if(nfactor<=0) nfactor=1; // fix nfactor if not initialized
87 
88  strcpy(work_dir,gSystem->WorkingDirectory());
89 
90  // get the number of job submit by condor
91  char full_condor_dir[1024];
92  sprintf(full_condor_dir,"%s/%s",work_dir,condor_dir);
93 
94  char condor_dag_file[1024];
95  sprintf(condor_dag_file,"%s/%s.dag",full_condor_dir,data_label);
96  Long_t id,size=0,flags,mt;
97  int estat = gSystem->GetPathInfo(condor_dag_file,&id,&size,&flags,&mt);
98  vector<int> condor_jobList;
99  if (estat==0) {
100  condor_jobList=CWB::Toolbox::getCondorJobList(full_condor_dir, data_label);
101  cout << "Number of jobs/factors in the condor lists : " << condor_jobList.size() << "/" << nfactor << endl;
102  }
103 
105  if(merge_jobList.size()<nfactor*condor_jobList.size()) {
106  sprintf(merge_job_list_str,"<font color=\"red\">%d</font>",(int)merge_jobList.size());
107  } else {
108  sprintf(merge_job_list_str,"%d",(int)merge_jobList.size());
109  }
112  if(condor_jobList.size()>0 && merge_jobList.size()>0) {
113  if(simulation) {
114  sprintf(condor_job_list_str,"(%d*%d)", nfactor,(int)condor_jobList.size());
115  sprintf(percentage_job_list_str,"<font color=\"blue\">%2.1f%%</font>",
116  100.*merge_jobList.size()/(nfactor*condor_jobList.size()));
117  } else {
118  sprintf(condor_job_list_str,"%d", (int)condor_jobList.size());
119  sprintf(percentage_job_list_str,"<font color=\"blue\">%2.1f%%</font>",
120  100.*merge_jobList.size()/condor_jobList.size());
121  }
122  } else { // super run
123  sprintf(condor_job_list_str,"0");
124  sprintf(percentage_job_list_str,"<font color=\"blue\">%2.1f%%</font>",0.);
125  }
126 
127  // save configuration files to report directory
129  if(gSystem->Getenv("HOME_WAT")==NULL) {
130  cout << "Error : environment HOME_WAT is not defined!!!" << endl;exit(1);
131  } else {
132  home_wat=TString(gSystem->Getenv("HOME_WAT"));
133  }
135  if(gSystem->Getenv("CWB_NETC_FILE")==NULL) {
136  cout << "Error : environment CWB_NETC_FILE is not defined!!!" << endl;exit(1);
137  } else {
138  cwb_netc_file=TString(gSystem->Getenv("CWB_NETC_FILE"));
139  }
141  if(gSystem->Getenv("CWB_PARAMETERS_FILE")==NULL) {
142  cout << "Error : environment CWB_PARAMETERS_FILE is not defined!!!" << endl;exit(1);
143  } else {
144  cwb_parameters_file=TString(gSystem->Getenv("CWB_PARAMETERS_FILE"));
145  }
147  if(gSystem->Getenv("CWB_UPARAMETERS_FILE")==NULL) {
148  cout << "Error : environment CWB_UPARAMETERS_FILE is not defined!!!" << endl;exit(1);
149  } else {
150  cwb_uparameters_file=TString(gSystem->Getenv("CWB_UPARAMETERS_FILE"));
151  }
153  if(gSystem->Getenv("CWB_PPARAMETERS_FILE")==NULL) {
154  cout << "Error : environment CWB_PPARAMETERS_FILE is not defined!!!" << endl;exit(1);
155  } else {
156  cwb_pparameters_file=TString(gSystem->Getenv("CWB_PPARAMETERS_FILE"));
157  }
159  if(gSystem->Getenv("CWB_UPPARAMETERS_FILE")==NULL) {
160  cout << "Error : environment CWB_UPPARAMETERS_FILE is not defined!!!" << endl;exit(1);
161  } else {
162  cwb_upparameters_file=TString(gSystem->Getenv("CWB_UPPARAMETERS_FILE"));
163  }
164 
165  char cmd[1024];
166  char odir[1024];
167  sprintf(odir,"%s/%s",pp_dir,pp_data_dir); // output report directory
168 
169  // get production lib versions from merged root file
171  TFile* wfile = new TFile(merged_file_name);
172  if(wfile==NULL) {cout << "Error : file " << merged_file_name.Data() << " not found" << endl;exit(1);}
173  // read history object & build a string with the multistage git versions
174  CWB::History* hst = (CWB::History*)wfile->Get("history");
177  if(hst) {
178  TString log="";
179  TList* stageList = hst->GetStageNames(); // get stage list
180  TList* typeList = hst->GetTypeNames(); // get type list
181  bool hwat=false,hgit=false,hcfg_branch=false,hcfg_tag=false,hcfg_diff=false,hfrlib=false,hroot=false,hlal=false;
182  for(int j=0;j<typeList->GetSize();j++) { // check if history types are defined
183  TObjString* typeObjString = (TObjString*)typeList->At(j);
184  TString typeName = typeObjString->GetString();
185  if(typeName=="WATVERSION") hwat=true;
186  if(typeName=="GITVERSION") hgit=true;
187  if(typeName=="FRLIBVERSION") hfrlib=true;
188  if(typeName=="ROOTVERSION") hroot=true;
189  if(typeName=="LALVERSION") hlal=true;
190  if(typeName=="CWB_CONFIG_BRANCH") hcfg_branch=true;
191  if(typeName=="CWB_CONFIG_TAG") hcfg_tag=true;
192  if(typeName=="CWB_CONFIG_DIFF") hcfg_diff=true;
193  }
194  delete typeList;
195  for(int i=0;i<stageList->GetSize();i++) { // get lib versions
196  TObjString* stageObjString = (TObjString*)stageList->At(i);
197  TString stageName = stageObjString->GetString();
198  char* stage = const_cast<char*>(stageName.Data());
199  TString stageLabel = stageName; stageLabel.Resize(2); stageLabel+=TString("-");
200  log = hwat ? hst->GetHistory(stage,const_cast<char*>("WATVERSION")) : "";
201  if(log!="") pr_wat_ver += log+" ";
202  log = hgit ? hst->GetHistory(stage,const_cast<char*>("GITVERSION")) : "";
203  if(log!="") pr_wat_git += stageLabel+log+" ";
204  log = hfrlib ? hst->GetHistory(stage,const_cast<char*>("FRLIBVERSION")) : "";
205  if(log!="") pr_framelib_ver = log;
206  log = hroot ? hst->GetHistory(stage,const_cast<char*>("ROOTVERSION")) : "";
207  if(log!="") pr_root_ver = log;
208  log = hlal ? hst->GetHistory(stage,const_cast<char*>("LALVERSION")) : "";
209  if(log!="") pr_lal_ver = log;
210  log = hcfg_branch ? hst->GetHistory(stage,const_cast<char*>("CWB_CONFIG_BRANCH")) : "";
211  if(log!="") pr_cfg_ver = log;
212  log = hcfg_tag ? hst->GetHistory(stage,const_cast<char*>("CWB_CONFIG_TAG")) : "";
213  if(log!="") pr_cfg_ver = log;
214  log = hcfg_diff ? hst->GetHistory(stage,const_cast<char*>("CWB_CONFIG_DIFF")) : "";
215  if(log!="") pr_cfg_ver += "/"+log;
216  // get cuts parameters used in setCuts
217  if(stageName=="CUTS") merge_cuts=hst->GetHistory(stage,const_cast<char*>("PARAMETERS"));
218  }
219  if(pr_wat_ver=="") pr_wat_ver="n/a";
220  if(pr_wat_git=="") pr_wat_git="n/a";
221  if(pr_framelib_ver=="") pr_framelib_ver="n/a";
222  if(pr_root_ver=="") pr_root_ver="n/a";
223  if(pr_lal_ver=="") pr_lal_ver="n/a";
224  if(pr_cfg_ver=="") pr_cfg_ver="n/a";
225  delete stageList;
226  delete hst;
227  }
228  wfile->Close();
229 
230  if(pp_jet_benckmark && merge_jobList.size()>0) {
231  // Create jet_benchmark.png (estimation time plot)
232  char max_opt[64]="";
233  if(pp_jet_benckmark>0) sprintf(max_opt,"--max %d",pp_jet_benckmark);
234  sprintf(cmd,"export CWB_BENCH_OPTS=");
235  sprintf(cmd,"%s'--bench jet --plot hist %s --save %s/jet_benchmark.png';",cmd,max_opt,odir);
236  sprintf(cmd,"%s root -n -l -b ",cmd);
237  sprintf(cmd,"%s ${CWB_ROOTLOGON_FILE} ${CWB_PARAMETERS_FILE}",cmd);
238  sprintf(cmd,"%s ${CWB_UPARAMETERS_FILE} ${CWB_EPARAMETERS_FILE}",cmd);
239  sprintf(cmd,"%s ${CWB_MACROS}/cwb_condor_benchmark.C",cmd);
240  cout << cmd << endl;
241  gSystem->Exec(cmd);
242  }
243  if(pp_mem_benckmark && merge_jobList.size()>0) {
244  // Create mem_benchmark.png (maximum memory)
245  char max_opt[64]="";
246  if(pp_mem_benckmark>0) sprintf(max_opt,"--max %d",pp_mem_benckmark);
247  sprintf(cmd,"export CWB_BENCH_OPTS=");
248  sprintf(cmd,"%s'--bench mem --plot hist %s --save %s/mem_benchmark.png';",cmd,max_opt,odir);
249  sprintf(cmd,"%s root -n -l -b ",cmd);
250  sprintf(cmd,"%s ${CWB_ROOTLOGON_FILE} ${CWB_PARAMETERS_FILE}",cmd);
251  sprintf(cmd,"%s ${CWB_UPARAMETERS_FILE} ${CWB_EPARAMETERS_FILE}",cmd);
252  sprintf(cmd,"%s ${CWB_MACROS}/cwb_condor_benchmark.C",cmd);
253  cout << cmd << endl;
254  gSystem->Exec(cmd);
255  }
256 
257  // Create the job_status.html file
258  int max_jobs = 0;
259  for(int i=0;i<condor_jobList.size();i++) // find max job id in the condor dag list
260  if(condor_jobList[i]>max_jobs) max_jobs=condor_jobList[i];
261  if(max_jobs==0) max_jobs = merge_jobList.size(); // online mode
262  vector<int> jobStatus(max_jobs);
263  vector<TString> jobFile(max_jobs);
264  for (int i=0;i<max_jobs;i++) jobStatus[i]=-1; // excluded jobs tag =-1
265  for (int i=0;i<condor_jobList.size();i++) // jobs in the dag file tag = 0
266  jobStatus[condor_jobList[i]-1]=0;
267  for (int i=0;i<merge_jobList.size();i++) { // jobs in the merge file tag >=1
268  if(merge_jobList[i]>max_jobs) {
269  cout << "cwb_mkhtml_header.C - Error : number of jobs in merged list is > job in condor list" << endl;
270  gSystem->Exit(1);
271  }
272  jobStatus[merge_jobList[i]-1]+=1;
273  jobFile[merge_jobList[i]-1]=merge_jobFileList[i];
274  }
275  char jstatus_file[1024];sprintf(jstatus_file,"%s/job_status.html",odir);
276  ofstream out;
277  out.open(jstatus_file,ios::out); // create job_status.html
278  char oline[1024];
279  out << "<html>" << endl;
280  char jstatus[1024];
281  sprintf(jstatus,"<font color=\"black\">Job Status : </font>");
282  sprintf(jstatus,"%s<font color=\"red\">%s</font>",jstatus,merge_job_list_str);
283  sprintf(jstatus,"%s<font color=\"black\">/%s - </font>",jstatus,condor_job_list_str);
284  sprintf(jstatus,"%s<font color=\"blue\">%s</font>",jstatus,percentage_job_list_str);
285  out << "<font style=\"font-weight:bold;\"><center><p><h2>"
286  << jstatus << "</h2><p><center></font>" << endl;
287  if(((pp_jet_benckmark)||(pp_mem_benckmark)) && (merge_jobList.size()>0)) {
288  out << "<hr><br>" << endl;
289  out << "<table border=0 cellpadding=2 align=\"center\">" << endl;
290  out << "<tr align=\"center\">" << endl;
291  if(pp_jet_benckmark)
292  out << "<td><a href=\"jet_benchmark.png\"><img src=\"jet_benchmark.png\" width=450></a></td>" << endl;
293  if(pp_mem_benckmark)
294  out << "<td><a href=\"mem_benchmark.png\"><img src=\"mem_benchmark.png\" width=450></a></td>" << endl;
295  out << "</tr>" << endl;
296  out << "<tr align=\"center\">" << endl;
297  if(pp_jet_benckmark>0)
298  out << "<td>max time < " << pp_jet_benckmark << " hours </td>" << endl;
299  else
300  out << "<td>max hour = auto </td>" << endl;
301  if(pp_mem_benckmark>0)
302  out << "<td>max mem < " << pp_mem_benckmark << " MB </td>" << endl;
303  else
304  out << "<td>max mem = auto </td>" << endl;
305  out << "</tr>" << endl;
306  out << "</table>" << endl;
307  }
308  out << "<hr><br>" << endl;
309  //out << "<a>(<td><font color=\"blue\"> blue </font></td> : used in the report )</a>" << endl;
310  out << "<a><td><font color=\"black\"> List of unfinished jobs </font></td></a>" << endl;
311  out << "<br><br>" << endl;
312  out << "<table border=0 cellpadding=2 align=\"center\">" << endl;
313 /*
314  out << "<tr align=\"center\">" << endl;
315  out << "<td>jobID</td>" << endl;
316  if(simulation) out << "<td>factors</td>" << endl;
317  out << "<td>File Name</td>" << endl;
318  out << "</tr>" << endl;
319 */
320  if(pp_job_status) { // write job_status.html
321  for (int i=0;i<max_jobs;i++) {
322  if(jobStatus[i]==0) { // jobs not done
323  int ib=i; int ie=i;
324  // extract range of jobs in the same status
325  for(int j=ib;j<max_jobs;j++) if(jobStatus[j]==0) ie=j; else break;
326  i=ie;
327  out << "<tr align=\"center\">" << endl;
328  if(ib==ie)
329  sprintf(oline,"<td><font color=\"blue\">%d</font></td>",ib+1);
330  else
331  sprintf(oline,"<td><font color=\"blue\">%d:%d</font></td>",ib+1,ie+1);
332  out << oline << endl;
333  if(simulation) {
334  sprintf(oline,"<td></td>");
335  out << oline << endl;
336  }
337  sprintf(oline,"<td></td>");
338  out << oline << endl;
339  sprintf(oline,"<td align=\"left\"><font color=\"red\">%s</font></td>","unfinished/excluded");
340  out << oline << endl;
341  out << "</tr>" << endl;
342  }
343  if(simulation&&(jobStatus[i]>=1)&&(jobStatus[i]<nfactor)) { // sim jobs not completed
344  TString status = "unfinished";
345  out << "<tr align=\"center\">" << endl;
346  sprintf(oline,"<td><font color=\"black\">%d</font></td>",i+1);
347  out << oline << endl;
348  sprintf(oline,"<td><font color=\"red\">%d</font>/%d</td>",jobStatus[i],nfactor);
349  out << oline << endl;
350  TObjArray* token = jobFile[i].Tokenize(TString('_'));
351  TObjString* stoken =(TObjString*)token->At(token->GetEntries()-2);
352  jobFile[i].ReplaceAll("_"+stoken->GetString()+"_job","_*_job");
353  if(token) delete token;
354  sprintf(oline,"<td align=\"left\"><font color=\"blue\">%s</font></td>",jobFile[i].Data());
355  out << oline << endl;
356  sprintf(oline,"<td align=\"left\"><font color=\"red\">%s</font></td>",status.Data());
357  out << oline << endl;
358  out << "</tr>" << endl;
359  }
360  }
361  }
362  out << "</table>" << endl;
363  out << "</html>" << endl;
364  out.close();
365 
366  // convert user macro into html and copy to report dir
367  THtml html;
368  html.SetEtcDir(gSystem->ExpandPathName("$HOME_WAT/html/etc/html"));
369  html.SetProductName("CWB");
370  TString html_input_dir="$CWB_TOOLBOX:$CWB_GWAT:$CWB_HISTORY:$HOME_CWB";
371  html_input_dir+=":$CWB_STFT:$CWB_BICO:$HOME_WAT/wat:$ROOTSYS/include";
372  html_input_dir+=":"+TString(odir);
373  html.SetInputDir(html_input_dir.Data());
374 
375  sprintf(cmd,"cp %s/tools/config.csh %s/%s/config.csh",home_wat.Data(),pp_dir,pp_data_dir);
376  gSystem->Exec(cmd);
377 
378  // redirect stderr to /dev/null to getrid of messages produced by html.Convert
379  fpos_t pos;
380  fflush(stderr); fgetpos(stderr, &pos);
381  int fd = dup(fileno(stderr));
382  freopen("/dev/null", "w", stderr);
383 
384  char ftitle[1024];
385 
386  sprintf(ftitle,"<h2 class=\"convert\" align=\"center\"> %s </h2>","cwb_parameters.C");
387  html.Convert(cwb_parameters_file.Data(),ftitle,odir);
388  TString cwb_uparameters_path = TString(work_dir)+"/"+cwb_uparameters_file;
389  sprintf(ftitle,"<h2 class=\"convert\" align=\"center\"> %s </h2>","user_parameters.C");
390  html.Convert(cwb_uparameters_path.Data(),ftitle,odir);
391  sprintf(ftitle,"<h2 class=\"convert\" align=\"center\"> %s </h2>","cwb_pparameters.C");
392  html.Convert(cwb_pparameters_file.Data(),ftitle,odir);
393  TString cwb_upparameters_path = TString(work_dir)+"/"+cwb_upparameters_file;
394  sprintf(ftitle,"<h2 class=\"convert\" align=\"center\"> %s </h2>","user_pparameters.C");
395  html.Convert(cwb_upparameters_path.Data(),ftitle,odir);
396 
397  // restore the stderr output
398  fflush(stderr); dup2(fd, fileno(stderr)); close(fd);
399  clearerr(stderr); fsetpos(stderr, &pos);
400 
401  // create plugin html
402  gRandom->SetSeed(0);
403  int rnID = int(gRandom->Rndm(13)*1.e9);
404  UserGroup_t* _uinfo = gSystem->GetUserInfo();
405  TString _uname = _uinfo->fUser;
406  char tdir[1024];
407  sprintf(tdir,"/dev/shm/%s/%d",_uname.Data(),rnID);
408  gSystem->Exec(TString("mkdir -p ")+TString(tdir));
409 
410  if(TString(plugin.GetName()).Sizeof()>1) {
411  char pluginName[1024]="";
412  sprintf(pluginName,"%s/CWB_Plugin.C",tdir);
413  plugin.SaveSource(pluginName);
414  sprintf(ftitle,"<h2 class=\"convert\" align=\"center\"> %s </h2>","CWB_Plugin.C");
415  html.Convert(pluginName,ftitle,odir);
416  gSystem->Exec(TString("rm -f ")+TString(pluginName));
417  }
418  if(TString(configPlugin.GetName()).Sizeof()>1) {
419  char configPluginName[1024]="";
420  sprintf(configPluginName,"%s/CWB_configPlugin.C",tdir);
421  configPlugin.SaveSource(configPluginName);
422  sprintf(ftitle,"<h2 class=\"convert\" align=\"center\"> %s </h2>","CWB_configPlugin.C");
423  html.Convert(configPluginName,ftitle,odir);
424  gSystem->Exec(TString("rm -f ")+TString(configPluginName));
425  }
426 
427  ofstream hout;
428  char ofile[1024];
429  sprintf(ofile,"%s/header.html", pp_dir);
430  cout << "make header file : " << ofile << endl;
431  hout.open(ofile,ios::out);
432  if (!hout.good()) {cout << "Error Opening File : " << ofile << endl;exit(1);}
433 
434  TString Rho_LF,RhOut,RhAcor,svED,sPEN,sIFAR,sWIN,sHRSS,sHRSS_LF,sfLow,sfHigh,sfResample;
435  TString sdelta,sgamma,ssubnet,sbpp,snetRHO,snetCC;
436  TString sT_cor,sT_cut,sT_scc,spp_vetoes;
437  TString spp_irho,spp_inetcc;
438  TString ssimulation;
439 
440  char s[128];
441  sprintf(s,"%g",delta); sdelta=s;
442  sprintf(s,"%g",GAMMA());sgamma=s;
443  if (TString(analysis)=="2G")
444  {
445  sprintf(s,"%.2f",subnet);
446  ssubnet = s;
447  }
448  else ssubnet = "-";
449  //sprintf(s,"%.2f",subnet); ssubnet = TString(analysis)=="2G" ? s : "-";
450  sprintf(s,"%.6f",bpp); sbpp=s;
451  sprintf(s,"%.2f",netRHO); snetRHO=s;
452  sprintf(s,"%.2f",netCC); snetCC=s;
453  sprintf(s,"%.2f",T_cor); sT_cor=s;
454  sprintf(s,"%.2f",T_cut); sT_cut=s;
455  sprintf(s,"%.2f",T_out); RhOut=s;
456  sprintf(s,"%.2f",T_acor); RhAcor=s;
457  sprintf(s,"%.2f",T_vED); svED=s;
458  sprintf(s,"%.2f",T_scc); sT_scc=s;
459  sprintf(s,"%.2f",T_pen); sPEN=s;
460  sprintf(s,"%.2f",T_ifar); sIFAR=s;
461  sprintf(s,"%.2f",T_win); sWIN=s;
462  sprintf(s,"%.2f",fLow); sfLow=s;
463  sprintf(s,"%.2f",fHigh); sfHigh=s;
464  sprintf(s,"%d",pp_irho); spp_irho=s;
465  sprintf(s,"%d",pp_inetcc); spp_inetcc=s;
466  sprintf(s,"%d",simulation); ssimulation=s;
467 
468  // search type
469  char ssearch[32]="";
470  if(optim) sprintf(ssearch,"SRA(%c)",SEARCH());
471  else sprintf(ssearch,"MRA(%c)",SEARCH());
472  if(pattern==0) sprintf(ssearch,"%s:Packet(0)",ssearch);
473  if((pattern!=0 && pattern<0)) sprintf(ssearch,"%s:Packet(%d)",ssearch,pattern);
474  if((pattern!=0 && pattern>0)) sprintf(ssearch,"%s:Packet(+%d)",ssearch,pattern);
475 
476  // user frequencies band cuts
477  char pp_fbandcuts[1024]="";
478  for(int j=0;j<nFCUT;j++) {
479  sprintf(pp_fbandcuts,"%s [%3.1f:%3.1f]",pp_fbandcuts,lowFCUT[j],highFCUT[j]);
480  }
481 
482  // post production vetoes
483  spp_vetoes="";
484 #ifdef CAT2_VETO
485  spp_vetoes+="cat2 ";
486 #endif
487 #ifdef HVETO_VETO
488  spp_vetoes+="hveto ";
489 #endif
490 #ifdef CAT3_VETO
491  spp_vetoes+="cat3 ";
492 #endif
493 #ifdef PEM_VETO
494  spp_vetoes+="pem ";
495 #endif
496 
497  // data rate after resample
498  double sRate = fResample>0 ? fResample>>levelR : inRate>>levelR;
499  sprintf(s,"%.2f",sRate); sfResample=s;
500 
501  // compute sky resolution (deg^2)
502  char sSkyMapRes[64];
503  if(healpix) { // healpix sky fragmentation
504  int npix = 12*pow(4,healpix);
505  double sphere_solid_angle = 4*TMath::Pi()*pow(180/TMath::Pi(),2);
506  double skyres = sphere_solid_angle/npix;
507  sprintf(sSkyMapRes,"healpix - order = %d - skyres = %2.3f (deg^2)",(int)healpix,skyres);
508  } else { // cwb built in sky fragmentation
509  double skyres = angle*angle;
510  sprintf(sSkyMapRes,"built-in - skyres = %2.3f (deg^2)",angle*angle);
511  }
512 
513  char sTFres[128]="";
514  for(int n=l_high;n>=l_low;n--)
515  sprintf(sTFres,"%s %gx(1/%g)",sTFres,(sRate/2)/TMath::Power(2,n),sRate/TMath::Power(2,n));
516 
517  ifstream in;
518  in.open(html_header_template,ios::in);
519  if (!in.good()) {cout << "Error Opening File : " << html_header_template << endl;exit(1);}
520 
521  char pp_framelib_ver[32]; sprintf(pp_framelib_ver,"%f",FRAMELIB_VERSION);
522  const char *pp_root_ver = gROOT->GetVersion();
523  CWB::mdc MDC;
524 
525  TString pp_cfg_ver = GetGitInfos("branch","$CWB_CONFIG");
526  pp_cfg_ver += GetGitInfos("tag","$CWB_CONFIG");
527  if(GetGitInfos("diff","$CWB_CONFIG")!="") pp_cfg_ver += "/M";
528 
529  char istring[1024];
530  while (1) {
531  in.getline(istring,1024);
532  if (!in.good()) break;
533  TString ostring(istring);
534  ostring.ReplaceAll("FLOW",sfLow);
535  ostring.ReplaceAll("FHIGH",sfHigh);
536  ostring.ReplaceAll("SKYMAPRES",sSkyMapRes);
537  ostring.ReplaceAll("TFRES",sTFres);
538  ostring.ReplaceAll("FRESAMPLE",sfResample);
539  ostring.ReplaceAll("RUN_LABEL",RunLabel);
540  ostring.ReplaceAll("ST_COR",sT_cor);
541  ostring.ReplaceAll("RHO_LF",Rho_LF);
542  ostring.ReplaceAll("ST_CUT",sT_cut);
543  ostring.ReplaceAll("RH_OUT",RhOut);
544  ostring.ReplaceAll("RH_ACOR",RhAcor);
545  ostring.ReplaceAll("svED",svED);
546  ostring.ReplaceAll("ST_SCC",sT_scc);
547  ostring.ReplaceAll("sPEN",sPEN);
548  ostring.ReplaceAll("sIFAR",sIFAR);
549  ostring.ReplaceAll("sWIN",sWIN);
550  ostring.ReplaceAll("sHRSS_LF",sHRSS_LF);
551  ostring.ReplaceAll("sHRSS",sHRSS);
552  ostring.ReplaceAll("sPP_VETOES",spp_vetoes);
553 // ostring.ReplaceAll("SUBTITLE",subtitle);
554  ostring.ReplaceAll("BUILD_DATE",wat::Time("now").GetDateString());
555  ostring.ReplaceAll("PR_WAT_VER",pr_wat_ver);
556  ostring.ReplaceAll("PR_WAT_GIT",pr_wat_git);
557  ostring.ReplaceAll("PR_ROOT_VER",pr_root_ver);
558  ostring.ReplaceAll("PR_FRAMELIB_VER",pr_framelib_ver);
559  ostring.ReplaceAll("PR_LAL_VER",pr_lal_ver);
560  ostring.ReplaceAll("PP_WAT_VER",watversion('s'));
561  ostring.ReplaceAll("PP_WAT_GIT",watversion('r'));
562  ostring.ReplaceAll("PP_ROOT_VER",pp_root_ver);
563  ostring.ReplaceAll("PP_FRAMELIB_VER",pp_framelib_ver);
564  ostring.ReplaceAll("PR_CFG_VER",pr_cfg_ver);
565  ostring.ReplaceAll("PP_CFG_VER",pp_cfg_ver);
566  if(GetLALVersion()!="") {
567  ostring.ReplaceAll("PP_LAL_VER",GetLALVersion());
568  } else {
569  ostring.ReplaceAll("PP_LAL_VER","");
570  }
571  ostring.ReplaceAll("PIPELINE",analysis);
572  ostring.ReplaceAll("SEARCH",ssearch);
573  ostring.ReplaceAll("SIMULATION",ssimulation);
574  ostring.ReplaceAll("DELTA",sdelta);
575  ostring.ReplaceAll("GAMMA",sgamma);
576  ostring.ReplaceAll("SUBNET",ssubnet);
577  ostring.ReplaceAll("BPP",sbpp);
578  ostring.ReplaceAll("PP_IRHO",spp_irho);
579  ostring.ReplaceAll("PP_INETCC",spp_inetcc);
580  ostring.ReplaceAll("NETRHO",snetRHO);
581  ostring.ReplaceAll("NETCC",snetCC);
582  ostring.ReplaceAll("PP_FREQ_BAND_CUTS",pp_fbandcuts);
583  ostring.ReplaceAll("MERGE_CUTS",merge_cuts);
584  ostring.ReplaceAll("TITLE",title);
585  ostring.ReplaceAll("SITE_CLUSTER",site_cluster);
586  ostring.ReplaceAll("WORK_DIR",work_dir);
587  ostring.ReplaceAll("PP_DATA_DIR",pp_data_dir);
588  ostring.ReplaceAll("JOB_MERGE",merge_job_list_str);
589  ostring.ReplaceAll("JOB_CONDOR",condor_job_list_str);
590  ostring.ReplaceAll("JOB_PERCENTAGE",percentage_job_list_str);
591  if (T_scc>0) {
592  ostring.ReplaceAll("<!--CUT_SCC","");
593  ostring.ReplaceAll("CUT_SCC-->","");
594  }
595  if (T_pen>0) {
596  ostring.ReplaceAll("<!--CUT_PEN","");
597  ostring.ReplaceAll("CUT_PEN-->","");
598  }
599  if (T_ifar>0) {
600  ostring.ReplaceAll("<!--CUT_IFAR","");
601  ostring.ReplaceAll("CUT_IFAR-->","");
602  }
603  if(simulation) {
604  ostring.ReplaceAll("<!--CUT_WIN","");
605  ostring.ReplaceAll("CUT_WIN-->","");
606  }
607  ostring.ReplaceAll("</html>","");
608  if (T_vED>0) {
609  ostring.ReplaceAll("<!--CUT_NED","");
610  ostring.ReplaceAll("CUT_NED-->","");
611  }
612  if (spp_vetoes!="") {
613  ostring.ReplaceAll("<!--CUT_PP_VETOES","");
614  ostring.ReplaceAll("CUT_PP_VETOES-->","");
615  }
616  if(TString(plugin.GetName()).Sizeof()>1) {
617  ostring.ReplaceAll("<!--CWB_PLUGIN","");
618  ostring.ReplaceAll("CWB_PLUGIN-->","");
619  }
620  if(TString(configPlugin.GetName()).Sizeof()>1) {
621  ostring.ReplaceAll("<!--CWB_CONF_PLUGIN","");
622  ostring.ReplaceAll("CWB_CONF_PLUGIN-->","");
623  }
624  if (TString(analysis)=="1G") {
625  ostring.ReplaceAll("<!--CWB1G_PARAMETERS","");
626  ostring.ReplaceAll("CWB1G_PARAMETERS-->","");
627  } else {
628  ostring.ReplaceAll("<!--CWB2G_PARAMETERS","");
629  ostring.ReplaceAll("CWB2G_PARAMETERS-->","");
630  }
631  if(cwb_doc_url!="") {
632  ostring.ReplaceAll("<!--CWB_DOC_URL","");
633  ostring.ReplaceAll("CWB_DOC_URL-->","");
634  ostring.ReplaceAll("XCWB_DOC_URL",cwb_doc_url.Data());
635  }
636  ostring.ReplaceAll("</html>","");
637  hout << ostring.Data() << endl;
638  }
639  in.close();
640  hout.close();
641 
642  exit(0);
643 }
char ofile[1024]
TString cwb_upparameters_file
TString GetLALVersion(TString options="")
Definition: Toolfun.hh:1004
TString GetGitInfos(TString option="path", TString igit_path="$CWB_CONFIG")
Definition: Toolfun.hh:345
double sRate
Definition: TestFrame5.C:14
double T_ifar
TString pr_wat_ver
TString home_wat
char condor_job_list_str[64]
vector< int > condor_jobList
char merge_job_list_str[64]
char cmd[1024]
double T_pen
CWB::History * hst
double fHigh
double delta
char percentage_job_list_str[64]
char condor_dag_file[1024]
int iversion
TString pr_framelib_ver
TString pr_root_ver
int n
Definition: cwb_net.C:28
TString full_parameters_file
double angle
char * watversion(char c='s')
Definition: watversion.hh:21
TString("c")
double T_cor
char RunLabel[1024]
double bpp
Definition: test_config1.C:22
bool optim
char odir[1024]
char full_condor_dir[1024]
Long_t flags
CWB::mdc * MDC
i pp_inetcc
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
Long_t size
int j
Definition: cwb_net.C:28
i drho i
int l_low
Definition: test_config1.C:40
TString cwb_netc_file
static bool checkFile(TString fName, bool question=false, TString message="")
Definition: Toolbox.cc:4670
bool pp_job_status
static vector< int > getMergeJobList(TString merge_dir, TString label, int version)
Definition: Toolbox.cc:1698
double netCC
Definition: test_config1.C:33
double fResample
Definition: test_config1.C:27
char data_label[512]
Definition: test_config1.C:160
double T_acor
TFile * wfile
TString cwb_pparameters_file
Definition: mdc.hh:248
int pp_jet_benckmark
int pattern
i() int(T_cor *100))
double Pi
char oline[1024]
bool log
Definition: WaveMDC.C:41
vector< int > merge_jobList
char merge_dir[512]
Definition: test_config1.C:147
ofstream out
TString merge_label
TList * GetStageNames()
Definition: History.cc:427
sprintf(html_footer,"%s/html/etc/html/footer.html", gSystem->Getenv("HOME_WAT"))
TList * GetTypeNames()
Definition: History.cc:440
char net_file_name[256]
char jstatus_file[1024]
TString pr_lal_ver
TString GetString(TTree *tree, int run, int lag, TString psfix)
Definition: Toolfun.hh:283
int npix
TString pr_cfg_ver
char sim_file_name[1024]
int pp_mem_benckmark
s s
Definition: cwb_net.C:155
char html_header_template[1024]
TString cwb_parameters_file
char title[256]
Definition: SSeriesExample.C:1
char html_footer[1024]
static vector< int > getCondorJobList(TString condor_dir, TString label)
Definition: Toolbox.cc:1398
ifstream in
double fLow
double T_win
TString merged_file_name
char pp_dir[512]
Definition: test_config1.C:155
TString site_cluster
double highFCUT[100]
char pp_data_dir[1024]
int estat
TString cwb_doc_url
strcpy(RunLabel, RUN_LABEL)
int nfactor
Definition: test_config1.C:83
double netRHO
Definition: test_config1.C:32
TObjArray * token
Long_t mt
TMacro plugin
double T_cut
TString cwb_uparameters_file
int l_high
Definition: test_config1.C:41
vector< TString > merge_jobFileList
Long_t id
char condor_dir[512]
Definition: test_config1.C:148
char work_dir[512]
Definition: test_config1.C:143
TMacro configPlugin
double T_out
in close()
int levelR
Definition: test_config1.C:37
char ilstfname[1024]
double T_scc
TString merge_cuts
char * GetHistory(char *StageName, char *Type)
Definition: History.cc:273
TString pr_wat_git
double T_vED
simulation
Definition: cwb_eced.C:26
int max_jobs
cwb_merge_label
i drho pp_irho
#define SEARCH(TYPE)
Definition: xroot.hh:4
double lowFCUT[100]
int * jobStatus
exit(0)
#define GAMMA(TYPE)
Definition: xroot.hh:5
size_t healpix