21 #pragma GCC system_header 29 #include "TObjArray.h" 30 #include "TObjString.h" 64 cout <<
"CWB_Plugin_cwb_inet.C : allowed only for 2G analysis" << endl;
69 TString cwb_inet_options=
TString(gSystem->Getenv(
"CWB_INET_OPTIONS"));
72 cout <<
"-----> plugins/CWB_Plugin_cwb_inet.C : ifo : " << ifo.Data() <<
" - type : " << type << endl;
73 cout <<
" options : " << cwb_inet_options << endl;
78 cwb_inet_tool.ToUpper();
80 cwb_inet_type.ToUpper();
86 int gISTAGE=-1;
IMPORT(
int,gISTAGE)
87 int gJSTAGE=-1;
IMPORT(
int,gJSTAGE)
90 if((cwb_inet_tool==
"PSD")&&((cwb_inet_type==
"STRAIN")||(cwb_inet_type==
"MDC"))) error=
false;
91 if((cwb_inet_tool==
"WDM")&&((cwb_inet_type==
"STRAIN")||(cwb_inet_type==
"MDC"))) error=
false;
92 if((cwb_inet_tool==
"FRDISPLAY")&&((cwb_inet_type==
"STRAIN")||(cwb_inet_type==
"MDC"))) error=
false;
93 if(cwb_inet_tool==
"INJ") error=
false;
96 if((cwb_inet_tool==
"WDM")&&(cwb_inet_type==
"STRAIN")) error=
false;
97 if((cwb_inet_tool==
"PSD")&&(cwb_inet_type==
"WHITE")) error=
false;
98 if((cwb_inet_tool==
"WDM")&&(cwb_inet_type==
"WHITE")) error=
false;
99 if((cwb_inet_tool==
"FRDISPLAY")&&(cwb_inet_type==
"WHITE")) error=
false;
100 if(cwb_inet_tool==
"INJ") error=
false;
101 if(cwb_inet_tool==
"NRMS") error=
false;
104 if(cwb_inet_tool==
"EMAX") error=
false;
107 if((cwb_inet_tool==
"SPARSE")&&(cwb_inet_type==
"SUPERCLUSTER")) error=
false;
110 if((cwb_inet_tool==
"SPARSE")&&(cwb_inet_type==
"LIKELIHOOD")) error=
false;
111 if(cwb_inet_tool==
"CED") error=
false;
115 cout <<
"CWB_Plugin_cwb_inet.C : cwb_inet option can not applied for this stage range , process terminated!!!" << endl;
117 cout <<
"OPTIONS : " << cwb_inet_options << endl;
126 if(cwb_inet_tool==
"FRDISPLAY")
CWB_Plugin_frdisplay(cwb_inet_options, jfile, cfg, net, x, ifo, type);
127 else if(cwb_inet_tool==
"PSD")
CWB_Plugin_psd(cwb_inet_options, jfile, cfg, net, x, ifo, type);
128 else if(cwb_inet_tool==
"INJ")
CWB_Plugin_inj(cwb_inet_options, jfile, cfg, net, x, ifo, type);
129 else if(cwb_inet_tool==
"NRMS")
CWB_Plugin_nRMS(cwb_inet_options, jfile, cfg, net, x, ifo, type);
130 else if(cwb_inet_tool==
"WDM")
CWB_Plugin_wdm(cwb_inet_options, jfile, cfg, net, x, ifo, type);
131 else if(cwb_inet_tool==
"EMAX")
CWB_Plugin_emax(cwb_inet_options, jfile, cfg, net, x, ifo, type);
132 else if(cwb_inet_tool==
"SPARSE")
CWB_Plugin_sparse(cwb_inet_options, jfile, cfg, net, ifo, type);
133 else if(cwb_inet_tool==
"CED")
CWB_Plugin_ced(cwb_inet_options, jfile, cfg, net, ifo, type);
135 cout <<
"CWB_Plugin_cwb_inet.C : Bad inet option --tool " << cwb_inet_tool << endl;
136 cout <<
"Select : --tool FRDISPLAY/PSD/NRMS/WDM/EMAX/SPARSE/CED" << endl << endl;
156 cwb_inet_draw.ToUpper();
160 jname.ReplaceAll(
":/",
"");
161 cout << jname.Data() << endl;
163 if(cwb_inet_draw==
"TRUE") {
165 char fmacroName[1024];
166 unsigned int Pid = gSystem->GetPid();
167 sprintf(fmacroName,
"%s/CWB_Plugin_cwb_inet_ced_macro_%s_%d_job%d.XXXXXX",
173 cout <<
"CWB_Plugin_cwb_inet.C - Error : Opening File : " << fmacroName << endl;
177 sprintf(line,
"{TFile* ifile = new TFile(\"%s\");TBrowser br(\"CWB\",ifile);}",jname.Data());
183 sprintf(cmd,
"root -l %s",fmacroName);
184 cout << cmd << endl; gSystem->Exec(cmd);
186 sprintf(cmd,
"rm %s",jname.Data());
187 cout << cmd << endl; gSystem->Exec(cmd);
188 sprintf(cmd,
"rm %s",fmacroName);
189 cout << cmd << endl; gSystem->Exec(cmd);
202 if(cwb_inet_type==
"")
return;
203 cwb_inet_type.ToLower();
218 cwb_inet_draw.ToUpper();
223 int mode = (cwb_inet_mode!=
"") ? cwb_inet_mode.Atoi() : 1;
226 if(mode==1) gmode=
"(E00+E90)/2";
227 if(mode==2) gmode=
"sqrt((E00+E90)/2)";
228 if(mode==3) gmode=
"amplitude:00";
229 if(mode==4) gmode=
"energy:00";
230 if(mode==5) gmode=
"|amplitude:00|";
231 if(mode==6) gmode=
"amplitude:90";
232 if(mode==7) gmode=
"energy:90";
233 if(mode==8) gmode=
"|amplitude:90|";
239 cwb_inet_core = ((cwb_inet_core==
"true")||(cwb_inet_core==
"false")) ? cwb_inet_core :
"true";
243 sprintf(fName,
"%s/sparse_%s_%s_%d_%s_job%lu.root",
245 TFile*
ofile =
new TFile(fName,
"RECREATE");
253 if(nIFO==2 &&
TString(pD[1]->Name)==pD[0]->Name) singleDetector=
true;
256 if(cwb_inet_ifo!=
"")
if(net->
getifo(
n)->
Name!=cwb_inet_ifo)
continue;
259 TDirectory* dsparse = ofile->mkdir(pD[
n]->Name);
262 int nSS = pD[
n]->
vSS.size();
263 for(
int i=0;
i<nSS;
i++) {
266 if(cwb_inet_type==
"supercluster") level =
i+cfg->
l_low;
267 if(cwb_inet_type==
"likelihood") level =
i+cfg->
l_low;
270 char dname[32];
sprintf(dname,
"%s:level-%d",pD[
n]->Name,level);
271 TDirectory* dlevel = dsparse->mkdir(dname);
275 int rate = rateANA>>level;
277 double df = rateANA/2./double(1<<level);
278 cout <<
"level : " << level <<
"\t rate : " << rate
279 <<
"\t df(hz) : " << df <<
"\t dt(ms) : " << dt << endl;
281 bool core = (cwb_inet_core==
"true") ?
true :
false;
282 pD[
n]->
vSS[
i].Expand(core);
293 WTS->
plot(WS, mode, start, stop,const_cast<char*>(
"COLZ"));
294 WTS->
hist2D->GetYaxis()->SetRangeUser(flow, fhigh);
296 sprintf(title,
"SPARSE TF (%s) - ifo:%s - type:sparse - level:%d - dt:%g (ms) - df=%g (Hz)",
298 WTS->
hist2D->SetTitle(title);
304 sprintf(title,
"SPARSE:TIME (%s) - ifo:%s - type:sparse - level:%d - dt:%g (ms) - df=%g (Hz)",
306 TH1D *tProjH2 = WTS->
hist2D->ProjectionX(name);
308 tProjH2->SetTitle(title);
309 tProjH2->SetStats(kFALSE);
314 int hist2D_size = WTS->
hist2D->GetNbinsX();
317 sprintf(title,
"SPARSE:FREQ (%s) - ifo:%s - type:sparse - level:%d - dt:%g (ms) - df=%g (Hz)",
319 TH1D *fProjH2 = WTS->
hist2D->ProjectionY(name,edgeSize,hist2D_size-edgeSize);
321 fProjH2->SetTitle(title);
322 fProjH2->SetStats(kFALSE);
327 if(singleDetector)
break;
333 if(cwb_inet_draw==
"TRUE") {
335 char fmacroName[1024];
336 unsigned int Pid = gSystem->GetPid();
337 sprintf(fmacroName,
"%s/CWB_Plugin_cwb_inet_sparse_macro_%s_%d_job%d.XXXXXX",
342 if(!out.good()) {cout <<
"CWB_Plugin_cwb_inet.C - Error : Opening File : " << fmacroName << endl;gSystem->Exit(1);}
344 sprintf(line,
"{TFile* ifile = new TFile(\"%s\");TBrowser br(\"CWB\",ifile);}",fName);
350 sprintf(cmd,
"root -l %s",fmacroName);
351 cout << cmd << endl; gSystem->Exec(cmd);
354 cout << cmd << endl; gSystem->Exec(cmd);
355 sprintf(cmd,
"rm %s",fmacroName);
356 cout << cmd << endl; gSystem->Exec(cmd);
358 cout << endl <<
"Dump Sparse : " << fName << endl << endl;
373 if(cwb_inet_type==
"")
return;
377 if(cwb_inet_ifo==
"")
return;
380 cout <<
"CWB_Plugin_cwb_inet.C : Error : NULL data " << endl;
386 if(cwb_inet_gps!=
"") {
387 if(!cwb_inet_gps.IsFloat()) {
388 cout<<
"CWB_Plugin_cwb_inet.C : Error : --gps value is not a number" << endl;
391 if(cwb_inet_gps.Atof()>0) gps=cwb_inet_gps.Atof();
393 cout <<
"CWB_Plugin_cwb_inet.C : gps = " << gps << endl;
397 cwb_inet_draw.ToUpper();
402 cwb_inet_oneside.ToUpper();
403 if(cwb_inet_oneside==
"") cwb_inet_oneside=
"TRUE";
404 if((cwb_inet_oneside!=
"TRUE")&&(cwb_inet_oneside!=
"FALSE")) {
405 cout <<
"CWB_Plugin_cwb_inet.C : Error : wrong --oneside option , must be true/false" << endl;
408 TString psdtype = (cwb_inet_oneside==
"TRUE") ?
"oneside" :
"doubleside";
409 bool oneside = (cwb_inet_oneside==
"TRUE") ?
true :
false;
423 double fNinquist = rate/2.;
436 if(gps<start || gps>stop) {
438 cout <<
"CWB_Plugin_cwb_inet.C : Error : --gps value is out of the data range [" 439 << start <<
":" << stop <<
"]" << endl;
444 const double scale = 1./nRMS.
wrate();
445 int igps = (gps-nRMS.
start())/scale + 1;
452 if(cwb_inet_chuncklen.IsFloat()) chuncklen = cwb_inet_chuncklen.Atof();
454 sprintf(file,
"%s/nrms_%s_gps%10.2f_%s_%s_%d_%s_job%lu.txt",
456 cout << endl <<
"Dump nRMS " <<
"(chuncklen = " << chuncklen <<
")" 457 <<
" : " << file << endl << endl;
460 if(!out.good()) {cout <<
"CWB_Plugin_cwb_inet.C : Error Opening File : " << file << endl;
exit(1);}
463 double rescale = oneside ? sqrt(2.)/sqrt(inRate) : 1./sqrt(inRate);
465 double df=fNinquist/
M;
466 for(
int j=1;
j<
M; ++
j) {
467 double f =
j*df+df/2.;
468 if(f<flow || f>fhigh)
continue;
469 out <<
j*df+df/2. <<
" " << nRMS.
data[igps*(M+1)+
j]*rescale << endl;
473 if(cwb_inet_draw==
"TRUE") {
475 cwb_inet_save.ToUpper();
476 int save = cwb_inet_save==
"TRUE" ? 1 : 0;
478 cwb_inet_range.ToUpper();
479 int range = cwb_inet_range==
"FIX" ? 1 : 0;
482 sprintf(cmd,
"export CWB_SENSITIVITY_FILE_NAME=\"%s\";",file);
483 sprintf(cmd,
"%s export CWB_SENSITIVITY_SAVE_PLOT=%d;",cmd,save);
484 sprintf(cmd,
"%s export CWB_SENSITIVITY_RANGE_FIX=%d;",cmd,range);
485 sprintf(cmd,
"%s root -n -l ${CWB_MACROS}/cwb_draw_sensitivity.C",cmd);
486 cout << cmd << endl; gSystem->Exec(cmd);
490 cout << cmd << endl; gSystem->Exec(cmd);
497 sprintf(fName,
"%s/nRMS_%s_%d_%s_job%lu.root",
499 TFile*
ofile =
new TFile(fName,
"RECREATE");
500 cout << endl <<
"Dump nRMS : " << fName << endl << endl;
503 WTS->
plot(nRMS, 3, start, stop,const_cast<char*>(
"COLZ"));
504 WTS->
hist2D->GetYaxis()->Set(WTS->
hist2D->GetNbinsY(),0, fNinquist);
505 WTS->
hist2D->GetYaxis()->SetRangeUser(flow, fhigh);
507 sprintf(title,
"nRMS TF - ifo:%s", ifo.Data());
508 WTS->
hist2D->SetTitle(title);
510 WTS->
canvas->SetLogz(
true);
516 if(cwb_inet_draw==
"TRUE") {
518 char fmacroName[1024];
519 unsigned int Pid = gSystem->GetPid();
520 sprintf(fmacroName,
"%s/CWB_Plugin_cwb_inet_nRMS_macro_%s_%d_job%d.XXXXXX",
525 if(!out.good()) {cout <<
"CWB_Plugin_cwb_inet.C - Error : Opening File : " << fmacroName << endl;gSystem->Exit(1);}
527 sprintf(line,
"{TFile* ifile = new TFile(\"%s\");TBrowser br(\"CWB\",ifile);}",fName);
533 sprintf(cmd,
"root -l %s",fmacroName);
534 cout << cmd << endl; gSystem->Exec(cmd);
537 cout << cmd << endl; gSystem->Exec(cmd);
538 sprintf(cmd,
"rm %s",fmacroName);
539 cout << cmd << endl; gSystem->Exec(cmd);
553 if(cwb_inet_type==
"")
return;
554 cwb_inet_type.ToLower();
558 if(cwb_inet_ifo==
"")
return;
561 cout <<
"CWB_Plugin_cwb_inet.C : Error : NULL data " << endl;
584 cwb_inet_draw.ToUpper();
589 int mode = (cwb_inet_mode!=
"") ? cwb_inet_mode.Atoi() : 2;
592 if(mode==1) gmode=
"(E00+E90)/2";
593 if(mode==2) gmode=
"sqrt((E00+E90)/2)";
594 if(mode==3) gmode=
"amplitude:00";
595 if(mode==4) gmode=
"energy:00";
596 if(mode==5) gmode=
"|amplitude:00|";
597 if(mode==6) gmode=
"amplitude:90";
598 if(mode==7) gmode=
"energy:90";
599 if(mode==8) gmode=
"|amplitude:90|";
603 sprintf(fName,
"%s/wdm_%s_%s_%d_%s_job%lu.root",
605 TFile*
ofile =
new TFile(fName,
"RECREATE");
606 cout << endl <<
"Dump WDM : " << fName << endl << endl;
608 for(
int level=cfg->
l_high; level>=cfg->
l_low; level--) {
611 char dname[32];
sprintf(dname,
"%s:level-%d",ifo.Data(),level);
612 TDirectory* dwdm = ofile->mkdir(dname);
615 int layers = level>0 ? 1<<level : 0;
616 cout <<
"level : " << level <<
" layers : " << layers << endl;
619 int rate = rateANA>>level;
621 double df = rateANA/2./double(1<<level);
622 cout <<
"level : " << level <<
"\t rate : " << rate
623 <<
"\t df(hz) : " << df <<
"\t dt(ms) : " << dt << endl;
625 pwdm = net->
getwdm(layers+1);
627 cout <<
"CWB_Plugin_cwb_inet.C : Error - WDM not defined !!!" << endl;
640 WTS->
plot(WS, mode, start, stop,const_cast<char*>(
"COLZ"));
641 WTS->
hist2D->GetYaxis()->SetRangeUser(flow, fhigh);
643 sprintf(title,
"WDM:TF (%s) - ifo:%s - type:%s - level:%d - dt:%g (ms) - df=%g (Hz)",
644 gmode.Data(),ifo.Data(),cwb_inet_type.Data(),level,
dt,
df);
645 WTS->
hist2D->SetTitle(title);
646 char name[64];
sprintf(name,
"%s:tf:%s-%d",ifo.Data(),cwb_inet_type.Data(),level);
650 sprintf(name,
"%s:t:%s-%d",ifo.Data(),cwb_inet_type.Data(),level);
651 sprintf(title,
"WDM:TIME (%s) - ifo:%s - type:%s - level:%d - dt:%g (ms) - df=%g (Hz)",
652 gmode.Data(),ifo.Data(),cwb_inet_type.Data(),level,
dt,
df);
653 TH1D *tProjH2 = WTS->
hist2D->ProjectionX(name);
655 tProjH2->SetTitle(title);
656 tProjH2->SetStats(kFALSE);
661 int hist2D_size = WTS->
hist2D->GetNbinsX();
663 sprintf(name,
"%s:f:%s-%d",ifo.Data(),cwb_inet_type.Data(),level);
664 sprintf(title,
"WDM:FREQ (%s) - ifo:%s - type:%s - level:%d - dt:%g (ms) - df=%g (Hz)",
665 gmode.Data(),ifo.Data(),cwb_inet_type.Data(),level,
dt,
df);
666 TH1D *fProjH2 = WTS->
hist2D->ProjectionY(name,edgeSize,hist2D_size-edgeSize);
668 fProjH2->SetTitle(title);
669 fProjH2->SetStats(kFALSE);
680 if(cwb_inet_draw==
"TRUE") {
682 char fmacroName[1024];
683 unsigned int Pid = gSystem->GetPid();
684 sprintf(fmacroName,
"%s/CWB_Plugin_cwb_inet_wdm_macro_%s_%d_job%d.XXXXXX",
689 if(!out.good()) {cout <<
"CWB_Plugin_cwb_inet.C - Error : Opening File : " << fmacroName << endl;gSystem->Exit(1);}
691 sprintf(line,
"{TFile* ifile = new TFile(\"%s\");TBrowser br(\"CWB\",ifile);}",fName);
697 sprintf(cmd,
"root -l %s",fmacroName);
698 cout << cmd << endl; gSystem->Exec(cmd);
701 cout << cmd << endl; gSystem->Exec(cmd);
702 sprintf(cmd,
"rm %s",fmacroName);
703 cout << cmd << endl; gSystem->Exec(cmd);
719 size_t gILEVEL=-1;
IMPORT(
size_t,gILEVEL)
723 int ilevel = cwb_inet_level.Atoi();
724 if(ilevel>0 && ilevel!=gILEVEL)
return;
727 cwb_inet_draw.ToUpper();
731 int layers = level>0 ? 1<<level : 0;
734 int rate = rateANA>>level;
736 double df = rateANA/2./double(1<<level);
737 cout <<
"level : " << level <<
"\t rate(hz) : " << rate <<
"\t layers : " << layers
738 <<
"\t df(hz) : " << df <<
"\t dt(ms) : " << dt << endl;
746 sprintf(fName,
"%s/emax_%d_%s_job%lu.root",
748 TFile*
ofile = (ilevel||level==cfg->
l_high) ?
new TFile(fName,
"RECREATE") :
new TFile(fName,
"UPDATE");
749 if(ofile==NULL||!ofile->IsOpen())
750 {cout <<
"CWB_Plugin_cwb_inet.C - Error opening : " << fName << endl;
exit(1);}
751 cout << endl <<
"Dump EMAX : " << fName << endl << endl;
756 if(nIFO==2 &&
TString(pD[1]->Name)==pD[0]->Name) singleDetector=
true;
766 TDirectory* demax = ofile->mkdir(ifo.Data());
776 WTS.
plot(*WS, 0, start, stop,const_cast<char*>(
"COLZ"));
777 WTS.
hist2D->GetYaxis()->SetRangeUser(flow, fhigh);
781 sprintf(title,
"EMAX:TF (energy) - ifo:%s - factor:%d - level:%d - dt:%g (ms) - df=%g (Hz)",
783 WTS.
hist2D->SetTitle(title);
789 sprintf(title,
"EMAX:TIME (energy) - ifo:%s - factor:%d - level:%d - dt:%g (ms) - df=%g (Hz)",
791 TH1D *tProjH2 = WTS.
hist2D->ProjectionX(name);
793 tProjH2->SetTitle(title);
794 tProjH2->SetStats(kFALSE);
799 int hist2D_size = WTS.
hist2D->GetNbinsX();
802 sprintf(title,
"EMAX:FREQ (energy) - ifo:%s - factor:%d - level:%d - dt:%g (ms) - df=%g (Hz)",
804 TH1D *fProjH2 = WTS.
hist2D->ProjectionY(name,edgeSize,hist2D_size-edgeSize);
806 fProjH2->SetTitle(title);
807 fProjH2->SetStats(kFALSE);
811 if(singleDetector)
break;
816 if(!ilevel && level!=cfg->
l_low)
return;
818 if(cwb_inet_draw==
"TRUE") {
820 char fmacroName[1024];
821 unsigned int Pid = gSystem->GetPid();
822 sprintf(fmacroName,
"%s/CWB_Plugin_cwb_inet_wdm_macro_%s_%d_job%d.XXXXXX",
827 if(!out.good()) {cout <<
"CWB_Plugin_cwb_inet.C - Error : Opening File : " << fmacroName << endl;gSystem->Exit(1);}
829 sprintf(line,
"{TFile* ifile = new TFile(\"%s\");TBrowser br(\"CWB\",ifile);}",fName);
835 sprintf(cmd,
"root -l %s",fmacroName);
836 cout << cmd << endl; gSystem->Exec(cmd);
839 cout << cmd << endl; gSystem->Exec(cmd);
840 sprintf(cmd,
"rm %s",fmacroName);
841 cout << cmd << endl; gSystem->Exec(cmd);
854 if(cwb_inet_type==
"")
return;
858 if(cwb_inet_ifo==
"")
return;
861 cout <<
"CWB_Plugin_cwb_inet.C : Error : NULL data " << endl;
866 cwb_inet_draw.ToUpper();
873 if(cwb_inet_chuncklen.IsFloat()) chuncklen = cwb_inet_chuncklen.Atof();
878 cwb_inet_oneside.ToUpper();
879 if(cwb_inet_oneside==
"") cwb_inet_oneside=
"TRUE";
880 if((cwb_inet_oneside!=
"TRUE")&&(cwb_inet_oneside!=
"FALSE")) {
881 cout <<
"CWB_Plugin_cwb_inet.C : Error : wrong --oneside option , must be true/false" << endl;
884 TString psdtype = (cwb_inet_oneside==
"TRUE") ?
"oneside" :
"doubleside";
885 bool oneside = (cwb_inet_oneside==
"TRUE") ?
true :
false;
888 sprintf(file,
"%s/psd_%s_%s_%s_%d_%s_job%lu.txt",
890 cout << endl <<
"Dump PSD " <<
"(chuncklen = " << chuncklen <<
")" 891 <<
" : " << file << endl << endl;
894 if(cwb_inet_draw==
"TRUE") {
896 cwb_inet_save.ToUpper();
897 int save = cwb_inet_save==
"TRUE" ? 1 : 0;
899 cwb_inet_range.ToUpper();
900 int range = cwb_inet_range==
"FIX" ? 1 : 0;
903 sprintf(cmd,
"export CWB_SENSITIVITY_FILE_NAME=\"%s\";",file);
904 sprintf(cmd,
"%s export CWB_SENSITIVITY_SAVE_PLOT=%d;",cmd,save);
905 sprintf(cmd,
"%s export CWB_SENSITIVITY_RANGE_FIX=%d;",cmd,range);
906 sprintf(cmd,
"%s root -n -l ${CWB_MACROS}/cwb_draw_sensitivity.C",cmd);
907 cout << cmd << endl; gSystem->Exec(cmd);
911 cout << cmd << endl; gSystem->Exec(cmd);
925 cwb_inet_draw.ToUpper();
934 sprintf(fName,
"%s/inj_%d_%s_job%lu.root",
936 TFile*
ofile =
new TFile(fName,
"RECREATE");
937 if(ofile==NULL||!ofile->IsOpen())
938 {cout <<
"CWB_Plugin_cwb_inet.C - Error opening : " << fName << endl;
exit(1);}
939 cout << endl <<
"Dump INJ : " << fName << endl << endl;
944 TDirectory* dinj = ofile->mkdir(pD[
n]->Name);
955 size_t K = pT->size();
966 nstrt =
int((T - dT)*rate);
967 nstop =
int((T + dT)*rate);
968 if(nstrt<=0) nstrt = 0;
969 if(nstop>=
int(N)) nstop =
N;
970 if(nstop<=0)
continue;
971 if(nstrt>=
int(N))
continue;
977 for(j=nstrt; j<nstop; j++) gx.
data[j-nstrt]=w.
data[j];
979 char name[256];
sprintf(name,
"%s:%2.2f",pD[
n]->Name,nstrt/rate);
985 if(cwb_inet_draw==
"TRUE") {
987 char fmacroName[1024];
988 unsigned int Pid = gSystem->GetPid();
989 sprintf(fmacroName,
"%s/CWB_Plugin_cwb_inet_wdm_macro_%s_%d_job%d.XXXXXX",
994 if(!out.good()) {cout <<
"CWB_Plugin_cwb_inet.C - Error : Opening File : " << fmacroName << endl;gSystem->Exit(1);}
996 sprintf(line,
"{TFile* ifile = new TFile(\"%s\");TBrowser br(\"CWB\",ifile);}",fName);
1002 sprintf(cmd,
"root -l %s",fmacroName);
1003 cout << cmd << endl; gSystem->Exec(cmd);
1006 cout << cmd << endl; gSystem->Exec(cmd);
1007 sprintf(cmd,
"rm %s",fmacroName);
1008 cout << cmd << endl; gSystem->Exec(cmd);
1021 if(cwb_inet_type==
"")
return;
1025 if(cwb_inet_ifo==
"")
return;
1028 cout <<
"CWB_Plugin_cwb_inet.C : Error : NULL data " << endl;
1037 if(gSystem->Getenv(
"HOME_FRDISPLAY")==NULL) {
1038 cout <<
"Error : environment HOME_FRDISPLAY is not defined!!!" << endl;
1041 home_frdisplay=
TString(gSystem->Getenv(
"HOME_FRDISPLAY"));
1043 cout <<
"home_frdisplay : " << home_frdisplay.Data() << endl;
1048 cout <<
"job_start : " << job_start <<
" job_stop : " << job_stop << endl;
1051 gRandom->SetSeed(0);
1052 int rnID = gRandom->Uniform(0,10000000);
1056 char frLabel[64];
sprintf(frLabel,
"CWB_Plugin_cwb_inet_%s_%s_%d",ifo.Data(),cwb_inet_type.Data(),rnID);
1061 sprintf(ffl,
"%s/CWB_Plugin_cwb_inet_%s_%s_%d.ffl",cfg->
tmp_dir,ifo.Data(),cwb_inet_type.Data(),rnID);
1062 cout <<
"ffl : " << ffl << endl;
1066 if (!out.good()) {cout <<
"Error Opening File : " << ffl << endl;gSystem->Exit(1);}
1067 out << frFile.Data() <<
" " << job_start <<
" " << job_stop-job_start <<
" " << 0 <<
" " << 0 << endl;
1068 cout << frFile.Data() << endl;
1073 sprintf(cmd,
"%s/FrDisplay -d 5 -proc -t %s -i %s",home_frdisplay.Data(),
chName,ffl);
1077 if(cwb_inet_hpf!=
"")
sprintf(cmd,
"%s -k \"-Bu -Hp -o 6 -a %s\"",cmd,cwb_inet_hpf.Data());
1079 char xoptions[256]=
"";
1082 if(cwb_inet_decimateby!=
"")
sprintf(xoptions,
"%s -decimateby %s",xoptions,cwb_inet_decimateby.Data());
1085 if(cwb_inet_downmix!=
"")
sprintf(xoptions,
"%s -downmix %s",xoptions,cwb_inet_downmix.Data());
1088 if(cwb_inet_uscaleby!=
"")
sprintf(xoptions,
"%s -uscaleby %s",xoptions,cwb_inet_uscaleby.Data());
1091 if(cwb_inet_decimategain!=
"")
sprintf(xoptions,
"%s -decimategain %s",xoptions,cwb_inet_decimategain.Data());
1094 if(
TString(xoptions)!=
"")
sprintf(cmd,
"%s -x \"%s\"",cmd,xoptions);
1095 cout << cmd << endl; gSystem->Exec(cmd);
1098 sprintf(cmd,
"rm %s %s",ffl,frFile.Data());
1099 cout << cmd << endl; gSystem->Exec(cmd);
1110 cwb_inet_type.ToUpper();
1111 if((cwb_inet_type==
"STRAIN")||(cwb_inet_type==
"MDC")||(cwb_inet_type==
"WHITE")||
1112 (cwb_inet_type==
"SUPERCLUSTER")||(cwb_inet_type==
"LIKELIHOOD")) {
1113 bool selected=
false;
1114 if((type==
CWB_PLUGIN_DATA) &&(cwb_inet_type==
"STRAIN")) selected=
true;
1115 if((type==
CWB_PLUGIN_MDC) &&(cwb_inet_type==
"MDC")) selected=
true;
1121 if(!selected)
return "";
1123 cout <<
"CWB_Plugin_cwb_inet.C : Option error --type " << cwb_inet_type << endl << endl;
1124 cout <<
"Select : --type strain/mdc/white/supercluster/likelihood" << endl << endl;
1129 return cwb_inet_type;
1137 cwb_inet_ifo.ToUpper();
1139 bool isPresentIFO=
false;
1140 for(
int n=0;
n<cfg->
nIFO;
n++)
if(cwb_inet_ifo==net->
getifo(
n)->
Name) isPresentIFO=
true;
1142 if(ifo!=
"0")
if(cwb_inet_ifo!=ifo)
return "";
1144 cout <<
"CWB_Plugin_cwb_inet.C : Option error --ifo " << cwb_inet_ifo << endl;
1147 cout <<
"Select : --ifo " << ifo_opts << endl << endl;
1152 return cwb_inet_ifo;
1162 if(jname.Contains(
"init_"))
remove=
false;
1163 if(jname.Contains(
"strain_"))
remove=
false;
1164 if(jname.Contains(
"cstrain_"))
remove=
false;
1165 if(jname.Contains(
"coherence_"))
remove=
false;
1166 if(jname.Contains(
"supercluster_"))
remove=
false;
1167 if(jname.Contains(
"likelihood_"))
remove=
false;
1169 jname.ReplaceAll(
":/",
"");
1171 gSystem->Exec(
TString(
"rm "+jname).Data());
1176 gSystem->Exec((
TString(
"rm ")+cfg->
plugin.GetTitle()).Data());
1180 if(configPluginName!=
"")
1181 gSystem->Exec((
TString(
"rm ")+configPluginName).Data());
1185 TList *files = (TList*)gROOT->GetListOfFiles();
1189 while ((file=(TSystemFile*)
next())) {
1191 if(fname.Contains(
"wave_")) gSystem->Exec((
TString(
"rm ")+fname).Data());
std::vector< char * > ifoName
CWB_JOBF_OPTIONS jobfOptions
detector * getifo(size_t n)
param: detector index
void CWB_Plugin_psd(TString cwb_inet_options, TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
std::vector< double > * getmdcTime()
virtual void rate(double r)
void CWB_Plugin_emax(TString cwb_inet_options, TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *xdummy, TString sdummy, int type)
void CWB_Plugin_RemoveTemporaryFiles(TFile *jfile, CWB::config *cfg)
cout<< endl;cout<< "ts size = "<< ts.size()<< " ts rate = "<< ts.rate()<< endl;tf.Forward(ts, wdm);int levels=tf.getLevel();cout<< "tf size = "<< tf.size()<< endl;double dF=tf.resolution();double dT=1./(2 *dF);cout<< "rate(hz) : "<< RATE<< "\ layers : "<< nLAYERS<< "\ dF(hz) : "<< dF<< "\ dT(ms) : "<< dT *1000.<< endl;int itime=TIME_PIXEL_INDEX;int ifreq=FREQ_PIXEL_INDEX;int index=(levels+1) *itime+ifreq;double time=itime *dT;double freq=(ifreq >0) ? ifreq *dF :dF/4;cout<< endl;cout<< "PIXEL TIME = "<< time<< " sec "<< endl;cout<< "PIXEL FREQ = "<< freq<< " Hz "<< endl;cout<< endl;wavearray< double > x
WDM< double > wdm(nLAYERS, nLAYERS, 6, 10)
void add(const wavearray< DataType_t > &, int=0, int=0, int=0)
std::vector< SSeries< double > > vSS[NIFO_MAX]
CWB_JOBF_OPTIONS jobfOptions
virtual void start(double s)
void plot(wavearray< double > &, char *=NULL, int=1, double=0., double=0., bool=false, float=0., float=0., bool=false, float=0., bool=false)
cout<< "SNR "<< xsnr<< endl;wavearray< double > f
network ** net
NOISE_MDC_SIMULATION.
void CWB_Plugin_wdm(TString cwb_inet_options, TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
WDM< double > * getwdm(size_t M)
param: number of wdm layers
virtual size_t size() const
void CWB_Plugin_frdisplay(TString cwb_inet_options, TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
static TString GetStageString(CWB_STAGE jstage)
#define IMPORT(TYPE, VAR)
gwavearray< double > * gx
void CWB_Plugin_ced(TString cwb_inet_options, TFile *jfile, CWB::config *cfg, network *net, TString ifo, int type)
void CWB_Plugin_sparse(TString cwb_inet_options, TFile *jfile, CWB::config *cfg, network *net, TString ifo, int type)
std::vector< std::string > mdcList
int getLayer(wavearray< DataType_t > &w, double n)
param: n - layer number
TIter next(twave->GetListOfBranches())
void CWB_Plugin_nRMS(TString cwb_inet_options, TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
TString CWB_Plugin_CheckIFO(TString cwb_inet_options, TFile *jfile, CWB::config *cfg, network *net, TString ifo)
char channelNamesRaw[NIFO_MAX][50]
void SetComment(TString comment)
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
COHERENCE.
void CWB_Plugin_inj(TString cwb_inet_options, TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
WSeries< double > * getTFmap()
param: no parameters
virtual void stop(double s)
double fabs(const Complex &x)
void Forward(int n=-1)
param: wavelet - n is number of steps (-1 means full decomposition)
strcpy(RunLabel, RUN_LABEL)
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
TString CWB_Plugin_CheckTYPE(TString cwb_inet_options, TFile *jfile, CWB::config *cfg, TString type)
WaveDWT< DataType_t > * pWavelet
cout<< "live time after cat 2 : "<< detSegs_ctime<< endl;if(detSegs_ctime< segTHR) {cout<< "job segment live time after cat2 < "<< segTHR<< " sec, job terminated !!!"<< endl;exit(1);} double Tb=detSegs[0].start;double Te=detSegs[0].stop;double dT=Te-Tb;char file[512], tdf00[512], tdf90[512], buFFer[1024];int rnID=int(gRandom->Rndm(13) *1.e9);if(simulation) { i=NET.readMDClog(injectionList, double(long(Tb)) -mdcShift);printf("GPS: %16.6f saved, injections: %d\", double(long(Tb)), i);frTB[nIFO].shiftBurstMDCLog(NET.mdcList, ifos, mdcShift);for(int i=0;i< NET.mdcTime.size();i++) NET.mdcTime[i]+=mdcShift;vector< waveSegment > mdcSegs(NET.mdcTime.size());for(int k=0;k< NET.mdcTime.size();k++) {mdcSegs[k].start=NET.mdcTime[k]-gap;mdcSegs[k].stop=NET.mdcTime[k]+gap;} vector< waveSegment > mdcSegs_dq2=slagTB.mergeSegLists(detSegs_dq2, mdcSegs);double mdcSegs_ctime=slagTB.getTimeSegList(mdcSegs_dq2);cout<< "live time in zero lag after cat2+inj : "<< mdcSegs_ctime<< endl;if(mdcSegs_ctime==0) {cout<< "job segment with zero cat2+inj live time in zero lag, job terminated !!!"<< endl;exit(1);} } if(dump_infos_and_exit) exit(0);if(mask >0.) NET.setSkyMask(mask, skyMaskFile);for(i=0;i< nIFO;i++) { frTB[i].readFrames(FRF[i], channelNamesRaw[i], x);x.start(x.start()+dataShift[i]);x.start(x.start() -segLen *(segID[i]-segID[0]));if(singleDetector) TB.resampleToPowerOfTwo(x);sprintf(file,"%s/%s_%d_%s_%d_%d.dat", nodedir, ifo[i], int(Tb), data_label, runID, rnID);if(dump_sensitivity_and_exit) { sprintf(file,"%s/sensitivity_%s_%d_%s_job%d.txt", dump_dir, ifo[i], int(Tb), data_label, runID);cout<< endl<< "Dump Sensitivity : "<< file<< endl<< endl;TB.makeSpectrum(file, x);continue;} if(dcCal[i]>0.) x *=dcCal[i];if(fResample >0) { x.FFT(1);x.resize(fResample/x.rate() *x.size());x.FFT(-1);x.rate(fResample);} pTF[i]=pD[i]-> getTFmap()
std::vector< SSeries< double > > vSS
virtual void resize(unsigned int)
void Inverse(int n=-1)
param: n - number of steps (-1 means full reconstruction)
TString frLabel[NIFO_MAX]