3 #pragma GCC system_header
11 #include "TObjArray.h"
12 #include "TObjString.h"
46 cout <<
"CWB_Plugin_cwb_inet.C : allowed only for 2G analysis" << endl;
51 TString cwb_inet_options=
TString(gSystem->Getenv(
"CWB_INET_OPTIONS"));
54 cout <<
"-----> plugins/CWB_Plugin_cwb_inet.C : ifo : " << ifo.Data() <<
" - type : " << type << endl;
55 cout <<
" options : " << cwb_inet_options << endl;
60 cwb_inet_tool.ToUpper();
62 cwb_inet_type.ToUpper();
68 int gISTAGE=-1;
IMPORT(
int,gISTAGE)
69 int gJSTAGE=-1;
IMPORT(
int,gJSTAGE)
72 if((cwb_inet_tool==
"PSD")&&((cwb_inet_type==
"STRAIN")||(cwb_inet_type==
"MDC"))) error=
false;
73 if((cwb_inet_tool==
"WDM")&&((cwb_inet_type==
"STRAIN")||(cwb_inet_type==
"MDC"))) error=
false;
74 if((cwb_inet_tool==
"FRDISPLAY")&&((cwb_inet_type==
"STRAIN")||(cwb_inet_type==
"MDC"))) error=
false;
75 if(cwb_inet_tool==
"INJ") error=
false;
78 if((cwb_inet_tool==
"WDM")&&(cwb_inet_type==
"STRAIN")) error=
false;
79 if((cwb_inet_tool==
"PSD")&&(cwb_inet_type==
"WHITE")) error=
false;
80 if((cwb_inet_tool==
"WDM")&&(cwb_inet_type==
"WHITE")) error=
false;
81 if((cwb_inet_tool==
"FRDISPLAY")&&(cwb_inet_type==
"WHITE")) error=
false;
82 if(cwb_inet_tool==
"INJ") error=
false;
83 if(cwb_inet_tool==
"NRMS") error=
false;
86 if(cwb_inet_tool==
"EMAX") error=
false;
89 if((cwb_inet_tool==
"SPARSE")&&(cwb_inet_type==
"SUPERCLUSTER")) error=
false;
92 if((cwb_inet_tool==
"SPARSE")&&(cwb_inet_type==
"LIKELIHOOD")) error=
false;
93 if(cwb_inet_tool==
"CED") error=
false;
97 cout <<
"CWB_Plugin_cwb_inet.C : cwb_inet option can not applied for this stage range , process terminated!!!" << endl;
99 cout <<
"OPTIONS : " << cwb_inet_options << endl;
108 if(cwb_inet_tool==
"FRDISPLAY")
CWB_Plugin_frdisplay(cwb_inet_options, jfile, cfg, net, x, ifo, type);
109 else if(cwb_inet_tool==
"PSD")
CWB_Plugin_psd(cwb_inet_options, jfile, cfg, net, x, ifo, type);
110 else if(cwb_inet_tool==
"INJ")
CWB_Plugin_inj(cwb_inet_options, jfile, cfg, net, x, ifo, type);
111 else if(cwb_inet_tool==
"NRMS")
CWB_Plugin_nRMS(cwb_inet_options, jfile, cfg, net, x, ifo, type);
112 else if(cwb_inet_tool==
"WDM")
CWB_Plugin_wdm(cwb_inet_options, jfile, cfg, net, x, ifo, type);
113 else if(cwb_inet_tool==
"EMAX")
CWB_Plugin_emax(cwb_inet_options, jfile, cfg, net, x, ifo, type);
114 else if(cwb_inet_tool==
"SPARSE")
CWB_Plugin_sparse(cwb_inet_options, jfile, cfg, net, ifo, type);
115 else if(cwb_inet_tool==
"CED")
CWB_Plugin_ced(cwb_inet_options, jfile, cfg, net, ifo, type);
117 cout <<
"CWB_Plugin_cwb_inet.C : Bad inet option --tool " << cwb_inet_tool << endl;
118 cout <<
"Select : --tool FRDISPLAY/PSD/NRMS/WDM/EMAX/SPARSE/CED" << endl << endl;
138 cwb_inet_draw.ToUpper();
142 jname.ReplaceAll(
":/",
"");
143 cout << jname.Data() << endl;
145 if(cwb_inet_draw==
"TRUE") {
147 char fmacroName[1024];
148 unsigned int Pid = gSystem->GetPid();
149 sprintf(fmacroName,
"%s/CWB_Plugin_cwb_inet_ced_macro_%s_%d_job%d.XXXXXX",
155 cout <<
"CWB_Plugin_cwb_inet.C - Error : Opening File : " << fmacroName << endl;
159 sprintf(line,
"{TFile* ifile = new TFile(\"%s\");TBrowser br(\"CWB\",ifile);}",jname.Data());
165 sprintf(cmd,
"root -l %s",fmacroName);
166 cout << cmd << endl; gSystem->Exec(cmd);
168 sprintf(cmd,
"rm %s",jname.Data());
169 cout << cmd << endl; gSystem->Exec(cmd);
170 sprintf(cmd,
"rm %s",fmacroName);
171 cout << cmd << endl; gSystem->Exec(cmd);
184 if(cwb_inet_type==
"")
return;
185 cwb_inet_type.ToLower();
200 cwb_inet_draw.ToUpper();
205 int mode = (cwb_inet_mode!=
"") ? cwb_inet_mode.Atoi() : 1;
208 if(mode==1) gmode=
"(E00+E90)/2";
209 if(mode==2) gmode=
"sqrt((E00+E90)/2)";
210 if(mode==3) gmode=
"amplitude:00";
211 if(mode==4) gmode=
"energy:00";
212 if(mode==5) gmode=
"|amplitude:00|";
213 if(mode==6) gmode=
"amplitude:90";
214 if(mode==7) gmode=
"energy:90";
215 if(mode==8) gmode=
"|amplitude:90|";
221 cwb_inet_core = ((cwb_inet_core==
"true")||(cwb_inet_core==
"false")) ? cwb_inet_core :
"true";
225 sprintf(fName,
"%s/sparse_%s_%s_%d_%s_job%lu.root",
227 TFile*
ofile =
new TFile(fName,
"RECREATE");
235 if(nIFO==2 &&
TString(pD[1]->Name)==pD[0]->Name) singleDetector=
true;
238 if(cwb_inet_ifo!=
"")
if(net->
getifo(
n)->
Name!=cwb_inet_ifo)
continue;
241 TDirectory* dsparse = ofile->mkdir(pD[
n]->Name);
244 int nSS = pD[
n]->
vSS.size();
245 for(
int i=0;
i<nSS;
i++) {
248 if(cwb_inet_type==
"supercluster") level =
i+cfg->
l_low;
249 if(cwb_inet_type==
"likelihood") level =
i+cfg->
l_low;
252 char dname[32];
sprintf(dname,
"%s:level-%d",pD[
n]->Name,level);
253 TDirectory* dlevel = dsparse->mkdir(dname);
257 int rate = rateANA>>level;
259 double df = rateANA/2./double(1<<level);
260 cout <<
"level : " << level <<
"\t rate : " << rate
261 <<
"\t df(hz) : " << df <<
"\t dt(ms) : " << dt << endl;
263 bool core = (cwb_inet_core==
"true") ?
true :
false;
264 pD[
n]->
vSS[
i].Expand(core);
276 WTS->
hist2D->GetYaxis()->SetRangeUser(flow, fhigh);
278 sprintf(title,
"SPARSE TF (%s) - ifo:%s - type:sparse - level:%d - dt:%g (ms) - df=%g (Hz)",
280 WTS->
hist2D->SetTitle(title);
286 sprintf(title,
"SPARSE:TIME (%s) - ifo:%s - type:sparse - level:%d - dt:%g (ms) - df=%g (Hz)",
288 TH1D *tProjH2 = WTS->
hist2D->ProjectionX(name);
290 tProjH2->SetTitle(title);
291 tProjH2->SetStats(kFALSE);
296 int hist2D_size = WTS->
hist2D->GetNbinsX();
299 sprintf(title,
"SPARSE:FREQ (%s) - ifo:%s - type:sparse - level:%d - dt:%g (ms) - df=%g (Hz)",
301 TH1D *fProjH2 = WTS->
hist2D->ProjectionY(name,edgeSize,hist2D_size-edgeSize);
303 fProjH2->SetTitle(title);
304 fProjH2->SetStats(kFALSE);
309 if(singleDetector)
break;
315 if(cwb_inet_draw==
"TRUE") {
317 char fmacroName[1024];
318 unsigned int Pid = gSystem->GetPid();
319 sprintf(fmacroName,
"%s/CWB_Plugin_cwb_inet_sparse_macro_%s_%d_job%d.XXXXXX",
324 if(!out.good()) {cout <<
"CWB_Plugin_cwb_inet.C - Error : Opening File : " << fmacroName << endl;gSystem->Exit(1);}
326 sprintf(line,
"{TFile* ifile = new TFile(\"%s\");TBrowser br(\"CWB\",ifile);}",fName);
332 sprintf(cmd,
"root -l %s",fmacroName);
333 cout << cmd << endl; gSystem->Exec(cmd);
336 cout << cmd << endl; gSystem->Exec(cmd);
337 sprintf(cmd,
"rm %s",fmacroName);
338 cout << cmd << endl; gSystem->Exec(cmd);
340 cout << endl <<
"Dump Sparse : " << fName << endl << endl;
355 if(cwb_inet_type==
"")
return;
359 if(cwb_inet_ifo==
"")
return;
362 cout <<
"CWB_Plugin_cwb_inet.C : Error : NULL data " << endl;
368 if(cwb_inet_gps!=
"") {
369 if(!cwb_inet_gps.IsFloat()) {
370 cout<<
"CWB_Plugin_cwb_inet.C : Error : --gps value is not a number" << endl;
373 if(cwb_inet_gps.Atof()>0) gps=cwb_inet_gps.Atof();
375 cout <<
"CWB_Plugin_cwb_inet.C : gps = " << gps << endl;
379 cwb_inet_draw.ToUpper();
384 cwb_inet_oneside.ToUpper();
385 if(cwb_inet_oneside==
"") cwb_inet_oneside=
"TRUE";
386 if((cwb_inet_oneside!=
"TRUE")&&(cwb_inet_oneside!=
"FALSE")) {
387 cout <<
"CWB_Plugin_cwb_inet.C : Error : wrong --oneside option , must be true/false" << endl;
390 TString psdtype = (cwb_inet_oneside==
"TRUE") ?
"oneside" :
"doubleside";
391 bool oneside = (cwb_inet_oneside==
"TRUE") ?
true :
false;
405 double fNinquist = rate/2.;
418 if(gps<start || gps>stop) {
420 cout <<
"CWB_Plugin_cwb_inet.C : Error : --gps value is out of the data range ["
421 << start <<
":" << stop <<
"]" << endl;
426 const double scale = 1./nRMS.
wrate();
427 int igps = (gps-nRMS.
start())/scale + 1;
434 if(cwb_inet_chuncklen.IsFloat()) chuncklen = cwb_inet_chuncklen.Atof();
436 sprintf(file,
"%s/nrms_%s_gps%10.2f_%s_%s_%d_%s_job%lu.txt",
438 cout << endl <<
"Dump nRMS " <<
"(chuncklen = " << chuncklen <<
")"
439 <<
" : " << file << endl << endl;
442 if(!out.good()) {cout <<
"CWB_Plugin_cwb_inet.C : Error Opening File : " << file << endl;
exit(1);}
445 double rescale = oneside ? sqrt(2.)/sqrt(inRate) : 1./sqrt(inRate);
447 double df=fNinquist/
M;
448 for(
int j=1;
j<
M; ++
j) {
449 double f =
j*df+df/2.;
450 if(f<flow || f>fhigh)
continue;
451 out <<
j*df+df/2. <<
" " << nRMS.
data[igps*(M+1)+
j]*rescale << endl;
455 if(cwb_inet_draw==
"TRUE") {
457 cwb_inet_save.ToUpper();
458 int save = cwb_inet_save==
"TRUE" ? 1 : 0;
460 cwb_inet_range.ToUpper();
461 int range = cwb_inet_range==
"FIX" ? 1 : 0;
464 sprintf(cmd,
"export CWB_SENSITIVITY_FILE_NAME=\"%s\";",file);
465 sprintf(cmd,
"%s export CWB_SENSITIVITY_SAVE_PLOT=%d;",cmd,save);
466 sprintf(cmd,
"%s export CWB_SENSITIVITY_RANGE_FIX=%d;",cmd,range);
467 sprintf(cmd,
"%s root -n -l ${CWB_MACROS}/cwb_draw_sensitivity.C",cmd);
468 cout << cmd << endl; gSystem->Exec(cmd);
472 cout << cmd << endl; gSystem->Exec(cmd);
479 sprintf(fName,
"%s/nRMS_%s_%d_%s_job%lu.root",
481 TFile*
ofile =
new TFile(fName,
"RECREATE");
482 cout << endl <<
"Dump nRMS : " << fName << endl << endl;
486 WTS->
hist2D->GetYaxis()->Set(WTS->
hist2D->GetNbinsY(),0, fNinquist);
487 WTS->
hist2D->GetYaxis()->SetRangeUser(flow, fhigh);
489 sprintf(title,
"nRMS TF - ifo:%s", ifo.Data());
490 WTS->
hist2D->SetTitle(title);
492 WTS->
canvas->SetLogz(
true);
498 if(cwb_inet_draw==
"TRUE") {
500 char fmacroName[1024];
501 unsigned int Pid = gSystem->GetPid();
502 sprintf(fmacroName,
"%s/CWB_Plugin_cwb_inet_nRMS_macro_%s_%d_job%d.XXXXXX",
507 if(!out.good()) {cout <<
"CWB_Plugin_cwb_inet.C - Error : Opening File : " << fmacroName << endl;gSystem->Exit(1);}
509 sprintf(line,
"{TFile* ifile = new TFile(\"%s\");TBrowser br(\"CWB\",ifile);}",fName);
515 sprintf(cmd,
"root -l %s",fmacroName);
516 cout << cmd << endl; gSystem->Exec(cmd);
519 cout << cmd << endl; gSystem->Exec(cmd);
520 sprintf(cmd,
"rm %s",fmacroName);
521 cout << cmd << endl; gSystem->Exec(cmd);
535 if(cwb_inet_type==
"")
return;
536 cwb_inet_type.ToLower();
540 if(cwb_inet_ifo==
"")
return;
543 cout <<
"CWB_Plugin_cwb_inet.C : Error : NULL data " << endl;
566 cwb_inet_draw.ToUpper();
571 int mode = (cwb_inet_mode!=
"") ? cwb_inet_mode.Atoi() : 2;
574 if(mode==1) gmode=
"(E00+E90)/2";
575 if(mode==2) gmode=
"sqrt((E00+E90)/2)";
576 if(mode==3) gmode=
"amplitude:00";
577 if(mode==4) gmode=
"energy:00";
578 if(mode==5) gmode=
"|amplitude:00|";
579 if(mode==6) gmode=
"amplitude:90";
580 if(mode==7) gmode=
"energy:90";
581 if(mode==8) gmode=
"|amplitude:90|";
585 sprintf(fName,
"%s/wdm_%s_%s_%d_%s_job%lu.root",
587 TFile*
ofile =
new TFile(fName,
"RECREATE");
588 cout << endl <<
"Dump WDM : " << fName << endl << endl;
590 for(
int level=cfg->
l_high; level>=cfg->
l_low; level--) {
593 char dname[32];
sprintf(dname,
"%s:level-%d",ifo.Data(),level);
594 TDirectory* dwdm = ofile->mkdir(dname);
597 int layers = level>0 ? 1<<level : 0;
598 cout <<
"level : " << level <<
" layers : " << layers << endl;
601 int rate = rateANA>>level;
603 double df = rateANA/2./double(1<<level);
604 cout <<
"level : " << level <<
"\t rate : " << rate
605 <<
"\t df(hz) : " << df <<
"\t dt(ms) : " << dt << endl;
607 pwdm = net->
getwdm(layers+1);
609 cout <<
"CWB_Plugin_cwb_inet.C : Error - WDM not defined !!!" << endl;
623 WTS->
hist2D->GetYaxis()->SetRangeUser(flow, fhigh);
625 sprintf(title,
"WDM:TF (%s) - ifo:%s - type:%s - level:%d - dt:%g (ms) - df=%g (Hz)",
626 gmode.Data(),ifo.Data(),cwb_inet_type.Data(),level,
dt,
df);
627 WTS->
hist2D->SetTitle(title);
628 char name[64];
sprintf(name,
"%s:tf:%s-%d",ifo.Data(),cwb_inet_type.Data(),level);
632 sprintf(name,
"%s:t:%s-%d",ifo.Data(),cwb_inet_type.Data(),level);
633 sprintf(title,
"WDM:TIME (%s) - ifo:%s - type:%s - level:%d - dt:%g (ms) - df=%g (Hz)",
634 gmode.Data(),ifo.Data(),cwb_inet_type.Data(),level,
dt,
df);
635 TH1D *tProjH2 = WTS->
hist2D->ProjectionX(name);
637 tProjH2->SetTitle(title);
638 tProjH2->SetStats(kFALSE);
643 int hist2D_size = WTS->
hist2D->GetNbinsX();
645 sprintf(name,
"%s:f:%s-%d",ifo.Data(),cwb_inet_type.Data(),level);
646 sprintf(title,
"WDM:FREQ (%s) - ifo:%s - type:%s - level:%d - dt:%g (ms) - df=%g (Hz)",
647 gmode.Data(),ifo.Data(),cwb_inet_type.Data(),level,
dt,
df);
648 TH1D *fProjH2 = WTS->
hist2D->ProjectionY(name,edgeSize,hist2D_size-edgeSize);
650 fProjH2->SetTitle(title);
651 fProjH2->SetStats(kFALSE);
662 if(cwb_inet_draw==
"TRUE") {
664 char fmacroName[1024];
665 unsigned int Pid = gSystem->GetPid();
666 sprintf(fmacroName,
"%s/CWB_Plugin_cwb_inet_wdm_macro_%s_%d_job%d.XXXXXX",
671 if(!out.good()) {cout <<
"CWB_Plugin_cwb_inet.C - Error : Opening File : " << fmacroName << endl;gSystem->Exit(1);}
673 sprintf(line,
"{TFile* ifile = new TFile(\"%s\");TBrowser br(\"CWB\",ifile);}",fName);
679 sprintf(cmd,
"root -l %s",fmacroName);
680 cout << cmd << endl; gSystem->Exec(cmd);
683 cout << cmd << endl; gSystem->Exec(cmd);
684 sprintf(cmd,
"rm %s",fmacroName);
685 cout << cmd << endl; gSystem->Exec(cmd);
701 size_t gILEVEL=-1;
IMPORT(
size_t,gILEVEL)
705 int ilevel = cwb_inet_level.Atoi();
706 if(ilevel>0 && ilevel!=gILEVEL)
return;
709 cwb_inet_draw.ToUpper();
713 int layers = level>0 ? 1<<level : 0;
716 int rate = rateANA>>level;
718 double df = rateANA/2./double(1<<level);
719 cout <<
"level : " << level <<
"\t rate(hz) : " << rate <<
"\t layers : " << layers
720 <<
"\t df(hz) : " << df <<
"\t dt(ms) : " << dt << endl;
728 sprintf(fName,
"%s/emax_%d_%s_job%lu.root",
730 TFile*
ofile = (ilevel||level==cfg->
l_high) ?
new TFile(fName,
"RECREATE") :
new TFile(fName,
"UPDATE");
731 if(ofile==NULL||!ofile->IsOpen())
732 {cout <<
"CWB_Plugin_cwb_inet.C - Error opening : " << fName << endl;
exit(1);}
733 cout << endl <<
"Dump EMAX : " << fName << endl << endl;
738 if(nIFO==2 &&
TString(pD[1]->Name)==pD[0]->Name) singleDetector=
true;
748 TDirectory* demax = ofile->mkdir(ifo.Data());
759 WTS.
hist2D->GetYaxis()->SetRangeUser(flow, fhigh);
763 sprintf(title,
"EMAX:TF (energy) - ifo:%s - factor:%d - level:%d - dt:%g (ms) - df=%g (Hz)",
765 WTS.
hist2D->SetTitle(title);
771 sprintf(title,
"EMAX:TIME (energy) - ifo:%s - factor:%d - level:%d - dt:%g (ms) - df=%g (Hz)",
773 TH1D *tProjH2 = WTS.
hist2D->ProjectionX(name);
775 tProjH2->SetTitle(title);
776 tProjH2->SetStats(kFALSE);
781 int hist2D_size = WTS.
hist2D->GetNbinsX();
784 sprintf(title,
"EMAX:FREQ (energy) - ifo:%s - factor:%d - level:%d - dt:%g (ms) - df=%g (Hz)",
786 TH1D *fProjH2 = WTS.
hist2D->ProjectionY(name,edgeSize,hist2D_size-edgeSize);
788 fProjH2->SetTitle(title);
789 fProjH2->SetStats(kFALSE);
793 if(singleDetector)
break;
798 if(!ilevel && level!=cfg->
l_low)
return;
800 if(cwb_inet_draw==
"TRUE") {
802 char fmacroName[1024];
803 unsigned int Pid = gSystem->GetPid();
804 sprintf(fmacroName,
"%s/CWB_Plugin_cwb_inet_wdm_macro_%s_%d_job%d.XXXXXX",
809 if(!out.good()) {cout <<
"CWB_Plugin_cwb_inet.C - Error : Opening File : " << fmacroName << endl;gSystem->Exit(1);}
811 sprintf(line,
"{TFile* ifile = new TFile(\"%s\");TBrowser br(\"CWB\",ifile);}",fName);
817 sprintf(cmd,
"root -l %s",fmacroName);
818 cout << cmd << endl; gSystem->Exec(cmd);
821 cout << cmd << endl; gSystem->Exec(cmd);
822 sprintf(cmd,
"rm %s",fmacroName);
823 cout << cmd << endl; gSystem->Exec(cmd);
836 if(cwb_inet_type==
"")
return;
840 if(cwb_inet_ifo==
"")
return;
843 cout <<
"CWB_Plugin_cwb_inet.C : Error : NULL data " << endl;
848 cwb_inet_draw.ToUpper();
855 if(cwb_inet_chuncklen.IsFloat()) chuncklen = cwb_inet_chuncklen.Atof();
860 cwb_inet_oneside.ToUpper();
861 if(cwb_inet_oneside==
"") cwb_inet_oneside=
"TRUE";
862 if((cwb_inet_oneside!=
"TRUE")&&(cwb_inet_oneside!=
"FALSE")) {
863 cout <<
"CWB_Plugin_cwb_inet.C : Error : wrong --oneside option , must be true/false" << endl;
866 TString psdtype = (cwb_inet_oneside==
"TRUE") ?
"oneside" :
"doubleside";
867 bool oneside = (cwb_inet_oneside==
"TRUE") ?
true :
false;
870 sprintf(file,
"%s/psd_%s_%s_%s_%d_%s_job%lu.txt",
872 cout << endl <<
"Dump PSD " <<
"(chuncklen = " << chuncklen <<
")"
873 <<
" : " << file << endl << endl;
876 if(cwb_inet_draw==
"TRUE") {
878 cwb_inet_save.ToUpper();
879 int save = cwb_inet_save==
"TRUE" ? 1 : 0;
881 cwb_inet_range.ToUpper();
882 int range = cwb_inet_range==
"FIX" ? 1 : 0;
885 sprintf(cmd,
"export CWB_SENSITIVITY_FILE_NAME=\"%s\";",file);
886 sprintf(cmd,
"%s export CWB_SENSITIVITY_SAVE_PLOT=%d;",cmd,save);
887 sprintf(cmd,
"%s export CWB_SENSITIVITY_RANGE_FIX=%d;",cmd,range);
888 sprintf(cmd,
"%s root -n -l ${CWB_MACROS}/cwb_draw_sensitivity.C",cmd);
889 cout << cmd << endl; gSystem->Exec(cmd);
893 cout << cmd << endl; gSystem->Exec(cmd);
907 cwb_inet_draw.ToUpper();
916 sprintf(fName,
"%s/inj_%d_%s_job%lu.root",
918 TFile*
ofile =
new TFile(fName,
"RECREATE");
919 if(ofile==NULL||!ofile->IsOpen())
920 {cout <<
"CWB_Plugin_cwb_inet.C - Error opening : " << fName << endl;
exit(1);}
921 cout << endl <<
"Dump INJ : " << fName << endl << endl;
926 TDirectory* dinj = ofile->mkdir(pD[
n]->Name);
937 size_t K = pT->size();
948 nstrt =
int((T - dT)*rate);
949 nstop =
int((T + dT)*rate);
950 if(nstrt<=0) nstrt = 0;
951 if(nstop>=
int(N)) nstop =
N;
952 if(nstop<=0)
continue;
953 if(nstrt>=
int(N))
continue;
959 for(j=nstrt; j<nstop; j++) gx.
data[j-nstrt]=w.
data[j];
961 char name[256];
sprintf(name,
"%s:%2.2f",pD[
n]->Name,nstrt/rate);
967 if(cwb_inet_draw==
"TRUE") {
969 char fmacroName[1024];
970 unsigned int Pid = gSystem->GetPid();
971 sprintf(fmacroName,
"%s/CWB_Plugin_cwb_inet_wdm_macro_%s_%d_job%d.XXXXXX",
976 if(!out.good()) {cout <<
"CWB_Plugin_cwb_inet.C - Error : Opening File : " << fmacroName << endl;gSystem->Exit(1);}
978 sprintf(line,
"{TFile* ifile = new TFile(\"%s\");TBrowser br(\"CWB\",ifile);}",fName);
984 sprintf(cmd,
"root -l %s",fmacroName);
985 cout << cmd << endl; gSystem->Exec(cmd);
988 cout << cmd << endl; gSystem->Exec(cmd);
989 sprintf(cmd,
"rm %s",fmacroName);
990 cout << cmd << endl; gSystem->Exec(cmd);
1003 if(cwb_inet_type==
"")
return;
1007 if(cwb_inet_ifo==
"")
return;
1010 cout <<
"CWB_Plugin_cwb_inet.C : Error : NULL data " << endl;
1019 if(gSystem->Getenv(
"HOME_FRDISPLAY")==NULL) {
1020 cout <<
"Error : environment HOME_FRDISPLAY is not defined!!!" << endl;
1023 home_frdisplay=
TString(gSystem->Getenv(
"HOME_FRDISPLAY"));
1025 cout <<
"home_frdisplay : " << home_frdisplay.Data() << endl;
1030 cout <<
"job_start : " << job_start <<
" job_stop : " << job_stop << endl;
1033 gRandom->SetSeed(0);
1034 int rnID = gRandom->Uniform(0,10000000);
1038 char frLabel[64];
sprintf(frLabel,
"CWB_Plugin_cwb_inet_%s_%s_%d",ifo.Data(),cwb_inet_type.Data(),
rnID);
1043 sprintf(ffl,
"%s/CWB_Plugin_cwb_inet_%s_%s_%d.ffl",cfg->
tmp_dir,ifo.Data(),cwb_inet_type.Data(),
rnID);
1044 cout <<
"ffl : " << ffl << endl;
1048 if (!out.good()) {cout <<
"Error Opening File : " << ffl << endl;gSystem->Exit(1);}
1049 out << frFile.Data() <<
" " << job_start <<
" " << job_stop-job_start <<
" " << 0 <<
" " << 0 << endl;
1050 cout << frFile.Data() << endl;
1055 sprintf(cmd,
"%s/FrDisplay -d 5 -proc -t %s -i %s",home_frdisplay.Data(),
chName,ffl);
1059 if(cwb_inet_hpf!=
"")
sprintf(cmd,
"%s -k \"-Bu -Hp -o 6 -a %s\"",cmd,cwb_inet_hpf.Data());
1061 char xoptions[256]=
"";
1064 if(cwb_inet_decimateby!=
"")
sprintf(xoptions,
"%s -decimateby %s",xoptions,cwb_inet_decimateby.Data());
1067 if(cwb_inet_downmix!=
"")
sprintf(xoptions,
"%s -downmix %s",xoptions,cwb_inet_downmix.Data());
1070 if(cwb_inet_uscaleby!=
"")
sprintf(xoptions,
"%s -uscaleby %s",xoptions,cwb_inet_uscaleby.Data());
1073 if(cwb_inet_decimategain!=
"")
sprintf(xoptions,
"%s -decimategain %s",xoptions,cwb_inet_decimategain.Data());
1076 if(
TString(xoptions)!=
"")
sprintf(cmd,
"%s -x \"%s\"",cmd,xoptions);
1077 cout << cmd << endl; gSystem->Exec(cmd);
1080 sprintf(cmd,
"rm %s %s",ffl,frFile.Data());
1081 cout << cmd << endl; gSystem->Exec(cmd);
1092 cwb_inet_type.ToUpper();
1093 if((cwb_inet_type==
"STRAIN")||(cwb_inet_type==
"MDC")||(cwb_inet_type==
"WHITE")||
1094 (cwb_inet_type==
"SUPERCLUSTER")||(cwb_inet_type==
"LIKELIHOOD")) {
1095 bool selected=
false;
1096 if((type==
CWB_PLUGIN_DATA) &&(cwb_inet_type==
"STRAIN")) selected=
true;
1097 if((type==
CWB_PLUGIN_MDC) &&(cwb_inet_type==
"MDC")) selected=
true;
1103 if(!selected)
return "";
1105 cout <<
"CWB_Plugin_cwb_inet.C : Option error --type " << cwb_inet_type << endl << endl;
1106 cout <<
"Select : --type strain/mdc/white/supercluster/likelihood" << endl << endl;
1111 return cwb_inet_type;
1119 cwb_inet_ifo.ToUpper();
1121 bool isPresentIFO=
false;
1122 for(
int n=0;
n<cfg->
nIFO;
n++)
if(cwb_inet_ifo==net->
getifo(
n)->
Name) isPresentIFO=
true;
1124 if(ifo!=
"0")
if(cwb_inet_ifo!=ifo)
return "";
1126 cout <<
"CWB_Plugin_cwb_inet.C : Option error --ifo " << cwb_inet_ifo << endl;
1129 cout <<
"Select : --ifo " << ifo_opts << endl << endl;
1134 return cwb_inet_ifo;
1144 if(jname.Contains(
"init_"))
remove=
false;
1145 if(jname.Contains(
"strain_"))
remove=
false;
1146 if(jname.Contains(
"cstrain_"))
remove=
false;
1147 if(jname.Contains(
"coherence_"))
remove=
false;
1148 if(jname.Contains(
"supercluster_"))
remove=
false;
1149 if(jname.Contains(
"likelihood_"))
remove=
false;
1151 jname.ReplaceAll(
":/",
"");
1153 gSystem->Exec(
TString(
"rm "+jname).Data());
1158 gSystem->Exec((
TString(
"rm ")+cfg->
plugin.GetTitle()).Data());
1162 if(configPluginName!=
"")
1163 gSystem->Exec((
TString(
"rm ")+configPluginName).Data());
1167 TList *
files = (TList*)gROOT->GetListOfFiles();
1171 while ((file=(TSystemFile*)
next())) {
1173 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
virtual size_t size() const
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)
cout<< "skymap size : "<< L<< endl;for(int l=0;l< L;l++) sm.set(l, l);sm > const_cast< char * >("skymap.dat")
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<< "\t layers : "<< nLAYERS<< "\t dF(hz) : "<< dF<< "\t 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)
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
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\n", 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]