Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cwb_mkhtml_cbc.C
Go to the documentation of this file.
1 
2 //#define WIDTH 496
3 //#define HEIGHT 440
4 //#define DIM "width=\"496\" height=\"440\""
5 //#define SHBOX "rel=\"shadowbox[gallery]"
6 
7 {
8 // #include "wat.hh"
9 #ifdef REDSHIFT
10  bool Redshift = 1;
11 #endif
12 
14 
15  TB.checkFile(gSystem->Getenv("CWB_ROOTLOGON_FILE"));
16  TB.checkFile(gSystem->Getenv("CWB_PARAMETERS_FILE"));
17  TB.checkFile(gSystem->Getenv("CWB_UPARAMETERS_FILE"));
18  TB.checkFile(gSystem->Getenv("CWB_PPARAMETERS_FILE"));
19  TB.checkFile(gSystem->Getenv("CWB_UPPARAMETERS_FILE"));
20  TB.checkFile(gSystem->Getenv("CWB_EPPARAMETERS_FILE"));
21 
22  bool singleDetector = false;
23  if (nIFO == 1) { // Single Detector Mode
25  config.Import();
26  config.SetSingleDetectorMode();
27  config.Export();
28  singleDetector = true;
29  }
30 
31  // if CWB_DOC_URL is define then man infos are added to web pages
33  if (gSystem->Getenv("CWB_DOC_URL") != NULL) {
34  cwb_doc_url = TString(gSystem->Getenv("CWB_DOC_URL"));
35  }
36 
37  sprintf(netdir, "%s/%s", pp_dir, pp_data_dir);
39  sprintf(netdir, "%s", pp_data_dir);
42  // char file[2048];
43 
44  network *net = NULL;
46  strcpy(cfg->tmp_dir, "tmp");
47  int gIFACTOR = 1;
48  gROOT->Macro(configPlugin.GetTitle());
49  /*
50  network* net=NULL;
51 
52 
53  CWB::config* cfg = new CWB::config;
54  strcpy(cfg->tmp_dir,"tmp");
55  // load MDC setup (define MDC set)
56 
57  gROOT->Macro(configPlugin.GetTitle());
58  TString Insp = MDC.GetInspiral();
59  int GpsStartTime = 0;
60  int GpsEndTime = 0;
61  TString waveform;
62 
63 
64  if(MDC.GetInspiralOption("--gps-start-time")!=""){GpsStartTime =
65  (int)MDC.GetInspiralOption("--gps-start-time").Atoi();}
66  if(MDC.GetInspiralOption("--gps-end-time")!=""){GpsEndTime =
67  (int)MDC.GetInspiralOption("--gps-end-time").Atoi();}
68  if(MDC.GetInspiralOption("--waveform")!=""){waveform =
69  MDC.GetInspiralOption("--waveform");}
70 
71  */
72  // convert eps plots to gif plots
73  vector<TString> epsList = TB.getFileListFromDir(PP_DATA_PATH, ".eps");
74  for (int i = 0; i < epsList.size(); i++) {
75  TString oFile = epsList[i];
76  oFile.ReplaceAll(".eps", ".png");
77  char cmd[2048];
78  sprintf(cmd, "convert %s -resize 996x774 %s", epsList[i].Data(),
79  oFile.Data());
80  // sprintf(cmd,"convert -density 664x516 %s -resize 664x516
81  // %s",epsList[i].Data(),oFile.Data());
82  // sprintf(cmd,"convert %s
83  //%s",epsList[i].Data(),oFile.Data());
84  cout << cmd << endl;
85  gSystem->Exec(cmd);
86  cout << "Removing eps files...." << endl;
87  sprintf(cmd, "rm %s", epsList[i].Data());
88  cout << cmd << endl;
89  gSystem->Exec(cmd);
90  }
91 
92  // create body.html file
93 
94  ofstream out;
95  char fileout[1024];
96  sprintf(fileout, "%s/body.html", pp_dir);
97  cout << fileout << endl;
98  out.open(fileout, ios::out);
99  if (!out.good()) {
100  cout << "Error Opening File : " << fileout << endl;
101  exit(1);
102  }
104  if (gSystem->Getenv("HOME_WAT") == NULL) {
105  cout << "Error : environment HOME_WAT is not defined!!!"
106  << endl;
107  exit(1);
108  } else {
109  home_wat = TString(gSystem->Getenv("HOME_WAT"));
110  }
111  char html_body_cbc_template[1024];
112 
113 #if defined(BKG_NTUPLE) || defined(LIVE_ZERO)
114  // sprintf(html_body_cbc_template,"%s/tools/cwb/postproduction/cbc/html_body_cbc_template.txt",home_wat.Data());
115  sprintf(html_body_cbc_template,
116  "%s/tools/cwb/postproduction/cbc/html_body_cbc_template.txt",
117  home_wat.Data());
118  cout << "BKG template!" << endl;
119 #else
120  sprintf(
121  html_body_cbc_template,
122  "%s/tools/cwb/postproduction/cbc/html_body_cbc_template_nobkg.txt",
123  home_wat.Data());
124 #endif
125 
126  TB.checkFile(html_body_cbc_template);
127 
128  ifstream bkgin;
129  bkgin.open(html_body_cbc_template, ios::in);
130  if (!bkgin.good()) {
131  cout << "Error Opening File : " << html_body_cbc_template
132  << endl;
133  exit(1);
134  }
135 
136  char exec[1024];
137 
138 #ifdef MINCHI
139  bool min_chi = true;
140 #else
141  bool min_chi = false;
142 #endif
143 
144  char istring[1024];
145  while (1) {
146  bkgin.getline(istring, 256);
147  if (!bkgin.good())
148  break;
149  TString ostringa(istring);
150  if (min_chi) {
151  ostringa.ReplaceAll("<!--MINCHI", "");
152  ostringa.ReplaceAll("MINCHI-->", "");
153  } else {
154  ostringa.ReplaceAll("<!--NO_MINCHI", "");
155  ostringa.ReplaceAll("NO_MINCHI-->", "");
156  }
157  ostringa.ReplaceAll("PP_DATA_DIR", PP_DATA_DIR);
158  ostringa.ReplaceAll("PLOT_LIST", pp_data_dir);
159  ostringa.ReplaceAll("</html>", "");
160  out << ostringa.Data() << endl;
161  }
162  bkgin.close();
163  out.close();
164 
165 // SORTING of ascii files
166 #ifdef WRITE_ASCII
167  char file_notsorted[1024];
168  sprintf(file_notsorted, "%s/recovered_signals.txt",
169  PP_DATA_PATH.Data());
170  char file_sorted[1024];
171  sprintf(file_sorted, "%s/recovered_signals_GPSsorted.txt",
172  PP_DATA_PATH.Data());
173  sprintf(exec, "sort -g --key=1 %s > %s", file_notsorted, file_sorted);
174  gSystem->Exec(exec);
175  sprintf(file_notsorted, "%s/injected_signals.txt", PP_DATA_PATH.Data());
176  sprintf(file_sorted, "%s/injected_signals_GPSsorted.txt",
177  PP_DATA_PATH.Data());
178  sprintf(exec, "sort -g --key=1 %s > %s", file_notsorted, file_sorted);
179  gSystem->Exec(exec);
180 
181  TString xml;
182  for (int i = 1; i < nfactor + 1; i++) {
183  if (Redshift) {
184  xml = XML[i - 1];
185  xml.ReplaceAll(".xml", ".found.txt");
186  sprintf(file_notsorted, "%s/%s", PP_DATA_PATH.Data(),
187  xml.Data());
188  xml.ReplaceAll(".found.txt", "_sorted.found.txt");
189  sprintf(file_sorted, "%s/%s", PP_DATA_PATH.Data(),
190  xml.Data());
191 
192  } else {
193  sprintf(file_notsorted, "%s/recovered_signals_%d.txt",
194  PP_DATA_PATH.Data(), i);
195  sprintf(file_sorted,
196  "%s/recovered_signals_%d_GPSsorted.txt",
197  PP_DATA_PATH.Data(), i);
198  }
199  sprintf(exec, "sort -g --key=1 %s > %s", file_notsorted,
200  file_sorted);
201  gSystem->Exec(exec);
202  if (Redshift) {
203  xml = XML[i - 1];
204  xml.ReplaceAll(".xml", ".inj.txt");
205  sprintf(file_notsorted, "%s/%s", PP_DATA_PATH.Data(),
206  xml.Data());
207  xml.ReplaceAll(".inj.txt", "_sorted.inj.txt");
208  sprintf(file_sorted, "%s/%s", PP_DATA_PATH.Data(),
209  xml.Data());
210 
211  } else {
212  sprintf(file_notsorted, "%s/injected_signals_%d.txt",
213  PP_DATA_PATH.Data(), i);
214  sprintf(file_sorted,
215  "%s/injected_signals_%d_GPSsorted.txt",
216  PP_DATA_PATH.Data(), i);
217  }
218  sprintf(exec, "sort -g --key=1 %s > %s", file_notsorted,
219  file_sorted);
220  gSystem->Exec(exec);
221  }
222 #endif
223  exit(0);
224 }
225 
226 //#define NEPS 28
227 //#define NEPS2 19
TString home_wat
static vector< TString > getFileListFromDir(TString dir_name, TString endString="", TString beginString="", TString containString="", bool fast=false)
Definition: Toolbox.cc:4333
void Export(TString fname="")
Definition: config.cc:388
TString PP_DATA_PATH
TString cwb_doc_url
char cmd[1024]
TString("c")
ofstream out
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
i drho i
void Import(TString umacro="")
Definition: config.cc:334
static bool checkFile(TString fName, bool question=false, TString message="")
Definition: Toolbox.cc:3956
CWB::Toolbox TB
Definition: ComputeSNR.C:5
CWB::config * cfg
#define nIFO
char netdir[1024]
char tmp_dir[1024]
Definition: config.hh:307
strcpy(cfg->tmp_dir,"tmp")
network * net
sprintf(netdir,"%s/%s", pp_dir, pp_data_dir)
TString HTML_DATA_DIR
bool singleDetector
ifstream in
bool Redshift
char pp_dir[512]
Definition: test_config1.C:155
int gIFACTOR
char pp_data_dir[1024]
TString PP_DATA_DIR
nfactor[0]
Definition: cwb_eced.C:10
vector< TString > epsList
TMacro configPlugin
char fileout[1024]
TString config
void SetSingleDetectorMode()
Definition: config.cc:1334
exit(0)