26 TB.
checkFile(gSystem->Getenv(
"CWB_ROOTLOGON_FILE"));
27 TB.
checkFile(gSystem->Getenv(
"CWB_PARAMETERS_FILE"));
28 TB.
checkFile(gSystem->Getenv(
"CWB_UPARAMETERS_FILE"));
31 if(gSystem->Getenv(
"HOME_SKYMAP_LIB")==NULL) {
32 cout <<
"cwb_report_skymap.C - Error : environment HOME_SKYMAP_LIB is not defined!!!" << endl;
exit(1);
34 home_skymap_lib=
TString(gSystem->Getenv(
"HOME_SKYMAP_LIB"));
38 if(gSystem->Getenv(
"CWB_USER_URL")==NULL) {
39 cout <<
"cwb_report_skymap.C - Error : environment CWB_USER_URL is not defined!!!" << endl;
exit(1);
41 cwb_user_url=
TString(gSystem->Getenv(
"CWB_USER_URL"));
45 if(gSystem->Getenv(
"CWB_REP_URL")!=NULL) {
46 cwb_rep_url=
TString(gSystem->Getenv(
"CWB_REP_URL"));
50 if(gSystem->Getenv(
"CWB_SKYMAP_FILE")==NULL) {
51 cout <<
"cwb_report_skymap.C - Error : environment CWB_SKYMAP_FILE is not defined!!!" << endl;
exit(1);
53 cwb_skymap_file=
TString(gSystem->Getenv(
"CWB_SKYMAP_FILE"));
57 if(cwb_skymap_file.EndsWith(
".fits")) {
58 }
else if(cwb_skymap_file.EndsWith(
".fits.gz")) {
60 cout <<
"cwb_report_skymap.C - Error : file name must ends with .fits/.fits.gz !!!" << endl;
exit(1);
71 if(cwb_report_options!=
"") {
72 cout << cwb_report_options << endl;
75 for(
int j=0;
j<token->GetEntries();
j++){
77 TObjString* tok = (TObjString*)token->At(
j);
78 TString stok = tok->GetString();
81 if(j<token->GetEntries()-1) {
82 TObjString* otoken = (TObjString*)token->At(
j+1);
83 cwb_skymap_dir = otoken->GetString();
86 if(stok==
"--output-dir") {
87 if(j<token->GetEntries()-1) {
88 TObjString* otoken = (TObjString*)token->At(
j+1);
89 cwb_skymap_dir = otoken->GetString();
94 if(j<token->GetEntries()-1) {
95 TObjString* otoken = (TObjString*)token->At(
j+1);
96 cwb_rep_url = otoken->GetString();
99 if(stok==
"--output-url") {
100 if(j<token->GetEntries()-1) {
101 TObjString* otoken = (TObjString*)token->At(
j+1);
102 cwb_rep_url = otoken->GetString();
106 if(j<token->GetEntries()-1) {
107 TObjString* otoken = (TObjString*)token->At(
j+1);
108 TString cwb_skymap_comp = otoken->GetString();
110 if(cwb_skymap_comp.EndsWith(
".fits")) {
111 }
else if(cwb_skymap_comp.EndsWith(
".fits.gz")) {
113 cout <<
"cwb_report_skymap.C - Error : file name of comparison skymap must ends with .fits/.fits.gz !!!" << endl;
exit(1);
116 cwb_report_options.ReplaceAll(
"--fits",
"");
117 singleSkymap =
false;
123 if(cwb_rep_url==
"") {
124 cout <<
"cwb_report_skymap.C - Error : --output-url not defined !!!" << endl;
exit(1);
129 if(!singleSkymap) cwb_skymap_dir.ReplaceAll(cwb_skymap_name,
TString(
"c")+cwb_skymap_name);
130 cwb_skymap_name.ReplaceAll(
".gz",
"");
131 cwb_skymap_name.ReplaceAll(
".fits",
"");
133 if(cwb_skymap_dir.EndsWith(
".fits.gz")) cwb_skymap_dir.ReplaceAll(
".fits.gz",
"");
134 if(cwb_skymap_dir.EndsWith(
".fits")) cwb_skymap_dir.ReplaceAll(
".fits",
"");
137 bool overwrite = TB.
checkFile(cwb_skymap_dir,
true,
"skymap statistic directory already exist");
138 if(!overwrite) {cout <<
"cwb_report_skymap.C terminated !!!" << endl<<endl;gSystem->Exit(1);}
140 TB.
mkDir(cwb_skymap_dir,
false,
true);
144 cout <<
"Network : " << ifostr << endl;
146 unsigned int Pid = gSystem->GetPid();
149 char skymap_script_file[1024];
154 if(rel_skymap_dir.BeginsWith(
report_dir))
if(rel_skymap_dir.First(
"/")>0) rel_skymap_dir.Remove(0,rel_skymap_dir.First(
"/")+1);
159 TString pyCmd = singleSkymap ?
"snglFITShtml.py" :
"multFITShtml.py";
163 out.open(skymap_script_file,
ios::out);
167 out << ostring << endl;
169 out << ostring << endl;
170 sprintf(ostring,
"USER_DIR=${PWD}; \\");
171 out << ostring << endl;
172 sprintf(ostring,
"cd %s; \\",home_skymap_lib.Data());
173 out << ostring << endl;
174 sprintf(ostring,
". setup.sh; \\");
175 out << ostring << endl;
176 sprintf(ostring,
"cd $USER_DIR; \\");
177 out << ostring << endl;
178 sprintf(ostring,
"fits=%s; \\",cwb_skymap_file.Data());
179 out << ostring << endl;
180 sprintf(ostring,
"time %s -v %s --dT-nside 128 --dT-Nsamp 500 -o %s -t cwb -O %s --no-margticks $fits %s \\",
181 pyCmd.Data(),
ifostr,odir.Data(),ourl,cwb_report_options.Data());
182 out << ostring << endl;
184 out << ostring << endl;
190 sprintf(cmd,
". %s",skymap_script_file);
193 sprintf(cmd,
"rm %s",skymap_script_file);
202 sprintf(index_html_file,
"%s/index.html",cwb_skymap_parent.Data());
213 int estat = gSystem->GetPathInfo(index_html_file,&
id,&size,&flags,&mt);
214 if(estat!=0) gSystem->Exit(0);
218 TString cwb_skymap_html = cwb_skymap_name+
"/"+cwb_skymap_name+
"-skymapSummary_cwb.html";
219 if(!singleSkymap) cwb_skymap_html =
TString(
"c")+cwb_skymap_name+
"/"+
"multFITS-skymapComparison_cwb.html";
222 in.open(index_html_file,
ios::in);
223 if(!in.good()) {cout <<
"cwb_report_skymap.C - Error Opening File : " << index_html_file << endl;
exit(1);}
227 sprintf(index_html_file_tmp,
"%s.tmp", index_html_file);
228 cout << index_html_file_tmp << endl;
229 out2.open(index_html_file_tmp,
ios::out);
230 if (!out2.good()) {cout <<
"cwb_report_skymap.C - Error Opening File : " << index_html_file_tmp << endl;
exit(1);}
235 in.getline(istr,1024);
236 if (!in.good())
break;
238 if(ostr.Contains(cwb_skymap_html)) found=
true;
239 if(!found && ostr.Contains(
"cwb_parameters.C.html")) {
240 out2 <<
"<li> <a href=\"" << cwb_skymap_html <<
"\" target=\"_blank\">Skymap Statistics</a>";
241 if(cwb_skymap_html==
"skyprobcc/skyprobcc-skymapSummary_cwb.html") out2 <<
" ( point estimate )" << endl;
242 else if(cwb_skymap_html==
"mskyprobcc/mskyprobcc-skymapSummary_cwb.html") out2 <<
" ( median )" << endl;
243 else if(cwb_skymap_html==
"cskyprobcc/multFITS-skymapComparison_cwb.html") out2 <<
" ( comparison )" << endl;
247 out2 << ostr.Data() << endl;
253 sprintf(cmd,
"rm %s;mv %s %s",index_html_file,index_html_file_tmp,index_html_file);
TString cwb_report_options
char index_html_file_tmp[1024]
char index_html_file[1024]
TString cwb_skymap_parent
sprintf(cmd,"rm %s", skymap_script_file)