Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cwb_mkhtml_index.C
Go to the documentation of this file.
1 {
2 
3  CWB::Toolbox::checkFile(gSystem->Getenv("CWB_ROOTLOGON_FILE"));
4  CWB::Toolbox::checkFile(gSystem->Getenv("CWB_PARAMETERS_FILE"));
5  CWB::Toolbox::checkFile(gSystem->Getenv("CWB_UPARAMETERS_FILE"));
6  CWB::Toolbox::checkFile(gSystem->Getenv("CWB_PPARAMETERS_FILE"));
7  CWB::Toolbox::checkFile(gSystem->Getenv("CWB_UPPARAMETERS_FILE"));
8  CWB::Toolbox::checkFile(gSystem->Getenv("CWB_EPPARAMETERS_FILE"));
9 
10  // get user defined html index file name (used by cwb_mkrep command)
13  if(gSystem->Getenv("CWB_MKREP_INDEX_FILE")!=NULL) {
14  cwb_mkrep_index_file=TString(gSystem->Getenv("CWB_MKREP_INDEX_FILE"));
15  if(!cwb_mkrep_index_file.EndsWith(".html")) {
16  cout<<"cwb_mkhtml_index.C : Error : the index html must have the .html extension"<<endl;
17  exit(1);
18  }
19  // get and create dir name contained in cwb_mkrep_index_file path
20  cwb_mkrep_index_dir = cwb_mkrep_index_file;
21  cwb_mkrep_index_dir = cwb_mkrep_index_dir.ReplaceAll(gSystem->BaseName(cwb_mkrep_index_dir),"");
22  char cmd[1024];
23  sprintf(cmd,"mkdir -p %s",cwb_mkrep_index_dir.Data());
24  cout << cmd << endl;
25  gSystem->Exec(cmd);
26  } else {
27  cwb_mkrep_index_file="";
28  }
29 
30  // If fad is enable & simulation==4 then execute cwb_mkfad.C macro
31  if(pp_fad!="" && simulation==4) {
32  gROOT->LoadMacro("$HOME_WAT/tools/cwb/macros/cwb_mkfad.C");
33  // get loud parameter from pp_fad
35  if(pp_fad_nzbins=="") pp_fad_nzbins="0";
36  int ipp_fad_nzbins = pp_fad_nzbins.Atoi();
37  // execute cwb_mkfad.C macro
38  cwb_mkfad("fad",ipp_fad_nzbins,0,false);
39  // add FAD report to the main report
40  for(int i=0;i<pp_sreport.size();i++) {
41  if(pp_sreport[i]=="") {pp_sreport[i]="--link fad --label FAD --name fad.html --high 4800";break;}
42  }
43  }
44 
45  // check if there are auxiliary reports to be added to the main report
47  for(int i=0;i<pp_sreport.size();i++) if(pp_sreport[i]!="") pp_sreport_size++;
48  if((pp_sreport_size>0)&&(simulation>=0)) {
49  vector<TString> pp_sreport_tmp = pp_sreport;
50  for(int i=0;i<pp_sreport.size();i++) pp_sreport[i]="";
51  pp_sreport[0]=TString("--label ")+data_label;
52  pp_sreport_size=1;
53  for(int i=0;i<pp_sreport_tmp.size();i++) if(pp_sreport_tmp[i]!="") {
54  pp_sreport[pp_sreport_size]=pp_sreport_tmp[i];
55  pp_sreport_size++;
56  }
57  }
58 
59  // open output index file
60  ofstream out;
61  char ofile[256];
62  if(cwb_mkrep_index_file!="") {
63  sprintf(ofile,"%s", cwb_mkrep_index_file.Data());
64  } else {
65  sprintf(ofile,"%s/index.html", pp_dir);
66  }
67  cout << "make index html file : " << ofile << endl;
68  out.open(ofile,ios::out);
69  if (!out.good()) {cout << "cwb_mkhtml_index.C : Error Opening File : " << ofile << endl;exit(1);}
70 
71  // open input index template file
72  ifstream in;
74  if (!in.good()) {
75  cout << "cwb_mkhtml_index.C : Error Opening File : " << html_index_template << endl;
76  exit(1);
77  }
78 
79  char sbody_height[256];
80  if(simulation==0) {
81  sprintf(sbody_height,"%d",2350+26*pp_max_nloudest_list);
82  } else {
83  if(TString(gSystem->Getenv("CWB_REPORT_PE"))!="") {
84  sprintf(sbody_height,"%d",5000);
85  } else {
86  sprintf(sbody_height,"%d",5800);
87  }
88  }
89 
90  char istring[1024];
91  while (1) {
92  in.getline(istring,1024);
93  if (!in.good()) break;
94  TString ostring(istring);
95  out << ostring.Data() << endl;
96  }
97 
98  out << "<html>" << endl;
99  out << "<br>" << endl;
100 
101  if(pp_sreport_size==0) {
102 
103  out << " <iframe src=\"header.html\" width=\"100%\" height=\"970px\" "
104  << "marginwidth=\"15\" marginheight=\"15\" frameborder=\"0\"></iframe>" << endl;
105 
106  if(TString(gSystem->Getenv("CWB_REPORT_PE"))!="") {
107 
108  out << "<div class=\"tabber\">" << endl;
109 
110  out << "<div class=\"tabbertab\">" << endl;
111  out << " <h2>Sky Localization</h2>" << endl;
112  out << " <iframe src=\"prc_body.html\" width=\"100%\" "
113  << " height=\"" << sbody_height << "px\" frameborder=\"0\"></iframe>" << endl;
114  out << "</div>" << endl;
115 
116  out << "<div class=\"tabbertab\">" << endl;
117  out << " <h2>Waveform</h2>" << endl;
118  out << " <iframe src=\"wrc_body.html\" width=\"100%\" "
119  << " height=\"" << sbody_height << "px\" frameborder=\"0\"></iframe>" << endl;
120  out << "</div>" << endl;
121 
122  out << "<div class=\"tabbertab\">" << endl;
123  out << " <h2>Chirp Mass</h2>" << endl;
124  out << " <iframe src=\"mchirp_body.html\" width=\"100%\" "
125  << " height=\"" << sbody_height << "px\" frameborder=\"0\"></iframe>" << endl;
126  out << "</div>" << endl;
127 
128  out << "</div>" << endl;
129 
130  } else {
131  out << " <iframe src=\"body.html\" width=\"100%\" "
132  << " height=\"" << sbody_height << "px\" frameborder=\"0\"></iframe>" << endl;
133  }
134  } else {
135 
136  sprintf(sbody_height,"%d",5800);
137  out << "<div class=\"tabber\">" << endl;
138  for(int i=0;i<pp_sreport.size();i++) if(pp_sreport[i]!="") {
139 
140  TString pp_sreport_link = CWB::Toolbox::getParameter(pp_sreport[i],"--link");
141  if(pp_sreport_link=="" && i!=0) {
142  cout<<"cwb_mkhtml_index.C : Error : pp_sreport --link not defined"<<endl;exit(1);}
143  if((i!=0)||(simulation<0)) {
144  if(!pp_sreport_link.EndsWith("/")) pp_sreport_link=pp_sreport_link+"/";
145  }
146 
147  TString pp_sreport_label = CWB::Toolbox::getParameter(pp_sreport[i],"--label");
148  if((pp_sreport_link!="</tab>/")&&(pp_sreport_label=="")) {
149  cout<<"cwb_mkhtml_index.C : Error : pp_sreport --label not defined"<<endl;exit(1);}
150 
151  TString pp_sreport_high = CWB::Toolbox::getParameter(pp_sreport[i],"--high");
152  if(pp_sreport_high=="") pp_sreport_high=sbody_height;
153  int ipp_sreport_high = pp_sreport_high.Atoi();
154 
155  TString pp_sreport_name = CWB::Toolbox::getParameter(pp_sreport[i],"--name");
156 
157  if(pp_sreport_link=="<tab>/") { // open a sub tab
158  out << "<div class=\"tabbertab\">" << endl;
159  out << " <h2>" << pp_sreport_label << "</h2>" << endl;
160  out << "<div class=\"tabber\">" << endl;
161  } else if(pp_sreport_link=="</tab>/") { // close sub tab
162  out << "</div>" << endl;
163  out << "</div>" << endl;
164  } else { // add a tab
165  out << "<div class=\"tabbertab\">" << endl;
166  out << " <h2>" << pp_sreport_label << "</h2>" << endl;
167 
168  if(pp_sreport_name=="") {
169  out << " <iframe src=\"" << pp_sreport_link << "header.html\" width=\"100%\" height=\"900px\" "
170  << "marginwidth=\"15\" marginheight=\"15\" frameborder=\"0\"></iframe>" << endl;
171 
172  out << " <iframe src=\"" << pp_sreport_link << "body.html\" width=\"100%\" "
173  << " height=\"" << ipp_sreport_high << "px\" frameborder=\"0\"></iframe>" << endl;
174  } else {
175  out << " <iframe src=\"" << pp_sreport_link << pp_sreport_name << "\" width=\"100%\" "
176  << " height=\"" << ipp_sreport_high << "px\" frameborder=\"0\"></iframe>" << endl;
177  }
178 
179  out << "</div>" << endl;
180  }
181  }
182  out << "</div>" << endl;
183  }
184 
185  out << "</html>" << endl;
186 
187  in.close();
188  out.close();
189 
190  // copy javascripts & Cascading Style Sheets to report the directory
191  TString odir = (cwb_mkrep_index_file!="") ? cwb_mkrep_index_dir : pp_dir;
192  char cmd[1024];
193  sprintf(cmd,"cp %s/html/etc/html/ROOT.css %s/",gSystem->ExpandPathName("$HOME_WAT"),odir.Data());
194  gSystem->Exec(cmd);
195  sprintf(cmd,"cp %s/html/etc/html/ROOT.js %s/",gSystem->ExpandPathName("$HOME_WAT"),odir.Data());
196  gSystem->Exec(cmd);
197  sprintf(cmd,"cp %s/html/etc/html/tabber.css %s/",gSystem->ExpandPathName("$HOME_WAT"),odir.Data());
198  gSystem->Exec(cmd);
199  sprintf(cmd,"cp %s/html/etc/html/tabber.js %s/",gSystem->ExpandPathName("$HOME_WAT"),odir.Data());
200  gSystem->Exec(cmd);
201 
202  exit(0);
203 }
char cmd[1024]
TString("c")
char odir[1024]
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
ofstream out
i drho i
static bool checkFile(TString fName, bool question=false, TString message="")
Definition: Toolbox.cc:3956
char data_label[512]
Definition: test_config1.C:160
char html_index_template[1024]
vector< TString > pp_sreport
int pp_sreport_size
static TString getParameter(TString options, TString param="")
Definition: Toolbox.cc:5943
ifstream in
TString cwb_mkrep_index_file
TString cwb_mkrep_index_dir
char pp_dir[512]
Definition: test_config1.C:155
char ofile[256]
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
int pp_max_nloudest_list
TString pp_fad_nzbins
Definition: cwb_mkfad.C:88
void cwb_mkfad(TString odir="fad", int nzbins=-1, double obstime=0, bool bexit=true)
Definition: cwb_mkfad.C:108
simulation
Definition: cwb_eced.C:9
exit(0)