8 TB.
checkFile(gSystem->Getenv(
"CWB_ROOTLOGON_FILE"));
9 TB.
checkFile(gSystem->Getenv(
"CWB_PARAMETERS_FILE"));
10 TB.
checkFile(gSystem->Getenv(
"CWB_UPARAMETERS_FILE"));
13 if(gSystem->Getenv(
"HOME_SKYMAP_LIB")==NULL) {
14 cout <<
"cwb_report_skymap.C - Error : environment HOME_SKYMAP_LIB is not defined!!!" << endl;
exit(1);
16 home_skymap_lib=
TString(gSystem->Getenv(
"HOME_SKYMAP_LIB"));
20 if(gSystem->Getenv(
"CWB_USER_URL")==NULL) {
21 cout <<
"cwb_report_skymap.C - Error : environment CWB_USER_URL is not defined!!!" << endl;
exit(1);
23 cwb_user_url=
TString(gSystem->Getenv(
"CWB_USER_URL"));
27 if(gSystem->Getenv(
"CWB_REP_URL")!=NULL) {
28 cwb_rep_url=
TString(gSystem->Getenv(
"CWB_REP_URL"));
32 if(gSystem->Getenv(
"CWB_SKYMAP_FILE")==NULL) {
33 cout <<
"cwb_report_skymap.C - Error : environment CWB_SKYMAP_FILE is not defined!!!" << endl;
exit(1);
35 cwb_skymap_file=
TString(gSystem->Getenv(
"CWB_SKYMAP_FILE"));
39 if(cwb_skymap_file.EndsWith(
".fits")) {
40 }
else if(cwb_skymap_file.EndsWith(
".fits.gz")) {
42 cout <<
"cwb_report_skymap.C - Error : file name must ends with .fits/.fits.gz !!!" << endl;
exit(1);
53 if(cwb_report_options!=
"") {
54 cout << cwb_report_options << endl;
57 for(
int j=0;
j<token->GetEntries();
j++){
59 TObjString* tok = (TObjString*)token->At(
j);
60 TString stok = tok->GetString();
63 if(j<token->GetEntries()-1) {
64 TObjString* otoken = (TObjString*)token->At(
j+1);
65 cwb_skymap_dir = otoken->GetString();
68 if(stok==
"--output-dir") {
69 if(j<token->GetEntries()-1) {
70 TObjString* otoken = (TObjString*)token->At(
j+1);
71 cwb_skymap_dir = otoken->GetString();
76 if(j<token->GetEntries()-1) {
77 TObjString* otoken = (TObjString*)token->At(
j+1);
78 cwb_rep_url = otoken->GetString();
81 if(stok==
"--output-url") {
82 if(j<token->GetEntries()-1) {
83 TObjString* otoken = (TObjString*)token->At(
j+1);
84 cwb_rep_url = otoken->GetString();
88 if(j<token->GetEntries()-1) {
89 TObjString* otoken = (TObjString*)token->At(
j+1);
90 TString cwb_skymap_comp = otoken->GetString();
92 if(cwb_skymap_comp.EndsWith(
".fits")) {
93 }
else if(cwb_skymap_comp.EndsWith(
".fits.gz")) {
95 cout <<
"cwb_report_skymap.C - Error : file name of comparison skymap must ends with .fits/.fits.gz !!!" << endl;
exit(1);
98 cwb_report_options.ReplaceAll(
"--fits",
"");
105 if(cwb_rep_url==
"") {
106 cout <<
"cwb_report_skymap.C - Error : --output-url not defined !!!" << endl;
exit(1);
111 if(!singleSkymap) cwb_skymap_dir.ReplaceAll(cwb_skymap_name,
TString(
"c")+cwb_skymap_name);
112 cwb_skymap_name.ReplaceAll(
".gz",
"");
113 cwb_skymap_name.ReplaceAll(
".fits",
"");
115 if(cwb_skymap_dir.EndsWith(
".fits.gz")) cwb_skymap_dir.ReplaceAll(
".fits.gz",
"");
116 if(cwb_skymap_dir.EndsWith(
".fits")) cwb_skymap_dir.ReplaceAll(
".fits",
"");
119 bool overwrite = TB.
checkFile(cwb_skymap_dir,
true,
"skymap statistic directory already exist");
120 if(!overwrite) {cout <<
"cwb_report_skymap.C terminated !!!" << endl<<endl;gSystem->Exit(1);}
122 TB.
mkDir(cwb_skymap_dir,
false,
true);
126 cout <<
"Network : " << ifostr << endl;
128 unsigned int Pid = gSystem->GetPid();
131 char skymap_script_file[1024];
136 if(rel_skymap_dir.BeginsWith(
report_dir))
if(rel_skymap_dir.First(
"/")>0) rel_skymap_dir.Remove(0,rel_skymap_dir.First(
"/")+1);
141 TString pyCmd = singleSkymap ?
"snglFITShtml.py" :
"multFITShtml.py";
145 out.open(skymap_script_file,
ios::out);
149 out << ostring << endl;
151 out << ostring << endl;
152 sprintf(ostring,
"USER_DIR=${PWD}; \\");
153 out << ostring << endl;
154 sprintf(ostring,
"cd %s; \\",home_skymap_lib.Data());
155 out << ostring << endl;
156 sprintf(ostring,
". setup.sh; \\");
157 out << ostring << endl;
158 sprintf(ostring,
"cd $USER_DIR; \\");
159 out << ostring << endl;
160 sprintf(ostring,
"fits=%s; \\",cwb_skymap_file.Data());
161 out << ostring << endl;
162 sprintf(ostring,
"time %s -v %s --dT-nside 128 --dT-Nsamp 500 -o %s -t cwb -O %s --no-margticks $fits %s \\",
163 pyCmd.Data(),
ifostr,odir.Data(),ourl,cwb_report_options.Data());
164 out << ostring << endl;
166 out << ostring << endl;
172 sprintf(cmd,
". %s",skymap_script_file);
175 sprintf(cmd,
"rm %s",skymap_script_file);
184 sprintf(index_html_file,
"%s/index.html",cwb_skymap_parent.Data());
195 int estat = gSystem->GetPathInfo(index_html_file,&
id,&size,&flags,&mt);
196 if(estat!=0) gSystem->Exit(0);
200 TString cwb_skymap_html = cwb_skymap_name+
"/"+cwb_skymap_name+
"-skymapSummary_cwb.html";
201 if(!singleSkymap) cwb_skymap_html =
TString(
"c")+cwb_skymap_name+
"/"+
"multFITS-skymapComparison_cwb.html";
204 in.open(index_html_file,
ios::in);
205 if(!in.good()) {cout <<
"cwb_report_skymap.C - Error Opening File : " << index_html_file << endl;
exit(1);}
209 sprintf(index_html_file_tmp,
"%s.tmp", index_html_file);
210 cout << index_html_file_tmp << endl;
211 out.open(index_html_file_tmp,
ios::out);
212 if (!out.good()) {cout <<
"cwb_report_skymap.C - Error Opening File : " << index_html_file_tmp << endl;
exit(1);}
217 in.getline(istr,1024);
218 if (!in.good())
break;
220 if(ostr.Contains(cwb_skymap_html)) found=
true;
221 if(!found && ostr.Contains(
"cwb_parameters.C.html")) {
222 out <<
"<li> <a href=\"" << cwb_skymap_html <<
"\" target=\"_blank\">Skymap Statistics</a>";
223 if(cwb_skymap_html==
"skyprobcc/skyprobcc-skymapSummary_cwb.html") out <<
" ( point estimate )" << endl;
224 else if(cwb_skymap_html==
"mskyprobcc/mskyprobcc-skymapSummary_cwb.html") out <<
" ( median )" << endl;
225 else if(cwb_skymap_html==
"cskyprobcc/multFITS-skymapComparison_cwb.html") out <<
" ( comparison )" << endl;
229 out << ostr.Data() << endl;
235 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)