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