21 #pragma GCC system_header 28 #include "TObjArray.h" 29 #include "TObjString.h" 32 #include "TGraphAsymmErrors.h" 121 #define nTRIALS 100 // number of trials for noise statistic (GetNoiseStatistic) 123 #define PE_INDEX "$HOME_CWB/www/pe_index_modern.html" // html template used for pe index report page 126 #define PLOT_TYPE "png" 130 #define PLOT_MEDIAN // plot median,lower50 boud,upper50 bound,lower90 boud,upper90 bound 134 #define SKYMASK_RADIUS 0.1 // used to define skymask 136 #define MAX_TRIALS 1000 138 #define EFRACTION_CUT 0.98 // energy threshold for time and frequency cuts 142 #define PE_TRIALS 100 // number of trials 143 #define PE_SIGNAL 0 // signal used for trials : 0/1/2 reconstructed/injected/(original=reconstructed+noise) 145 #define PE_NOISE 1 // noise used for trials : 0/1/2 149 #define PE_AMP_CAL_ERR 0 // max percentage of amplitude miscalibration if>0 (uniform in -max,+max) else (gaus(max)) 150 #define PE_PHS_CAL_ERR 0 // max phase (degrees) of phase miscalibration if>0 (uniform in -max,+max) else (gaus(max)) 151 #define PE_SKYMASK 0 // skymask used for trials : 0(def)/1/2 155 #define PE_SEED 0 // 0 : seed used by PE for ramdom generation 156 #define PE_GPS 0 // default 0 - if >0 only gps +/- iwindow is analyzed 158 #define PE_MULTITASK false // if enabled, PE trials are executed by different jobs in multitask : only simulation=0 and single event (gps>0) 160 #define NOISE_SIGMA 1.0 // noise sigma used in AddNoiseAndCalErrToSparse 162 #define PE_CED_DUMP -1 // dump CED at gLRETRY=PE_CED_DUMP 164 #define PE_CED_TFMAP true // Shows the Time-Frequency Maps -> Spectrograms, Scalograms, TF Like,Null 165 #define PE_CED_RDR true // Shows Reconstructed Detector Response tab 166 #define PE_CED_PSD true // Shows Power Spectral Density tab 167 #define PE_CED_SKYMAP true // Shows SkyMaps 168 #define PE_CED_REC true // Shows Reconstructed Waveforms/Instantaneous-Frequency with errors 169 #define PE_CED_INJ true // Shows Injected vs Reconstructed Waveforms/Instantaneous-Frequency with errors 170 #define PE_CED_rINJ false // Shows Reduced Injected vs Reconstructed Waveforms with errors 171 #define PE_CED_CM true // Shows Chirp Mass Value/Error Distributions 172 #define PE_CED_DISTR false // Shows Residuals Distributions 173 #define PE_CED_NULL true // Shows Null Pixels Distributions 174 #define PE_CED_PCA false // Shows PCA likelihood TF plot 176 #define PE_OUTPUT_INJ false // save injected into the output root file 177 #define PE_OUTPUT_REC false // save reconstructed into the output root file 178 #define PE_OUTPUT_WHT false // save whitened data into the output root file 179 #define PE_OUTPUT_DAT false // save rec+nois data into the output root file 180 #define PE_OUTPUT_MED false // save median into the output root file 181 #define PE_OUTPUT_P50 false // save percentile 50 into the output root file 182 #define PE_OUTPUT_P90 false // save percentile 90 into the output root file 183 #define PE_OUTPUT_AVR false // save averaged into the output root file 184 #define PE_OUTPUT_RMS false // save rms into the output root file 251 bool fft=
false,
TString pdir=
"",
double P=0.99, EColor col1=kRed, EColor col2=kBlue, EColor col3=(EColor)418);
393 std::vector<wavearray<double> >
vINJ;
394 std::vector<wavearray<double> >
vREC;
395 std::vector<wavearray<double> >
vWHT;
396 std::vector<wavearray<double> >
vPCA;
397 std::vector<wavearray<double> >
vDAT;
398 std::vector<wavearray<double> >
vNUL;
399 std::vector<wavearray<double> >
cINJ;
401 std::vector<wavearray<double> >
vAVR;
402 std::vector<wavearray<double> >
vRMS;
404 std::vector<wavearray<double> >
vMED;
405 std::vector<wavearray<double> >
vL50;
406 std::vector<wavearray<double> >
vU50;
407 std::vector<wavearray<double> >
vL90;
408 std::vector<wavearray<double> >
vU90;
410 std::vector<wavearray<double> >
fREC;
411 std::vector<wavearray<double> >
fINJ;
412 std::vector<wavearray<double> >
fAVR;
413 std::vector<wavearray<double> >
fRMS;
415 std::vector<wavearray<double> >
fMED;
416 std::vector<wavearray<double> >
fL50;
417 std::vector<wavearray<double> >
fU50;
418 std::vector<wavearray<double> >
fL90;
419 std::vector<wavearray<double> >
fU90;
464 if(gCWB2G->
istage!=
CWB_STAGE_FULL) {cout<<
"CWB_Plugin_PE - Error : PE can be executed only in CWB_STAGE_FULL mode" << endl;
exit(1);}
467 cout <<
"CWB_Plugin_PE Error : PE enable only with pattern>0 !!!" << endl;
477 TString cwb_inet_options=
TString(gSystem->Getenv(
"CWB_INET_OPTIONS"));
480 if(gOPT.ced_inj && gOPT.ced_rinj) gOPT.ced_rinj=
false;
484 cout<<
"CWB_Plugin_PE - Error : when simulation=4, PE multitask can be executed only with nfactors=1" << endl;
exit(1);
490 if(gOPT.output_inj || gOPT.output_rec ||
491 gOPT.output_med || gOPT.output_p50 ||
492 gOPT.output_p90 || gOPT.output_avr ||
493 gOPT.output_rms || gOPT.output_wht || gOPT.output_dat) cfg->
online=
true;
502 if(gtrial.CompareTo(
"")!=0) {
503 if(!gtrial.IsDigit()) {cout<<
"CWB_Plugin_PE - Error : when simulation=0, CWB_MDC_FACTOR must be an interger > 0" << endl;
exit(1);}
504 gMTRIAL=gtrial.Atoi();
505 if(gMTRIAL==0) {cout<<
"CWB_Plugin_PE - Error : when simulation=0, CWB_MDC_FACTOR must be an interger > 0" << endl;
exit(1);}
506 if(gMTRIAL!=gOPT.trials) {
509 cout <<
"CWB_Plugin_PE - MultiTask Mode : new data_label = " << cfg->
data_label << endl;
512 gOPT.output_inj=
false;
513 gOPT.output_rec=
false;
514 gOPT.output_wht=
false;
515 gOPT.output_dat=
false;
516 gOPT.output_med=
false;
517 gOPT.output_p50=
false;
518 gOPT.output_p90=
false;
519 gOPT.output_avr=
false;
520 gOPT.output_rms=
false;
524 bool last_trial = (gMTRIAL==gOPT.trials) ?
true :
false;
525 if(!last_trial) {gOPT.trials=1;gMTRIAL*=-1;}
531 gRandom->SetSeed(gOPT.seed);
537 if(gOPT.signal!=0 && gOPT.signal!=1 && gOPT.signal!=2) {
539 cout <<
"CWB_Plugin_PE Error : option pe_signal not allowed : must be (0/1/2) !!!" << endl;
546 cout <<
"CWB_Plugin_PE Error : option pe_signal=1 is allowed only in simulation mode !!!" << endl;
553 cout <<
"CWB_Plugin_PE Error : option pe_skymask=3 is allowed only in simulation mode !!!" << endl;
564 cout <<
"CWB_Plugin_PE - Error : gps time must be within the segment interval: " 577 cout <<
"CWB_Plugin_PE Error : detected " << NET->
mdcTime.size() <<
" injections." 578 <<
" Must be only one injection per segment !!!" << endl;
594 if(gOPT.multitask)
EXPORT(
int,gLRETRY,
"gLRETRY = 1;")
595 else EXPORT(
int,gLRETRY,TString::Format(
"gLRETRY = %d;",gOPT.trials).Data())
603 if(cid.
size()==0)
return;
606 if(gOPT.trials==0)
return;
609 int gLRETRY=-1;
IMPORT(
int,gLRETRY)
611 cout <<
"-------------------------------------------------------------------" << endl;
612 cout <<
"-----> CWB_Plugin_PE.C -> ID : " << ID
613 <<
" -> gLRETRY : " << gLRETRY <<
"/" << gOPT.trials << endl;
614 cout <<
"-------------------------------------------------------------------" << endl;
620 if(gLRETRY==gOPT.trials) {
629 if(gLRETRY!=gOPT.trials) {
632 if(gOPT.skymask==1) {
634 int isky = (
int)gHSKYPROB.GetRandom();
635 double th = 90-gSKYPROB.
getTheta(isky);
640 if(gOPT.skymask==2) {
644 if(gOPT.skymask==3) {
653 if(gOPT.signal==0) jtype=
'r';
654 if(gOPT.signal==1) jtype=
'j';
655 if(gOPT.signal==2) jtype=
'v';
660 if((gOPT.ced_dump>=0) && (gLRETRY==gOPT.ced_dump)) cfg->
cedDump=
true;
667 if((gLRETRY==0)&&(gMTRIAL==gOPT.trials)) {
692 int gLRETRY=-1;
IMPORT(
int,gLRETRY)
710 for(
int k=0;
k<
K;
k++) {
712 id = NET->
getwc(
k)->
get(const_cast<char*>(
"ID"), 0,
'L', rate);
718 int ID = size_t(
id.data[
j]+0.5);
725 iSNR[
n].push_back(EVT->
iSNR[
n]);
726 oSNR[
n].push_back(EVT->
oSNR[
n]);
727 ioSNR[
n].push_back(EVT->
ioSNR[
n]);
729 for(
int n=0;
n<6;
n++) {
730 vCHIRP[
n].push_back(EVT->
chirp[
n]);
736 cout <<
"event parameters : ID -> " << ID << endl;
738 cout <<
"rec_theta : " << EVT->
theta[0] <<
" rec_phi : " << EVT->
phi[0] << endl;
739 cout <<
"SNRnet : " << sqrt(EVT->
likelihood) <<
" netcc[0] : " << EVT->
netcc[0]
740 <<
" rho[0] : " << EVT->
rho[0] <<
" size : " << EVT->
size[0] << endl;
751 if((gLRETRY==gOPT.trials) || (gOPT.multitask && gLRETRY==1)) {
755 if(vINJ.size()!=
nIFO) {
756 cout <<
"CWB_Plugin_PE Error : Injection Waveform Not Found !!!" << endl;
791 gSEGGPS = EVT->
gps[0];
792 gITHETA = EVT->
theta[1]; gIPHI = EVT->
phi[1];
793 gOTHETA = EVT->
theta[3]; gOPHI = EVT->
phi[3];
802 if(gLRETRY!=gOPT.trials) {
823 cout <<
"dirCED : " << dirCED << endl;
833 gStyle->SetOptFit(1111);
847 gStyle->SetOptFit(0000);
875 int gLRETRY=-1;
IMPORT(
int,gLRETRY)
879 cout <<
"-------------------------------------------------------------------" << endl;
880 cout <<
"-----> CWB_Plugin_PE.C -> RedoAnalysis : " 881 <<
" -> gLRETRY : " << gLRETRY <<
"/" << gOPT.trials << endl;
882 cout <<
"-------------------------------------------------------------------" << endl;
884 EXPORT(
int,gLRETRY,TString::Format(
"gLRETRY = %d;",--gLRETRY).Data())
885 }
while(csize==0 && gLRETRY>0);
886 EXPORT(
int,gLRETRY,TString::Format(
"gLRETRY = %d;",++gLRETRY).Data())
906 std::vector<netpixel> vPIX;
910 if(V>cfg->
BATCH)
return vPIX;
915 __m128* _xi = (__m128*) xi.
data;
916 __m128* _XI = (__m128*) XI.
data;
918 __m128* _aa = (__m128*) NET->
a_00.
data;
919 __m128* _AA = (__m128*) NET->
a_90.
data;
922 for(
int j=0;
j<V;
j++) {
927 if(ee>En) nPC++;
else ee=0.;
934 for(
int j=0;
j<V;
j++) {
936 vPIX.push_back(*pix);
954 if(V>cfg->
BATCH)
return;
955 for(
int j=0;
j<V;
j++) {
960 while(!vPIX->empty()) vPIX->pop_back();
961 vPIX->clear(); std::vector<netpixel>().swap(*vPIX);
966 std::vector<wavearray<double> > xPCA;
968 std::vector<netpixel> vPIX;
969 vPIX =
DoPCA(NET, cfg, lag,
id);
991 std::vector<netpixel> vPIX;
992 vPIX =
DoPCA(NET, cfg, lag,
id);
997 TString xtitle = TString::Format(
"Time (sec) : GPS OFFSET = %.3f",EVT->
gps[0]);
1002 sprintf(fname,
"%s/pca_l_tfmap_scalogram.png",pdir.Data());
1003 cout <<
"write " << fname << endl;
1004 WTS.
plot(pwc, 1, nIFO,
'L', 0, const_cast<char*>(
"COLZ"));
1005 WTS.
hist2D->GetYaxis()->SetRangeUser(EVT->
low[0],EVT->
high[0]);
1006 WTS.
hist2D->GetXaxis()->SetTitle(xtitle);
1007 WTS.
canvas->Print(fname);
1017 ResetPCA(NET, cfg, pwc, &vPIX,
id);
1023 std::vector<wavearray<double> > xINJ;
1027 double recTime = EVT->
time[0];
1032 double injTime = 1.e12;
1034 for(
int m=0;
m<
M;
m++) {
1037 if(T<injTime && INJ.
fill_in(NET,mdcID)) {
1052 pwfINJ[
n] = INJ.
pwf[
n];
1053 if (pwfINJ[
n]==NULL) {
1054 cout <<
"CWB_Plugin_Boostrap.C : Error : Injected waveform not saved !!! : detector " 1059 double rFactor = 1.;
1060 rFactor *= factor>0 ?
factor : 1;
1063 xINJ.push_back(*wf);
1074 std::vector<wavearray<double> > xREC;
1082 int idSize = pd->
RWFID.size();
1084 for(
int mm=0; mm<idSize; mm++)
if (pd->
RWFID[mm]==ID) wfIndex=mm;
1087 cout <<
"CWB_Plugin_Boostrap.C : Error : Reconstructed waveform not saved !!! : ID -> " 1088 << ID <<
" : detector " << NET->
ifoName[
n] << endl;
1091 if(wfIndex>=0) pwfREC[
n] = pd->
RWFP[wfIndex];
1094 xREC.push_back(*wf);
1103 if(type!=
'S' && type!=
's' && type!=
'W' && type!=
'w' && type!=
'N' && type!=
'n') {
1104 cout <<
"GetWaveform : not valid type : Abort" << endl;
exit(1);
1107 std::vector<wavearray<double> > vWAV;
1112 if(type==
'S' || type==
's') {
1119 vWAV.push_back(*wf);
1123 if(type==
'W' || type==
'w') {
1130 vWAV.push_back(*wf);
1134 if(type==
'N' || type==
'n') {
1144 vWAV.push_back(*wf);
1154 std::vector<wavearray<double> > vSIG;
1167 int V4 = V + (V%4 ? 4 - V%4 : 0);
1179 std::vector<float*> _DAT;
1180 std::vector<float*> _vtd;
1181 std::vector<float*> _vTD;
1186 for(i=0; i<
NIFO; i++) {
1187 ptmp = (
float*)_mm_malloc((V4*3+8)*
sizeof(float),32);
1188 for(j=0; j<(V4*3+8); j++) ptmp[j]=0; _DAT.push_back(ptmp);
1189 ptmp = (
float*)_mm_malloc(tsize*V4*
sizeof(
float),32);
1190 for(j=0; j<tsize*V4; j++) ptmp[j]=0; _vtd.push_back(ptmp);
1191 ptmp = (
float*)_mm_malloc(tsize*V4*
sizeof(
float),32);
1192 for(j=0; j<tsize*V4; j++) ptmp[j]=0; _vTD.push_back(ptmp);
1195 std::vector<float*> _AVX;
1197 float* p_et = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1198 for(j=0; j<V4; j++) p_et[j]=0; _AVX.push_back(p_et);
1199 float* pMSK = (
float*)_mm_malloc(V44*
sizeof(
float),32);
1200 for(j=0; j<V44; j++) pMSK[j]=0; _AVX.push_back(pMSK); pMSK[V4]=
nIFO;
1201 float* p_fp = (
float*)_mm_malloc(V44*
sizeof(
float),32);
1202 for(j=0; j<V44; j++) p_fp[j]=0; _AVX.push_back(p_fp);
1203 float* p_fx = (
float*)_mm_malloc(V44*
sizeof(
float),32);
1204 for(j=0; j<V44; j++) p_fx[j]=0; _AVX.push_back(p_fx);
1205 float* p_si = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1206 for(j=0; j<V4; j++) p_si[j]=0; _AVX.push_back(p_si);
1207 float* p_co = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1208 for(j=0; j<V4; j++) p_co[j]=0; _AVX.push_back(p_co);
1209 float* p_uu = (
float*)_mm_malloc((V4+16)*
sizeof(float),32);
1210 for(j=0; j<V4+16; j++) p_uu[j]=0; _AVX.push_back(p_uu);
1211 float* p_UU = (
float*)_mm_malloc((V4+16)*
sizeof(float),32);
1212 for(j=0; j<V4+16; j++) p_UU[j]=0; _AVX.push_back(p_UU);
1213 float* p_vv = (
float*)_mm_malloc((V4+16)*
sizeof(float),32);
1214 for(j=0; j<V4+16; j++) p_vv[j]=0; _AVX.push_back(p_vv);
1215 float* p_VV = (
float*)_mm_malloc((V4+16)*
sizeof(float),32);
1216 for(j=0; j<V4+16; j++) p_VV[j]=0; _AVX.push_back(p_VV);
1217 float* p_au = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1218 for(j=0; j<V4; j++) p_au[j]=0; _AVX.push_back(p_au);
1219 float* p_AU = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1220 for(j=0; j<V4; j++) p_AU[j]=0; _AVX.push_back(p_AU);
1221 float* p_av = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1222 for(j=0; j<V4; j++) p_av[j]=0; _AVX.push_back(p_av);
1223 float* p_AV = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1224 for(j=0; j<V4; j++) p_AV[j]=0; _AVX.push_back(p_AV);
1225 float* p_uv = (
float*)_mm_malloc(V4*4*
sizeof(
float),32);
1226 for(j=0; j<V4*4; j++) p_uv[j]=0; _AVX.push_back(p_uv);
1227 float* p_ee = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1228 for(j=0; j<V4; j++) p_ee[j]=0; _AVX.push_back(p_ee);
1229 float* p_EE = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1230 for(j=0; j<V4; j++) p_EE[j]=0; _AVX.push_back(p_EE);
1231 float* pTMP=(
float*)_mm_malloc(V4*4*NIFO*
sizeof(
float),32);
1232 for(j=0; j<V4*4*
NIFO; j++) pTMP[j]=0; _AVX.push_back(pTMP);
1233 float* p_ni = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1234 for(j=0; j<V4; j++) p_ni[j]=0; _AVX.push_back(p_ni);
1235 float* p_ec = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1236 for(j=0; j<V4; j++) p_ec[j]=0; _AVX.push_back(p_ec);
1237 float* p_gn = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1238 for(j=0; j<V4; j++) p_gn[j]=0; _AVX.push_back(p_gn);
1239 float* p_ed = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1240 for(j=0; j<V4; j++) p_ed[j]=0; _AVX.push_back(p_ed);
1241 float* p_rn = (
float*)_mm_malloc(V4*
sizeof(
float),32);
1242 for(j=0; j<V4; j++) p_rn[j]=0; _AVX.push_back(p_rn);
1245 for(
int j=0; j<V; j++) {
1247 if(!pix->
core)
continue;
1260 for(
int i=0; i<
NIFO; i++) {
1278 for(
int j=0; j<V; j++) {
1280 pix->
likelihood = (pMSK[
j]>0) ? (p_ee[j]+p_EE[j])/2 : 0;
1281 if(pMSK[j]>0) pix->
core =
true;
1283 for(
int i=0; i<
nIFO; i++) {
1284 pix->
setdata(
double(pd[i][j]),
'S',i);
1285 pix->
setdata(
double(pD[i][j]),
'P',i);
1290 #ifdef SAVE_REDUCED_INJ 1291 for(
int i=0; i<
nIFO; i++) {
1294 sprintf(title,
"%s (TIME) : vREC(red) - vSIG(blue)",NET->
ifoName[i]);
1295 sprintf(ofname,
"%s_vREC_vSIG_time_id_%d.%s",NET->
ifoName[i],
id,
"root");
1296 PlotWaveform(ofname, title, cfg,&vREC[i], &vSIG[i], NULL, NULL,
false);
1297 sprintf(title,
"%s (TIME) : vINJ(red) - vSIG(blue)",NET->
ifoName[i]);
1298 sprintf(ofname,
"%s_vINJ_vSIG_time_id_%d.%s",NET->
ifoName[i],
id,
"root");
1299 PlotWaveform(ofname, title, cfg,&vINJ[i], &vSIG[i], NULL, NULL,
false);
1313 gPE.ff[0]=0; gPE.ff[1]=0;
1314 gPE.of[0]=0; gPE.of[1]=0;
1316 int size = iSNR[0].size();
1320 double isnr=0;
for(
int n=0;
n<
nIFO;
n++) isnr+= iSNR[
n][
i];
1321 double osnr=0;
for(
int n=0;
n<
nIFO;
n++) osnr+= oSNR[
n][
i];
1322 double iosnr=0;
for(
int n=0;
n<
nIFO;
n++) iosnr+=ioSNR[
n][
i];
1323 double ff = iosnr/sqrt(isnr*isnr);
1324 double of = iosnr/sqrt(isnr*osnr);
1327 gPE.ff[1] += pow(ff,2);
1330 gPE.of[1] += pow(of,2);
1334 gPE.ff[1] = sqrt(gPE.ff[1]/size-gPE.ff[0]*gPE.ff[0]);
1337 gPE.of[1] = sqrt(gPE.of[1]/size-gPE.of[0]*gPE.of[0]);
1345 int size = vCHIRP[1].size();
1349 gPE.mch[0] += vCHIRP[1][
i];
1350 gPE.mch[1] += pow(vCHIRP[1][
i],2);
1354 gPE.mch[1] = sqrt(gPE.mch[1]/size-gPE.mch[0]*gPE.mch[0]);
1362 int size = iSNR[0].size();
1367 for(
int n=0;
n<
nIFO;
n++) osnr+=oSNR[
n][
i];
1368 gPE.snet[0] += sqrt(osnr);
1369 gPE.snet[1] += osnr;
1372 gPE.snet[0] /=
size;
1373 gPE.snet[1] = sqrt(gPE.snet[1]/size-gPE.snet[0]*gPE.snet[0]);
1386 int sCuts = pwc->
sCuts[
id-1];
1387 pwc->
sCuts[
id-1] = 0;
1395 int tsize = pix->
tdAmp[0].size();
1396 if(!tsize || tsize&1) {
1397 cout<<
"GetNullPixels error: wrong pixel TD data\n";
1401 cout <<
"tsize :" << tsize << endl;
1402 int V4 = V + (V%4 ? 4 - V%4 : 0);
1403 std::vector<int>* vtof = &(pwc->
nTofF[
id-1]);
1405 for(
int n=0;
n<2*7*
nIFO;
n++) gPE.nstat[
n]=0;
1408 for(
int m=0;
m<nIFO;
m++)
cnt[
m]=0;
1414 for(
int j=0;
j<V;
j++) {
1420 double SS = a_90[j*
NIFO+
m];
1421 ee += pow(ss,2)+pow(SS,2);
1434 int l = (*vtof)[
m]+tsize/2;
1435 double dd = pix->
tdAmp[
m].data[
l];
1436 double DD = pix->
tdAmp[
m].data[l+tsize];
1442 double SS = a_90[j*
NIFO+
m];
1445 aNUL[
m].push_back(dd-ss);
1448 ANUL[
m].push_back(DD-SS);
1454 pwc->
sCuts[
id-1] = sCuts;
1475 bool fft,
TString pdir,
double P, EColor col1, EColor col2, EColor col3) {
1477 watplot PTS(const_cast<char*>(
"ptspe"),200,20,800,500);
1481 if(wref==NULL)
return;
1482 if(wf1==NULL)
return;
1483 else tmin=wf1->
start();
1484 if(wf2!=NULL)
if(wf2->
start()<tmin) tmin=wf2->
start();
1485 if(wf3!=NULL)
if(wf3->
start()<tmin) tmin=wf3->
start();
1490 if(wf2!=NULL)
if(wf2!=wf1) wf2->
start(wf2->
start()-tmin);
1491 if(wf3!=NULL)
if(wf3!=wf1 && wf3!=wf2) wf3->
start(wf3->
start()-tmin);
1492 if(wref!=wf1 && wref!=wf2 && wref!=wf3) wref->
start(wref->
start()-tmin);
1499 for(
int i=0;
i<wf1->
size();
i++) {
1501 if(time>bT && time<eT) wf[k++]=wf1->
data[
i];
1504 PTS.
plot(&wf, const_cast<char*>(
"AL"), col1, 0, 0,
true, cfg->
fLow, cfg->
fHigh);
1506 PTS.
plot(wf1, const_cast<char*>(
"AL"), col1, bT, eT);
1507 PTS.
graph[0]->GetXaxis()->SetRangeUser(bT, eT);
1509 PTS.
graph[0]->SetLineWidth(1);
1510 PTS.
graph[0]->SetTitle(title);
1512 TString xtitle = TString::Format(
"Time (sec) : GPS OFFSET = %.3f",tmin);
1513 PTS.
graph[0]->GetXaxis()->SetTitle(xtitle);
1519 for(
int i=0;
i<wf2->
size();
i++) {
1521 if(time>bT && time<eT) wf[k++]=wf2->
data[
i];
1524 PTS.
plot(&wf, const_cast<char*>(
"SAME"), col2, 0, 0,
true, cfg->
fLow, cfg->
fHigh);
1527 if(wf2!=NULL) PTS.
plot(wf2, const_cast<char*>(
"SAME"), col2, 0, 0);
1529 if(wf2!=NULL) PTS.
graph[1]->SetLineWidth(2);
1536 for(
int i=0;
i<wf3->
size();
i++) {
1538 if(time>bT && time<eT) wf[k++]=wf3->
data[
i];
1541 PTS.
plot(&wf, const_cast<char*>(
"SAME"), col3, 0, 0,
true, cfg->
fLow, cfg->
fHigh);
1544 if(wf3!=NULL) PTS.
plot(wf3, const_cast<char*>(
"SAME"), col3, 0, 0);
1546 if(wf3!=NULL) PTS.
graph[2]->SetLineWidth(1);
1550 if(wf2!=NULL)
if(wf2!=wf1) wf2->
start(wf2->
start()+tmin);
1551 if(wf3!=NULL)
if(wf3!=wf1 && wf3!=wf2) wf3->
start(wf3->
start()+tmin);
1552 if(wref!=wf1 && wref!=wf2 && wref!=wf3) wref->
start(wref->
start()+tmin);
1561 PTS.
canvas->Print(ofname);
1562 cout <<
"write : " << ofname << endl;
1568 double R=wf1->
rate();
1570 double b_wf1 = wf1->
start();
1571 double e_wf1 = wf1->
start()+wf1->
size()/R;
1572 double b_wf2 = wf2->
start();
1573 double e_wf2 = wf2->
start()+wf2->
size()/R;
1575 int o_wf1 = b_wf1>b_wf2 ? 0 :
int((b_wf2-b_wf1)*R+0.5);
1576 int o_wf2 = b_wf1<b_wf2 ? 0 :
int((b_wf1-b_wf2)*R+0.5);
1578 double startXCOR = b_wf1>b_wf2 ? b_wf1 : b_wf2;
1579 double endXCOR = e_wf1<e_wf2 ? e_wf1 : e_wf2;
1580 int sizeXCOR =
int((endXCOR-startXCOR)*R+0.5);
1585 for(
int i=0;
i<sizeXCOR;
i++) wf12 += wf1->
data[
i+o_wf1] * wf2->
data[
i+o_wf2];
1586 for(
int i=0;i<wf1->
size();
i++) wf11 += pow(wf1->
data[
i],2);
1587 for(
int i=0;
i<wf2->
size();
i++) wf22 += pow(wf2->
data[
i],2);
1589 double FF = wf12/sqrt(wf11*wf22);
1596 double R=wf1->
rate();
1598 double b_wf1 = wf1->
start();
1599 double e_wf1 = wf1->
start()+wf1->
size()/R;
1600 double b_wf2 = wf2->
start();
1601 double e_wf2 = wf2->
start()+wf2->
size()/R;
1603 int o_wf1 = b_wf1>b_wf2 ? 0 :
int((b_wf2-b_wf1)*R+0.5);
1604 int o_wf2 = b_wf1<b_wf2 ? 0 :
int((b_wf1-b_wf2)*R+0.5);
1606 double startXCOR = b_wf1>b_wf2 ? b_wf1 : b_wf2;
1607 double endXCOR = e_wf1<e_wf2 ? e_wf1 : e_wf2;
1608 int sizeXCOR =
int((endXCOR-startXCOR)*R+0.5);
1613 wfdif.
start(b_wf1+
double(o_wf1)/R);
1615 for(
int i=0;
i<sizeXCOR;
i++) wfdif[
i] = wf1->
data[
i+o_wf1] - wf2->
data[
i+o_wf2];
1634 sprintf(title,
"%s (TIME) : INJ(red) - SM(blue)",NET->
ifoName[ifoID]);
1636 PlotWaveform(ofname, title, cfg, wf, &ss, NULL, NULL,
false);
1642 int n_amp_cal_err=0;
1643 int n_phs_cal_err=0;
1644 if(options.CompareTo(
"")!=0) {
1645 cout << options << endl;
1646 if(!options.Contains(
"--")) {
1649 for(
int j=0;
j<token->GetEntries();
j++){
1651 TObjString* tok = (TObjString*)token->At(
j);
1652 TString stok = tok->GetString();
1654 if(stok.Contains(
"pe_trials=") || stok.Contains(
"pe_retry=")) {
1656 pe_trials.Remove(0,pe_trials.Last(
'=')+1);
1657 if(pe_trials.IsDigit()) gOPT.trials=pe_trials.Atoi();
1659 cout <<
"ReadUserOptions Error : trials must be <= MAX_TRIALS : " <<
MAX_TRIALS << endl;
exit(1);
1663 if(stok.Contains(
"pe_ced_dump=")) {
1665 pe_ced_dump.Remove(0,pe_ced_dump.Last(
'=')+1);
1666 if(pe_ced_dump.IsDigit()) gOPT.ced_dump=pe_ced_dump.Atoi();
1669 if(stok.Contains(
"pe_ced_enable=")) {
1671 pe_ced_enable.Remove(0,pe_ced_enable.Last(
'=')+1);
1672 if(pe_ced_enable==
"tfmap") gOPT.ced_tfmap =
true;
1673 if(pe_ced_enable==
"rdr") gOPT.ced_rdr =
true;
1674 if(pe_ced_enable==
"psd") gOPT.ced_psd =
true;
1675 if(pe_ced_enable==
"skymap") gOPT.ced_skymap =
true;
1676 if(pe_ced_enable==
"rec") gOPT.ced_rec =
true;
1677 if(pe_ced_enable==
"inj") gOPT.ced_inj =
true;
1678 if(pe_ced_enable==
"rinj") gOPT.ced_rinj =
true;
1679 if(pe_ced_enable==
"cm") gOPT.ced_cm =
true;
1680 if(pe_ced_enable==
"distr") gOPT.ced_distr =
true;
1681 if(pe_ced_enable==
"null") gOPT.ced_null =
true;
1682 if(pe_ced_enable==
"pca") gOPT.ced_pca =
true;
1685 if(stok.Contains(
"pe_ced_disable=")) {
1687 pe_ced_disable.Remove(0,pe_ced_disable.Last(
'=')+1);
1688 if(pe_ced_disable==
"tfmap") gOPT.ced_tfmap =
false;
1689 if(pe_ced_disable==
"rdr") gOPT.ced_rdr =
false;
1690 if(pe_ced_disable==
"psd") gOPT.ced_psd =
false;
1691 if(pe_ced_disable==
"skymap") gOPT.ced_skymap =
false;
1692 if(pe_ced_disable==
"rec") gOPT.ced_rec =
false;
1693 if(pe_ced_disable==
"inj") gOPT.ced_inj =
false;
1694 if(pe_ced_disable==
"rinj") gOPT.ced_rinj =
false;
1695 if(pe_ced_disable==
"cm") gOPT.ced_cm =
false;
1696 if(pe_ced_disable==
"distr") gOPT.ced_distr =
false;
1697 if(pe_ced_disable==
"null") gOPT.ced_null =
false;
1698 if(pe_ced_disable==
"pca") gOPT.ced_pca =
false;
1701 if(stok.Contains(
"pe_seed=")) {
1703 pe_seed.Remove(0,pe_seed.Last(
'=')+1);
1704 if(pe_seed.IsDigit()) gOPT.seed=pe_seed.Atoi();
1707 if(stok.Contains(
"pe_gps=")) {
1709 pe_gps.Remove(0,pe_gps.Last(
'=')+1);
1710 if(pe_gps.IsFloat()) gOPT.gps=pe_gps.Atof();
1713 if(stok.Contains(
"pe_amp_cal_err=")) {
1715 pe_amp_cal_err.Remove(0,pe_amp_cal_err.Last(
'=')+1);
1716 if(pe_amp_cal_err.IsFloat()) gOPT.amp_cal_err[n_amp_cal_err]=pe_amp_cal_err.Atof();
1717 if(n_amp_cal_err<(
NIFO_MAX-1)) n_amp_cal_err++;
1720 if(stok.Contains(
"pe_phs_cal_err=")) {
1722 pe_phs_cal_err.Remove(0,pe_phs_cal_err.Last(
'=')+1);
1723 if(pe_phs_cal_err.IsFloat()) gOPT.phs_cal_err[n_phs_cal_err]=pe_phs_cal_err.Atof();
1724 if(n_phs_cal_err<(
NIFO_MAX-1)) n_phs_cal_err++;
1727 if(stok.Contains(
"pe_skymask=")) {
1729 pe_skymask.Remove(0,pe_skymask.Last(
'=')+1);
1730 if(pe_skymask==
"false") gOPT.skymask=0;
1731 if(pe_skymask==
"true") gOPT.skymask=1;
1732 if(pe_skymask.IsDigit()) gOPT.skymask=pe_skymask.Atoi();
1735 if(stok.Contains(
"pe_signal=")) {
1737 pe_signal.Remove(0,pe_signal.Last(
'=')+1);
1738 if(pe_signal.IsDigit()) gOPT.signal=pe_signal.Atoi();
1741 if(stok.Contains(
"pe_noise=")) {
1743 pe_noise.Remove(0,pe_noise.Last(
'=')+1);
1744 if(pe_noise==
"false") gOPT.noise=0;
1745 if(pe_noise==
"true") gOPT.noise=1;
1746 if(pe_noise.IsDigit()) gOPT.noise=pe_noise.Atoi();
1749 if(stok.Contains(
"pe_multitask=")) {
1751 pe_multitask.Remove(0,pe_multitask.Last(
'=')+1);
1752 if(pe_multitask==
"true") gOPT.multitask=
true;
1753 if(pe_multitask==
"false") gOPT.multitask=
false;
1756 if(stok.Contains(
"pe_output_enable=")) {
1757 TString pe_output_enable=stok;
1758 pe_output_enable.Remove(0,pe_output_enable.Last(
'=')+1);
1759 if(pe_output_enable==
"inj") gOPT.output_inj=
true;
1760 if(pe_output_enable==
"rec") gOPT.output_rec=
true;
1761 if(pe_output_enable==
"wht") gOPT.output_wht=
true;
1762 if(pe_output_enable==
"dat") gOPT.output_dat=
true;
1763 if(pe_output_enable==
"med") gOPT.output_med=
true;
1764 if(pe_output_enable==
"p50") gOPT.output_p50=
true;
1765 if(pe_output_enable==
"p90") gOPT.output_p90=
true;
1766 if(pe_output_enable==
"avr") gOPT.output_avr=
true;
1767 if(pe_output_enable==
"rms") gOPT.output_rms=
true;
1770 if(stok.Contains(
"pe_output_disable=")) {
1771 TString pe_output_disable=stok;
1772 pe_output_disable.Remove(0,pe_output_disable.Last(
'=')+1);
1773 if(pe_output_disable==
"inj") gOPT.output_inj=
false;
1774 if(pe_output_disable==
"rec") gOPT.output_rec=
false;
1775 if(pe_output_disable==
"wht") gOPT.output_wht=
false;
1776 if(pe_output_disable==
"dat") gOPT.output_dat=
false;
1777 if(pe_output_disable==
"med") gOPT.output_med=
false;
1778 if(pe_output_disable==
"p50") gOPT.output_p50=
false;
1779 if(pe_output_disable==
"p90") gOPT.output_p90=
false;
1780 if(pe_output_disable==
"avr") gOPT.output_avr=
false;
1781 if(pe_output_disable==
"rms") gOPT.output_rms=
false;
1791 cout <<
"-----------------------------------------" << endl;
1792 cout <<
"PE config options " << endl;
1793 cout <<
"-----------------------------------------" << endl << endl;
1794 cout <<
"PE_TRIALS " << gOPT.trials << endl;
1795 cout <<
"PE_SIGNAL " << gOPT.signal << endl;
1796 cout <<
"PE_NOISE " << gOPT.noise << endl;
1797 for(
int n=0;
n<cfg->
nIFO;
n++) {
1798 cout <<
"PE_AMP_CAL_ERR " << cfg->
ifo[
n] <<
" " << gOPT.amp_cal_err[
n] << endl;
1799 cout <<
"PE_PHS_CAL_ERR " << cfg->
ifo[
n] <<
" " << gOPT.phs_cal_err[
n] << endl;
1801 cout <<
"PE_SKYMASK " << gOPT.skymask << endl;
1802 cout <<
"PE_SEED " << gOPT.seed << endl;
1804 cout <<
"PE_GPS " << gOPT.gps << endl;
1807 cout <<
"PE_MULTITASK " << gOPT.multitask << endl;
1809 cout <<
"PE_CED_DUMP " << gOPT.ced_dump << endl;
1811 cout <<
"PE_CED_TFMAP " << gOPT.ced_tfmap << endl;
1812 cout <<
"PE_CED_RDR " << gOPT.ced_rdr << endl;
1813 cout <<
"PE_CED_PSD " << gOPT.ced_psd << endl;
1814 cout <<
"PE_CED_SKYMAP " << gOPT.ced_skymap << endl;
1815 cout <<
"PE_CED_REC " << gOPT.ced_rec << endl;
1816 cout <<
"PE_CED_INJ " << gOPT.ced_inj << endl;
1817 cout <<
"PE_CED_rINJ " << gOPT.ced_rinj << endl;
1818 cout <<
"PE_CED_CM " << gOPT.ced_cm << endl;
1819 cout <<
"PE_CED_DISTR " << gOPT.ced_distr << endl;
1820 cout <<
"PE_CED_NULL " << gOPT.ced_null << endl;
1821 cout <<
"PE_CED_PCA " << gOPT.ced_pca << endl;
1823 cout <<
"PE_OUTPUT_INJ " << gOPT.output_inj << endl;
1824 cout <<
"PE_OUTPUT_REC " << gOPT.output_rec << endl;
1825 cout <<
"PE_OUTPUT_WHT " << gOPT.output_wht << endl;
1826 cout <<
"PE_OUTPUT_DAT " << gOPT.output_dat << endl;
1827 cout <<
"PE_OUTPUT_MED " << gOPT.output_med << endl;
1828 cout <<
"PE_OUTPUT_P50 " << gOPT.output_p50 << endl;
1829 cout <<
"PE_OUTPUT_P90 " << gOPT.output_p90 << endl;
1830 cout <<
"PE_OUTPUT_AVR " << gOPT.output_avr << endl;
1831 cout <<
"PE_OUTPUT_RMS " << gOPT.output_rms << endl;
1842 if(!out.good()) {cout <<
"DumpUserOptions : Error Opening File : " << ofName << endl;
exit(1);}
1851 out <<
"--------------------------------" << endl;
1852 out <<
"PE version " << endl;
1853 out <<
"--------------------------------" << endl;
1855 out << version << endl;
1858 out <<
"--------------------------------" << endl;
1859 out <<
"PE config options " << endl;
1860 out <<
"--------------------------------" << endl;
1863 out <<
"pe_trials " << gOPT.trials << endl;
1864 info =
"// number of trials (def=100)";
1865 out << tabs << info << endl;
1867 out <<
"pe_signal " << gOPT.signal << endl;
1868 info =
"// signal used for trials : 0(def)/1/2";
1869 out << tabs << info << endl;
1870 info =
"// 0 - reconstructed waveform";
1871 out << tabs << info << endl;
1872 info =
"// 1 - injected waveform (available only in simulation mode)";
1873 out << tabs << info << endl;
1874 info =
"// 2 - original waveform = (reconstructed+null)";
1875 out << tabs << info << endl;
1877 out <<
"pe_noise " << gOPT.noise << endl;
1878 info =
"// noise used for trials : 0/1(def)/2 ";
1879 out << tabs << info << endl;
1880 info =
"// 0 - waveform is injected in the whitened HoT and apply Coherent+SuperCluster+Likelihood stages";
1881 out << tabs << info << endl;
1882 info =
"// 1 - add gaussian noise to likelihood sparse maps and apply Likelihood stage";
1883 out << tabs << info << endl;
1884 info =
"// 2 - add whitened HoT to likelihood sparse maps and apply Likelihood stage";
1885 out << tabs << info << endl;
1887 for(
int n=0;
n<cfg->
nIFO;
n++) {
1888 out <<
"pe_amp_cal_err " << cfg->
ifo[
n] <<
" " << gOPT.amp_cal_err[
n] << endl;
1890 info =
"// max percentage of amplitude miscalibration : def(0) -> disabled";
1891 out << tabs << info << endl;
1892 info =
"// if>0 -> uniform in [1-pe_amp_cal_err,1+pe_amp_cal_err] else gaus(1,pe_amp_cal_err)";
1893 out << tabs << info << endl;
1895 for(
int n=0;
n<cfg->
nIFO;
n++) {
1896 out <<
"pe_phs_cal_err " << cfg->
ifo[
n] <<
" " << gOPT.phs_cal_err[
n] << endl;
1898 info =
"// max phase (degrees) miscalibration : def(0) -> disabled";
1899 out << tabs << info << endl;
1900 info =
"// if>0 -> uniform in [-pe_phs_cal_err,+pe_phs_cal_err] else gaus(pe_phs_cal_err)";
1901 out << tabs << info << endl;
1903 out <<
"pe_multitask " << (gOPT.multitask ?
"enable" :
"disable") << endl;
1904 info =
"// if enabled, PE trials are executed by different jobs in multitask : only simulation=0 and single event (gps>0)";
1905 out << tabs << info << endl;
1907 out <<
"pe_ced_dump " << gOPT.ced_dump << endl;
1908 info =
"// dump CED at gLRETRY=PE_CED_DUMP (def(-1) -> disabled)";
1909 out << tabs << info << endl;
1911 out <<
"pe_skymask " << gOPT.skymask << endl;
1912 info =
"// skymask used for trials : 0(def)/1/2/3 ";
1913 out << tabs << info << endl;
1914 info =
"// 0 - disable -> search over all sky";
1915 out << tabs << info << endl;
1916 out << tabs <<
"// 1 - skymask with radius " <<
SKYMASK_RADIUS <<
"(deg) and source selected according the reconstructed skymap probability " << endl;
1917 info =
"// 2 - skymask select only the sky position where the waveform is reconstructed (the maximum of detection statistic)";
1918 out << tabs << info << endl;
1919 info =
"// 3 - skymask select only the sky position where the waveform has been injected";
1920 out << tabs << info << endl;
1922 out <<
"pe_seed " << gOPT.seed << endl;
1923 info =
"// seed used by PE for random generation - 0(def) -> random seed";
1924 out << tabs << info << endl;
1927 out <<
"pe_gps " << gOPT.gps << endl;
1928 info =
"// if >0 only gps +/- iwindow is analyzed - 0(def) -> disabled";
1929 out << tabs << info << endl;
1933 out <<
"pe_ced tfmap " << (gOPT.ced_tfmap ?
"enable" :
"disable") << endl;
1934 info =
"// tfmap - pe_ced_enable(def)/disable : Shows/Hides the Time-Frequency Maps Tab -> Spectrograms, Scalograms, TF Likelihood,Null";
1935 out << tabs << info << endl;
1936 out <<
"pe_ced rdr " << (gOPT.ced_rdr ?
"enable" :
"disable") << endl;
1937 info =
"// rdr - pe_ced_enable(def)/disable : Shows/Hides Reconstructed Detector Response Tab";
1938 out << tabs << info << endl;
1939 out <<
"pe_ced psd " << (gOPT.ced_psd ?
"enable" :
"disable") << endl;
1940 info =
"// psd - pe_ced_enable(def)/disable : Shows/Hides Power Spectral Density Tab";
1941 out << tabs << info << endl;
1942 out <<
"pe_ced skymap " << (gOPT.ced_skymap ?
"enable" :
"disable") << endl;
1943 info =
"// skymap - pe_ced_enable(def)/disable : Shows/Hides SkyMaps Tab";
1944 out << tabs << info << endl;
1945 out <<
"pe_ced rec " << (gOPT.ced_rec ?
"enable" :
"disable") << endl;
1946 info =
"// rec - pe_ced_enable(def)/disable : Shows/Hides Reconstructed Waveforms/Instantaneous-Frequency with errors Tab";
1947 out << tabs << info << endl;
1948 out <<
"pe_ced inj " << (gOPT.ced_inj ?
"enable" :
"disable") << endl;
1949 info =
"// inj - pe_ced_enable(def)/disable : Showsi/Hides Injection' tab reports the comparison with the injected whitened waveform";
1950 out << tabs << info << endl;
1951 out <<
"pe_ced rinj " << (gOPT.ced_rinj ?
"enable" :
"disable") << endl;
1952 info =
"// rinj - pe_ced_enable/disable(def) : Shows/Hides Injection' tab reports the comparison with the injected whitened waveform";
1953 out << tabs << info << endl;
1954 info =
" in time-frequency subspace of the PointEstimated waveform";
1955 out << tabs << info << endl;
1956 out <<
"pe_ced cm " << (gOPT.ced_cm ?
"enable" :
"disable") << endl;
1957 info =
"// cm - pe_ced_enable(def)/disable : Shows/Hides Chirp Mass Value/Error Distributions Tab";
1958 out << tabs << info << endl;
1959 out <<
"pe_ced distr " << (gOPT.ced_distr ?
"enable" :
"disable") << endl;
1960 info =
"// distr - pe_ced_enable/disable(def) : Shows/Hides Residuals Distributions Tab";
1961 out << tabs << info << endl;
1962 out <<
"pe_ced null " << (gOPT.ced_null ?
"enable" :
"disable") << endl;
1963 info =
"// null - pe_ced_enable/disable(def) : Shows/Hides Null Pixels Distributions Tab";
1964 out << tabs << info << endl;
1965 out <<
"pe_ced pca " << (gOPT.ced_pca ?
"enable" :
"disable") << endl;
1966 info =
"// pca - pe_ced_enable/disable(def) : Shows/Hides PCA likelihood TF plot in the Time-Frequency Maps Tab";
1967 out << tabs << info << endl;
2013 float* gSLAGSHIFT=NULL;
IMPORT(
float*,gSLAGSHIFT)
2018 TFile*
froot = NULL;
2019 TList *files = (TList*)gROOT->GetListOfFiles();
2026 while ((file=(TSystemFile*)
next())) {
2027 fname = file->GetName();
2029 if(fname.Contains(
"wave_")) {
2030 froot=(TFile*)file;froot->cd();
2032 gOUTPUT.ReplaceAll(
".root.tmp",
".txt");
2037 cout <<
"CWB_Plugin_Boostrap.C : Error - output root file not found" << endl;
2041 cout <<
"CWB_Plugin_Boostrap.C : Error - output root file not found" << endl;
2047 if(gOPT.output_rec)
for(
int n=0;
n<
nIFO;
n++) gPE.wREC[
n] = &vREC[
n];
2048 if(gOPT.output_wht)
for(
int n=0;
n<
nIFO;
n++) gPE.wWHT[
n] = &vWHT[
n];
2049 if(gOPT.output_dat)
for(
int n=0;
n<
nIFO;
n++) gPE.wDAT[
n] = &vDAT[
n];
2050 if(gOPT.output_med)
for(
int n=0;
n<
nIFO;
n++) gPE.wMED[
n] = &vMED[
n];
2051 if(gOPT.output_p50)
for(
int n=0;
n<
nIFO;
n++) gPE.wL50[
n] = &vL50[
n];
2052 if(gOPT.output_p50)
for(
int n=0;
n<
nIFO;
n++) gPE.wU50[
n] = &vU50[
n];
2053 if(gOPT.output_p90)
for(
int n=0;
n<
nIFO;
n++) gPE.wL90[
n] = &vL90[
n];
2054 if(gOPT.output_p90)
for(
int n=0;
n<
nIFO;
n++) gPE.wU90[
n] = &vU90[
n];
2055 if(gOPT.output_avr)
for(
int n=0;
n<
nIFO;
n++) gPE.wAVR[
n] = &vAVR[
n];
2056 if(gOPT.output_rms)
for(
int n=0;
n<
nIFO;
n++) gPE.wRMS[
n] = &vRMS[
n];
2059 gTREE = (TTree *) froot->Get(
"waveburst");
2063 gTREE->Branch(
"pe_trials",&gPE.trials,
"pe_trials/I");
2064 gTREE->Branch(
"pe_erR",gPE.erR,TString::Format(
"pe_erR[%i]/F",11));
2065 gTREE->Branch(
"pe_erF",gPE.erF,TString::Format(
"pe_erF[%i]/F",11));
2066 gTREE->Branch(
"pe_nstat",gPE.nstat,TString::Format(
"pe_nstat[%i]/F",2*7*cfg->
nIFO));
2067 gTREE->Branch(
"pe_snet",gPE.snet,TString::Format(
"pe_snet[%i]/F",2));
2068 gTREE->Branch(
"pe_ff",gPE.ff,TString::Format(
"pe_ff[%i]/F",2));
2069 gTREE->Branch(
"pe_of",gPE.of,TString::Format(
"pe_of[%i]/F",2));
2070 gTREE->Branch(
"pe_mch",gPE.mch,TString::Format(
"pe_mch[%i]/F",2));
2073 if(gOPT.output_inj)
if(cfg->
simulation) gTREE->Branch(TString::Format(
"pe_wINJ_%d",
n).Data(),
"wavearray<double>",&gPE.wINJ[
n],32000,0);
2074 if(gOPT.output_rec) gTREE->Branch(TString::Format(
"pe_wREC_%d",
n).Data(),
"wavearray<double>",&gPE.wREC[
n],32000,0);
2075 if(gOPT.output_wht) gTREE->Branch(TString::Format(
"pe_wWHT_%d",
n).Data(),
"wavearray<double>",&gPE.wWHT[
n],32000,0);
2076 if(gOPT.output_dat) gTREE->Branch(TString::Format(
"pe_wDAT_%d",
n).Data(),
"wavearray<double>",&gPE.wDAT[
n],32000,0);
2077 if(gOPT.output_med) gTREE->Branch(TString::Format(
"pe_wMED_%d",
n).Data(),
"wavearray<double>",&gPE.wMED[
n],32000,0);
2078 if(gOPT.output_p50) gTREE->Branch(TString::Format(
"pe_wL50_%d",
n).Data(),
"wavearray<double>",&gPE.wL50[
n],32000,0);
2079 if(gOPT.output_p50) gTREE->Branch(TString::Format(
"pe_wU50_%d",
n).Data(),
"wavearray<double>",&gPE.wU50[
n],32000,0);
2080 if(gOPT.output_p90) gTREE->Branch(TString::Format(
"pe_wL90_%d",
n).Data(),
"wavearray<double>",&gPE.wL90[
n],32000,0);
2081 if(gOPT.output_p90) gTREE->Branch(TString::Format(
"pe_wU90_%d",
n).Data(),
"wavearray<double>",&gPE.wU90[
n],32000,0);
2082 if(gOPT.output_avr) gTREE->Branch(TString::Format(
"pe_wAVR_%d",
n).Data(),
"wavearray<double>",&gPE.wAVR[
n],32000,0);
2083 if(gOPT.output_rms) gTREE->Branch(TString::Format(
"pe_wRMS_%d",
n).Data(),
"wavearray<double>",&gPE.wRMS[
n],32000,0);
2086 if(gOPT.multitask&&(gMTRIAL!=gOPT.trials)) {
2087 for(
int n=0;
n<
nIFO;
n++) gTREE->Branch(TString::Format(
"mtpe_wREC_%d",
n).Data(),
"wavearray<double>",&wREC[0][
n],32000,0);
2088 gTREE->Branch(
"mtpe_skyprob",
"skymap",&wSKYPROB[0], 32000,0);
2101 if(cfg->
dump) EVT->
dopen(gOUTPUT.Data(),
const_cast<char*
>(
"a"),
false);
2102 EVT->
output2G(gTREE,NET,ID,k,factor);
2109 while(!vINJ.empty()) vINJ.pop_back();
2110 vINJ.clear(); std::vector<wavearray<double> >().swap(vINJ);
2111 while(!vREC.empty()) vREC.pop_back();
2112 vREC.clear(); std::vector<wavearray<double> >().swap(vREC);
2113 while(!vWHT.empty()) vWHT.pop_back();
2114 vWHT.clear(); std::vector<wavearray<double> >().swap(vWHT);
2115 while(!vPCA.empty()) vPCA.pop_back();
2116 vPCA.clear(); std::vector<wavearray<double> >().swap(vPCA);
2117 while(!vDAT.empty()) vDAT.pop_back();
2118 vDAT.clear(); std::vector<wavearray<double> >().swap(vDAT);
2119 while(!vNUL.empty()) vNUL.pop_back();
2120 vNUL.clear(); std::vector<wavearray<double> >().swap(vNUL);
2121 while(!cINJ.empty()) cINJ.pop_back();
2122 cINJ.clear(); std::vector<wavearray<double> >().swap(cINJ);
2124 while(!vAVR.empty()) vAVR.pop_back();
2125 vAVR.clear(); std::vector<wavearray<double> >().swap(vAVR);
2126 while(!vRMS.empty()) vRMS.pop_back();
2127 vRMS.clear(); std::vector<wavearray<double> >().swap(vRMS);
2129 while(!vMED.empty()) vMED.pop_back();
2130 vMED.clear(); std::vector<wavearray<double> >().swap(vMED);
2131 while(!vL50.empty()) vL50.pop_back();
2132 vL50.clear(); std::vector<wavearray<double> >().swap(vL50);
2133 while(!vU50.empty()) vU50.pop_back();
2134 vU50.clear(); std::vector<wavearray<double> >().swap(vU50);
2135 while(!vL90.empty()) vL90.pop_back();
2136 vL90.clear(); std::vector<wavearray<double> >().swap(vL90);
2137 while(!vU90.empty()) vU90.pop_back();
2138 vU90.clear(); std::vector<wavearray<double> >().swap(vU90);
2140 while(!fREC.empty()) fREC.pop_back();
2141 fREC.clear(); std::vector<wavearray<double> >().swap(fREC);
2142 while(!fINJ.empty()) fINJ.pop_back();
2143 fINJ.clear(); std::vector<wavearray<double> >().swap(fINJ);
2144 while(!fAVR.empty()) fAVR.pop_back();
2145 fAVR.clear(); std::vector<wavearray<double> >().swap(fAVR);
2146 while(!fRMS.empty()) fRMS.pop_back();
2147 fRMS.clear(); std::vector<wavearray<double> >().swap(fRMS);
2149 while(!fMED.empty()) fMED.pop_back();
2150 fMED.clear(); std::vector<wavearray<double> >().swap(fMED);
2151 while(!fL50.empty()) fL50.pop_back();
2152 fL50.clear(); std::vector<wavearray<double> >().swap(fL50);
2153 while(!fU50.empty()) fU50.pop_back();
2154 fU50.clear(); std::vector<wavearray<double> >().swap(fU50);
2155 while(!fL90.empty()) fL90.pop_back();
2156 fL90.clear(); std::vector<wavearray<double> >().swap(fL90);
2157 while(!fU90.empty()) fU90.pop_back();
2158 fU90.clear(); std::vector<wavearray<double> >().swap(fU90);
2160 while(!vRES.empty()) vRES.pop_back();
2161 vRES.clear(); std::vector<double >().swap(vRES);
2162 while(!fRES.empty()) fRES.pop_back();
2163 fRES.clear(); std::vector<double >().swap(fRES);
2166 while(!wREC[
n].empty()) wREC[
n].pop_back();
2167 wREC[
n].clear(); std::vector<wavearray<double> >().swap(wREC[
n]);
2171 while(!iSNR[
n].empty()) iSNR[
n].pop_back();
2172 iSNR[
n].clear(); std::vector<double>().swap(iSNR[
n]);
2173 while(!oSNR[n].empty()) oSNR[
n].pop_back();
2174 oSNR[
n].clear(); std::vector<double>().swap(oSNR[n]);
2175 while(!ioSNR[n].empty()) ioSNR[
n].pop_back();
2176 ioSNR[
n].clear(); std::vector<double>().swap(ioSNR[n]);
2179 for(
int n=0;
n<6;
n++) {
2180 while(!vCHIRP[
n].empty()) vCHIRP[
n].pop_back();
2181 vCHIRP[
n].clear(); std::vector<double>().swap(vCHIRP[
n]);
2184 while(!vLIKELIHOOD.empty()) vLIKELIHOOD.pop_back();
2185 vLIKELIHOOD.clear(); std::vector<double >().swap(vLIKELIHOOD);
2188 while(!aNUL[
n].empty()) aNUL[
n].pop_back();
2189 aNUL[
n].clear(); std::vector<double>().swap(aNUL[
n]);
2190 while(!ANUL[n].empty()) ANUL[
n].pop_back();
2191 ANUL[
n].clear(); std::vector<double>().swap(ANUL[n]);
2195 while(!aNSE[
n].empty()) aNSE[
n].pop_back();
2196 aNSE[
n].clear(); std::vector<double>().swap(aNSE[
n]);
2197 while(!ANSE[n].empty()) ANSE[
n].pop_back();
2198 ANSE[
n].clear(); std::vector<double>().swap(ANSE[n]);
2202 while(!vSS[
n].empty()) vSS[
n].pop_back();
2203 vSS[
n].clear(); std::vector<SSeries<double> >().swap(vSS[
n]);
2204 while(!rSS[n].empty()) rSS[
n].pop_back();
2205 rSS[
n].clear(); std::vector<SSeries<double> >().swap(rSS[n]);
2206 while(!jSS[n].empty()) jSS[
n].pop_back();
2207 jSS[
n].clear(); std::vector<SSeries<double> >().swap(jSS[n]);
2208 while(!dSS[n].empty()) dSS[
n].pop_back();
2209 dSS[
n].clear(); std::vector<SSeries<double> >().swap(dSS[n]);
2219 char title[256];
char ofname[256];
2245 #ifdef SET_WAVEFORM_CUTS 2248 sprintf(title,
"%s (TIME) : cINJ(red) - cINJ-vAVR(blue) - vRMS(green)",NET->
ifoName[n]);
2250 PlotWaveform(ofname, title, cfg, &cINJ[n], &wDIF, &vRMS[n], NULL,
false, pdir);
2259 #ifdef SET_WAVEFORM_CUTS 2261 sprintf(title,
"%s (TIME) : cINJ(red) - vREC(blue) - vAVR(green)",NET->
ifoName[n]);
2263 PlotWaveform(ofname, title, cfg, &cINJ[n], &vREC[n], &vAVR[n], NULL,
false, pdir);
2266 #ifdef SET_WAVEFORM_CUTS 2268 sprintf(title,
"%s (TIME) : cINJ(red) - cINJ(blue)",NET->
ifoName[n]);
2270 PlotWaveform(ofname, title, cfg, &cINJ[n], &cINJ[n], NULL, NULL,
false, pdir);
2277 double scale = sqrt(1<<cfg->
levelR);
2281 PlotWaveform(ofname,
"", cfg, &vWHT[n], &vREC[n], NULL, &vREC[n],
false, pdir,0.999,(EColor)16,kRed);
2283 PlotWaveform(ofname,
"", cfg, &vWHT[n], &vREC[n], NULL, &vREC[n],
true, pdir,0.999,(EColor)16,kRed);
2288 for(
int j=0;
j<2;
j++) {
2291 double P =
j==0 ? 0.995 : 0.9;
2299 sprintf(title,
"%s (TIME) : vREC (red) - vRMS:2vRMS (grey:light_gray)",NET->
ifoName[n]);
2302 PlotWaveformAsymmErrors(ofname,
"", cfg, &vREC[n], &vMED[n], &vL50[n], &vU50[n], &vL90[n], &vU90[n], &vREC[n], pdir, P);
2304 PlotWaveformErrors(ofname,
"", cfg, &vREC[n], &vAVR[n], &vRMS[n], &vREC[n], pdir, P);
2313 sprintf(title,
"%s (TIME) : vREC-vAVR(red) - 2*vRMS(gray)",NET->
ifoName[n]);
2316 PlotWaveformAsymmErrors(ofname,
"", cfg, &wDIF, &wDIF, &vL50[n], &vU50[n], &vL90[n], &vU90[n], &vREC[n], pdir, P);
2322 sprintf(title,
"%s (FREQ) : fREC (red) - fRMS:2fRMS (grey:light_gray)",NET->
ifoName[n]);
2325 PlotWaveformAsymmErrors(ofname,
"", cfg, &fREC[n], &fMED[n], &fL50[n], &fU50[n], &fL90[n], &fU90[n], &vREC[n], pdir, P,
true);
2332 sprintf(title,
"%s (TIME) : vREC(red) - vDAT-vREC(blue) - vRMS(green)",NET->
ifoName[n]);
2334 PlotWaveform(ofname,
"", cfg, &vREC[n], &wDIF, &vRMS[n], &vREC[n],
false, pdir, P);
2344 sprintf(title,
"%s (TIME) : vINJ (red) - vRMS:2vRMS (grey:light_gray)",NET->
ifoName[n]);
2347 PlotWaveformAsymmErrors(ofname,
"", cfg, &wALI, &vMED[n], &vL50[n], &vU50[n], &vL90[n], &vU90[n], &vREC[n], pdir, P);
2353 sprintf(title,
"%s (FREQ) : fINJ (red) - fRMS:2fRMS (grey:light_gray)",NET->
ifoName[n]);
2356 PlotWaveformAsymmErrors(ofname,
"", cfg, &fINJ[n], &fMED[n], &fL50[n], &fU50[n], &fL90[n], &fU90[n], &vREC[n], pdir, P,
true);
2368 sprintf(title,
"%s (TIME) : vAVR-vINJ(red) - 2*vRMS(gray)",NET->
ifoName[n]);
2371 PlotWaveformAsymmErrors(ofname,
"", cfg, &wDIF, &wDIF, &vL50[n], &vU50[n], &vL90[n], &vU90[n], &vREC[n], pdir, P);
2388 sprintf(title,
"%s (TIME) : vAVR-cINJ(red) - 2*vRMS(gray)",NET->
ifoName[n]);
2391 PlotWaveformAsymmErrors(ofname,
"", cfg, &wDIF, &wDIF, &vL50[n], &vU50[n], &vL90[n], &vU90[n], &vREC[n], pdir, P);
2397 sprintf(title,
"%s (TIME) : cINJ (red) - vRMS:2vRMS (grey:light_gray)",NET->
ifoName[n]);
2400 PlotWaveformAsymmErrors(ofname,
"", cfg, &cINJ[n], &vMED[n], &vL50[n], &vU50[n], &vL90[n], &vU90[n], &vREC[n], pdir, P);
2402 PlotWaveformErrors(ofname,
"", cfg, &cINJ[n], &vAVR[n], &vRMS[n], &vREC[n], pdir, P);
2406 sprintf(title,
"%s (FREQ) : fINJ (red) - fRMS:2fRMS (grey:light_gray)",NET->
ifoName[n]);
2409 PlotWaveformAsymmErrors(ofname,
"", cfg, &fINJ[n], &fMED[n], &fL50[n], &fU50[n], &fL90[n], &fU90[n], &vREC[n], pdir, P,
true);
2415 sprintf(title,
"%s (TIME) : cINJ(red) - vREC(blue) - vRMS(green)",NET->
ifoName[n]);
2417 PlotWaveform(ofname,
"", cfg, &cINJ[n], &vREC[n], &vRMS[n], &vREC[n],
false, pdir, P);
2423 sprintf(title,
"%s (TIME) : vINJ(red) - cINJ(blue) - vINJ-cINJ(green)",NET->
ifoName[n]);
2425 PlotWaveform(ofname,
"", cfg, &wALI, &cINJ[n], &wDIF, &vREC[n],
false, pdir, P);
2443 cout << endl <<
"SetSkyMask : " << cfg->
skyMaskFile << endl << endl;
2450 if(type!=
'j' && type!=
'r' && type!=
'v') {
2451 cout <<
"AddNoiseAndCalErrToSparse - Error : wrong wave type" << endl;
exit(1);
2477 switch(gOPT.noise) {
2479 for(
int i=0;
i<WF[
n].
size();
i++) {
2482 cout <<
"AddNoiseAndCalErrToSparse - Info : add gaussian noise to waveform type : " << type << endl;
2491 k = gRandom->Uniform(jS+jW,jE-jW);
2493 for(
int i=jS;
i<jE;
i++) {
2501 ts = gRandom->Uniform(0.,dt);
2502 for (
int j=0;
j<size/2;
j++) {
2503 TComplex X(WF[
n].data[2*
j],WF[
n].data[2*j+1]);
2504 X=X*C.Exp(TComplex(0.,-2*
PI*j*df*ts));
2506 WF[
n].
data[2*j+1]=X.Im();
2509 printf(
"Info : %s add data noise with time shift : %.5f sec to waveform type : %c\n",NET->
getifo(
n)->
Name,(double)k/rate+ts,type);
2520 if(gOPT.amp_cal_err[
n]) {
2521 double amp_cal_err = 1;
2522 if(gOPT.amp_cal_err[
n]>0) amp_cal_err = gRandom->Uniform(1-gOPT.amp_cal_err[
n],1+gOPT.amp_cal_err[
n]);
2523 else amp_cal_err = gRandom->Gaus(1,
fabs(gOPT.amp_cal_err[
n]));
2524 cout << NET->
ifoName[
n] <<
" -> amp_cal_err : " << amp_cal_err << endl;
2528 if(gOPT.phs_cal_err[
n]) {
2529 double phs_cal_err = 0;
2530 if(gOPT.phs_cal_err[
n]>0) phs_cal_err = gRandom->Uniform(-gOPT.phs_cal_err[
n],gOPT.phs_cal_err[
n]);
2531 else phs_cal_err = gRandom->Gaus(0,
fabs(gOPT.phs_cal_err[
n]));
2532 cout << NET->
ifoName[
n] <<
" -> phs_cal_err : " << phs_cal_err << endl;
2533 C = cos(-phs_cal_err*d2r);
2534 S = sin(-phs_cal_err*d2r);
2544 aa = rSS[
n][
k].sparseMap00[
l];
2545 AA = rSS[
n][
k].sparseMap90[
l];
2548 aa = jSS[
n][
k].sparseMap00[
l];
2549 AA = jSS[
n][
k].sparseMap90[
l];
2552 aa = vSS[
n][
k].sparseMap00[
l];
2553 AA = vSS[
n][
k].sparseMap90[
l];
2558 double bb = C*aa +
S*AA;
2559 double BB = -
S*aa + C*AA ;
2571 if(type!=
'j' && type!=
'r' && type!=
'v' && type!=
'd') {
2572 cout <<
"Wave2Sparse - Error : wrong wave type" << endl;
exit(1);
2579 if(type==
'v') vSS[
n]=pD->
vSS;
2580 if(type==
'r') rSS[
n]=pD->
vSS;
2581 if(type==
'j') jSS[
n]=pD->
vSS;
2582 if(type==
'd') dSS[
n]=pD->
vSS;
2584 if(type==
'v')
return;
2592 WF[
n].
rate(vSS[
n][0].wdm_rate);
2593 WF[
n].
start(vSS[
n][0].wdm_start);
2597 for (
int i=0;
i<vINJ[
n].size();
i++) WF[
n][wos+
i] = vINJ[
n][
i];
2601 for (
int i=0;
i<vREC[
n].size();
i++) WF[
n][wos+
i] = vREC[
n][
i];
2605 for (
int i=0;
i<vDAT[
n].size();
i++) WF[
n][wos+
i] = vDAT[
n][
i];
2608 #ifdef SAVE_WAVE2SPARSE_PLOT 2613 if(type==
'r') gfile=TString::Format(
"%s/WAVE2SPARSE_REC_%s.root",
".",NET->
ifoName[n]);
2614 if(type==
'j') gfile=TString::Format(
"%s/WAVE2SPARSE_INJ_%s.root",
".",NET->
ifoName[n]);
2615 if(type==
'd') gfile=TString::Format(
"%s/WAVE2SPARSE_DAT_%s.root",
".",NET->
ifoName[n]);
2630 if(type==
'r') size = rSS[
n][
k].sparseMap00.size();
2631 if(type==
'j') size = jSS[
n][
k].sparseMap00.size();
2632 if(type==
'd') size = dSS[
n][
k].sparseMap00.size();
2636 if(type==
'r') index = rSS[
n][
k].sparseIndex[
j];
2637 if(type==
'j') index = jSS[
n][
k].sparseIndex[
j];
2638 if(type==
'd') index = dSS[
n][
k].sparseIndex[
j];
2642 rSS[
n][
k].sparseMap00[
j]=v00;
2643 rSS[
n][
k].sparseMap90[
j]=v90;
2646 jSS[
n][
k].sparseMap00[
j]=v00;
2647 jSS[
n][
k].sparseMap90[
j]=v90;
2650 dSS[
n][
k].sparseMap00[
j]=v00;
2651 dSS[
n][
k].sparseMap90[
j]=v90;
2661 std::vector<int> nrec(nIFO);
2663 #ifdef SET_WAVEFORM_CUTS 2671 if(bT<gBT) gBT=bT;
if(eT>gET) gET=eT;
2672 if(bF<gBF) gBF=bF;
if(eF>gEF) gEF=eF;
2675 cout <<
"CUT TIME RANGE : " << gBT-gBT <<
" " << gET-gBT << endl;
2676 cout <<
"CUT FREQ RANGE : " << gBF <<
" " << gEF << endl;
2687 #ifdef SET_WAVEFORM_CUTS 2699 for(
int i=0;
i<gOPT.trials;
i++) {
2700 if(wREC[
i].
size()) {
2703 #ifdef SET_WAVEFORM_CUTS 2708 wrec[
i][
n] = vREC[
n]; wrec[
i][
n]=0;
2709 frec[
i][
n] = wrec[
i][
n];
2712 if(nrec[
n]==0) {nrec.clear();
return nrec;}
2715 gPE.trials = nrec[0];
2716 cout << endl <<
"ComputeStatisticalErrors - detected/trials : " << nrec[0] <<
"/" << gOPT.trials << endl << endl;
2722 wrms[
n] = wrec[0][
n]; wrms[
n] = 0;
2723 wavr[
n] = wrec[0][
n]; wavr[
n] = 0;
2724 for(
int i=0;
i<gOPT.trials;
i++) {
2725 wavr[
n] += wrec[
i][
n];
2726 for(
int j=0;
j< wrec[
i][
n].
size();
j++) wrms[
n][
j] += wrec[
i][
n][
j]*wrec[
i][
n][
j];
2728 wavr[
n] *= 1./nrec[
n];
2730 wrms[
n] *= 1./nrec[
n];
2731 for(
int j=0;
j< wrms[
n].
size();
j++) {
2732 wrms[
n][
j] -= wavr[
n][
j]*wavr[
n][
j];
2733 wrms[
n][
j] = sqrt(wrms[
n][
j]);
2736 vAVR.push_back(wavr[
n]);
2737 vRMS.push_back(wrms[n]);
2747 wmed[
n] = wrec[0][
n]; wmed[
n] = 0;
2748 wl50[
n] = wrec[0][
n]; wl50[
n] = 0;
2749 wu50[
n] = wrec[0][
n]; wu50[
n] = 0;
2750 wl90[
n] = wrec[0][
n]; wl90[
n] = 0;
2751 wu90[
n] = wrec[0][
n]; wu90[
n] = 0;
2753 int ntry = gPE.trials;
2754 int *
index =
new int[ntry];
2755 float *
value =
new float[ntry];
2756 for(
int j=0;
j<wrec[0][
n].
size();
j++) {
2758 int k=0;
for(
int i=0;
i<gOPT.trials;
i++)
if(wREC[
i].
size()) value[k++] = wrec[
i][
n][
j];
2759 TMath::Sort(ntry,value,index,
false);
2761 int imed = (ntry*50.)/100.;
if(imed>=ntry) imed=ntry-1;
2762 wmed[
n][
j] = value[index[imed]];
2764 int il50 = (ntry*25.)/100.;
if(il50>=ntry) il50=ntry-1;
2765 int iu50 = (ntry*75.)/100.;
if(iu50>=ntry) iu50=ntry-1;
2766 int il90 = (ntry*5.)/100.;
if(il90>=ntry) il90=ntry-1;
2767 int iu90 = (ntry*95.)/100.;
if(iu90>=ntry) iu90=ntry-1;
2769 wl50[
n][
j] = wmed[
n][
j]>0 ? wmed[
n][
j]-value[index[il50]] : value[index[iu50]]-wmed[
n][
j];
2770 wu50[
n][
j] = wmed[
n][
j]>0 ? value[index[iu50]]-wmed[
n][
j] : wmed[
n][
j]-value[index[il50]];
2771 wl90[
n][
j] = wmed[
n][
j]>0 ? wmed[
n][
j]-value[index[il90]] : value[index[iu90]]-wmed[
n][
j];
2772 wu90[
n][
j] = wmed[
n][
j]>0 ? value[index[iu90]]-wmed[
n][
j] : wmed[
n][
j]-value[index[il90]];
2777 vMED.push_back(wmed[
n]);
2778 vL50.push_back(wl50[n]);
2779 vU50.push_back(wu50[n]);
2780 vL90.push_back(wl90[n]);
2781 vU90.push_back(wu90[n]);
2788 frms[
n] = frec[0][
n]; frms[
n] = 0;
2789 favr[
n] = frec[0][
n]; favr[
n] = 0;
2790 for(
int i=0;
i<gOPT.trials;
i++) {
2791 favr[
n] += frec[
i][
n];
2792 for(
int j=0;
j< frec[
i][
n].
size();
j++) frms[
n][
j] += frec[
i][
n][
j]*frec[
i][
n][
j];
2794 favr[
n] *= 1./nrec[
n];
2796 frms[
n] *= 1./nrec[
n];
2797 for(
int j=0;
j< frms[
n].
size();
j++) {
2798 frms[
n][
j] -= favr[
n][
j]*favr[
n][
j];
2799 frms[
n][
j] = sqrt(frms[
n][
j]);
2802 fAVR.push_back(favr[
n]);
2803 fRMS.push_back(frms[n]);
2813 fmed[
n] = frec[0][
n]; fmed[
n] = 0;
2814 fl50[
n] = frec[0][
n]; fl50[
n] = 0;
2815 fu50[
n] = frec[0][
n]; fu50[
n] = 0;
2816 fl90[
n] = frec[0][
n]; fl90[
n] = 0;
2817 fu90[
n] = frec[0][
n]; fu90[
n] = 0;
2819 int ntry = gPE.trials;
2820 int *
index =
new int[ntry];
2821 float *
value =
new float[ntry];
2822 for(
int j=0;
j<frec[0][
n].
size();
j++) {
2824 int k=0;
for(
int i=0;
i<gOPT.trials;
i++)
if(wREC[
i].
size()) value[k++] = frec[
i][
n][
j];
2825 TMath::Sort(ntry,value,index,
false);
2827 int imed = (ntry*50.)/100.;
if(imed>=ntry) imed=ntry-1;
2828 fmed[
n][
j] = value[index[imed]];
2830 int il50 = (ntry*25.)/100.;
if(il50>=ntry) il50=ntry-1;
2831 int iu50 = (ntry*75.)/100.;
if(iu50>=ntry) iu50=ntry-1;
2832 int il90 = (ntry*5.)/100.;
if(il90>=ntry) il90=ntry-1;
2833 int iu90 = (ntry*95.)/100.;
if(iu90>=ntry) iu90=ntry-1;
2835 fl50[
n][
j] = fmed[
n][
j]>0 ? fmed[
n][
j]-value[index[il50]] : value[index[iu50]]-fmed[
n][
j];
2836 fu50[
n][
j] = fmed[
n][
j]>0 ? value[index[iu50]]-fmed[
n][
j] : fmed[
n][
j]-value[index[il50]];
2837 fl90[
n][
j] = fmed[
n][
j]>0 ? fmed[
n][
j]-value[index[il90]] : value[index[iu90]]-fmed[
n][
j];
2838 fu90[
n][
j] = fmed[
n][
j]>0 ? value[index[iu90]]-fmed[
n][
j] : fmed[
n][
j]-value[index[il90]];
2843 fMED.push_back(fmed[
n]);
2844 fL50.push_back(fl50[n]);
2845 fU50.push_back(fu50[n]);
2846 fL90.push_back(fl90[n]);
2847 fU90.push_back(fu90[n]);
2855 for(
int j=0;
j< wavr[
n].
size();
j++) eavr += pow(wavr[
n][
j],2);
2857 for(
int i=0;
i<gOPT.trials;
i++) {
2858 if(wREC[
i].
size()) {
2861 for(
int j=0;
j< wavr[
n].
size();
j++) {
2862 eres += pow(wrec[
i][
n][
j]-wavr[
n][
j],2);
2866 vRES.push_back(eres/eavr);
2872 for(
int j=0;
j< wavr[
n].
size();
j++) {
2873 jres += pow(winj[
n][
j]-wavr[
n][
j],2);
2879 vRES.push_back(jres);
2882 int size = vRES.size()-1;
2885 for(
int i=0;
i<
size;
i++) eres[
i] = vRES[
i];
2886 TMath::Sort(size,const_cast<double*>(eres.
data),index.
data,
false);
2888 for(
int i=1;
i<10;
i++) gPE.erR[
i]=eres[index[
int(
i*size/10.)]];
2891 if(eres[
i]<=jres) gPE.erR[10]+=1.;
2896 cout << endl <<
"gPE.erR : ";
2897 for(
int i=0;
i<10;
i++) cout << gPE.erR[
i] <<
"/";
2898 cout << gPE.erR[10] << endl << endl;
2904 for(
int n=0;
n<nIFO;
n++) {
2905 for(
int j=0;
j< wavr[
n].
size();
j++) eavr += pow(wavr[
n][
j],4)*pow(favr[
n][j],2);
2907 for(
int i=0;
i<gOPT.trials;
i++) {
2908 if(wREC[
i].
size()) {
2911 for(
int j=0;
j<wavr[
n].
size();
j++) {
2912 eres += pow(wavr[
n][
j],4)*pow(frec[
i][
n][j]-favr[
n][j],2);
2916 fRES.push_back(eres/eavr);
2922 for(
int j=0;
j< wavr[
n].
size();
j++) {
2923 jres += pow(wavr[
n][
j],4)*pow(finj[
n][j]-favr[
n][j],2);
2929 fRES.push_back(jres);
2932 for(
int i=0;
i<
size;
i++) eres[
i] = fRES[
i];
2933 TMath::Sort(size,const_cast<double*>(eres.
data),index.
data,
false);
2935 for(
int i=1;
i<10;
i++) gPE.erF[
i]=eres[index[
int(
i*size/10.)]];
2938 if(eres[
i]<=jres) gPE.erF[10]+=1.;
2943 cout << endl <<
"gPE.erF : ";
2944 for(
int i=0;
i<10;
i++) cout << gPE.erF[
i] <<
"/";
2945 cout << gPE.erF[10] << endl << endl;
2955 if(wf1==NULL)
return wf;
2956 if(wf1->
size()==0)
return wf;
2958 double R=wf1->
rate();
2960 double b_wf1 = wf1->
start();
2961 double e_wf1 = wf1->
start()+wf1->
size()/R;
2962 double b_wf2 = wf2->
start();
2963 double e_wf2 = wf2->
start()+wf2->
size()/R;
2965 int o_wf1 = b_wf1>b_wf2 ? 0 :
int((b_wf2-b_wf1)*R+0.5);
2966 int o_wf2 = b_wf1<b_wf2 ? 0 :
int((b_wf1-b_wf2)*R+0.5);
2968 double startXCOR = b_wf1>b_wf2 ? b_wf1 : b_wf2;
2969 double endXCOR = e_wf1<e_wf2 ? e_wf1 : e_wf2;
2970 int sizeXCOR =
int((endXCOR-startXCOR)*R+0.5);
2972 for(
int i=0;
i<sizeXCOR;
i++) wf[
i+o_wf2] = wf1->
data[
i+o_wf1];
2981 if(wf==NULL)
return wfq;
2982 if(wf->
size()==0)
return wfq;
2987 for(
int i=0;
i<wf->
size();
i++) wfq[
i] = sqrt(pow(wf->
data[
i],2)+pow(wfq[
i],2));
2994 std::vector<float>* vP;
2995 std::vector<int>* vI;
3001 if(NET->
wc_List[0].p_Map.size()) {
3003 vP = &(NET->
wc_List[0].p_Map[
id-1]);
3004 vI = &(NET->
wc_List[0].p_Ind[
id-1]);
3009 for(
int j=0;
j<
int(vP->size());
j++) {
3014 skyprob.
set(k,(*vP)[
j]);
3023 std::vector<float>* vP;
3024 std::vector<int>* vI;
3027 if(NET->
wc_List[0].p_Map.size()) {
3029 vP = &(NET->
wc_List[0].p_Map[
id-1]);
3030 vI = &(NET->
wc_List[0].p_Ind[
id-1]);
3035 for(
int j=0;
j<
int(vP->size());
j++) {
3040 gSKYPROB.
set(k,(*vP)[
j]);
3044 gHSKYPROB.SetBins(gSKYPROB.
size(),0,gSKYPROB.
size()-1);
3047 for(
int l=0;
l<gSKYPROB.
size();
l++) PROB+=gSKYPROB.
get(
l);
3048 cout <<
"PROB : " << PROB << endl;
3049 for(
int l=0;
l<gSKYPROB.
size();
l++) gHSKYPROB.SetBinContent(
l,gSKYPROB.
get(
l));
3079 gSM.
Print(TString::Format(
"%s/gSkyprob_%d.png",
".",
id));
3085 std::vector<double > xRES = type==
'f' ?
fRES :
vRES;
3087 int size = xRES.size()-1;
3088 double jres = xRES[
size];
3093 for(
int i=0;
i<
size;
i++) {
if(xRES[
i]>hmax) hmax=xRES[
i];
if(xRES[
i]<hmin) hmin=xRES[
i];}
3094 hmin-=0.4*(hmax-hmin);
3095 hmax+=0.4*(hmax-hmin);
3096 hmax*=1.2;
if(hmax>1) hmax=1;
3099 TCanvas* cres =
new TCanvas(
"residuals",
"residuals", 200, 20, 600, 600);
3100 TH1F* hres =
new TH1F(
"residuals",
"residuals",100,hmin,hmax);
3101 for(
int i=0;
i<
size;
i++) hres->Fill(xRES[
i]);
3104 double integral = hres->ComputeIntegral();
3105 if (integral==0) {cout <<
"PlotResiduals : Empty histogram !!!" << endl;
return;}
3106 double* cumulative = hres->GetIntegral();
3107 for (
int i=0;i<hres->GetNbinsX();i++) hres->SetBinContent(i,cumulative[i]/integral);
3109 hres->SetLineWidth(2);
3113 hres->GetXaxis()->SetTitle(
"residuals");
3114 hres->GetXaxis()->SetTitleOffset(1.4);
3115 hres->GetXaxis()->SetLabelOffset(0.02);
3116 hres->GetXaxis()->SetNoExponent();
3117 hres->GetXaxis()->SetMoreLogLabels();
3119 hres->GetXaxis()->SetRangeUser(0.001,1.0);
3121 hres->GetXaxis()->SetRangeUser(0.01,1.0);
3124 hres->GetYaxis()->SetTitle(
"probability");
3125 hres->GetYaxis()->SetTitleOffset(1.6);
3126 hres->GetYaxis()->SetLabelOffset(0.02);
3127 hres->GetYaxis()->SetNoExponent();
3128 hres->GetYaxis()->SetRangeUser(0.01,1.0);
3136 float ymax = hres->GetMaximum();
3137 TLine *
line =
new TLine(jres,0,jres,ymax);
3138 line->SetLineWidth(2);
3139 line->SetLineColor(kRed);
3140 if(sim) line->Draw();
3145 cout << endl <<
"---------> gPE.erF : ";
3146 for(
int i=0;i<10;i++) cout << gPE.erF[i] <<
"/";
3147 cout << gPE.erF[10] << endl << endl;
3149 cout << endl <<
"---------> gPE.erR : ";
3150 for(
int i=0;i<10;i++) cout << gPE.erR[i] <<
"/";
3151 cout << gPE.erR[10] << endl << endl;
3154 gStyle->SetLineColor(kBlack);
3157 sprintf(title,
"Cumulative distribution of freq residuals errors (entries=%d - prob inj = %2.2g)",size,gPE.erF[10]);
3159 sprintf(title,
"Cumulative distribution of residuals errors (entries=%d - prob inj = %2.2g)",size,gPE.erR[10]);
3161 hres->SetTitle(title);
3162 hres->SetStats(kFALSE);
3164 cres->Print(TString::Format(
"%s/fresiduals_errors.%s",pdir.Data(),
PLOT_TYPE));
3166 cres->Print(TString::Format(
"%s/residuals_errors.%s",pdir.Data(),
PLOT_TYPE));
3176 int size = sim ? iSNR[0].size() : vLIKELIHOOD.size();
3183 if(sim)
for(
int n=0;
n<
nIFO;
n++) osnr+=oSNR[
n][
i];
3184 else osnr+=vLIKELIHOOD[
i];
3186 if(osnr>hmax) hmax=osnr;
3187 if(osnr<hmin) hmin=osnr;
3189 hmin-=0.4*(hmax-hmin);
3190 hmax+=0.4*(hmax-hmin);
3194 for(
int n=0;
n<
nIFO;
n++) isnr+=iSNR[
n][0];
3196 if(isnr<hmin) hmin=0.8*isnr;
3197 if(isnr>hmax) hmax=1.2*isnr;
3201 TCanvas* csnr =
new TCanvas(
"SNRnet",
"SNRnet", 200, 20, 600, 600);
3202 TH1F* hsnr =
new TH1F(
"SNRnet",
"SNRnet",10,hmin,hmax);
3205 if(sim)
for(
int n=0;
n<
nIFO;
n++) osnr+=oSNR[
n][
i];
3206 else osnr+=vLIKELIHOOD[
i];
3207 hsnr->Fill(sqrt(osnr));
3209 hsnr->SetLineWidth(2);
3213 hsnr->GetXaxis()->SetTitle(
"SNRnet");
3214 hsnr->GetXaxis()->SetTitleOffset(1.4);
3215 hsnr->GetXaxis()->SetLabelOffset(0.02);
3216 hsnr->GetXaxis()->SetNoExponent();
3218 hsnr->GetYaxis()->SetTitle(
"counts");
3219 hsnr->GetYaxis()->SetTitleOffset(1.6);
3220 hsnr->GetYaxis()->SetLabelOffset(0.02);
3221 hsnr->GetYaxis()->SetNoExponent();
3228 float ymax = hsnr->GetMaximum();
3229 TLine *
line =
new TLine(isnr,0,isnr,ymax);
3230 line->SetLineWidth(2);
3231 line->SetLineColor(kRed);
3232 if(sim) line->Draw();
3234 hsnr->Fit(
"gaus",
"q0");
3235 TF1* gauss = (TF1*)hsnr->GetFunction(
"gaus");
3237 gauss->Draw(
"SAME");
3238 gauss->SetLineColor(kGreen);
3239 gauss->SetLineWidth(2);
3243 if(sim)
sprintf(title,
"SNRnet Distribution (entries=%d - SNRnet inj = %2.2g)",size,isnr);
3244 else sprintf(title,
"SNRnet Distribution (entries=%d)",size);
3245 hsnr->SetTitle(title);
3246 hsnr->SetStats(kTRUE);
3247 csnr->Print(TString::Format(
"%s/SNRnet.%s",pdir.Data(),
PLOT_TYPE));
3248 hsnr->SetStats(kFALSE);
3263 if(gtype<1 || gtype>5)
return;
3266 if(gtype==1) gname=
"chirp_mass";
3267 if(gtype==2) gname=
"chirp_mass_err";
3268 if(gtype==3) gname=
"chirp_ell";
3269 if(gtype==4) gname=
"chirp_pfrac";
3270 if(gtype==5) gname=
"chirp_efrac";
3272 int size = vCHIRP[gtype].size();
3278 double omchirp = vCHIRP[gtype][
i];
3279 if(omchirp>hmax) hmax=omchirp;
3280 if(omchirp<hmin) hmin=omchirp;
3282 hmin-=0.4*(hmax-hmin);
3283 hmax+=0.4*(hmax-hmin);
3285 double imchirp=vCHIRP[0][0];
3286 if(sim && gtype==1) {
3287 if(imchirp<hmin) hmin=0.8*imchirp;
3288 if(imchirp>hmax) hmax=1.2*imchirp;
3292 TCanvas* cmchirp =
new TCanvas(
"mchirp",
"mchirp", 200, 20, 600, 600);
3293 TH1F* hmchirp =
new TH1F(
"mchirp",
"mchirp",10,hmin,hmax);
3294 for(
int i=0;
i<
size;
i++) hmchirp->Fill(vCHIRP[gtype][
i]);
3295 hmchirp->SetLineWidth(2);
3299 hmchirp->GetXaxis()->SetTitle(gname);
3300 hmchirp->GetXaxis()->SetTitleOffset(1.4);
3301 hmchirp->GetXaxis()->SetLabelOffset(0.02);
3302 hmchirp->GetXaxis()->SetNoExponent();
3304 hmchirp->GetYaxis()->SetTitle(
"counts");
3305 hmchirp->GetYaxis()->SetTitleOffset(1.6);
3306 hmchirp->GetYaxis()->SetLabelOffset(0.02);
3307 hmchirp->GetYaxis()->SetNoExponent();
3310 cmchirp->SetGridx();
3311 cmchirp->SetGridy();
3314 float ymax = hmchirp->GetMaximum();
3315 TLine *
line =
new TLine(imchirp,0,imchirp,ymax);
3316 line->SetLineWidth(2);
3317 line->SetLineColor(kRed);
3318 if(sim && gtype==1) line->Draw();
3328 gStyle->SetLineColor(kBlack);
3330 if(sim && gtype==1)
sprintf(title,
"%s distribution (entries=%d - inj chirp mass = %2.2g)",gname.Data(),
size,imchirp);
3331 else sprintf(title,
"%s distribution (entries=%d)",gname.Data(),
size);
3332 hmchirp->SetTitle(title);
3333 hmchirp->SetStats(kTRUE);
3334 cmchirp->Print(TString::Format(
"%s/%s.%s",pdir.Data(),gname.Data(),
PLOT_TYPE));
3335 hmchirp->SetStats(kFALSE);
3347 if(gtype!=0 && gtype!=1)
return;
3349 int size = iSNR[0].size();
3355 double isnr=0;
for(
int n=0;
n<
nIFO;
n++) isnr+= iSNR[
n][
i];
3356 double osnr=0;
for(
int n=0;
n<
nIFO;
n++) osnr+= oSNR[
n][
i];
3357 double iosnr=0;
for(
int n=0;
n<
nIFO;
n++) iosnr+=ioSNR[
n][
i];
3358 double ff = iosnr/sqrt(isnr*isnr);
3359 double of = iosnr/sqrt(isnr*osnr);
3360 double factor = gtype==0 ? ff : of;
3361 if(factor>hmax) hmax=
factor;
if(factor<hmin) hmin=
factor;
3363 hmin-=0.4*(hmax-hmin);
3364 hmax+=0.4*(hmax-hmin);
3367 TCanvas* cf =
new TCanvas(
"Factors",
"Factors", 200, 20, 600, 600);
3368 TH1F* hf =
new TH1F(
"Factors",
"Factors",10,hmin,hmax);
3370 double isnr=0;
for(
int n=0;
n<
nIFO;
n++) isnr+= iSNR[
n][
i];
3371 double osnr=0;
for(
int n=0;
n<
nIFO;
n++) osnr+= oSNR[
n][
i];
3372 double iosnr=0;
for(
int n=0;
n<
nIFO;
n++) iosnr+=ioSNR[
n][
i];
3373 double ff = iosnr/sqrt(isnr*isnr);
3374 double of = iosnr/sqrt(isnr*osnr);
3375 double factor = gtype==0 ? ff : of;
3378 hf->SetLineWidth(2);
3382 if(gtype==0) hf->GetXaxis()->SetTitle(
"Fitting Factor");
3383 if(gtype==1) hf->GetXaxis()->SetTitle(
"Overlap Factor");
3384 hf->GetXaxis()->SetTitleOffset(1.4);
3385 hf->GetXaxis()->SetLabelOffset(0.02);
3386 hf->GetXaxis()->SetNoExponent();
3388 hf->GetYaxis()->SetTitle(
"counts");
3389 hf->GetYaxis()->SetTitleOffset(1.6);
3390 hf->GetYaxis()->SetLabelOffset(0.02);
3391 hf->GetYaxis()->SetNoExponent();
3398 if(gtype==0)
sprintf(title,
"Fitting Factor Distribution (entries=%d)",size);
3399 if(gtype==1)
sprintf(title,
"Overlap Factor Distribution (entries=%d)",size);
3400 hf->SetTitle(title);
3401 gStyle->SetLineColor(kBlack);
3402 hf->SetStats(kTRUE);
3403 if(gtype==0) cf->Print(TString::Format(
"%s/FittingFactor.%s",pdir.Data(),
PLOT_TYPE));
3404 if(gtype==1) cf->Print(TString::Format(
"%s/OverlapFactor.%s",pdir.Data(),
PLOT_TYPE));
3405 hf->SetStats(kFALSE);
3413 if(vNUL->size()==0 || vNSE->size()==0)
return;
3417 for(
int i=0;
i<vNUL->size();
i++) {
3418 if((*vNUL)[
i]>xmax) xmax=(*vNUL)[
i];
if((*vNUL)[
i]<xmin) xmin=(*vNUL)[
i];
3420 xmin *= xmin>0 ? 0.5 : 1.5;
3421 xmax *= xmax>0 ? 1.5 : 0.5;
3424 TH1F* hnul =
new TH1F(
"null",
"null",10,xmin,xmax);
3425 for(
int i=0;
i<vNUL->size();
i++) hnul->Fill((*vNUL)[
i]);
3426 hnul->SetLineWidth(2);
3427 hnul->SetLineColor(kRed);
3429 TH1F* hnse =
new TH1F(
"noise",
"noise",10,xmin,xmax);
3430 for(
int i=0;i<vNSE->size();i++) hnse->Fill((*vNSE)[i]);
3431 double scale = double(hnul->GetEntries())/hnse->GetEntries();
3433 hnse->SetLineWidth(2);
3434 hnse->SetLineColor(kBlack);
3438 for(
int i=0;i<=hnul->GetNbinsX();i++) {
3439 double binc = hnul->GetBinContent(i);
3440 if(binc>ymax) ymax=binc;
3442 for(
int i=0;i<=hnse->GetNbinsX();i++) {
3443 double binc = hnse->GetBinContent(i);
3444 if(binc>ymax) ymax=binc;
3447 hnse->GetYaxis()->SetRangeUser(ymin,ymax);
3449 double KS = hnul->Integral() ? hnul->KolmogorovTest(hnse,
"N") : 0.;
3450 double AD = hnul->Integral() ? hnul->AndersonDarlingTest(hnse) : 0;
3452 hnul->Fit(
"gaus",
"q0");
3453 TF1* gaus = (TF1*)hnul->GetFunction(
"gaus");
3454 double chi2 = gaus ? gaus->GetChisquare()/gaus->GetNDF() : 0;
3458 TCanvas* cnul =
new TCanvas(
"cnull",
"cnull", 200, 20, 600, 600);
3463 hnse->GetXaxis()->SetTitle(gtype);
3464 hnse->GetXaxis()->SetTitleOffset(1.4);
3465 hnse->GetXaxis()->SetLabelOffset(0.02);
3466 hnse->GetXaxis()->SetNoExponent();
3468 hnse->GetYaxis()->SetTitle(
"counts");
3469 hnse->GetYaxis()->SetTitleOffset(1.6);
3470 hnse->GetYaxis()->SetLabelOffset(0.02);
3471 hnse->GetYaxis()->SetNoExponent();
3477 hnse->Fit(
"gaus",
"q0");
3478 gaus = (TF1*)hnse->GetFunction(
"gaus");
3481 gaus->SetLineColor(kGreen);
3482 gaus->SetLineWidth(2);
3486 sprintf(title,
"%s : %s (entries=%d) : KS=%0.2f : AD=%0.2f : CHI2=%0.2f",ifoName.Data(),gtype.Data(),vNUL->size(),KS,AD,chi2);
3487 hnse->SetTitle(title);
3488 hnse->SetStats(kTRUE);
3489 cnul->Print(TString::Format(
"%s/%s_%s_dist.%s",pdir.Data(),ifoName.Data(),gtype.Data(),
PLOT_TYPE));
3490 hnse->SetStats(kFALSE);
3499 if(gtype==
"null_90") I+=7;
3501 gPE.nstat[I+0] = hnul->GetMean();
3502 gPE.nstat[I+1] = hnul->GetRMS();
3503 gPE.nstat[I+2] = hnse->GetMean();
3504 gPE.nstat[I+3] = hnse->GetRMS();
3505 gPE.nstat[I+4] = chi2;
3506 gPE.nstat[I+5] = KS;
3507 gPE.nstat[I+6] = AD;
3510 cout <<
" Pixels Statistic : " << ifoName <<
" " << gtype << endl;
3511 cout <<
" Null Pixels Mean : " << gPE.nstat[I+0] << endl;
3512 cout <<
" Null Pixels RMS : " << gPE.nstat[I+1] << endl;
3513 cout <<
" Noise Pixels Mean : " << gPE.nstat[I+2] << endl;
3514 cout <<
" Noise Pixels RMS : " << gPE.nstat[I+3] << endl;
3515 cout <<
" Noise Pixels Chi2 : " << gPE.nstat[I+4] << endl;
3516 cout <<
" KolmogorovTest : " << gPE.nstat[I+5] << endl;
3517 cout <<
" AndersonDarlingTest : " << gPE.nstat[I+6] << endl;
3536 T = E>0 ?
T/E : 0.5*size/
rate;
3550 for(
int i=0;
i<
N;
i++) {avr+=
i*x[
i]*x[
i]; E+=x[
i]*x[
i];}
3557 double sum = ((M>=0)&&(M<N)) ? x[M]*x[M] : 0.;
3558 for(
int j=1;
j<
N;
j++) {
3559 a = ((M-
j>=0)&&(M-j<N)) ? x[M-j] : 0.;
3560 b = ((M+j>=0)&&(M+j<N)) ? x[M+j] : 0.;
3564 if(sum/E > P)
break;
3580 double dF=(rate/(double)size)/2.;
3582 a = x[
j]*x[
j]+x[
j+1]*x[
j+1];
3586 F = E>0 ?
F/E : 0.5*
rate;
3602 for(
int i=0;
i<
N;
i++) {avr+=
i*x[
i]*x[
i]; E+=x[
i]*x[
i];}
3609 double sum = ((M>=0)&&(M<N)) ? x[M]*x[M] : 0.;
3610 for(
int j=1;
j<
N;
j++) {
3611 a = ((M-
j>=0)&&(M-j<N)) ? x[M-j] : 0.;
3612 b = ((M+j>=0)&&(M+j<N)) ? x[M+j] : 0.;
3616 if(sum/E > P)
break;
3619 double dF=(x.
rate()/(double)x.
size())/2.;
3639 if(T<bT || T>eT) x[
j]=0;
3644 double dF=(x.
rate()/(double)x.
size())/2.;
3648 if(F<bF || F>eF) {x[
j]=0;x[
j+1]=0;}
3664 double dT = 1./x->
rate();
3667 if(T<bT || T>eT) x->
data[
j]=0;
3672 double dF=(x->
rate()/(double)x->
size())/2.;
3676 if(F<bF || F>eF) {x->
data[
j]=0;x->
data[
j+1]=0;}
3692 if(factor==0)
sprintf(sfactor,
"z%g",factor);
3693 if(factor>0)
sprintf(sfactor,
"p%g",factor);
3694 }
else sprintf(sfactor,
"%g",factor);
3698 char sim_label[512];
3700 sprintf(out_CED,
"%s/ced_%s_%d",cfg->
nodedir,sim_label,gSystem->GetPid());
3702 char prod_label[512];
3703 sprintf(prod_label,
"%d_%d_%s_slag%d_lag%lu_%lu_job%d",
3705 sprintf(out_CED,
"%s/ced_%s_%d",cfg->
nodedir,prod_label,gSystem->GetPid());
3707 cout << out_CED << endl;
3717 cout<<
"DumpCED : dump ced to disk ..." <<endl;
3733 ced.
Write(ofactor,fullCED);
3743 sprintf(dirCED,
"%s/%s", out_CED, ifostr);
3767 if(gSystem->Getenv(
"HOME_CED_WWW")==NULL) {
3768 cout <<
"Error : environment HOME_CED_WWW is not defined!!! " << endl;
exit(1);}
3771 sprintf(ofileName,
"%s/pe_index.html",dirCED.Data());
3772 cout <<
"ofileName : " << ofileName << endl;
3779 if(!out.good()) {cout <<
"Error Opening File : " << ofileName << endl;
exit(1);}
3781 WriteBodyHTML(pe_index,
"PE_HEADER_BEG",
"PE_HEADER_END", &out);
3783 WriteBodyHTML(pe_index,
"PE_BODY_BEG",
"PE_BODY_END", &out);
3785 int sbody_height = 0;
3786 out <<
"<div class=\"tabber\">" << endl;
3790 if(gOPT.ced_tfmap) {
3791 out <<
"<div class=\"tabbertab\">" << endl;
3792 out <<
" <h2>Time-Frequency Maps</h2>" << endl;
3793 sbody_height = 1000+nIFO*400;
3794 if(gOPT.ced_pca) sbody_height += 600;
3795 out <<
" <iframe src=\"tfmap_body.html\" width=\"100%\" " 3796 <<
" height=\"" << sbody_height <<
"px\" frameborder=\"0\"></iframe>" << endl;
3797 out <<
"</div>" << endl;
3803 out <<
"<div class=\"tabbertab\">" << endl;
3804 out <<
" <h2>Reconstructed Detector Responses</h2>" << endl;
3805 if(!sim) sbody_height = 350+nIFO*450;
3806 else sbody_height = 350+nIFO*1340;
3807 out <<
" <iframe src=\"rec_signal_body.html\" width=\"100%\" " 3808 <<
" height=\"" << sbody_height <<
"px\" frameborder=\"0\"></iframe>" << endl;
3809 out <<
"</div>" << endl;
3815 out <<
"<div class=\"tabbertab\">" << endl;
3816 out <<
" <h2>PSD</h2>" << endl;
3817 sbody_height = 350+(nIFO+1)*750;
3818 out <<
" <iframe src=\"psd_body.html\" width=\"100%\" " 3819 <<
" height=\"" << sbody_height <<
"px\" frameborder=\"0\"></iframe>" << endl;
3820 out <<
"</div>" << endl;
3825 sbody_height = 2050;
3827 out <<
"<div class=\"tabbertab\">" << endl;
3828 out <<
" <h2>SkyMaps</h2>" << endl;
3829 out <<
" <iframe src=\"skymap_body.html\" width=\"100%\" " 3830 <<
" height=\"" << sbody_height <<
"px\" frameborder=\"0\"></iframe>" << endl;
3831 out <<
"</div>" << endl;
3837 out <<
"<div class=\"tabbertab\">" << endl;
3838 out <<
" <h2>Waveform Errors</h2>" << endl;
3839 sbody_height = 370+nIFO*880;
3840 out <<
" <iframe src=\"rec_avr_signal_body.html\" width=\"100%\" " 3841 <<
" height=\"" << sbody_height <<
"px\" frameborder=\"0\"></iframe>" << endl;
3842 out <<
"</div>" << endl;
3847 if(sim && gOPT.ced_inj) {
3848 out <<
"<div class=\"tabbertab\">" << endl;
3849 out <<
" <h2>Injection</h2>" << endl;
3850 sbody_height = 390+nIFO*880;
3851 out <<
" <iframe src=\"rec_inj_signal_body.html\" width=\"100%\" " 3852 <<
" height=\"" << sbody_height <<
"px\" frameborder=\"0\"></iframe>" << endl;
3853 out <<
"</div>" << endl;
3859 if(sim && gOPT.ced_rinj) {
3860 out <<
"<div class=\"tabbertab\">" << endl;
3861 out <<
" <h2>Injection</h2>" << endl;
3862 sbody_height = 390+nIFO*320;
3863 out <<
" <iframe src=\"rec_inj_signal_body.html\" width=\"100%\" " 3864 <<
" height=\"" << sbody_height <<
"px\" frameborder=\"0\"></iframe>" << endl;
3865 out <<
"</div>" << endl;
3871 sbody_height = 2100;
3872 out <<
"<div class=\"tabbertab\">" << endl;
3873 out <<
" <h2>Chirp Mass</h2>" << endl;
3874 out <<
" <iframe src=\"mchirp_body.html\" width=\"100%\" " 3875 <<
" height=\"" << sbody_height <<
"px\" frameborder=\"0\"></iframe>" << endl;
3876 out <<
"</div>" << endl;
3881 if(gOPT.ced_distr) {
3882 sbody_height = 2000;
3883 out <<
"<div class=\"tabbertab\">" << endl;
3884 out <<
" <h2>Distributions</h2>" << endl;
3885 out <<
" <iframe src=\"distribution_body.html\" width=\"100%\" " 3886 <<
" height=\"" << sbody_height <<
"px\" frameborder=\"0\"></iframe>" << endl;
3887 out <<
"</div>" << endl;
3893 sbody_height = 100+nIFO*1300;
3894 out <<
"<div class=\"tabbertab\">" << endl;
3895 out <<
" <h2>Null Pixels</h2>" << endl;
3896 out <<
" <iframe src=\"nstat_body.html\" width=\"100%\" " 3897 <<
" height=\"" << sbody_height <<
"px\" frameborder=\"0\"></iframe>" << endl;
3898 out <<
"</div>" << endl;
3903 out <<
"</div>" << endl;
3907 if(gOPT.ced_tfmap) {
3908 out.open(TString::Format(
"%s/tfmap_body.html",dirCED.Data()).Data(),
ios::out);
3910 WriteBodyHTML(pe_index,
"PE_JSCRIPT_BEG",
"PE_JSCRIPT_END", &out);
3911 WriteBodyHTML(pe_index,
"PE_TFMAP_HEADER_BEG",
"PE_TFMAP_HEADER_END", &out);
3912 WriteBodyHTML(pe_index,
"PE_TFMAP_BEG",
"PE_TFMAP_END", &out, nIFO, ifo);
3914 out <<
"<p><br /></p> " << endl;
3915 out <<
"<p><br /></p> " << endl;
3916 WriteBodyHTML(pe_index,
"PE_LIKELIHOOD_BEG",
"PE_LIKELIHOOD_END", &out);
3921 if(gOPT.ced_pca)
WriteBodyHTML(pe_index,
"PE_PCA_BEG",
"PE_PCA_END", &out);
3927 out.open(TString::Format(
"%s/rec_signal_body.html",dirCED.Data()).Data(),
ios::out);
3928 WriteBodyHTML(pe_index,
"PE_JSCRIPT_BEG",
"PE_JSCRIPT_END", &out);
3929 WriteBodyHTML(pe_index,
"PE_REC_SIGNAL_HEADER_BEG",
"PE_REC_SIGNAL_HEADER_END", &out);
3931 WriteBodyHTML(pe_index,
"PE_IFO_SIGNAL_BEG",
"PE_IFO_SIGNAL_END", &out, 1, &ifo[
n]);
3933 WriteBodyHTML(pe_index,
"PE_INJ_SIGNAL_BEG",
"PE_INJ_SIGNAL_END", &out, 1, &ifo[n]);
3935 WriteBodyHTML(pe_index,
"PE_REC_SIGNAL_BEG",
"PE_REC_SIGNAL_END", &out, 1, &ifo[n]);
3936 out <<
"<p><br /></p> " << endl;
3937 out <<
"<p><br /></p> " << endl;
3944 out.open(TString::Format(
"%s/psd_body.html",dirCED.Data()).Data(),
ios::out);
3945 WriteBodyHTML(pe_index,
"PE_JSCRIPT_BEG",
"PE_JSCRIPT_END", &out);
3946 WriteBodyHTML(pe_index,
"PE_PSD_HEADER_BEG",
"PE_PSD_HEADER_END", &out);
3948 WriteBodyHTML(pe_index,
"PE_IFO_PSD_BEG",
"PE_IFO_PSD_END", &out, 1, &ifo[
n]);
3949 WriteBodyHTML(pe_index,
"PE_PSD_BEG",
"PE_PSD_END", &out, 1, &ifo[n]);
3950 out <<
"<p><br /></p> " << endl;
3951 out <<
"<p><br /></p> " << endl;
3958 out.open(TString::Format(
"%s/skymap_body.html",dirCED.Data()).Data(),
ios::out);
3959 WriteBodyHTML(pe_index,
"PE_JSCRIPT_BEG",
"PE_JSCRIPT_END", &out);
3960 WriteBodyHTML(pe_index,
"PE_SKYMAP_BEG",
"PE_SKYMAP_END", &out);
3966 out.open(TString::Format(
"%s/rec_avr_signal_body.html",dirCED.Data()).Data(),
ios::out);
3967 WriteBodyHTML(pe_index,
"PE_JSCRIPT_BEG",
"PE_JSCRIPT_END", &out);
3968 WriteBodyHTML(pe_index,
"PE_REC_AVR_SIGNAL_HEADER_BEG",
"PE_REC_AVR_SIGNAL_HEADER_END", &out);
3970 WriteBodyHTML(pe_index,
"PE_REC_AVR_SIGNAL_BEG",
"PE_REC_AVR_SIGNAL_END", &out, 1, &ifo[
n]);
3971 out <<
"<p><br /></p> " << endl;
3972 out <<
"<p><br /></p> " << endl;
3978 if(sim && (gOPT.ced_inj || gOPT.ced_rinj)) {
3979 out.open(TString::Format(
"%s/rec_inj_signal_body.html",dirCED.Data()).Data(),
ios::out);
3980 WriteBodyHTML(pe_index,
"PE_JSCRIPT_BEG",
"PE_JSCRIPT_END", &out);
3981 if(gOPT.ced_inj)
WriteBodyHTML(pe_index,
"PE_REC_INJ_SIGNAL_0_HEADER_BEG",
"PE_REC_INJ_SIGNAL_0_HEADER_END", &out);
3982 if(gOPT.ced_rinj)
WriteBodyHTML(pe_index,
"PE_REC_INJ_SIGNAL_HEADER_BEG",
"PE_REC_INJ_SIGNAL_HEADER_END", &out);
3985 if(gOPT.ced_inj)
WriteBodyHTML(pe_index,
"PE_REC_INJ_SIGNAL_0_BEG",
"PE_REC_INJ_SIGNAL_0_END", &out, 1, &ifo[
n]);
3986 if(gOPT.ced_rinj)
WriteBodyHTML(pe_index,
"PE_REC_INJ_SIGNAL_BEG",
"PE_REC_INJ_SIGNAL_END", &out, 1, &ifo[n]);
3987 out <<
"<p><br /></p> " << endl;
3988 out <<
"<p><br /></p> " << endl;
3996 if(gOPT.ced_distr) {
3997 out.open(TString::Format(
"%s/distribution_body.html",dirCED.Data()).Data(),
ios::out);
3998 WriteBodyHTML(pe_index,
"PE_JSCRIPT_BEG",
"PE_JSCRIPT_END", &out);
3999 WriteBodyHTML(pe_index,
"PE_DISTRIBUTION_BEG",
"PE_DISTRIBUTION_END", &out);
4000 if(sim)
WriteBodyHTML(pe_index,
"PE_FACTORS_DISTRIBUTION_BEG",
"PE_FACTORS_DISTRIBUTION_END", &out);
4006 out.open(TString::Format(
"%s/nstat_body.html",dirCED.Data()).Data(),
ios::out);
4007 WriteBodyHTML(pe_index,
"PE_JSCRIPT_BEG",
"PE_JSCRIPT_END", &out);
4008 WriteBodyHTML(pe_index,
"PE_NULPIX_DISTRIBUTION_HEADER_BEG",
"PE_NULPIX_DISTRIBUTION_HEADER_END", &out);
4010 WriteBodyHTML(pe_index,
"PE_NULPIX_DISTRIBUTION_BEG",
"PE_NULPIX_DISTRIBUTION_END", &out, 1, &ifo[
n]);
4011 out <<
"<p><br /></p> " << endl;
4012 out <<
"<p><br /></p> " << endl;
4019 out.open(TString::Format(
"%s/mchirp_body.html",dirCED.Data()).Data(),
ios::out);
4020 WriteBodyHTML(pe_index,
"PE_JSCRIPT_BEG",
"PE_JSCRIPT_END", &out);
4021 WriteBodyHTML(pe_index,
"PE_MCHIRP_DISTRIBUTION_HEADER_BEG",
"PE_MCHIRP_DISTRIBUTION_HEADER_END", &out);
4022 WriteBodyHTML(pe_index,
"PE_MCHIRP_DISTRIBUTION_BEG",
"PE_MCHIRP_DISTRIBUTION_END", &out);
4028 sprintf(cmd,
"cp ${HOME_WAT}//html/etc/html/tabber.css %s",dirCED.Data());
4030 sprintf(cmd,
"cp ${HOME_WAT}//html/etc/html/tabber.js %s",dirCED.Data());
4033 sprintf(cmd,
"mv %s/pe_index.html %s/index.html",dirCED.Data(),dirCED.Data());
4046 if(gSystem->Getenv(
"SITE_CLUSTER")!=NULL) {
4047 site_cluster=
TString(gSystem->Getenv(
"SITE_CLUSTER"));
4049 TString cluster_site_logo =
"cluster_site_logo_modern.png";
4050 TString cluster_site_url1 =
"http://www.ligo.caltech.edu/";
4051 TString cluster_site_name1 =
"LIGO Homepage";
4052 TString cluster_site_url2 =
"https://www.virgo-gw.eu/";
4053 TString cluster_site_name2 =
"VIRGO Homepage";
4054 if(site_cluster==
"ATLAS") {
4055 cluster_site_logo =
"atlas_logo_modern.png";
4056 cluster_site_url1 =
"http://www.aei.mpg.de/14026/AEI_Hannover/";
4057 cluster_site_name1 =
"AEI Hannover Homepage";
4058 cluster_site_url2 =
"http://www.aei.mpg.de/14026/AEI_Hannover";
4059 cluster_site_name2 =
"AEI Hannover Homepage";
4061 if(site_cluster==
"CIT") {
4062 cluster_site_logo =
"ligo_virgo_logo_modern.png";
4063 cluster_site_url1 =
"http://www.ligo.caltech.edu/";
4064 cluster_site_name1 =
"LIGO Homepage";
4065 cluster_site_url2 =
"https://www.virgo-gw.eu/";
4066 cluster_site_name2 =
"VIRGO Homepage";
4068 if(site_cluster==
"VIRTUALBOX") {
4069 cluster_site_logo =
"cluster_site_logo_modern.png";
4070 cluster_site_url1 =
"https://www.gw-openscience.org/about/";
4071 cluster_site_name1 =
"GWOSC Homepage";
4072 cluster_site_url2 =
"https://www.gw-openscience.org/about/";
4073 cluster_site_name2 =
"GWOSC Homepage";
4077 TString home_www=
"~waveburst/waveburst";
4078 if(gSystem->Getenv(
"HOME_WWW")!=NULL) {
4079 home_www=
TString(gSystem->Getenv(
"HOME_WWW"));
4083 TString home_ced_www=
"~waveburst/waveburst/ced-1.0-modern";
4084 if(gSystem->Getenv(
"HOME_CED_WWW")!=NULL) {
4085 home_ced_www=
TString(gSystem->Getenv(
"HOME_CED_WWW"));
4090 if(gSystem->Getenv(
"CWB_DOC_URL")!=NULL) {
4091 cwb_doc_url=
TString(gSystem->Getenv(
"CWB_DOC_URL"));
4095 TString cwb_git_url=
"https://git.ligo.org";
4096 if(gSystem->Getenv(
"CWB_GIT_URL")!=NULL) {
4097 cwb_git_url=
TString(gSystem->Getenv(
"CWB_GIT_URL"));
4101 TString cwb_git_issues_url=cwb_git_url;
4102 TString partA=cwb_git_issues_url;
4103 TString partB=cwb_git_issues_url;
4104 partA.Remove(partA.Last(
'/'),partA.Sizeof()-1);
4105 partB.Remove(0,partB.Last(
'/')+1);
4106 cwb_git_issues_url=partA+
"/groups/"+partB+
"/-/issues";
4113 in.open(html_template.Data(),
ios::in);
4114 if(!in.good()) {cout <<
"Error Opening File : " << html_template.Data() << endl;
exit(1);}
4116 in.getline(line,1024);
4117 if(!in.good())
break;
4119 if(sline.Contains(html_tag_beg)&&!
output) output=
true;
4120 if(sline.Contains(html_tag_end)&&
output) {output=
false;
break;}
4121 if(ifo!=NULL) sline.ReplaceAll(
"IFO",ifo[
n]);
4122 sline.ReplaceAll(
"xNTRIALS",TString::Format(
"%d",(
int)vCHIRP[0].
size()-1).Data());
4123 sline.ReplaceAll(
"xINRATE",TString::Format(
"%d",(
int)gINRATE));
4124 sline.ReplaceAll(
"xRATEANA",TString::Format(
"%d",(
int)gRATEANA));
4126 sline.ReplaceAll(
"xMEAN",
"Median");
4127 sline.ReplaceAll(
"xSIGMA",
"50% Percentile");
4128 sline.ReplaceAll(
"x2SIGMA",
"90% Percentile");
4130 sline.ReplaceAll(
"xMEAN",
"Mean");
4131 sline.ReplaceAll(
"xSIGMA",
"RMS");
4132 sline.ReplaceAll(
"x2SIGMA",
"2RMS");
4134 sline.ReplaceAll(
"HOME_CED_WWW",home_ced_www.Data());
4135 sline.ReplaceAll(
"CWB_DOC_URL",cwb_doc_url.Data());
4136 sline.ReplaceAll(
"HOME_WWW",home_www.Data());
4137 if(cwb_doc_url!=
"") {
4138 sline.ReplaceAll(
"<!--CWB_DOC_URL",
"");
4139 sline.ReplaceAll(
"CWB_DOC_URL-->",
"");
4140 sline.ReplaceAll(
"XCWB_DOC_URL",cwb_doc_url.Data());
4143 sline.ReplaceAll(
"HOME_WWW",home_www);
4144 sline.ReplaceAll(
"HOME_CED_WWW",home_ced_www);
4145 if(cwb_doc_url.Contains(
"gwburst.gitlab.io")) {
4146 sline.ReplaceAll(
"/CWB_DOC_URL/cwb/man",cwb_doc_url);
4148 sline.ReplaceAll(
"CWB_DOC_URL",cwb_doc_url);
4150 sline.ReplaceAll(
"CWB_GIT_URL",cwb_git_url);
4151 sline.ReplaceAll(
"CWB_GIT_ISSUES_URL",cwb_git_issues_url);
4152 sline.ReplaceAll(
"CLUSTER_SITE_LOGO",cluster_site_logo);
4153 sline.ReplaceAll(
"CLUSTER_SITE_URL1",cluster_site_url1);
4154 sline.ReplaceAll(
"CLUSTER_SITE_NAME1",cluster_site_name1);
4155 sline.ReplaceAll(
"CLUSTER_SITE_URL2",cluster_site_url2);
4156 sline.ReplaceAll(
"CLUSTER_SITE_NAME2",cluster_site_name2);
4161 if(output) (*out) << sline.Data() << endl;
4172 n = ifo->
IWFP.size();
4173 for (
int i=0;
i<
n;
i++) {
4180 n = ifo->
RWFP.size();
4181 for (
int i=0;
i<
n;
i++) {
4200 TString xtitle = TString::Format(
"Time (sec) : GPS OFFSET = %.3f",gSEGGPS);
4206 for(
int i=0;
i<frec->
size();
i++) {
4208 if(xtime>bT && xtime<eT)
continue;
4215 TGraphErrors* e2gr =
new TGraphErrors(size,time.
data,favr->
data,etime.
data,f2err.
data);
4216 e2gr->SetLineColor(17);
4217 e2gr->SetFillStyle(1001);
4218 e2gr->SetFillColor(17);
4219 e2gr->GetXaxis()->SetTitle(xtitle);
4220 e2gr->GetYaxis()->SetTitle(
"frequency (hz)");
4221 e2gr->SetTitle(title);
4222 e2gr->GetXaxis()->SetTitleFont(42);
4223 e2gr->GetXaxis()->SetLabelFont(42);
4224 e2gr->GetXaxis()->SetLabelOffset(0.012);
4225 e2gr->GetXaxis()->SetTitleOffset(1.5);
4226 e2gr->GetYaxis()->SetTitleFont(42);
4227 e2gr->GetYaxis()->SetLabelFont(42);
4228 e2gr->GetYaxis()->SetLabelOffset(0.01);
4229 e2gr->GetYaxis()->SetTitleOffset(1.4);
4232 TGraphErrors* egr =
new TGraphErrors(size,time.
data,favr->
data,etime.
data,ferr->
data);
4233 egr->SetLineColor(15);
4234 egr->SetFillStyle(1001);
4235 egr->SetFillColor(15);
4237 TGraph* agr =
new TGraph(size,time.
data,favr->
data);
4238 agr->SetLineWidth(1);
4239 agr->SetLineColor(kWhite);
4240 agr->SetLineStyle(1);
4242 TGraph*
gr =
new TGraph(size,time.
data,frec->
data);
4243 gr->SetLineWidth(1);
4244 gr->SetLineColor(2);
4246 TCanvas*
canvas =
new TCanvas(
"frec",
"frec",200,20,800,500);
4251 e2gr->GetXaxis()->SetRangeUser(bT, eT);
4253 egr->Draw(
"P4same");
4259 canvas->Print(ofname);
4260 cout <<
"write : " << ofname << endl;
4281 TString xtitle = TString::Format(
"Time (sec) : GPS OFFSET = %.3f",gSEGGPS);
4283 TGraphErrors* e2gr =
new TGraphErrors(size,time.
data,wavr->
data,etime.
data,w2err.
data);
4284 e2gr->SetLineColor(17);
4285 e2gr->SetFillStyle(1001);
4286 e2gr->SetFillColor(17);
4287 e2gr->GetXaxis()->SetTitle(xtitle);
4288 e2gr->GetYaxis()->SetTitle(
"magnitude");
4289 e2gr->SetTitle(title);
4290 e2gr->GetXaxis()->SetTitleFont(42);
4291 e2gr->GetXaxis()->SetLabelFont(42);
4292 e2gr->GetXaxis()->SetLabelOffset(0.012);
4293 e2gr->GetXaxis()->SetTitleOffset(1.5);
4294 e2gr->GetYaxis()->SetTitleFont(42);
4295 e2gr->GetYaxis()->SetLabelFont(42);
4296 e2gr->GetYaxis()->SetLabelOffset(0.01);
4297 e2gr->GetYaxis()->SetTitleOffset(1.4);
4299 TGraphErrors* egr =
new TGraphErrors(size,time.
data,wavr->
data,etime.
data,werr->
data);
4300 egr->SetLineColor(15);
4301 egr->SetFillStyle(1001);
4302 egr->SetFillColor(15);
4304 TGraph* agr =
new TGraph(size,time.
data,wavr->
data);
4305 agr->SetLineWidth(1);
4306 agr->SetLineColor(kWhite);
4307 agr->SetLineStyle(1);
4309 TGraph*
gr =
new TGraph(size,time.
data,wrec->
data);
4310 gr->SetLineWidth(1);
4311 gr->SetLineColor(2);
4313 TCanvas*
canvas =
new TCanvas(
"wrec",
"wrec",200,20,800,500);
4322 e2gr->GetXaxis()->SetRangeUser(bT, eT);
4330 canvas->Print(ofname);
4331 cout <<
"write : " << ofname << endl;
4359 for(
int i=0;
i<wrec->
size();
i++) {
4360 if(time[
i]>bT && time[
i]<eT)
continue;
4365 TString xtitle = TString::Format(
"Time (sec) : GPS OFFSET = %.3f",gSEGGPS);
4367 TGraphAsymmErrors* egr90 =
new TGraphAsymmErrors(size,time.
data,wmed->
data,etime.
data,etime.
data,wl90->
data,wu90->
data);
4368 egr90->SetLineColor(17);
4369 egr90->SetFillStyle(1001);
4370 egr90->SetFillColor(17);
4371 egr90->GetXaxis()->SetTitle(xtitle);
4372 if(freq) egr90->GetYaxis()->SetTitle(
"frequency (hz)");
4373 else egr90->GetYaxis()->SetTitle(
"magnitude");
4374 egr90->SetTitle(title);
4375 egr90->GetXaxis()->SetTitleFont(42);
4376 egr90->GetXaxis()->SetLabelFont(42);
4377 egr90->GetXaxis()->SetLabelOffset(0.012);
4378 egr90->GetXaxis()->SetTitleOffset(1.5);
4379 egr90->GetYaxis()->SetTitleFont(42);
4380 egr90->GetYaxis()->SetLabelFont(42);
4381 egr90->GetYaxis()->SetLabelOffset(0.01);
4382 egr90->GetYaxis()->SetTitleOffset(1.4);
4384 TGraphAsymmErrors* egr50 =
new TGraphAsymmErrors(size,time.
data,wmed->
data,etime.
data,etime.
data,wl50->
data,wu50->
data);
4385 egr50->SetLineColor(15);
4386 egr50->SetFillStyle(1001);
4387 egr50->SetFillColor(15);
4389 TGraph* agr =
new TGraph(size,time.
data,wmed->
data);
4390 agr->SetLineWidth(1);
4391 agr->SetLineColor(kWhite);
4392 agr->SetLineStyle(1);
4394 TGraph*
gr =
new TGraph(size,time.
data,wrec->
data);
4395 gr->SetLineWidth(1);
4396 gr->SetLineColor(2);
4398 TCanvas*
canvas =
new TCanvas(
"wrec",
"wrec",200,20,800,500);
4403 egr90->GetXaxis()->SetRangeUser(bT, eT);
4405 egr50->Draw(
"3same");
4411 canvas->Print(ofname);
4412 cout <<
"write : " << ofname << endl;
4434 if (!out.good()) {cout <<
"Error Opening Output File : " << ofname << endl;
exit(1);}
4435 cout <<
"Create Output File : " << ofname << endl;
4439 out <<
"#whitened data : time," <<
4440 " amp_point, amp_mean, amp_rms," <<
4441 " amp_median, amp_lower_50_perc, amp_lower_90_perc, amp_upper_50_perc, amp_upper_90_perc," <<
4442 " frq_point, frq_mean, frq_rms," <<
4443 " frq_median, frq_lower_50_perc, frq_lower_90_perc, frq_upper_50_perc, frq_upper_90_perc" << endl;
4446 int size = vREC[
n].size();
4447 double dt=1./vREC[
n].rate();
4452 double time =
i*dt+vREC[
n].start();
4454 double vl50 = vMED[
n][
i]-
fabs(vL50[
n][
i]);
4455 double vu50 = vMED[
n][
i]+
fabs(vU50[
n][i]);
4456 double vl90 = vMED[
n][
i]-
fabs(vL90[
n][i]);
4457 double vu90 = vMED[
n][
i]+
fabs(vU90[
n][i]);
4459 double fl50 = fMED[
n][
i]-
fabs(fL50[
n][i]);
4460 double fu50 = fMED[
n][
i]+
fabs(fU50[
n][i]);
4461 double fl90 = fMED[
n][
i]-
fabs(fL90[
n][i]);
4462 double fu90 = fMED[
n][
i]+
fabs(fU90[
n][i]);
4465 <<
" " << vREC[
n][
i] <<
" " << vAVR[
n][
i] <<
" " << vRMS[
n][
i]
4466 <<
" " << vMED[
n][
i] <<
" " << vl50 <<
" " << vl90 <<
" " << vu50 <<
" " << vu90
4467 <<
" " << fREC[
n][
i] <<
" " << fAVR[
n][
i] <<
" " << fRMS[
n][
i]
4468 <<
" " << fMED[
n][
i] <<
" " << fl50 <<
" " << fl90 <<
" " << fu50 <<
" " << fu90
4488 if (!out.good()) {cout <<
"Error Opening Output File : " << ofname << endl;
exit(1);}
4489 cout <<
"Create Output File : " << ofname << endl;
4493 out <<
"# time white_amp" << endl;
4496 int size = vINJ[
n].size();
4497 double dt=1./vINJ[
n].rate();
4499 double time =
i*dt+vINJ[
n].start();
4500 out << time <<
" " << vINJ[
n][
i] << endl;
4510 int gLRETRY=-1;
IMPORT(
int,gLRETRY)
4514 if(gLRETRY==0)
return 1;
4516 bool use_original_data = (gLRETRY==1) ?
true :
false;
4518 if(gOPT.multitask) use_original_data = (gMTRIAL==gOPT.trials) ?
true :
false;
4520 if(use_original_data) cout << endl <<
"Last Trial : Analysis of the original data" << endl << endl;
4525 vector<TString> delObjList;
4527 delObjList.push_back(
"supercluster");
4528 delObjList.push_back(
"sparse");
4530 jname.ReplaceAll(
":/",
"");
4542 if(gOPT.signal==0) wf=vREC[
n];
4544 if(gOPT.signal==2) wf=vDAT[
n];
4547 if((!use_original_data) && gOPT.amp_cal_err[n]) {
4548 double amp_cal_err = 1;
4549 if(gOPT.amp_cal_err[n]>0) amp_cal_err = gRandom->Uniform(1-gOPT.amp_cal_err[n],1+gOPT.amp_cal_err[n]);
4550 else amp_cal_err = gRandom->Gaus(1,
fabs(gOPT.amp_cal_err[n]));
4551 cout <<
"Apply Amplitude Mis-Calibration (" << gOPT.amp_cal_err[
n] <<
"%) " 4552 << NET->
ifoName[
n] <<
" -> amp_cal_err : " << amp_cal_err << endl;
4556 if((!use_original_data) && gOPT.phs_cal_err[n]) {
4557 double phs_cal_err = 0;
4558 if(gOPT.phs_cal_err[n]>0) phs_cal_err = gRandom->Uniform(-gOPT.phs_cal_err[n],gOPT.phs_cal_err[n]);
4559 else phs_cal_err = gRandom->Gaus(0,
fabs(gOPT.phs_cal_err[n]));
4560 cout <<
"Apply Phase Mis-Calibration (" << gOPT.phs_cal_err[
n] <<
" deg) " 4561 << NET->
ifoName[
n] <<
" -> phs_cal_err : " << phs_cal_err <<
" deg" << endl;
4566 size = gHOT[
n].
size();
4567 rate = gHOT[
n].
rate();
4572 k = gRandom->Uniform(jS+jW,jE-jW);
4573 if(use_original_data) {
4574 *gCWB2G->
hot[
n] = gHOT[
n];
4577 for(
int i=jS;
i<jE;
i++) {
4597 jfile =
new TFile(jname);
4601 cout <<
"Loading sparse TF map ... " << endl;
4609 else sprintf(swname,
"sparse/%s-level:%d",ifo.Data(),
i+cfg->
l_low);
4612 cout <<
"CWB_Plugin_PE - Likelihood : sparse map " << swname
4613 <<
" not exist in job file" << endl;
exit(1);
4616 pD->
vSS.push_back(SS);
4626 vector<int> clist = pwc->
read(jfile,
"supercluster",
"clusters",0,cycle);
4627 return clist.size();
4634 if(wf1==NULL)
return wf;
4635 if(wf1->
size()==0)
return wf;
4637 double R=wf1->
rate();
4639 double b_wf1 = wf1->
start();
4640 double e_wf1 = wf1->
start()+wf1->
size()/R;
4641 double b_wf2 = wf2->
start();
4642 double e_wf2 = wf2->
start()+wf2->
size()/R;
4644 int o_wf1 = b_wf1>b_wf2 ? 0 :
int((b_wf2-b_wf1)*R+0.5);
4645 int o_wf2 = b_wf1<b_wf2 ? 0 :
int((b_wf1-b_wf2)*R+0.5);
4647 double startXCOR = b_wf1>b_wf2 ? b_wf1 : b_wf2;
4648 double endXCOR = e_wf1<e_wf2 ? e_wf1 : e_wf2;
4649 int sizeXCOR =
int((endXCOR-startXCOR)*R+0.5);
4651 for(
int i=0;
i<sizeXCOR;
i++) wf[
i+o_wf1] += wf2->
data[
i+o_wf2];
4663 for(
int n=0;
n<cfg->
nIFO;
n++) {
4677 cout <<
"Write file : " << cfg->
DQF[cfg->
nDQF-1].
file << endl;
4678 if (!out.good()) {cout <<
"Error Opening File : " << cfg->
DQF[cfg->
nDQF-1].
file << endl;
exit(1);}
4682 out <<
"1 " << istart <<
" " << istop <<
" " << 2*cfg->
iwindow << endl;
4693 int ntry=0;
for(
int i=0;
i<gOPT.trials;
i++)
if(wREC[
i].
size()) ntry++;
4695 int *
index =
new int[ntry];
4696 float *
value =
new float[ntry];
4698 int L = skyprob.
size();
4700 for(
int l=0;
l<
L;
l++) {
4702 int k=0;
for(
int i=0;
i<gOPT.trials;
i++)
if(wREC[
i].
size()) value[k++] = wSKYPROB[
i].
get(
l);
4703 TMath::Sort(ntry,value,index,
false);
4705 int imed = (ntry*50.)/100.;
if(imed>=ntry) imed=ntry-1;
4707 skyprob.
set(
l,value[index[imed]]);
4709 sum+=value[index[imed]];
4713 if(sum>0)
for(
int l=0;
l<
L;
l++) skyprob.
set(
l,skyprob.
get(
l)/sum);
4726 int L = skyprobcc.
size();
4727 for(
int l=0;
l<
L;
l++) {
4733 skyprobcc.
set(k,skyprob->
get(
l));
4739 sprintf(fname,
"%s/mskyprobcc.%s", odir.Data(),
"fits");
4743 if(NET->
MRA) analysis+=
":MRA";
4744 if(NET->
pattern==0) analysis+=
":Packet(0)";
4748 char configur[64]=
"";
4750 if (search==
'r')
sprintf(configur,
"%s un-modeled",analysis.Data());
4751 if (search==
'i')
sprintf(configur,
"%s iota-wave",analysis.Data());
4752 if (search==
'p')
sprintf(configur,
"%s psi-wave",analysis.Data());
4753 if((search==
'l')||(search==
's'))
sprintf(configur,
"%s linear",analysis.Data());
4754 if((search==
'c')||(search==
'g'))
sprintf(configur,
"%s circular",analysis.Data());
4755 if((search==
'e')||(search==
'b'))
sprintf(configur,
"%s elliptical",analysis.Data());
4756 skyprobcc.Dump2fits(fname,EVT->
time[0],configur,const_cast<char*>(
"PROB"),const_cast<char*>(
"pix-1"),
'C');
4765 char beginString[1024];
4767 char endString[1024];
4768 sprintf(endString,
"_job%d.root",runID);
4769 char containString[1024];
4775 for(
int i=0;i<nIFO;i++) mtpe_wREC[i] = new wavearray<double>;
4777 float* chirp =
new float[6];
4778 float* isnr =
new float[
nIFO];
4779 float* osnr =
new float[
nIFO];
4780 float* iosnr =
new float[
nIFO];
4784 int nfile = fileList.size();
4785 for(
int n=0;
n<nfile;
n++) {
4786 cout <<
n <<
" " << fileList[
n].Data() << endl;
4788 TFile*
froot =
new TFile(fileList[
n].Data(),
"READ");
4790 cout <<
"CWB_Plugin_PE Error : Failed to open file : " << fileList[
n].Data() << endl;
4793 TTree*
itree = (TTree*)froot->Get(
"waveburst");
4795 cout <<
"CWB_Plugin_PE Error : Failed to open tree waveburst from file : " << fileList[
n].Data() << endl;
4799 for(
int i=0;
i<
nIFO;
i++) itree->SetBranchAddress(TString::Format(
"mtpe_wREC_%d",
i).Data(),&mtpe_wREC[
i]);
4800 itree->SetBranchAddress(
"mtpe_skyprob",&mtpe_skyprob);
4801 itree->SetBranchAddress(
"chirp",chirp);
4802 itree->SetBranchAddress(
"likelihood",&likelihood);
4808 if(mtpe_wREC[
i]==NULL) {
4809 cout <<
"CWB_Plugin_PE Error : Object wavearray not exist !!! " << endl;
4813 if(mtpe_skyprob==NULL) {
4814 cout <<
"CWB_Plugin_PE Error : Object skymap not exist !!! " << endl;
4819 wSKYPROB[gOPT.trials-
n-1] = *mtpe_skyprob;
4822 wREC[gOPT.trials-
n-1].push_back(*mtpe_wREC[
i]);
4824 for(
int i=0;i<
nIFO;i++) {
4825 iSNR[
i].push_back(isnr[i]);
4826 oSNR[
i].push_back(osnr[i]);
4827 ioSNR[
i].push_back(iosnr[i]);
4832 vLIKELIHOOD.push_back(likelihood);
4837 sprintf(command,
"/bin/rm %s",fileList[
n].Data());
4838 cout << command << endl;
4839 gSystem->Exec(command);
4842 for(
int i=0;
i<
nIFO;
i++)
delete mtpe_wREC[
i];
4843 delete mtpe_skyprob;
4870 int layers_high = 1<<cfg->
l_high;
4873 int index_min=2*gHOT[0].
size();
4874 for(
int k=0;
k<V;
k++) {
4878 if(index<index_min) index_min=
index;
4881 index_min = index_min-(index_min%layers_high);
4893 int index_off = gRandom->Uniform(jS,jE-jW);
4894 index_off = index_off-(index_off%layers_high);
4895 for(
int k=0;
k<V;
k++) {
4899 int ilayers = 1<<(ires+cfg->
l_low);
4900 index = index_off+(index-index_min);
4908 aNSE[
n].push_back(dd);
4909 ANSE[
n].push_back(DD);
4920 if(type!=
"data" && type!=
"null" && type!=
"signal" && type!=
"injection") {
4921 cout <<
"CWB_Plugin_PE Error : wrong PlotSpectrogram type, must be data/null/signal" << endl;
4935 if(type==
"signal") {
4940 if(type==
"injection") {
4946 *pTF*=1./sqrt(1<<cfg->
levelR);
4950 if(pTF->
size()==0)
continue;
4956 double fparm=nfact*6;
4961 int ysize=ystop-ystart;
4974 tstart+=0.9;tstop-=0.9;
4977 sprintf(fname,
"%s/%s_%s_spectrogram_0.png", pdir.Data(), NET->
ifoName[
n], type.Data());
4980 canvas->SetLogy(
true);
4982 sprintf(fname,
"%s/%s_%s_spectrogram_logy_0.png", pdir.Data(), NET->
ifoName[
n], type.Data());
4992 std::vector<wavearray<double> > xWHT;
5016 vector<int> clist = pwc->
read(jfile,
"supercluster",
"clusters",0,cycle);
5019 if(clist.size()==0)
return;
5025 for(
int k=0;
k<(
int)clist.size();
k++) {
5027 pwc->
read(jfile,
"supercluster",
"clusters",-2,cycle,0,clist[
k]);
5028 int psize = pwc->
size()-npixels;
5029 if(psize>msize) {maxk=
k;msize=psize;}
5037 for(
int k=0;
k<ctime.
size();
k++) {
5041 int kindex = gps>0 ? mink : maxk;
5045 pwc->
read(jfile,
"supercluster",
"clusters",-1,cycle,0,clist[kindex]);
5048 vector<TString> delObjList;
5049 delObjList.push_back(
"supercluster");
5051 jname.ReplaceAll(
":/",
"");
5056 jfile =
new TFile(jname,
"UPDATE");
5058 if(jfile==NULL||!jfile->IsOpen())
5059 {cout <<
"CWB_Plugin_PE.C - Error opening : " << jname << endl;
exit(1);}
5060 pwc->
write(jfile,
"supercluster",
"clusters",0,cycle);
5061 pwc->
write(jfile,
"supercluster",
"clusters",-1,cycle);
monster wdmMRA
list of pixel pointers for MRA
std::vector< char * > ifoName
std::vector< wavearray< double > > fL50
void SetOptions(int simulation, double rho, double inRate, bool useSparse=false, char *gtype=const_cast< char *>("png"), int paletteId=0)
detector * getifo(size_t n)
param: detector index
static float _sse_abs_ps(__m128 *_a)
skymap wSKYPROB[MAX_TRIALS]
double FittingFactor(wavearray< double > *wf1, wavearray< double > *wf2)
std::vector< SSeries< double > > dSS[NIFO_MAX]
size_t write(const char *file, int app=0)
wavearray< double > GetWaveformEnvelope(wavearray< double > *wf)
void GetNullPixels(std::vector< double > *aNUL, std::vector< double > *ANUL, network *NET, CWB::config *cfg, int lag, int id)
Float_t * rho
biased null statistics
std::vector< wavearray< double > > fINJ
std::vector< wavearray< double > > vREC
Float_t * high
min frequency
std::vector< wavearray< double > > GetSigWaveform(network *NET, CWB::config *cfg, int lag, int id)
void FileGarbageCollector(TString ifName, TString ofName="", vector< TString > delObjList=vector< TString >())
std::vector< wavearray< double > > wREC[MAX_TRIALS]
std::vector< double > vCHIRP[6]
std::vector< netcluster > wc_List
void setSLags(float *slag)
void PlotWaveforms(network *NET, CWB::config *cfg, int ID, TString pdir="")
void SetSkyMask(network *NET, CWB::config *cfg, double theta, double phi, double radius)
void GetFactorsStatistic(int nIFO)
bool singleDetector
used for the stage stuff
void DumpRecWavePE(network *NET, TString pdir="")
Double_t * start
cluster duration = stopW-startW
WSeries< double > * pTF[NIFO_MAX]
pointers to detectors
std::vector< double > * getmdcTime()
WDM< double > * pwdm[NRES_MAX]
virtual void rate(double r)
void PlotChirpMass(int gtype, TString pdir, int sim=true)
std::vector< wavearray< float > > tdAmp
Float_t * low
average center_of_snr frequency
void Print(TString pname)
wavearray< double > a(hp.size())
std::vector< wavearray< double > > fU50
std::vector< wavearray< double > > fREC
std::vector< wavearray< double > > vDAT
wavearray< double > GetCutWaveform(wavearray< double > x, double bT, double eT, double bF, double eF)
wavearray< double > AddWaveforms(wavearray< double > *wf1, wavearray< double > *wf2)
wavearray< double > gHOT[NIFO_MAX]
static void _sse_zero_ps(__m128 *_p)
void PlotFactors(int gtype, int nIFO, TString pdir)
wavearray< float > _avx_norm_ps(float **, float **, std::vector< float *> &, int)
wavearray< float > a_90
buffer for cluster sky 00 amplitude
char * watversion(char c='s')
size_t setIndexMode(size_t=0)
void SetEventWindow(CWB::config *cfg, double gps)
TFile * jfile
output root file
std::vector< wavearray< double > > vRMS
Int_t * size
cluster volume
void ResetPCA(network *NET, CWB::config *cfg, netcluster *pwc, std::vector< netpixel > *vPIX, int ID)
std::vector< double > aNUL[NIFO_MAX]
static void PhaseShift(wavearray< double > &x, double pShift=0.)
void DumpSkyProb(skymap *skyprob, network *NET, netevent *&EVT, TString odir)
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
std::vector< wavearray< double > > GetInjWaveform(network *NET, netevent *EVT, int id, double factor)
int _sse_mra_ps(float *, float *, float, int)
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< wavearray< double > > vMED
std::vector< TGraph * > graph
std::vector< SSeries< double > > vSS[NIFO_MAX]
std::vector< wavearray< double > > cINJ
std::vector< wavearray< double > > vINJ
void Coherence(int ifactor)
double getTheta(size_t i)
Float_t * ioSNR
reconstructed snr waveform
std::vector< wavearray< double > > vNUL
TString DumpCED(network *NET, netevent *&EVT, CWB::config *cfg, double factor)
std::vector< double > fRES
size_t setcore(bool core, int id=0)
void Draw(int dpaletteId=1, Option_t *option="colfz")
WSeries< double > waveBand
std::vector< wavearray< double > > fL90
std::vector< double > oSNR[NIFO_MAX]
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 setTDFilter(int nCoeffs, int L=1)
std::vector< double > ANUL[NIFO_MAX]
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
std::vector< SSeries< double > > jSS[NIFO_MAX]
std::vector< detector * > ifoList
std::vector< double > ioSNR[NIFO_MAX]
void dopen(const char *fname, char *mode, bool header=true)
void Draw(double t1=0.0, double t2=0.0, double f1=0.0, double f2=0.0, double z1=0.0, double z2=0.0, int dpaletteId=DUMMY_PALETTE_ID, Option_t *option="colfz")
cout<< "Selected Pixels : "<< nPix<< endl;wc.cluster(1, 1);SSeries< double > ss
std::vector< wavearray< double > > vL90
size_t getSkyIndex(double th, double ph)
param: theta param: phi
std::vector< wavearray< double > > GetRecWaveform(network *NET, netevent *EVT, int id)
wavearray< float > pNRG
buffers for cluster residual energy
virtual size_t size() const
void PlotWaveformAsymmErrors(TString ofname, TString title, CWB::config *cfg, wavearray< double > *wrec, wavearray< double > *wmed, wavearray< double > *wl50, wavearray< double > *wu50, wavearray< double > *wl90, wavearray< double > *wu90, wavearray< double > *wref, TString pdir, double P, bool freq=false)
std::vector< wavearray< double > > vU50
void output2G(TTree *, network *, size_t, int, double)
static float _avx_packet_ps(float **p, float **q, std::vector< float *> &pAVX, int I)
Int_t Psave
number of detectors
std::vector< double > wRMS[NIFO_MAX]
void PlotSparse(int ifoID, network *NET, CWB::config *cfg, int ID, wavearray< double > *wf)
#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
void SuperCluster(int ifactor)
wavearray< int > sparseLookup
double GetTimeBoundaries(wavearray< double > x, double P, double &bT, double &eT)
void setDelayIndex(double rate)
param: MDC log file
void PlotFrequencyErrors(TString ofname, TString title, CWB::config *cfg, wavearray< double > *frec, wavearray< double > *favr, wavearray< double > *ferr, wavearray< double > *wref, TString pdir, double P)
std::vector< netpixel > DoPCA(network *NET, CWB::config *cfg, int lag, int id)
Double_t * stop
GPS start time of the cluster.
static void _avx_free_ps(std::vector< float *> &v)
wavearray< float > a_00
wdm multi-resolution analysis
std::vector< WDM< double > * > wdmList
WSeries< double > pTF[nRES]
printf("total live time: non-zero lags = %10.1f \, liveTot)
TIter next(twave->GetListOfBranches())
std::vector< wavearray< double > > fRMS
void GetNoisePixels(std::vector< double > *aNSE, std::vector< double > *ANSE, network *NET, CWB::config *cfg, int lag, int id)
int Write(double factor, bool fullCED=true)
std::vector< wavearray< double > > fAVR
void SetOutputFile(network *NET, netevent *&EVT, CWB::config *cfg, bool dump_pe)
char channelNamesRaw[NIFO_MAX][50]
void SetChannelName(char *chName)
std::vector< double > iSNR[NIFO_MAX]
Float_t * netcc
effective correlated SNR
void ClearWaveforms(detector *ifo)
std::vector< wavearray< double > * > IWFP
void PlotSNRnet(int nIFO, TString pdir, int sim=true)
std::vector< double > wAVR[NIFO_MAX]
void DumpOutputFile(network *NET, netevent *&EVT, CWB::config *cfg, int ID, int k, int factor)
void PlotResiduals(int ID, TString pdir="", int sim=true, char type='w')
size_t loadTDampSSE(network &net, char c, size_t BATCH=10000, size_t LOUD=0)
void DumpInjWavePE(network *NET, TString pdir="")
double GetFrequencyBoundaries(wavearray< double > x, double P, double &bF, double &eF)
skymap GetMedianSkyProb(network *NET)
netpixel * getPixel(size_t n, size_t i)
void WriteBodyHTML(TString html_template, TString html_tag_beg, TString html_tag_end, ofstream *out, int nIFO=1, TString *ifo=NULL)
std::vector< wavearray< double > > vWHT
std::vector< wavearray< double > > vAVR
void PrintUserOptions(CWB::config *cfg)
#define EXPORT(TYPE, VAR, CMD)
double GetCentralFrequency(wavearray< double > x)
std::vector< double > vLIKELIHOOD
Float_t * phi
sqrt(h+*h+ + hx*hx)
netevent EVT(itree, nifo)
double GetCentralTime(wavearray< double > x)
Float_t * theta
[0]-reconstructed, [1]-injected phi angle, [2]-RA
Double_t * time
beam pattern coefficients for hx
void Expand(bool bcore=true)
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *NET, WSeries< double > *x, TString ifo, int type)
COHERENCE.
static float _avx_setAMP_ps(float **p, float **q, std::vector< float *> &pAVX, int I)
void PlotWaveformErrors(TString ofname, TString title, CWB::config *cfg, wavearray< double > *wrec, wavearray< double > *wavr, wavearray< double > *werr, wavearray< double > *wref, TString pdir="", double P=0.99)
WSeries< double > waveForm
void Wave2Sparse(network *NET, CWB::config *cfg, char type)
wavearray< double > ts(N)
void GetChirpMassStatistic(std::vector< double > *vCHIRP)
std::vector< wavearray< double > > GetWhitenedData(network *NET, CWB::config *cfg)
WSeries< double > * getTFmap()
param: no parameters
cout<< "Starting reading output directory ..."<< endl;vector< TString > fileList
double fabs(const Complex &x)
double GetSparseMapData(SSeries< double > *SS, bool phase, int index)
void GetNullStatistic(std::vector< double > *vNUL, std::vector< double > *vNSE, int ifoId, TString ifoName, TString gtype, TString pdir="")
wavearray< float > sparseMap00
int SetSkyMask(network *net, CWB::config *cfg, char *options, char skycoord, double skyres=-1)
wavearray< float > sparseMap90
std::vector< wavearray< double > > vL50
std::vector< int > ComputeStatisticalErrors(network *NET, CWB::config *cfg, int ID)
void Forward(int n=-1)
param: wavelet - n is number of steps (-1 means full decomposition)
strcpy(RunLabel, RUN_LABEL)
Meyer< double > S(1024, 2)
netcluster * getwc(size_t n)
param: delay index
void DumpUserOptions(TString odir, CWB::config *cfg)
std::vector< SSeries< double > > rSS[NIFO_MAX]
void PlotSpectrogram(TString type, network *NET, netevent *&EVT, CWB::config *cfg, TString pdir)
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 CreateIndexHTML(TString dirCED, int nIFO, TString *ifo, bool sim=false)
std::vector< clusterdata > cData
wavearray< double > GetDifWaveform(wavearray< double > *wf1, wavearray< double > *wf2)
void SaveSkyProb(network *NET, CWB::config *cfg, int id)
void set(size_t i, double a)
param: sky index param: value to set
std::vector< double > aNSE[NIFO_MAX]
std::vector< wavearray< double > > vPCA
std::vector< wavearray< double > > GetPCAWaveform(network *NET, CWB::config *cfg, int lag, int id)
int RedoAnalysis(TFile *jfile, CWB::config *cfg, network *NET)
wavearray< float > rNRG
buffer for cluster sky 90 amplitudes
double factors[FACTORS_MAX]
double get(size_t i)
param: sky index
WaveDWT< DataType_t > * pWavelet
skymap GetSkyProb(network *NET, int id)
wavearray< double > * hot[NIFO_MAX]
wavelet pointers: pwdm[0] - l_high, wdm[nRES-1] l_low
wavearray< double > wINJ[NIFO_MAX]
void ReplaceSuperclusterData(TFile *&jfile, CWB::config *cfg, network *NET, double gps=0)
SSeries< double > * getSTFmap(size_t n)
wavearray< double > GetAlignedWaveform(wavearray< double > *wf1, wavearray< double > *wf2)
Bool_t fill_in(network *, int, bool=true)
std::vector< SSeries< double > > vSS
std::vector< wavearray< double > > vU90
size_t read(const char *)
WSeries< double > waveNull
size_t getmdc__ID(size_t n)
std::vector< wavearray< double > > GetWaveform(network *NET, int lag, int id, char type, bool shift=true)
void AddNoiseAndCalErrToSparse(network *NET, CWB::config *cfg, char type)
wavearray< double > ** pwf
[x1,y1,z1,x2,y2,z2] components of spin vector
virtual void resize(unsigned int)
void Print(TString pname)
void Inverse(int n=-1)
param: n - number of steps (-1 means full reconstruction)
std::vector< wavearray< double > > fU90
void PlotTimeFrequencyPCA(network *NET, netevent *EVT, CWB::config *cfg, int id, int lag, TString pdir)
void SetOptions(TString projection="hammer", TString coordinate="Geographic", double resolution=1, bool goff=false)
std::vector< double > ANSE[NIFO_MAX]
Float_t * chirp
range to source: [0/1]-rec/inj
void GetSNRnetStatistic(int nIFO)
void Draw(GWAT_DRAW type=GWAT_TIME, TString options="ALP", Color_t color=kBlack)
void ReadUserOptions(TString options)
std::vector< double > vRES
void LoadFromMultiTaskJobOutput(int runID, CWB::config *cfg)
std::vector< wavearray< double > > fMED
void SetZaxisTitle(TString zAxisTitle)
int binarySearch(int array[], int start, int end, int key)
std::vector< vector_int > nTofF
bool setdata(double a, char type='R', size_t n=0)
Float_t * iSNR
energy of reconstructed responses Sk*Sk
void SetWaveformCuts(wavearray< double > *x, double bT, double eT, double bF, double eF)
Float_t * oSNR
injected snr waveform