21 #pragma GCC system_header 30 #include "TObjArray.h" 31 #include "TObjString.h" 34 #include "TGraphAsymmErrors.h" 67 #define WF_VERSION 1.2 69 #define WF_OUTPUT_ROOT false 71 #define WF_OUTPUT_INJ false // save injected into the output root file 72 #define WF_OUTPUT_REC true // save reconstructed into the output root file 73 #define WF_OUTPUT_WHT false // save whitened data into the output root file 74 #define WF_OUTPUT_DAT false // save rec+null data into the output root file 75 #define WF_OUTPUT_NUL false // save null data into the output root file 77 #define WF_OUTPUT_STRAIN false // save full strain data buffer into the output root file 78 #define WF_OUTPUT_MDC false // save full strain mdc injections data buffer into the output root file 79 #define WF_OUTPUT_CSTRAIN false // save full cstrain data buffer into the output root file 81 #define WF_OUTPUT_CLUSTER false // save event crate/cluster 82 #define WF_OUTPUT_POL false // save event polarization components (dual stream polarization frame) 90 #define WF_INJ_TSTEP 0 // is the injection step time 91 #define WF_INJ_TOFF 0 // is time offset (sec) of periodic time step injections 145 std::vector<netpixel>* pCLUSTER;
189 std::vector<wavearray<double> >
vINJ;
190 std::vector<wavearray<double> >
vAUX;
191 std::vector<wavearray<double> >
cINJ;
192 std::vector<wavearray<double> >
vREC;
193 std::vector<wavearray<double> >
vWHT;
194 std::vector<wavearray<double> >
vDAT;
195 std::vector<wavearray<double> >
vNUL;
196 std::vector<wavearray<double> >
vRES;
238 bool fft=
false,
TString pdir=
"",
double P=0.99, EColor col1=kRed, EColor col2=kBlue, EColor col3=(EColor)418);
265 if(gOPT.fits_pe!=
"" && gOPT.gps_pe<=0) {
266 cout<<
"CWB_Plugin_xWF - Error : plugin parameter wf_gps_pe not defined" << endl;
exit(1);
268 if(gOPT.fits_os!=
"" && gOPT.gps_os<=0) {
269 cout<<
"CWB_Plugin_xWF - Error : plugin parameter wf_gps_os not defined" << endl;
exit(1);
271 if(gOPT.inj_tstep<=0) {
272 cout<<
"CWB_Plugin_xWF - Error : plugin parameter inj_tstep not defined" << endl;
exit(1);
286 if(gOPT.output_strain) {
296 if(gOPT.output_mdc) {
306 if(gOPT.output_wht) gHOT[
ifoID] = *
x;
307 if(gOPT.output_cstrain) gCSTRAIN[
ifoID] = *
x;
316 gvLOG[
k].erase(std::remove(gvLOG[
k].begin(), gvLOG[
k].end(),
'\n'), gvLOG[
k].end());
333 cout <<
"CWB_Plugin_WF.C " << endl;
355 for(
int k=0;
k<
K;
k++) {
357 id = NET->
getwc(
k)->
get(const_cast<char*>(
"ID"), 0,
'L', rate);
361 int ID = size_t(
id.data[
j]+0.5);
369 double minDT = 1.e12;
372 for(
int m=0;
m<
M;
m++) {
375 if(DT<minDT && INJ.
fill_in(NET,mdcID)) {
380 gTCOA = gvTCOA[injID];
386 cout <<
"CWB_Plugin_WF - event parameters : ID -> " << ID << endl;
388 cout <<
"rec_theta : " << EVT->
theta[0] <<
" rec_phi : " << EVT->
phi[0] << endl;
389 cout <<
"SNRnet : " << sqrt(EVT->
likelihood) <<
" netcc[0] : " << EVT->
netcc[0]
390 <<
" rho[0] : " << EVT->
rho[0] <<
" size : " << EVT->
size[0] << endl;
397 if(gOPT.fits_pe!=
"") {
399 cout <<
"SKYMAP PE Overlap Factor = " <<
gSM_PE_OF << endl;
401 if(gOPT.fits_os!=
"") {
403 cout <<
"SKYMAP OS Overlap Factor = " <<
gSM_OS_OF << endl;
408 cout <<
"MAX SKYMAP Correlation*CumProbability " << maxcc << endl;
409 if(gOPT.fits_pe!=
"") {
411 cout <<
"MAX SKYMAP Correlation*CumProbability PE " << maxcc_pe << endl;
413 if(gOPT.fits_os!=
"") {
415 cout <<
"MAX SKYMAP Correlation*CumProbability OS " << maxcc_os << endl;
425 if(vINJ.size()!=
nIFO) {
426 cout <<
"CWB_Plugin_WF Error : Injection Waveform Not Found !!!" << endl;
441 cout << ID <<
" vREC[0]xvREC[1] --------------------------------> sync_time " << sync_time <<
" sync_xcor : " << sync_xcor << endl;
461 vector<double>
tstop;
492 if(gOPT.output_pol) {
505 cout << ID <<
" vDIF[0]xvDIF[1] --------------------------------> sync_time " << sync_time <<
" sync_xcor : " << sync_xcor << endl;
511 for(
int i=0; i<
nIFO; i++) {
513 sprintf(title,
"%s (TIME) : vREC(red) - cINJ(blue)",NET->
ifoName[i]);
515 PlotWaveform(ofname, title, cfg, &vREC[i], &cINJ[i], NULL, &vREC[i],
false);
521 if(gOPT.output_root) {
541 if(type!=
'S' && type!=
's' && type!=
'W' && type!=
'w' && type!=
'N' && type!=
'n') {
542 cout <<
"GetWaveform : not valid type : Abort" << endl;
exit(1);
545 std::vector<wavearray<double> > vWAV;
550 if(type==
'S' || type==
's') {
561 if(type==
'W' || type==
'w') {
572 if(type==
'N' || type==
'n') {
592 float* gSLAGSHIFT=NULL;
IMPORT(
float*,gSLAGSHIFT)
598 TList *files = (TList*)gROOT->GetListOfFiles();
605 while ((file=(TSystemFile*)
next())) {
606 fname = file->GetName();
608 if(fname.Contains(
"wave_")) {
609 froot=(TFile*)file;froot->cd();
611 gOUTPUT.ReplaceAll(
".root.tmp",
".txt");
616 cout <<
"CWB_Plugin_WF.C : Error - output root file not found" << endl;
620 cout <<
"CWB_Plugin_WF.C : Error - output root file not found" << endl;
628 if(gOPT.output_rec)
for(
int n=0;
n<
nIFO;
n++) gWF.wREC[
n] = &vREC[
n];
629 if(gOPT.output_wht)
for(
int n=0;
n<
nIFO;
n++) gWF.wWHT[
n] = &vWHT[
n];
630 if(gOPT.output_dat)
for(
int n=0;
n<
nIFO;
n++) gWF.wDAT[
n] = &vDAT[
n];
631 if(gOPT.output_nul)
for(
int n=0;
n<
nIFO;
n++) gWF.wNUL[
n] = &vNUL[
n];
632 if(gOPT.output_cluster) gWF.pCLUSTER = &
gCLUSTER;
635 gTREE = (TTree *) froot->Get(
"waveburst");
639 if(gOPT.fits_pe!=
"")
gTREE->Branch(
"sm_pe_of",&
gSM_PE_OF,
"sm_pe_of/F");
640 if(gOPT.fits_os!=
"")
gTREE->Branch(
"sm_os_of",&
gSM_OS_OF,
"sm_os_of/F");
646 if(gOPT.output_inj)
if(cfg->
simulation)
gTREE->Branch(TString::Format(
"wINJ_%d",
n).Data(),
"wavearray<double>",&gWF.wINJ[
n],32000,0);
647 if(gOPT.output_inj)
if(cfg->
simulation && vAUX.size()==
nIFO)
gTREE->Branch(TString::Format(
"wAUX_%d",
n).Data(),
"wavearray<double>",&gWF.wAUX[
n],32000,0);
648 if(gOPT.output_inj)
if(cfg->
simulation)
gTREE->Branch(TString::Format(
"cINJ_%d",
n).Data(),
"wavearray<double>",&gWF.cINJ[
n],32000,0);
649 if(gOPT.output_rec)
gTREE->Branch(TString::Format(
"wREC_%d",
n).Data(),
"wavearray<double>",&gWF.wREC[
n],32000,0);
650 if(gOPT.output_wht)
gTREE->Branch(TString::Format(
"wWHT_%d",
n).Data(),
"wavearray<double>",&gWF.wWHT[
n],32000,0);
651 if(gOPT.output_dat)
gTREE->Branch(TString::Format(
"wDAT_%d",
n).Data(),
"wavearray<double>",&gWF.wDAT[
n],32000,0);
652 if(gOPT.output_nul)
gTREE->Branch(TString::Format(
"wNUL_%d",
n).Data(),
"wavearray<double>",&gWF.wNUL[
n],32000,0);
653 if(gOPT.output_strain)
gTREE->Branch(TString::Format(
"wSTRAIN_%d",
n).Data(),
"wavearray<double>",&gSTRAIN[
n],32000,0);
654 if(gOPT.output_mdc)
gTREE->Branch(TString::Format(
"wMDC_%d",n).Data(),
"wavearray<double>",&gMDC[n],32000,0);
655 if(gOPT.output_cstrain)
gTREE->Branch(TString::Format(
"wCSTRAIN_%d",n).Data(),
"wavearray<double>",&gCSTRAIN[n],32000,0);
657 if(gOPT.output_cluster) {
660 gTREE->Branch(
"cluster",
"vector<netpixel>",&gWF.pCLUSTER,32000,0);
662 if(gOPT.output_pol) {
663 gTREE->Branch(
"rPOL00",
"wavearray<double>",&gWF.rPOL00,32000,0);
664 gTREE->Branch(
"aPOL00",
"wavearray<double>",&gWF.aPOL00,32000,0);
665 gTREE->Branch(
"rPOL90",
"wavearray<double>",&gWF.rPOL90,32000,0);
666 gTREE->Branch(
"aPOL90",
"wavearray<double>",&gWF.aPOL90,32000,0);
672 if(gOPT.fits_pe!=
"")
gTREE->SetBranchAddress(
"sm_pe_of",&
gSM_PE_OF);
673 if(gOPT.fits_os!=
"")
gTREE->SetBranchAddress(
"sm_os_of",&
gSM_OS_OF);
692 n = ifo->
IWFP.size();
693 for (
int i=0;
i<
n;
i++) {
700 n = ifo->
RWFP.size();
701 for (
int i=0;
i<
n;
i++) {
717 for(
int j=0;
j<token->GetEntries();
j++) {
719 TObjString* tok = (TObjString*)token->At(
j);
720 TString stok = tok->GetString();
722 if(stok.Contains(
"wf_output_enable=")) {
724 wf_output_enable.Remove(0,wf_output_enable.Last(
'=')+1);
725 if(wf_output_enable==
"root") gOPT.output_root=
true;
726 if(wf_output_enable==
"inj") gOPT.output_inj=
true;
727 if(wf_output_enable==
"rec") gOPT.output_rec=
true;
728 if(wf_output_enable==
"wht") gOPT.output_wht=
true;
729 if(wf_output_enable==
"dat") gOPT.output_dat=
true;
730 if(wf_output_enable==
"nul") gOPT.output_nul=
true;
731 if(wf_output_enable==
"strain") gOPT.output_strain=
true;
732 if(wf_output_enable==
"mdc") gOPT.output_mdc=
true;
733 if(wf_output_enable==
"cstrain") gOPT.output_cstrain=
true;
734 if(wf_output_enable==
"cluster") gOPT.output_cluster=
true;
735 if(wf_output_enable==
"pol") gOPT.output_pol=
true;
738 if(stok.Contains(
"wf_output_disable=")) {
739 TString wf_output_disable=stok;
740 wf_output_disable.Remove(0,wf_output_disable.Last(
'=')+1);
741 if(wf_output_disable==
"root") gOPT.output_root=
false;
742 if(wf_output_disable==
"inj") gOPT.output_inj=
false;
743 if(wf_output_disable==
"rec") gOPT.output_rec=
false;
744 if(wf_output_disable==
"wht") gOPT.output_wht=
false;
745 if(wf_output_disable==
"dat") gOPT.output_dat=
false;
746 if(wf_output_disable==
"nul") gOPT.output_nul=
false;
747 if(wf_output_disable==
"strain") gOPT.output_strain=
false;
748 if(wf_output_disable==
"mdc") gOPT.output_mdc=
false;
749 if(wf_output_disable==
"cstrain") gOPT.output_cstrain=
false;
750 if(wf_output_disable==
"cluster") gOPT.output_cluster=
false;
751 if(wf_output_disable==
"pol") gOPT.output_pol=
false;
754 if(stok.Contains(
"wf_fits_pe=")) {
756 wf_fits_pe.Remove(0,wf_fits_pe.Last(
'=')+1);
757 gOPT.fits_pe=wf_fits_pe;
759 if(stok.Contains(
"wf_gps_pe=")) {
761 wf_gps_pe.Remove(0,wf_gps_pe.Last(
'=')+1);
762 if(wf_gps_pe.IsFloat()) gOPT.gps_pe=wf_gps_pe.Atof();
765 if(stok.Contains(
"wf_fits_os=")) {
767 wf_fits_os.Remove(0,wf_fits_os.Last(
'=')+1);
768 gOPT.fits_os=wf_fits_os;
770 if(stok.Contains(
"wf_gps_os=")) {
772 wf_gps_os.Remove(0,wf_gps_os.Last(
'=')+1);
773 if(wf_gps_os.IsFloat()) gOPT.gps_os=wf_gps_os.Atof();
775 if(stok.Contains(
"wf_inj_tstep=")) {
777 wf_inj_tstep.Remove(0,wf_inj_tstep.Last(
'=')+1);
778 if(wf_inj_tstep.IsFloat()) gOPT.inj_tstep=wf_inj_tstep.Atof();
780 if(stok.Contains(
"wf_inj_toff=")) {
782 wf_inj_toff.Remove(0,wf_inj_toff.Last(
'=')+1);
783 if(wf_inj_toff.IsFloat()) gOPT.inj_toff=wf_inj_toff.Atof();
812 cout <<
"-----------------------------------------" << endl;
813 cout <<
"WF config options " << endl;
814 cout <<
"-----------------------------------------" << endl << endl;
816 cout <<
"WF_OUTPUT_ROOT " << gOPT.output_root << endl;
818 cout <<
"WF_OUTPUT_INJ " << gOPT.output_inj << endl;
819 cout <<
"WF_OUTPUT_REC " << gOPT.output_rec << endl;
820 cout <<
"WF_OUTPUT_WHT " << gOPT.output_wht << endl;
821 cout <<
"WF_OUTPUT_DAT " << gOPT.output_dat << endl;
822 cout <<
"WF_OUTPUT_NUL " << gOPT.output_nul << endl;
824 cout <<
"WF_OUTPUT_STRAIN " << gOPT.output_strain << endl;
825 cout <<
"WF_OUTPUT_MDC " << gOPT.output_mdc << endl;
826 cout <<
"WF_OUTPUT_CSTRAIN " << gOPT.output_cstrain << endl;
828 cout <<
"WF_OUTPUT_CLUSTER " << gOPT.output_cluster << endl;
829 cout <<
"WF_OUTPUT_POL " << gOPT.output_pol << endl;
831 cout <<
"WF_FITS_PE " << gOPT.fits_pe << endl;
832 cout <<
"WF_GPS_PE " << gOPT.gps_pe << endl;
833 cout <<
"WF_FITS_OS " << gOPT.fits_os << endl;
834 cout <<
"WF_GPS_OS " << gOPT.gps_os << endl;
836 cout <<
"WF_INJ_TSTEP " << gOPT.inj_tstep << endl;
837 cout <<
"WF_INJ_TOFF " << gOPT.inj_toff << endl;
845 std::vector<wavearray<double> > xWHT;
857 std::vector<wavearray<double> > xINJ;
861 double recTime = EVT->
time[0];
866 double injTime = 1.e12;
868 for(
int m=0;
m<
M;
m++) {
871 if(T<injTime && INJ.
fill_in(NET,mdcID)) {
886 pwfINJ[
n] = INJ.
pwf[
n];
887 if (pwfINJ[
n]==NULL) {
888 cout <<
"CWB_Plugin_WF.C : Error : Injected waveform not saved !!! : detector " 894 rFactor *= factor>0 ?
factor : 1;
908 std::vector<wavearray<double> > xAUX;
912 double recTime = EVT->
time[0];
917 double injTime = 1.e12;
919 for(
int m=0;
m<
M;
m++) {
922 if(T<injTime && INJ.
fill_in(NET,mdcID)) {
930 int J = pD->
IWFP.size();
933 for(
int j=0;
j<J;
j++) {
935 if(mdcID<0 || mdcID==injID)
continue;
939 if(recTime>
start && recTime<stop) auxID =
j;
956 std::vector<wavearray<double> > xREC;
964 int idSize = pd->
RWFID.size();
966 for(
int mm=0; mm<idSize; mm++)
if (pd->
RWFID[mm]==ID) wfIndex=mm;
969 cout <<
"CWB_Plugin_WF.C : Error : Reconstructed waveform not saved !!! : ID -> " 970 << ID <<
" : detector " << NET->
ifoName[
n] << endl;
975 if(wfIndex>=0) pwfREC[
n] = pd->
RWFP[wfIndex];
987 while(!vINJ.empty()) vINJ.pop_back();
988 vINJ.clear(); std::vector<wavearray<double> >().swap(vINJ);
989 while(!cINJ.empty()) cINJ.pop_back();
990 cINJ.clear(); std::vector<wavearray<double> >().swap(cINJ);
991 while(!vREC.empty()) vREC.pop_back();
992 vREC.clear(); std::vector<wavearray<double> >().swap(vREC);
993 while(!vWHT.empty()) vWHT.pop_back();
994 vWHT.clear(); std::vector<wavearray<double> >().swap(vWHT);
995 while(!vDAT.empty()) vDAT.pop_back();
996 vDAT.clear(); std::vector<wavearray<double> >().swap(vDAT);
997 while(!vNUL.empty()) vNUL.pop_back();
998 vNUL.clear(); std::vector<wavearray<double> >().swap(vNUL);
999 while(!vRES.empty()) vRES.pop_back();
1000 vRES.clear(); std::vector<wavearray<double> >().swap(vRES);
1006 std::vector<wavearray<double> > vSIG;
1019 int V4 = V + (V%4 ? 4 - V%4 : 0);
1031 std::vector<float*> _DAT;
1032 std::vector<float*> _vtd;
1033 std::vector<float*> _vTD;
1038 for(i=0; i<
NIFO; i++) {
1039 ptmp = (
float*)_mm_malloc((V4*3+8)*
sizeof(float),32);
1040 for(j=0; j<(V4*3+8); j++) ptmp[j]=0; _DAT.push_back(ptmp);
1041 ptmp = (
float*)_mm_malloc(tsize*V4*
sizeof(
float),32);
1042 for(j=0; j<tsize*V4; j++) ptmp[j]=0; _vtd.push_back(ptmp);
1043 ptmp = (
float*)_mm_malloc(tsize*V4*
sizeof(
float),32);
1044 for(j=0; j<tsize*V4; j++) ptmp[j]=0; _vTD.push_back(ptmp);
1047 std::vector<float*> _AVX;
1049 float* p_et = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1050 for(j=0; j<V4; j++) p_et[j]=0; _AVX.push_back(p_et);
1051 float* pMSK = (
float*)_mm_malloc(V44*
sizeof(
float),32);
1052 for(j=0; j<V44; j++) pMSK[j]=0; _AVX.push_back(pMSK); pMSK[V4]=
nIFO;
1053 float* p_fp = (
float*)_mm_malloc(V44*
sizeof(
float),32);
1054 for(j=0; j<V44; j++) p_fp[j]=0; _AVX.push_back(p_fp);
1055 float* p_fx = (
float*)_mm_malloc(V44*
sizeof(
float),32);
1056 for(j=0; j<V44; j++) p_fx[j]=0; _AVX.push_back(p_fx);
1057 float* p_si = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1058 for(j=0; j<V4; j++) p_si[j]=0; _AVX.push_back(p_si);
1059 float* p_co = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1060 for(j=0; j<V4; j++) p_co[j]=0; _AVX.push_back(p_co);
1061 float* p_uu = (
float*)_mm_malloc((V4+16)*
sizeof(float),32);
1062 for(j=0; j<V4+16; j++) p_uu[j]=0; _AVX.push_back(p_uu);
1063 float* p_UU = (
float*)_mm_malloc((V4+16)*
sizeof(float),32);
1064 for(j=0; j<V4+16; j++) p_UU[j]=0; _AVX.push_back(p_UU);
1065 float* p_vv = (
float*)_mm_malloc((V4+16)*
sizeof(float),32);
1066 for(j=0; j<V4+16; j++) p_vv[j]=0; _AVX.push_back(p_vv);
1067 float* p_VV = (
float*)_mm_malloc((V4+16)*
sizeof(float),32);
1068 for(j=0; j<V4+16; j++) p_VV[j]=0; _AVX.push_back(p_VV);
1069 float* p_au = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1070 for(j=0; j<V4; j++) p_au[j]=0; _AVX.push_back(p_au);
1071 float* p_AU = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1072 for(j=0; j<V4; j++) p_AU[j]=0; _AVX.push_back(p_AU);
1073 float* p_av = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1074 for(j=0; j<V4; j++) p_av[j]=0; _AVX.push_back(p_av);
1075 float* p_AV = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1076 for(j=0; j<V4; j++) p_AV[j]=0; _AVX.push_back(p_AV);
1077 float* p_uv = (
float*)_mm_malloc(V4*4*
sizeof(
float),32);
1078 for(j=0; j<V4*4; j++) p_uv[j]=0; _AVX.push_back(p_uv);
1079 float* p_ee = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1080 for(j=0; j<V4; j++) p_ee[j]=0; _AVX.push_back(p_ee);
1081 float* p_EE = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1082 for(j=0; j<V4; j++) p_EE[j]=0; _AVX.push_back(p_EE);
1083 float* pTMP=(
float*)_mm_malloc(V4*4*NIFO*
sizeof(
float),32);
1084 for(j=0; j<V4*4*
NIFO; j++) pTMP[j]=0; _AVX.push_back(pTMP);
1085 float* p_ni = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1086 for(j=0; j<V4; j++) p_ni[j]=0; _AVX.push_back(p_ni);
1087 float* p_ec = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1088 for(j=0; j<V4; j++) p_ec[j]=0; _AVX.push_back(p_ec);
1089 float* p_gn = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1090 for(j=0; j<V4; j++) p_gn[j]=0; _AVX.push_back(p_gn);
1091 float* p_ed = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1092 for(j=0; j<V4; j++) p_ed[j]=0; _AVX.push_back(p_ed);
1093 float* p_rn = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1094 for(j=0; j<V4; j++) p_rn[j]=0; _AVX.push_back(p_rn);
1097 for(
int j=0; j<V; j++) {
1099 if(!pix->
core)
continue;
1112 for(
int i=0; i<
NIFO; i++) {
1130 std::vector<netpixel> vPIX =
SavePixels(NET, cfg, lag,
id);
1132 for(
int j=0; j<V; j++) {
1134 pix->
likelihood = (pMSK[
j]>0) ? (p_ee[j]+p_EE[j])/2 : 0;
1135 if(pMSK[j]>0) pix->
core =
true;
1137 for(
int i=0; i<
nIFO; i++) {
1138 pix->
setdata(
double(pd[i][j]),
'S',i);
1139 pix->
setdata(
double(pD[i][j]),
'P',i);
1148 for(
int i=0; i<
nIFO; i++) {
1152 sprintf(title,
"%s (TIME) : vREC(red) - vSIG(blue)",NET->
ifoName[i]);
1153 sprintf(ofname,
"%s_vREC_vSIG_time_id_%d.%s",NET->
ifoName[i],
id,
"root");
1154 PlotWaveform(ofname, title, cfg, &vREC[i], &vSIG[i], NULL, &vREC[i],
false);
1156 sprintf(title,
"%s (TIME) : vINJ(red) - vSIG(blue)",NET->
ifoName[i]);
1157 sprintf(ofname,
"%s_vINJ_vSIG_time_id_%d.%s",NET->
ifoName[i],
id,
"root");
1158 PlotWaveform(ofname, title, cfg, &vINJ[i], &vSIG[i], NULL, &vREC[i],
false);
1162 sprintf(title,
"%s (TIME) : vREC(red) - cREC-vSIG(blue)",NET->
ifoName[i]);
1163 sprintf(ofname,
"%s_cINJ_vREvSIG_id_%d.%s",NET->
ifoName[i],
id,
"root");
1164 PlotWaveform(ofname, title, cfg, &vREC[i], &wDIF[i], NULL, &vREC[i],
false);
1178 if(type!=
'j' && type!=
'r' && type!=
'v' && type!=
'd' && type!=
'x') {
1179 cout <<
"Wave2Sparse - Error : wrong wave type" << endl;
exit(1);
1186 if(type==
'v') vSS[
n]=pD->
vSS;
1187 if(type==
'r') rSS[
n]=pD->
vSS;
1188 if(type==
'j') jSS[
n]=pD->
vSS;
1189 if(type==
'd') dSS[
n]=pD->
vSS;
1190 if(type==
'x') xSS[
n]=pD->
vSS;
1192 if(type==
'v')
return;
1200 WF[
n].
rate(vSS[
n][0].wdm_rate);
1201 WF[
n].
start(vSS[
n][0].wdm_start);
1205 for (
int i=0;
i<vINJ[
n].size();
i++) WF[
n][wos+
i] = vINJ[
n][
i];
1209 for (
int i=0;
i<vREC[
n].size();
i++) WF[
n][wos+
i] = vREC[
n][
i];
1213 for (
int i=0;
i<vDAT[
n].size();
i++) WF[
n][wos+
i] = vDAT[
n][
i];
1217 for (
int i=0;
i<vRES[
n].size();
i++) WF[
n][wos+
i] = vRES[
n][
i];
1220 #ifdef SAVE_WAVE2SPARSE_PLOT 1225 if(type==
'r') gfile=TString::Format(
"%s/WAVE2SPARSE_REC_%s.root",
".",NET->
ifoName[n]);
1226 if(type==
'j') gfile=TString::Format(
"%s/WAVE2SPARSE_INJ_%s.root",
".",NET->
ifoName[n]);
1227 if(type==
'd') gfile=TString::Format(
"%s/WAVE2SPARSE_DAT_%s.root",
".",NET->
ifoName[n]);
1228 if(type==
'x') gfile=TString::Format(
"%s/WAVE2SPARSE_RES_%s.root",
".",NET->
ifoName[n]);
1243 if(type==
'r') size = rSS[
n][
k].sparseMap00.size();
1244 if(type==
'j') size = jSS[
n][
k].sparseMap00.size();
1245 if(type==
'd') size = dSS[
n][
k].sparseMap00.size();
1246 if(type==
'x') size = xSS[
n][
k].sparseMap00.size();
1250 if(type==
'r') index = rSS[
n][
k].sparseIndex[
j];
1251 if(type==
'j') index = jSS[
n][
k].sparseIndex[
j];
1252 if(type==
'd') index = dSS[
n][
k].sparseIndex[
j];
1253 if(type==
'x') index = xSS[
n][
k].sparseIndex[
j];
1257 rSS[
n][
k].sparseMap00[
j]=v00;
1258 rSS[
n][
k].sparseMap90[
j]=v90;
1261 jSS[
n][
k].sparseMap00[
j]=v00;
1262 jSS[
n][
k].sparseMap90[
j]=v90;
1265 dSS[
n][
k].sparseMap00[
j]=v00;
1266 dSS[
n][
k].sparseMap90[
j]=v90;
1269 xSS[
n][
k].sparseMap00[
j]=v00;
1270 xSS[
n][
k].sparseMap90[
j]=v90;
1292 bool fft,
TString pdir,
double P, EColor col1, EColor col2, EColor col3) {
1294 watplot PTS(const_cast<char*>(
"ptspe"),200,20,800,500);
1298 if(wref==NULL)
return;
1299 if(wf1==NULL)
return;
1300 else tmin=wf1->
start();
1301 if(wf2!=NULL)
if(wf2->
start()<tmin) tmin=wf2->
start();
1302 if(wf3!=NULL)
if(wf3->
start()<tmin) tmin=wf3->
start();
1307 if(wf2!=NULL)
if(wf2!=wf1) wf2->
start(wf2->
start()-tmin);
1308 if(wf3!=NULL)
if(wf3!=wf1 && wf3!=wf2) wf3->
start(wf3->
start()-tmin);
1309 if(wref!=wf1 && wref!=wf2 && wref!=wf3) wref->
start(wref->
start()-tmin);
1316 for(
int i=0;
i<wf1->
size();
i++) {
1318 if(time>bT && time<eT) wf[k++]=wf1->
data[
i];
1321 PTS.
plot(&wf, const_cast<char*>(
"AL"), col1, 0, 0,
true, cfg->
fLow, cfg->
fHigh);
1323 PTS.
plot(wf1, const_cast<char*>(
"AL"), col1, bT, eT);
1324 PTS.
graph[0]->GetXaxis()->SetRangeUser(bT, eT);
1326 PTS.
graph[0]->SetLineWidth(1);
1327 PTS.
graph[0]->SetTitle(title);
1329 TString xtitle = TString::Format(
"Time (sec) : GPS OFFSET = %.3f",tmin);
1330 PTS.
graph[0]->GetXaxis()->SetTitle(xtitle);
1336 for(
int i=0;
i<wf2->
size();
i++) {
1338 if(time>bT && time<eT) wf[k++]=wf2->
data[
i];
1341 PTS.
plot(&wf, const_cast<char*>(
"SAME"), col2, 0, 0,
true, cfg->
fLow, cfg->
fHigh);
1344 if(wf2!=NULL) PTS.
plot(wf2, const_cast<char*>(
"SAME"), col2, 0, 0);
1346 if(wf2!=NULL) PTS.
graph[1]->SetLineWidth(2);
1353 for(
int i=0;
i<wf3->
size();
i++) {
1355 if(time>bT && time<eT) wf[k++]=wf3->
data[
i];
1358 PTS.
plot(&wf, const_cast<char*>(
"SAME"), col3, 0, 0,
true, cfg->
fLow, cfg->
fHigh);
1361 if(wf3!=NULL) PTS.
plot(wf3, const_cast<char*>(
"SAME"), col3, 0, 0);
1363 if(wf3!=NULL) PTS.
graph[2]->SetLineWidth(1);
1367 if(wf2!=NULL)
if(wf2!=wf1) wf2->
start(wf2->
start()+tmin);
1368 if(wf3!=NULL)
if(wf3!=wf1 && wf3!=wf2) wf3->
start(wf3->
start()+tmin);
1369 if(wref!=wf1 && wref!=wf2 && wref!=wf3) wref->
start(wref->
start()+tmin);
1378 PTS.
canvas->Print(ofname);
1379 cout <<
"write : " << ofname << endl;
1389 skymap skyprob = skyprobcc;
1392 std::vector<float>* vP;
1393 std::vector<int>* vI;
1395 vP = &(NET->
wc_List[lag].p_Map[ID-1]);
1396 vI = &(NET->
wc_List[lag].p_Ind[ID-1]);
1399 for(
int j=0;
j<
int(vP->size());
j++) {
1405 skyprob.
set(k,(*vP)[
j]);
1407 ra = skyprob.
getRA(i);
1409 skyprobcc.
set(k,(*vP)[j]);
1413 sprintf(fname,
"skyprobcc_%d.%s", ID,
"fits");
1414 skyprobcc.Dump2fits(const_cast<char*>(fname),EVT->
time[0],const_cast<char*>(
""),const_cast<char*>(
"PROB"),const_cast<char*>(
"pix-1"),
'C');
1424 skymap skyprob = skyprobcc;
1427 std::vector<float>* vP;
1428 std::vector<int>* vI;
1430 vP = &(NET->
wc_List[lag].p_Map[ID-1]);
1431 vI = &(NET->
wc_List[lag].p_Ind[ID-1]);
1434 for(
int j=0;
j<
int(vP->size());
j++) {
1440 skyprob.
set(k,(*vP)[
j]);
1442 ra = skyprob.
getRA(i);
1444 skyprobcc.
set(k,(*vP)[j]);
1458 double* prob =
new double[
L];
1459 for(
int l=0;
l<
L;
l++) {
1460 prob[
l] = csm.
get(
l);
1461 integral += prob[
l];
1464 TMath::Sort(L,prob,index,
false);
1466 for(
int l=0;
l<
L;
l++) {
1469 csm.
set(m,cumul/integral);
1473 for(
int l=0;
l<
L;
l++) {
1476 if(p1*p2>max) max=p1*
p2;
1485 int L = sm1->
size();
1490 for(
int l=0;
l<
L;
l++) {
1498 double OF = pp12/sqrt(pp11*pp22);
1518 for(
int l=0;
l<
L;
l++) {
1519 double p = sm->
get(
l);
1522 double xphi = sm->
RA2phi(phi, gps);
1530 std::vector<netpixel>
1535 std::vector<netpixel> vPIX;
1539 if(V>cfg->
BATCH)
return vPIX;
1541 for(
int j=0;
j<V;
j++) {
1543 vPIX.push_back(*pix);
1554 if(V>cfg->
BATCH)
return;
1555 for(
int j=0;
j<V;
j++) {
1560 while(!vPIX->empty()) vPIX->pop_back();
1561 vPIX->clear(); std::vector<netpixel>().swap(*vPIX);
1570 double tdelay = MDC.
GetDelay(ifo,
"",phi,theta);
1571 double ifo_tcoa = geocentric_tcoa+tdelay;
1580 std::vector<netpixel> vPIX;
1585 for(
int j=0;
j<V;
j++) {
1587 vPIX.push_back(*pix);
monster wdmMRA
list of pixel pointers for MRA
std::vector< char * > ifoName
detector * getifo(size_t n)
param: detector index
double GetSparseMapData(SSeries< double > *SS, bool phase, int index)
skymap EarthCoordinatesSM(skymap *sm, double gps)
#define WF_OUTPUT_CLUSTER
Float_t * rho
biased null statistics
std::vector< wavearray< double > > vWHT
std::vector< wavearray< double > > wREC[MAX_TRIALS]
std::vector< netcluster > wc_List
void setSLags(float *slag)
std::vector< wavearray< double > > GetInjWaveform(network *NET, netevent *EVT, int id, double factor)
std::vector< double > * getmdcTime()
std::vector< wavearray< double > > vDAT
std::vector< wavearray< double > > wNUL[PE_MAX_EVENTS]
std::vector< wavearray< double > > GetSigWaveform(network *NET, CWB::config *cfg, int lag, int id)
#define WF_OUTPUT_CSTRAIN
virtual void rate(double r)
wavearray< double > gCSTRAIN[NIFO_MAX]
wavearray< float > _avx_norm_ps(float **, float **, std::vector< float *> &, int)
std::vector< netpixel > SavePixels(network *NET, CWB::config *cfg, int lag, int id)
std::vector< SSeries< double > > dSS[NIFO_MAX]
std::vector< SSeries< double > > jSS[NIFO_MAX]
void set(size_t i, double a)
Int_t * size
cluster volume
std::vector< wavearray< double > > cINJ
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
std::vector< pixdata > data
wavearray< double > get(char *name, size_t index=0, char atype='R', int type=1, bool=true)
param: string with parameter name param: index in the amplitude array, which define detector param: c...
std::vector< wavearray< double > * > RWFP
skymap ReadSkyMap(TString fitsFile, CWB::config *cfg, double gps)
void PlotWaveform(TString ofname, TString title, CWB::config *cfg, wavearray< double > *wf1, wavearray< double > *wf2, wavearray< double > *wf3, wavearray< double > *wref, bool fft=false, TString pdir="", double P=0.99, EColor col1=kRed, EColor col2=kBlue, EColor col3=(EColor) 418)
std::vector< TGraph * > graph
void RestorePixels(network *NET, CWB::config *cfg, netcluster *pwc, std::vector< netpixel > *vPIX, int id)
double getTheta(size_t i)
std::vector< double > gvTCOA
WSeries< double > waveBand
virtual void start(double s)
bool getMRAwave(size_t ID, size_t lag, char atype='S', int mode=0, bool tof=false)
std::vector< double > mdcTime
void plot(wavearray< double > &, char *=NULL, int=1, double=0., double=0., bool=false, float=0., float=0., bool=false, float=0., bool=false)
wavearray< int > sparseIndex
double GetDelay(TString ifo1, TString ifo2, double phi, double theta)
void dopen(const char *fname, char *mode, bool header=true)
std::vector< wavearray< double > > vNUL
watplot p2(const_cast< char *>("TFMap2"))
size_t getSkyIndex(double th, double ph)
param: theta param: phi
std::vector< wavearray< double > > vREC
virtual size_t size() const
std::vector< SSeries< double > > xSS[NIFO_MAX]
wavearray< double > gHOT[NIFO_MAX]
void output2G(TTree *, network *, size_t, int, double)
static float _avx_packet_ps(float **p, float **q, std::vector< float *> &pAVX, int I)
static double GetMatchFactor(TString match, vector< wavearray< double > > &w1, vector< wavearray< double > > &w2, vector< double > tstart=DEFAULT_VECtOR_DOUBLE, vector< double > tstop=DEFAULT_VECtOR_DOUBLE)
Int_t Psave
number of detectors
skymap GetSkyMap(network *NET, int lag, netevent *EVT, int ID)
#define IMPORT(TYPE, VAR)
xtalk getXTalk(int nLay1, size_t indx1, int nLay2, size_t indx2)
param: numbers of layers identifying the resolution of the first pixel param: TF map index of the fir...
Double_t * gps
average center_of_gravity time
wavearray< int > sparseLookup
std::vector< SSeries< double > > vSS[NIFO_MAX]
wavearray< double > gMDC[NIFO_MAX]
watplot p1(const_cast< char *>("TFMap1"))
static wavearray< double > GetAligned(wavearray< double > *w1, wavearray< double > *w2)
std::vector< std::string > mdcList
void Resample(const wavearray< DataType_t > &, double, int=6)
static void _avx_free_ps(std::vector< float *> &v)
std::vector< WDM< double > * > wdmList
printf("total live time: non-zero lags = %10.1f \, liveTot)
TIter next(twave->GetListOfBranches())
std::vector< wavearray< double > > vAUX
void DumpSkymap(network *NET, int lag, netevent *EVT, int ID)
std::vector< string > gvLOG
Float_t * netcc
effective correlated SNR
void DumpOutputFile(network *NET, netevent *&EVT, CWB::config *cfg, int ID, int k, int factor)
std::vector< wavearray< double > * > IWFP
std::vector< wavearray< double > > GetWhitenedData(network *NET, CWB::config *cfg)
double RA2phi(double ph, double gps)
void ClearWaveforms(detector *ifo)
void ReadUserOptions(TString options)
std::vector< netpixel > GetCluster(network *NET, int lag, int id)
static double TimeSync(wavearray< double > &w1, wavearray< double > &w2, double &sync_time)
static double GetTimeBoundaries(wavearray< double > x, double P, double &bT, double &eT, double T=-1., double Q=-1.)
double ComputeMaxSkyMapProduct(skymap *sm1, skymap *sm2)
std::vector< wavearray< double > > wAUX[PE_MAX_EVENTS]
netpixel * getPixel(size_t n, size_t i)
void Wave2Sparse(network *NET, CWB::config *cfg, char type)
Float_t * phi
sqrt(h+*h+ + hx*hx)
void PrintUserOptions(CWB::config *cfg)
netevent EVT(itree, nifo)
Float_t * theta
[0]-reconstructed, [1]-injected phi angle, [2]-RA
Double_t * time
beam pattern coefficients for hx
double GetInjTcoa(double geocentric_tcoa, network *NET, TString ifo, double theta, double phi)
static float _avx_setAMP_ps(float **p, float **q, std::vector< float *> &pAVX, int I)
std::vector< wavearray< double > > GetRecWaveform(network *NET, netevent *EVT, int id)
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *NET, WSeries< double > *x, TString ifo, int type)
COHERENCE.
static wavearray< double > GetDiff(wavearray< double > *w1, wavearray< double > *w2)
WSeries< double > waveForm
double fabs(const Complex &x)
wavearray< float > sparseMap00
wavearray< float > sparseMap90
std::vector< netpixel > gCLUSTER
void Forward(int n=-1)
param: wavelet - n is number of steps (-1 means full decomposition)
netcluster * getwc(size_t n)
param: delay index
std::vector< SSeries< double > > rSS[NIFO_MAX]
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
static float _avx_loadata_ps(float **p, float **q, float **u, float **v, float En, std::vector< float *> &pAVX, int I)
void set(size_t i, double a)
param: sky index param: value to set
std::vector< wavearray< double > > GetWaveform(network *NET, int lag, int id, char type, bool shift=true)
double factors[FACTORS_MAX]
double get(size_t i)
param: sky index
WaveDWT< DataType_t > * pWavelet
wavearray< double > gSTRAIN[NIFO_MAX]
wavearray< double > wINJ[NIFO_MAX]
Bool_t fill_in(network *, int, bool=true)
double ComputeSkyMapOF(skymap *sm1, skymap *sm2)
std::vector< SSeries< double > > vSS
WSeries< double > waveNull
size_t getmdc__ID(size_t n)
wavearray< double > ** pwf
[x1,y1,z1,x2,y2,z2] components of spin vector
virtual void resize(unsigned int)
wavearray< double > r90_POL[2]
buffer for standard response 00 ampl
std::vector< wavearray< double > > vINJ
void Draw(GWAT_DRAW type=GWAT_TIME, TString options="ALP", Color_t color=kBlack)
std::vector< wavearray< double > > GetAuxWaveform(network *NET, netevent *EVT, int id, double factor)
int binarySearch(int array[], int start, int end, int key)
bool setdata(double a, char type='R', size_t n=0)
void SetOutputFile(network *NET, netevent *&EVT, CWB::config *cfg, bool dump_wf)
wavearray< double > r00_POL[2]
buffer for projection on network plane 90 ampl
std::vector< wavearray< double > > vRES