3 #pragma GCC system_header
10 #include "TObjArray.h"
11 #include "TObjString.h"
36 #define PLOT_DIR "plot"
43 double& enINJ,
double& enREC,
double& xcorINJ_REC);
118 #define SKYMASK_SEED 0
120 #define APPLY_INJ_MRA
145 #define AMP_CAL_ERR 0.1
146 #define PHS_CAL_ERR 10
175 #define WRC_PLUGIN_VERSION "v1.3"
185 cout <<
"ifo " << ifo.Data() << endl;
186 cout <<
"type " << type << endl;
207 cout <<
"-----------------------------------------" << endl;
208 cout <<
"WRC config options " << endl << endl;
209 cout <<
"WRC_RETRY " <<
WRC_RETRY << endl;
211 cout <<
"WRC_NOISE " <<
WRC_NOISE << endl;
226 cout <<
"CWB_Plugin_xWRC.C -> CWB_PLUGIN_ILIKELIHOOD implemented only for 2G" << endl;
231 cout <<
"CWB_Plugin_xWRC.C -> implemented only for zero lag" << endl;
242 cout <<
"CWB_Plugin_xWRC.C -> CWB_PLUGIN_XLIKELIHOOD implemented only for 2G" << endl;
247 int gLRETRY=-1;
IMPORT(
int,gLRETRY)
248 cout <<
"-----> CWB_Plugin_xWRC.C -> " <<
" gLRETRY : " << gLRETRY <<
"/" <<
WRC_RETRY <<
" - WRC : ";
255 #ifdef USE_wINJ // use wINJ (default wREC) (are pixels used as inj+noise in the retry)
258 #ifdef USE_wWHT // use wWHT (default wREC)
261 #if !defined (USE_wINJ) && !defined (USE_wWHT)
270 if(gLRETRY==WRC_RETRY) {
285 if(gLRETRY==WRC_RETRY) {
304 cout <<
"CWB_Plugin_xWRC.C -> CWB_PLUGIN_OLIKELIHOOD implemented only for 2G" << endl;
309 int gLRETRY=-1;
IMPORT(
int,gLRETRY)
330 int ID = size_t(
id.data[
j]+0.5);
332 if(NET->
getwc(zlag)->
sCuts[ID-1]!=-1)
continue;
335 EXPORT(
int,gLRETRY,
"gLRETRY = 0;")
350 cout <<
"-----> Event Detected ID = " << ID << endl;
355 #if defined (SAVE_PLOT_WERR) || defined (SAVE_PLOT_WERR2) || (SAVE_WHT_PLOT)
371 for(
int j=0;
j<wAVR[
n].size();
j++) {
372 if(wTRY[
n][
j]==0)
continue;
373 wAVR[
n][
j]/=wTRY[
n][
j];
374 wRMS[
n][
j]/=wTRY[
n][
j];
375 wRMS[
n][
j]-=wAVR[
n][
j]*wAVR[
n][
j];
376 wRMS[
n][
j] =sqrt(wRMS[
n][
j]);
380 #ifdef SAVE_PLOT_WERR
384 #ifdef SAVE_PLOT_WERR2
391 #ifdef SAVE_MRA_PLOT // monster event display
392 PlotMRA(NET, ID, zlag,
"last_wREC");
400 #ifdef SAVE_MRA_PLOT // monster event display
401 PlotMRA(NET, ID, zlag,
"wREC");
455 double& enINJ,
double& enREC,
double& xcorINJ_REC) {
457 double bINJ = wfINJ->
start();
458 double eINJ = wfINJ->
stop();
459 double bREC = wfREC->
start();
460 double eREC = wfREC->
stop();
465 double R=wfINJ->
rate();
467 int oINJ = bINJ>bREC ? 0 :
int((bREC-bINJ)*R+0.5);
468 int oREC = bINJ<bREC ? 0 :
int((bINJ-bREC)*R+0.5);
471 double startXCOR = bINJ>bREC ? bINJ : bREC;
472 double endXCOR = eINJ<eREC ? eINJ : eREC;
473 int sizeXCOR =
int((endXCOR-startXCOR)*R+0.5);
480 if (sizeXCOR<=0)
return;
484 for (
int i=0;
i<sizeXCOR;
i++) enREC+=wfREC->
data[
i+oREC]*wfREC->
data[
i+oREC];
485 for (
int i=0;
i<sizeXCOR;
i++) xcorINJ_REC+=wfINJ->
data[
i+oINJ]*wfREC->
data[
i+oREC];
487 double erINJ_REC = enINJ+enREC-2*xcorINJ_REC;
497 double bINJ = wfINJ->
start();
498 double eINJ = wfINJ->
stop();
499 double bREC = wfREC->
start();
500 double eREC = wfREC->
stop();
505 double R=wfINJ->
rate();
507 int oINJ = bINJ>bREC ? 0 :
int((bREC-bINJ)*R+0.5);
508 int oREC = bINJ<bREC ? 0 :
int((bINJ-bREC)*R+0.5);
511 double startXCOR = bINJ>bREC ? bINJ : bREC;
512 double endXCOR = eINJ<eREC ? eINJ : eREC;
513 int sizeXCOR =
int((endXCOR-startXCOR)*R+0.5);
517 for (
int i=0;
i<sizeXCOR;
i++) {
531 std::vector<int> sCuts = NET->
getwc(k)->
sCuts;
543 cout <<
"write " << fname << endl;
548 cout <<
"write " << fname << endl;
571 PTS.
graph[0]->SetLineWidth(1);
577 PTS.
graph[1]->SetLineWidth(2);
582 if(fft)
sprintf(label,
"%s",
"fft");
583 else sprintf(label,
"%s",
"time");
584 if(strain)
sprintf(label,
"%s_%s",label,
"strain");
585 else sprintf(label,
"%s_%s",label,
"white");
590 cout <<
"write : " << fname << endl;
598 gRandom->SetSeed(seed);
625 if(wave_type!=
'j' && wave_type!=
'r' && wave_type!=
's' && wave_type!=
'n' && wave_type!=
'v') {
626 cout <<
"Wave2Sparse - Error : wrong wave type" << endl;
exit(1);
637 if(wave_type==
'v') vSS[
n]=pD->
vSS;
638 if(wave_type==
'r') rSS[
n]=pD->
vSS;
639 if(wave_type==
'j') jSS[
n]=pD->
vSS;
640 if(wave_type==
's') sSS[
n]=pD->
vSS;
642 if(wave_type==
'v')
return;
652 WF[
n].
rate(sSS[
n][0].wdm_rate);
653 WF[
n].
start(sSS[
n][0].wdm_start);
656 for (
int i=0;
i<sINJ[
n].
size();
i++) WF[
n][wos+
i] = sINJ[
n][
i];
660 WF[
n].
rate(jSS[
n][0].wdm_rate);
661 WF[
n].
start(jSS[
n][0].wdm_start);
664 for (
int i=0;
i<wINJ[
n].
size();
i++) WF[
n][wos+
i] = wINJ[
n][
i];
668 WF[
n].
rate(rSS[
n][0].wdm_rate);
669 WF[
n].
start(rSS[
n][0].wdm_start);
672 for (
int i=0;
i<wREC[
n].
size();
i++) WF[
n][wos+
i] = wREC[
n][
i];
680 for (
int i=0;
i<WF[
n].
size();
i++) WF[
n][
i] = gRandom->Gaus(0,1);
688 if(wave_type==
'r') gfile=TString::Format(
"%s/REC_%s.png",
PLOT_DIR,NET->
ifoName[n]);
689 if(wave_type==
'j') gfile=TString::Format(
"%s/INJ_%s.png",
PLOT_DIR,NET->
ifoName[n]);
690 if(wave_type==
's') gfile=TString::Format(
"%s/sINJ_%s.png",
PLOT_DIR,NET->
ifoName[n]);
691 if(wave_type!=
'n') (*plot) >>
gfile;
702 int layers = level>0 ? 1<<level : 0;
703 pwdm = NET->
getwdm(layers+1);
706 if((wave_type==
'n')&&(
i==nRES-1)) {
712 if(wave_type==
'r') size = rSS[
n][
i].sparseMap00.size();
713 if(wave_type==
'j') size = jSS[
n][
i].sparseMap00.size();
714 if(wave_type==
's') size = sSS[
n][
i].sparseMap00.size();
715 if(wave_type==
'n') vN[
n].push_back(w);
719 if(wave_type==
'r') index = rSS[
n][
i].sparseIndex[
j];
720 if(wave_type==
'j') index = jSS[
n][
i].sparseIndex[
j];
721 if(wave_type==
's') index = sSS[
n][
i].sparseIndex[
j];
725 rSS[
n][
i].sparseMap00[
j]=v00;
726 rSS[
n][
i].sparseMap90[
j]=v90;
729 jSS[
n][
i].sparseMap00[
j]=v00;
730 jSS[
n][
i].sparseMap90[
j]=v90;
733 sSS[
n][
i].sparseMap00[
j]=v00;
734 sSS[
n][
i].sparseMap90[
j]=v90;
745 gRandom->SetSeed(seed);
747 TF2 *gaus2d =
new TF2(
"gaus2d",
"exp(-x*x/2)*exp(-y*y/2)", -5,5,-5,5);
756 #ifdef USE_wWHT // use wWHT (default wREC)
784 int size = pD->
vSS[
i].sparseMap00.size();
791 double aa = pD->
vSS[
i].sparseMap00[
j];
792 double AA = pD->
vSS[
i].sparseMap90[
j];
794 pD->
vSS[
i].sparseMap00[
j] = C*aa + S*AA;
795 pD->
vSS[
i].sparseMap90[
j] = -S*aa + C*AA ;
804 int levels = (1<<(nRES-1-
i));
809 itime = levels*sI[itime/levels];
810 index = itime*layers +
ifreq;
812 r00 = vN[
n][
i].pWavelet->pWWS[
index];
813 r90 = vN[
n][
i].pWavelet->pWWS[index+vN[
n][
i].maxIndex()+1];
816 pD->
vSS[
i].sparseMap00[
j]+=r00;
817 pD->
vSS[
i].sparseMap90[
j]+=r90;
826 std::vector<float>* vP;
827 std::vector<int>* vI;
830 if(NET->
wc_List[0].p_Map.size()) {
832 vP = &(NET->
wc_List[0].p_Map[
id-1]);
833 vI = &(NET->
wc_List[0].p_Ind[
id-1]);
838 for(
int j=0;
j<
int(vP->size());
j++) {
840 double th = rec_skyprob.
getTheta(i);
843 rec_skyprob.
set(k,(*vP)[
j]);
850 for(
int l=0;
l<rec_skyprob.
size();
l++) prob+=rec_skyprob.
get(
l);
851 cout <<
"PROB : " << prob << endl;
873 for(
int j=0;
j<geINJ.
size();
j++) geINJ[
j]=sqrt(wINJ[n][
j]*wINJ[n][
j]+geINJ[
j]*geINJ[
j]);
877 for(
int j=0;j<wAVR[
n].size();j++) geAVR[j]=wAVR[n][j];
879 for(
int j=0;j<geAVR.
size();j++) geAVR[j]=sqrt(wAVR[n][j]*wAVR[n][j]+geAVR[j]*geAVR[j]);
883 for(
int j=0;j<wRMS[
n].size();j++) geRMS[j]=wRMS[n][j];
898 for(
int j=1;j<gF.
size();j++) {
902 gF[
j]=atan2(XX[j],xx[j])-atan2(XX[j-1],xx[j-1]);
903 if(gF[j]<-Pi) gF[
j]+=2*
Pi;
904 if(gF[j]> Pi) gF[
j]-=2*
Pi;
910 for(
int j=0;j<yy.
size();j++) yy[j]=wAVR[n][j];
914 for(
int j=1;j<gFF.
size();j++) {
915 gFF[
j]=atan2(YY[j],yy[j])-atan2(YY[j-1],yy[j-1]);
916 if(gFF[j]<-Pi) gFF[
j]+=2*
Pi;
917 if(gFF[j]> Pi) gFF[
j]-=2*
Pi;
923 gfile=TString::Format(
"%s/FREQ_%d.root",
PLOT_DIR,n);
929 for(
int j=0;j<geDIF.
size();j++) geDIF[j]=geAVR[j]-geINJ[j];
934 gfile=TString::Format(
"%s/eDIF_%d.root",
PLOT_DIR,n);
941 for(
int j=0;j<wAVR[
n].size();j++) gwAVR[j]=wAVR[n][j];
943 for(
int j=0;j<wAVR[
n].size();j++) gwAVR[j]=wRMS[n][j];
947 gfile=TString::Format(
"%s/wAVR_%d.root",
PLOT_DIR,n);
952 double bINJ = wINJ[
n].
start();
953 double eINJ = wINJ[
n].
stop();
954 double bREC = wREC[
n].
start();
955 double eREC = wREC[
n].
stop();
957 cout <<
"bINJ : " << bINJ <<
" eINJ : " << eINJ << endl;
958 cout <<
"bREC : " << bREC <<
" eREC : " << eREC << endl;
960 double R=wINJ[
n].
rate();
962 int oINJ = bINJ>bREC ? 0 :
int((bREC-bINJ)*R+0.5);
963 int oREC = bINJ<bREC ? 0 :
int((bINJ-bREC)*R+0.5);
964 cout <<
"oINJ : " << oINJ <<
" oREC : " << oREC << endl;
966 double startXCOR = bINJ>bREC ? bINJ : bREC;
967 double endXCOR = eINJ<eREC ? eINJ : eREC;
968 int sizeXCOR =
int((endXCOR-startXCOR)*R+0.5);
969 cout <<
"sizeXCOR : " << sizeXCOR << endl;
970 cout <<
"wINJ[n].size() : " << wINJ[
n].
size() << endl;
971 cout <<
"wREC[n].size() : " << wREC[
n].
size() << endl;
974 for(
int j=0;j<sizeXCOR;j++) gwREC[j+oINJ]=wREC[n][j+oREC];
977 for(
int j=0;j<wINJ[
n].
size();j++) gwREC[j]=wINJ[n][j];
979 for(
int j=0;j<wAVR[
n].size();j++) gwREC[j]=wRMS[n][j];
983 gfile=TString::Format(
"%s/wREC_%d.root",
PLOT_DIR,n);
1016 cout <<
"tMin " << tMin <<
" tMax " << tMax << endl;
1020 for(
int j=0;
j<wAVR[
n].size();
j++) gw[
j]=wAVR[
n][
j];
1022 for(
int j=0;
j<wAVR[
n].size();
j++) gw[
j]=wRMS[
n][
j];
1028 sprintf(gtitle,
"%s : %10.3f (gps) - injected(Black) - average(Red) - rms(Blue)",gw.
start(),NET->
ifoName[
n]);
1029 plot->
gtitle(gtitle,
"time(sec)",
"amplitude");
1048 cout <<
"tMin " << tMin <<
" tMax " << tMax << endl;
1058 plot->
gtitle(gtitle,
"time(sec)",
"amplitude");
1076 for(
int i=0;
i<vREC[
n].size();
i++) {
1099 double bINJ = wINJ[
n].
start();
1100 double eINJ = wINJ[
n].
stop();
1101 double bREC = wREC[
n].
start();
1102 double eREC = wREC[
n].
stop();
1104 double R=wINJ[0].
rate();
1106 int oINJ = bINJ>bREC ? 0 :
int((bREC-bINJ)*R+0.5);
1107 int oREC = bINJ<bREC ? 0 :
int((bINJ-bREC)*R+0.5);
1109 double startXCOR = bINJ>bREC ? bINJ : bREC;
1110 double endXCOR = eINJ<eREC ? eINJ : eREC;
1111 int sizeXCOR =
int((endXCOR-startXCOR)*R+0.5);
1113 if (sizeXCOR<=0)
continue;
1115 for (
int j=0;
j<sizeXCOR;
j++) winj[
n][
j+oREC]+=wINJ[
n].data[
j+oINJ];
1124 double bINJ = wREC[
n].
start();
1125 double eINJ = wREC[
n].
stop();
1126 for(
int i=0;
i<vREC[
n].size();
i++) {
1128 double bREC = vREC[
n][
i].start();
1129 double eREC = vREC[
n][
i].stop();
1134 double R=wREC[
n].
rate();
1136 int oINJ = bINJ>bREC ? 0 :
int((bREC-bINJ)*R+0.5);
1137 int oREC = bINJ<bREC ? 0 :
int((bINJ-bREC)*R+0.5);
1140 double startXCOR = bINJ>bREC ? bINJ : bREC;
1141 double endXCOR = eINJ<eREC ? eINJ : eREC;
1142 int sizeXCOR =
int((endXCOR-startXCOR)*R+0.5);
1146 if (sizeXCOR<=0)
continue;
1148 for (
int j=0;
j<sizeXCOR;
j++) wavr[
n][
j+oINJ]+=vREC[
n][
i].data[
j+oREC];
1150 wavr[
n]*=1./vREC[
n].size();
1155 for(
int i=0;
i<vREC[0].size();
i++) {
1161 rnum+=(enINJ[
n]+enREC[
n]-2*xcorINJ_REC[
n]);
1175 rnum+=(enINJ[
n]+enREC[
n]-2*xcorINJ_REC[
n]);
1185 rnum+=(enINJ[
n]+enREC[
n]-2*xcorINJ_REC[
n]);
1197 rnum+=(enINJ[
n]+enREC[
n]-2*xcorINJ_REC[
n]);
1202 #ifdef SAVE_WF_COMPARISON
1208 PlotFinal3(NET, ID,
n, &rINJ[
n], &winj[n],
"rINJvsINJ",
"root");
1209 PlotFinal3(NET, ID, n, &rINJ[n], &wREC[n],
"rINJvsREC",
"root");
1210 PlotFinal3(NET, ID, n, &rINJ[n], &wavr[n],
"rINJvsAVR",
"root");
1212 PlotFinal3(NET, ID, n, &winj[n], &wavr[n],
"INJvsAVR",
"root");
1213 PlotFinal3(NET, ID, n, &wREC[n], &wavr[n],
"RECvsAVR",
"root");
1222 for(
int i=1;
i<10;
i++) erR[
i]=vRES[
index[
i*
int(vRES.
size()/10.)]];
1225 for(
int i=0;
i<vRES.
size();
i++) {
1226 if(vRES[
i]<=jres) erR[10]+=1.;
1228 erR[10]/=vRES.
size();
1232 for(
int i=0;
i<10;
i++) cout << erR[
i] <<
"/";
1233 cout << erR[10] << endl;
1235 #ifdef SAVE_PLOT_RESIDUALS
1238 TCanvas*
canvas2=
new TCanvas(
"canvas2",
"canvas2", 200, 20, 600, 600);
1239 TH1F* hres =
new TH1F(
"residuals",
"residuals",10,0,1);
1240 for(
int i=0;
i<vRES.
size();
i++) hres->Fill(vRES[
i]);
1245 float ymax = hres->GetMaximum();
1246 TLine *
line =
new TLine(jres,0,jres,ymax);
1247 line->SetLineColor(kRed);
1250 gStyle->SetLineColor(kWhite);
1251 hres->SetTitle(
"Distribution of residuals");
1252 hres->SetStats(kTRUE);
1253 canvas2->Print(TString::Format(
"%s/residuals_%d.png",
PLOT_DIR,ID));
1270 while(!vSS[
n].empty()) vSS[
n].pop_back();
1271 vSS[
n].clear(); std::vector<SSeries<double> >().swap(vSS[
n]);
1272 while(!sSS[n].empty()) sSS[
n].pop_back();
1273 sSS[
n].clear(); std::vector<SSeries<double> >().swap(sSS[n]);
1274 while(!rSS[n].empty()) rSS[
n].pop_back();
1275 rSS[
n].clear(); std::vector<SSeries<double> >().swap(rSS[n]);
1276 while(!jSS[n].empty()) jSS[
n].pop_back();
1277 jSS[
n].clear(); std::vector<SSeries<double> >().swap(jSS[n]);
1279 while(!vN[n].empty()) vN[
n].pop_back();
1280 vN[
n].clear(); std::vector<WSeries<double> >().swap(vN[n]);
1282 while(!wTRY[n].empty()) wTRY[
n].pop_back();
1283 wTRY[
n].clear(); std::vector<int >().swap(wTRY[n]);
1285 while(!wAVR[n].empty()) wAVR[
n].pop_back();
1286 wAVR[
n].clear(); std::vector<double >().swap(wAVR[n]);
1288 while(!wRMS[n].empty()) wRMS[
n].pop_back();
1289 wRMS[
n].clear(); std::vector<double >().swap(wRMS[n]);
1291 while(!vDREC[n].empty()) vDREC[
n].pop_back();
1292 vDREC[
n].clear(); std::vector<double >().swap(vDREC[n]);
1294 while(!vREC[n].empty()) vREC[
n].pop_back();
1295 vREC[
n].clear(); std::vector<wavearray<double> >().swap(vREC[n]);
1302 TString cwb_inet_options=
TString(gSystem->Getenv(
"CWB_INET_OPTIONS"));
1303 if(cwb_inet_options.CompareTo(
"")!=0) {
1304 TString inet_options = cwb_inet_options;
1305 cout << inet_options << endl;
1306 if(!inet_options.Contains(
"--")) {
1309 for(
int j=0;
j<token->GetEntries();
j++){
1311 TObjString* tok = (TObjString*)token->At(
j);
1312 TString stok = tok->GetString();
1314 if(stok.Contains(
"wrc_id=")) {
1316 wrc_id.Remove(0,wrc_id.Last(
'=')+1);
1317 if(wrc_id.IsDigit())
WRC_ID=wrc_id.Atoi();
1319 cout <<
"WRC_ID : " <<
WRC_ID << endl;
1322 if(stok.Contains(
"wrc_retry=")) {
1324 wrc_retry.Remove(0,wrc_retry.Last(
'=')+1);
1325 if(wrc_retry.IsDigit())
WRC_RETRY=wrc_retry.Atoi();
1327 cout <<
"WRC_RETRY : " <<
WRC_RETRY << endl;
1330 if(stok.Contains(
"wrc_ced_id=")) {
1332 wrc_ced_id.Remove(0,wrc_ced_id.Last(
'=')+1);
1333 if(wrc_ced_id.IsDigit())
WRC_CED_ID=wrc_ced_id.Atoi();
1335 cout <<
"WRC_CED_ID : " <<
WRC_CED_ID << endl;
1338 if(stok.Contains(
"wrc_ced_retry=")) {
1340 wrc_ced_retry.Remove(0,wrc_ced_retry.Last(
'=')+1);
1341 if(wrc_ced_retry.IsDigit())
WRC_CED_RETRY=wrc_ced_retry.Atoi();
1346 if(stok.Contains(
"wrc_skymask=")) {
1348 wrc_skymask.Remove(0,wrc_skymask.Last(
'=')+1);
1354 if(stok.Contains(
"wrc_noise=")) {
1356 wrc_noise.Remove(0,wrc_noise.Last(
'=')+1);
1388 __m128* _m00 = (__m128*) mam;
1389 __m128* _m90 = (__m128*) mAM;
1390 __m128* _amp = (__m128*) amp;
1391 __m128* _AMP = (__m128*) AMP;
1392 __m128* _a00 = (__m128*) NET->
a_00.
data;
1393 __m128* _a90 = (__m128*) NET->
a_90.
data;
1397 for(j=0; j<V; ++j) if(ee[j]>ee[
m]) m=j;
1398 if(ee[m]<=Eo)
break; mm = m*
f;
1409 for(j=0; j<J; j++) {
1415 if(ee[n]>0) cc += c[5];
1431 for(j=0; j<J; j++) {
1433 if(E<E2 && n!=m) {c+=7;
continue;}
1451 float* gSLAGSHIFT=NULL;
IMPORT(
float*,gSLAGSHIFT)
1456 TFile*
froot = NULL;
1457 TList *
files = (TList*)gROOT->GetListOfFiles();
1464 while ((file=(TSystemFile*)
next())) {
1465 fname = file->GetName();
1467 if(fname.Contains(
"wave_")) {
1468 froot=(TFile*)file;froot->cd();
1470 outDump.ReplaceAll(
".root.tmp",
".txt");
1475 cout <<
"CWB_Plugin_xWRC.C : Error - output root file not found" << endl;
1479 cout <<
"CWB_Plugin_xWRC.C : Error - output root file not found" << endl;
1483 net_tree = (TTree *) froot->Get(
"waveburst");
1493 net_tree->Branch(
"erR",
erR,TString::Format(
"erR[%i]/F",11));
1511 int gLRETRY=-1;
IMPORT(
int,gLRETRY)
1515 EVT->
output2G(NULL,NET,ID,k,factor);
1517 cout <<
"rec_theta : " << EVT->
theta[0] <<
" rec_phi : " << EVT->
phi[0] << endl;
1523 int idSize = pd->
RWFID.size();
1525 for(
int mm=0; mm<idSize; mm++)
if (pd->
RWFID[mm]==ID) wfIndex=mm;
1528 cout <<
"CWB_Plugin_xWRC.C : Error : Reconstructed waveform not saved !!! : ID -> "
1529 << ID <<
" : detector " << NET->
ifoName[
n] << endl;
1532 if(wfIndex>=0) pwfREC[
n] = pd->
RWFP[wfIndex];
1535 double delay = EVT->
time[
n]-EVT->
time[0];
1540 vREC[
n].push_back(*wfREC);
1541 vDREC[
n].push_back(delay);
1570 int gLRETRY=-1;
IMPORT(
int,gLRETRY)
1574 double recTime = EVT->
time[0];
1579 double injTime = 1.e12;
1581 for(
int m=0;
m<
M;
m++) {
1584 if(T<injTime && INJ.
fill_in(NET,mdcID)) {
1599 pwfINJ[
n] = INJ.
pwf[
n];
1600 if (pwfINJ[
n]==NULL) {
1601 cout <<
"CWB_Plugin_xWRC.C : Error : Injected waveform not saved !!! : detector "
1606 double rFactor = 1.;
1607 rFactor *= factor>0 ? factor : 1;
1615 double delay = EVT->
time[
n]-EVT->
time[0];
1619 wTRY[
n].resize(wINJ[n].
size());
1620 wAVR[
n].resize(wINJ[n].
size());
1621 wRMS[
n].resize(wINJ[n].
size());
1622 for(
int j=0;
j<wINJ[
n].
size();
j++) {wTRY[
n][
j]=0;wAVR[
n][
j]=0;wRMS[
n][
j]=0;};
1640 std::vector<int>* vint = &(pwc->
cList[ID-1]);
1641 int V = vint->size();
1647 irate = pv!=NULL ? (*pv)[0] : 0;
1649 bool isPCs = !(cfg->
optim&&std::isupper(cfg->
search));
1659 for(
int n=0;
n<V;
n++) {
1662 cout <<
"CWB_Plugin_eWRC.C - Error : is enabled only for WDM (2G)" << endl;
1666 #ifdef APPLY_INJ_MRA
1673 #ifdef APPLY_INJ_MRA
1676 if(!pix->
core)
continue;
1677 if((irate)&&(irate !=
int(pix->
rate+0.5)))
continue;
1685 #ifdef APPLY_INJ_MRA
1688 NET->
rNRG[
n]+=aa*aa+AA*AA;
1694 #ifdef SAVE_MRA_PLOT // monster event display
1698 #ifdef APPLY_INJ_MRA
1700 int V4 = V + (V%4 ? 4 - V%4 : 0);
1709 for(
int n=0;
n<V;
n++) {
1712 cout <<
"CWB_Plugin_eWRC.C - Error : is enabled only for WDM (2G)" << endl;
1719 if(!pix->
core)
continue;
1720 if((irate)&&(irate !=
int(pix->
rate+0.5)))
continue;
1722 double aa = amp[
n*
NIFO+
m];
1723 double AA = AMP[
n*
NIFO+
m];
1729 #ifdef SAVE_MRA_PLOT // monster event display
1730 PlotMRA(NET, ID, k,
"mra_rINJ");
monster wdmMRA
list of pixel pointers for MRA
wavearray< double > gwREC[NIFO_MAX]
std::vector< char * > ifoName
detector * getifo(size_t n)
param: detector index
static float _sse_abs_ps(__m128 *_a)
std::vector< int > vector_int
virtual size_t size() const
void AddNoise2Sparse(network *NET, CWB::config *cfg, int seed=0)
std::vector< int > wTRY[NIFO_MAX]
std::vector< vector_int > cRate
void gtitle(TString title="", TString xtitle="", TString ytitle="")
void ComputeErrorWF(wavearray< double > *wfINJ, wavearray< double > *wfREC, int ifoID)
void PlotWaveform(TString ifo, wavearray< double > *wfINJ, wavearray< double > *wfREC, CWB::config *cfg, bool fft=false, bool strain=false)
std::vector< netcluster > wc_List
void SaveSkyProb(network *NET, CWB::config *cfg, int id)
void setSLags(float *slag)
double GetSparseMap(SSeries< double > *SS, bool phase, int index)
std::vector< WSeries< double > > vN[NIFO_MAX]
void PlotFinal2(network *NET, int ID)
std::vector< double > * getmdcTime()
virtual void rate(double r)
static void _sse_zero_ps(__m128 *_p)
cout<< "skymap size : "<< L<< endl;for(int l=0;l< L;l++) sm.set(l, l);sm > const_cast< char * >("skymap.dat")
wavearray< float > a_90
buffer for cluster sky 00 amplitude
static void PhaseShift(wavearray< double > &x, double pShift=0.)
cout<< endl;cout<< "ts size = "<< ts.size()<< " ts rate = "<< ts.rate()<< endl;tf.Forward(ts, wdm);int levels=tf.getLevel();cout<< "tf size = "<< tf.size()<< endl;double dF=tf.resolution();double dT=1./(2 *dF);cout<< "rate(hz) : "<< RATE<< "\t layers : "<< nLAYERS<< "\t dF(hz) : "<< dF<< "\t dT(ms) : "<< dT *1000.<< endl;int itime=TIME_PIXEL_INDEX;int ifreq=FREQ_PIXEL_INDEX;int index=(levels+1)*itime+ifreq;double time=itime *dT;double freq=(ifreq >0)?ifreq *dF:dF/4;cout<< endl;cout<< "PIXEL TIME = "<< time<< " sec "<< endl;cout<< "PIXEL FREQ = "<< freq<< " Hz "<< endl;cout<< endl;wavearray< double > x
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< vector_float > sArea
wavearray< double > rINJ[NIFO_MAX]
void Wave2Sparse(network *NET, CWB::config *cfg, char wave_type)
std::vector< TGraph * > graph
plot gtitle(gtitle,"frequency (Hz)","strain/#sqrt{Hz}")
static float _sse_rotsub_ps(__m128 *_u, float c, __m128 *_v, float s, __m128 *_a)
double getTheta(size_t i)
void DumpOutput(network *NET, netevent *&EVT, CWB::config *cfg, int ID, int k, int factor)
static void _sse_cpf_ps(float *a, __m128 *_p)
std::vector< vector_int > cList
virtual void start(double s)
bool getMRAwave(size_t ID, size_t lag, char atype='S', int mode=0, bool tof=false)
void plot(wavearray< double > &, char *=NULL, int=1, double=0., double=0., bool=false, float=0., float=0., bool=false, float=0., bool=false)
void Draw(int dpaletteId=0, Option_t *option="colfz")
wavearray< int > sparseIndex
static void _sse_rotadd_ps(__m128 *_u, float c, __m128 *_v, float s, __m128 *_a)
void dopen(const char *fname, char *mode, bool header=true)
WDM< double > * getwdm(size_t M)
param: number of wdm layers
size_t getSkyIndex(double th, double ph)
param: theta param: phi
void output2G(TTree *, network *, size_t, int, double)
void GetInjWaveform(network *NET, netevent *EVT, int ID, int k, int factor)
Int_t Psave
number of detectors
std::vector< double > wRMS[NIFO_MAX]
#define IMPORT(TYPE, VAR)
bool WRC_PHS_CAL_ERR_CONFIG
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...
wavearray< int > sparseLookup
std::vector< SSeries< double > > rSS[NIFO_MAX]
std::vector< SSeries< double > > sSS[NIFO_MAX]
wavearray< double > wREC[NIFO_MAX]
void ComputeErrorStatistic(network *NET, CWB::config *cfg, int ID)
wavearray< float > a_00
wdm multi-resolution analysis
void PlotFinal3(network *NET, int ID, int ifoID, wavearray< double > *w1, wavearray< double > *w2, TString tag, TString gtype="png")
TIter next(twave->GetListOfBranches())
void SetOutput(network *NET, netevent *&EVT, CWB::config *cfg)
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *NET, WSeries< double > *x, TString ifo, int type)
COHERENCE.
bool WRC_SKYMASK_REC_SKY_CONFIG
double GetTimeRange(double &tMin, double &tMax, double efraction=0.9999999)
int _sse_mra_ps(network *NET, float *amp, float *AMP, float Eo, int K)
size_t cpf(const netcluster &, bool=false, int=0)
std::vector< double > wAVR[NIFO_MAX]
void SetTimeRange(double tMin, double tMax)
wavearray< double > sINJ[NIFO_MAX]
std::vector< SSeries< double > > vSS[NIFO_MAX]
netpixel * getPixel(size_t n, size_t i)
static void TimeShift(wavearray< double > &x, double tShift=0.)
#define EXPORT(TYPE, VAR, CMD)
void GetRecWaveform(network *NET, netevent *EVT, int ID, int k, int factor)
void ComputeResidualEnergy(wavearray< double > *wfINJ, wavearray< double > *wfREC, double &enINJ, double &enREC, double &xcorINJ_REC)
Float_t * phi
sqrt(h+*h+ + hx*hx)
void PlotMRA(network *NET, int ID, int k, TString tag)
netevent EVT(itree, nifo)
Float_t * theta
[0]-reconstructed, [1]-injected phi angle, [2]-RA
Double_t * time
beam pattern coefficients for hx
static void _sse_add_ps(__m128 *_a, __m128 *_b)
WSeries< double > waveForm
bool WRC_AMP_CAL_ERR_CONFIG
virtual void stop(double s)
double fabs(const Complex &x)
void SetSkyMask(network *NET, CWB::config *cfg, int seed=0)
wavearray< float > sparseMap00
int SetSkyMask(network *net, CWB::config *cfg, char *options, char skycoord, double skyres=-1)
wavearray< float > sparseMap90
void Forward(int n=-1)
param: wavelet - n is number of steps (-1 means full decomposition)
Meyer< double > S(1024, 2)
netcluster * getwc(size_t n)
param: delay index
std::vector< double > vDREC[NIFO_MAX]
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
void set(size_t i, double a)
param: sky index param: value to set
static void _sse_mul_ps(__m128 *_a, float b)
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
wavearray< double > wINJ[NIFO_MAX]
Bool_t fill_in(network *, int, bool=true)
std::vector< SSeries< double > > vSS
size_t getmdc__ID(size_t n)
for(int i=0;i< 101;++i) Cos2[2][i]=0
wavearray< double > ** pwf
[x1,y1,z1,x2,y2,z2] components of spin vector
virtual void resize(unsigned int)
void Print(TString pname)
#define WRC_PLUGIN_VERSION
std::vector< wavearray< double > > vREC[NIFO_MAX]
void Draw(GWAT_DRAW type=GWAT_TIME, TString options="ALP", Color_t color=kBlack)
void GetRInjWaveform(network *NET, netevent *EVT, CWB::config *cfg, int ID, int k)
std::vector< double > vRES
void SetZaxisTitle(TString zAxisTitle)
int binarySearch(int array[], int start, int end, int key)
std::vector< SSeries< double > > jSS[NIFO_MAX]
bool setdata(double a, char type='R', size_t n=0)