10 #define MIN_SKYRES_HEALPIX 4
11 #define MIN_SKYRES_ANGLE 3
14 #define REGRESSION_FILTER_LENGTH 8
15 #define REGRESSION_MATRIX_FRACTION 0.95
16 #define REGRESSION_SOLVE_EIGEN_THR 0.
17 #define REGRESSION_SOLVE_EIGEN_NUM 10
18 #define REGRESSION_SOLVE_REGULATOR 'h'
19 #define REGRESSION_APPLY_THR 0.8
22 #define SELECT_SUBRHO 5.0
23 #define SELECT_SUBNET 0.1
26 #define WDM_BETAORDER 6 // beta function order for Meyer
27 #define WDM_PRECISION 10 // wavelet precision
29 #define EXIT(ERR) gSystem->Exit(ERR) // better exit handling for ROOT stuff
39 if(pwdm[
i]!=NULL)
delete pwdm[
i];
51 sprintf(cmd,
"gCWB2G = (void*)%p;",
this);
EXPORT(
void*,gCWB2G,cmd);
55 {cout <<
"cwb2G::Init - Error : analysis must be 2G" << endl;
EXIT(1);}
57 {cout <<
"cwb2G::Init - Error : if initial stage!=CWB_STAGE_FULL "
58 <<
"then input file name must be a job file " << endl;
EXIT(1);}
66 char MRAcatalog[1024];
68 cout <<
"cwb2G::Init - Loading catalog of WDM cross-talk coefficients ... " << endl;
69 cout << MRAcatalog << endl;
86 int layers = level>0 ? 1<<level : 0;
92 cout <<
"cwb2G::Init : Error - filter length must be <= segEdge !!!" << endl;
93 cout <<
"filter length : " << wdmFLen <<
" sec" << endl;
94 cout <<
"cwb scratch : " <<
cfg.
segEdge <<
" sec" << endl;
97 cout <<
"Filter length = " << wdmFLen <<
" (sec)" << endl;
104 cout <<
"cwb2G::Init : Error - segEdge must be > "
105 <<
"1.5x the length for time delay amplitudes!!!" << endl;
106 cout <<
"TD length : " <<
cfg.
TDSize/rate <<
" sec" << endl;
107 cout <<
"segEdge : " <<
cfg.
segEdge <<
" sec" << endl;
108 cout <<
"Select segEdge > " <<
int(1.5*(
cfg.
TDSize/rate)+0.5) << endl << endl;
120 int layers = level>0 ? 1<<level : 0;
124 if(check_layers!=
nRES) {
125 cout <<
"cwb2G::Init - Error : analysis layers do not match the MRA catalog" << endl;
126 cout << endl <<
"analysis layers : " << endl;
128 int layers = level>0 ? 1<<level : 0;
129 cout <<
"level : " << level <<
" layers : " << layers << endl;
131 cout << endl <<
"MRA catalog layers : " << endl;
139 int layers = level>0 ? 1<<level : 0;
141 cout <<
"level : " << level <<
"\t rate(hz) : " << rate <<
"\t layers : " << layers
142 <<
"\t df(hz) : " <<
rateANA/2./double(1<<level)
143 <<
"\t dt(ms) : " << 1000./rate << endl;
153 double dt_max = 1./rate_min;
154 if(fmod(rate_min,1.)) {
155 cout <<
"cwb2G::Init - Error : rate min=" << rate_min <<
"(Hz) is not integer" << endl << endl;
159 cout <<
"cwb2G::Init - Error : lagStep=" <<
cfg.
lagStep <<
"(sec)"
160 <<
" is not a multple of 2*max_time_resolution=" << 2*dt_max <<
"(sec)" << endl << endl;
164 cout <<
"cwb2G::Init - Error : segEdge=" <<
cfg.
segEdge <<
"(sec)"
165 <<
" is not a multple of 2*max_time_resolution=" << 2*dt_max <<
"(sec)" << endl << endl;
169 cout <<
"cwb2G::Init - Error : segMLS=" <<
cfg.
segMLS <<
"(sec)"
170 <<
" is not a multple of 2*max_time_resolution=" << 2*dt_max <<
"(sec)" << endl << endl;
208 std::vector<wavearray<double> >
y;
214 WDM<double> WDMwhite(layers_high,layers_high,6,10);
217 double wdmFLen = double(WDMwhite.
m_H)/
rateANA;
220 cout <<
"cwb2G::ReadData : Error - filter scratch must be <= cwb scratch!!!" << endl;
221 cout <<
"filter length : " << wdmFLen <<
" sec" << endl;
222 cout <<
"cwb scratch : " <<
cfg.
segEdge <<
" sec" << endl;
225 cout <<
"WDM filter length for regression = " << wdmFLen <<
" (sec)" << endl;
235 {cout <<
"cwb2G::ReadData - Error opening root file : " <<
jname << endl;
EXIT(1);}
236 TDirectory* cdstrain = (TDirectory*)
jfile->Get(
"strain");
237 if(cdstrain==NULL) cdstrain =
jfile->mkdir(
"strain");
253 if(TMath::IsNaN(x.
mean()))
254 {cout <<
"cwb2G::ReadData - Error : found NaN in strain data !!!" << endl;
EXIT(1);}
257 {cout <<
"cwb2G::ReadData - input rate from frame " << x.
rate()
258 <<
" do not match the one defined in config : " <<
cfg.
inRate << endl;
EXIT(1);}
277 if(
i>0 && xstart != x.
start()) {
278 cout <<
"cwb2G::ReadData - Error : ifo noise data not synchronized" << endl;
279 cout <<
ifo[
i] <<
" " << x.
start() <<
" != " <<
ifo[0] <<
" " << xstart << endl;
282 if(
i>0 && xrate != x.
rate()) {
283 cout <<
"cwb2G::ReadData - Error : ifo noise data have different rates" << endl;
284 cout <<
ifo[
i] <<
" " << x.
rate() <<
" != " <<
ifo[0] <<
" " << xrate << endl;
289 TDirectory* cdmdc = (TDirectory*)
jfile->Get(
"mdc");
290 if(cdmdc==NULL) cdmdc =
jfile->mkdir(
"mdc");
298 {cout <<
"cwb2G::ReadData - input rate from frame " << x.
rate()
299 <<
" do not match the one defined in config : " <<
cfg.
inRate << endl;
EXIT(1);}
302 if(TMath::IsNaN(x.
mean()))
303 {cout <<
"cwb2G::ReadData - Error : found NaN in MDC data !!!" << endl;
EXIT(1);}
327 double layer =
j+0.01;
340 if(xstart != x.
start()) {
341 cout <<
"cwb2G::ReadData - Error : mdc/noise data with different start time" << endl;
342 printf(
"start time : noise = %10.6f - mdc = %10.6f\n",xstart,x.
start());
345 if(xrate != x.
rate()) {
346 cout <<
"cwb2G::ReadData - Error : mdc/noise data with different rate" << endl;
347 printf(
"rate : noise = %10.6f - mdc = %10.6f\n",xrate,x.
rate());
350 if(xsize != x.
size()) {
351 cout <<
"cwb2G::ReadData - Error : mdc/noise data with different buffer size" << endl;
352 printf(
"buffer size : noise = %d - mdc = %lu\n",xsize,x.
size());
361 TDirectory* cdmdc = (TDirectory*)
jfile->Get(
"mdc");
362 if(cdmdc==NULL) cdmdc =
jfile->mkdir(
"mdc");
365 std::vector<double> mdcFactor;
366 for (
int k=0;
k<(
int)
pD[0]->ISNR.size();
k++) {
369 for(
int i=0;
i<
nIFO;
i++) snr+=
pD[0]->ISNR.data[
k];
371 for(
int i=0;
i<
nIFO;
i++) snr+=
pD[
i]->ISNR.data[
k];
374 if(snr>0) mdcFactor.push_back(1./snr);
else mdcFactor.push_back(0.);
377 size_t K = mdcFactor.size();
378 for(
int k=0;
k<(
int)K;
k++) {
379 if(mdcFactor[
k]) cout << k <<
" mdcFactor : " << mdcFactor[
k] << endl;
392 for(
int k=0;
k<(
int)
pD[i]->IWFP.size();
k++) {
397 for(
int k=0;
k<(
int)K;
k++) {
405 for(
int k=0;
k<(
int)K;
k++) {
406 int ilog[5] = {1,3,12,13,14};
407 for(
int l=0;
l<5;
l++) {
408 double mfactor =
l<2 ? mdcFactor[
k] : mdcFactor[
k]*mdcFactor[
k];
462 TDirectory* cdrms=NULL;
463 TDirectory* cdcstrain=NULL;
467 WDM<double> WDMwhite(layers_high,layers_high,6,10);
472 double wdmFLen = double(WDMwhite.
m_H)/
rateANA;
475 cout <<
"cwb2G::DataConditioning : Error - filter scratch must be <= cwb scratch!!!" << endl;
476 cout <<
"filter length : " << wdmFLen <<
" sec" << endl;
477 cout <<
"cwb scratch : " <<
cfg.
segEdge <<
" sec" << endl;
480 cout <<
"WDM filter max length = " << wdmFLen <<
" (sec)" << endl;
488 {cout <<
"cwb2G::DataConditioning - Error : file " <<
jname <<
" not found" << endl;
EXIT(1);}
492 TDirectory* dcstrain = (TDirectory*)
jfile->Get(
"cstrain");
493 if(dcstrain==NULL) dcstrain=
jfile->mkdir(
"cstrain");
494 char cdcstrain_name[32];
sprintf(cdcstrain_name,
"cstrain-f%d",ifactor);
495 cdcstrain=dcstrain->mkdir(cdcstrain_name);
497 TDirectory* drms = (TDirectory*)
jfile->Get(
"rms");
498 if(drms==NULL) drms=
jfile->mkdir(
"rms");
499 char cdrms_name[32];
sprintf(cdrms_name,
"rms-f%d",ifactor);
500 cdrms=drms->mkdir(cdrms_name);
507 if(TMath::IsNaN(px->
mean()))
508 {cout <<
"cwb2G::DataConditioning - Error : found NaN in strain data !!!" << endl;
EXIT(1);}
516 if(TMath::IsNaN(px->
mean()))
517 {cout <<
"cwb2G::DataConditioning - Error : found NaN in MDC data !!!" << endl;
EXIT(1);}
520 int nshift =
int(factor*px->
rate());
522 int jstart = nshift<0 ? -nshift : 0;
523 int jstop = nshift<0 ? px->
size() : px->
size()-nshift;
524 for(
int j=jstart;
j<jstop;
j++) px->
data[
j+nshift] = pX.data[
j];
526 double tshift=nshift/px->
rate();
531 for(
int k=0;
k<(
int)
pD[i]->IWFP.size();
k++) {
536 for(
int k=0;
k<(
int)
pD[i]->TIME.size();
k++)
pD[i]->TIME[
k]+=tshift;
540 vector<TString>
ifos(nIFO);
589 double layer =
j+0.01;
603 sprintf(info,
"-IFO:%d-RMS:%g",i,
hot[i]->rms());
626 cout<<
"After "<<
ifo[
i]<<
" data conditioning"<<endl;
645 if(ifile!=NULL) ifile->Close();
653 vector<TString> delObjList;
673 char cdrms_name[32];
sprintf(cdrms_name,
"rms-f%d",ifactor);
674 char cdcstrain_name[32];
sprintf(cdcstrain_name,
"cstrain-f%d",ifactor);
677 TFile*
ifile =
new TFile(fName);
679 {cout <<
"cwb2G::DataConditioning - Error opening root file : " << fName << endl;
EXIT(1);}
683 {cout <<
"cwb::DataConditioning - Error opening root file : " <<
jname << endl;
EXIT(1);}
686 TDirectory* jcdrms = NULL;
687 TDirectory* jcdcstrain = NULL;
689 TDirectory* dcstrain = (TDirectory*)
jfile->Get(
"cstrain");
690 if(dcstrain==NULL) dcstrain=
jfile->mkdir(
"cstrain");
691 jcdcstrain=dcstrain->mkdir(cdcstrain_name);
693 TDirectory* drms = (TDirectory*)
jfile->Get(
"rms");
694 if(drms==NULL) drms=
jfile->mkdir(
"rms");
695 jcdrms=drms->mkdir(cdrms_name);
714 {cout <<
"cwb2G::DataConditioning - Error : cstrain not present, job terminated!!!" << endl;
EXIT(1);}
716 {
jfile->cd();jcdcstrain->cd();pws->Write(
ifo[
i]);}
726 {cout <<
"cwb2G::DataConditioning - Error : strain rms not present, job terminated!!!" << endl;
EXIT(1);}
728 {
jfile->cd();jcdcstrain->cd();jcdrms->cd();pws->Write(
ifo[
i]);}
781 std::vector<SSeries<double> >
vSS;
782 for(
int n=0;
n<
nIFO;
n++) vSS.push_back(SS);
788 {cout <<
"cwb2G::Coherence - Error : file " <<
jname <<
" not found" << endl;
EXIT(1);}
791 TDirectory* sdir = (TDirectory*)
jfile->Get(
"csparse");
792 if(sdir==NULL) sdir =
jfile->mkdir(
"csparse");
795 char sfactor[8];
sprintf(sfactor,
"%d",ifactor);
801 int upN =
rateANA/1024;
if(upN<1) upN=1;
807 int layers = level>0 ? 1<<level : 0;
809 cout <<
"level : " << level <<
"\t rate(hz) : " << rate
810 <<
"\t layers : " << layers <<
"\t df(hz) : " <<
rateANA/2./double(1<<level)
811 <<
"\t dt(ms) : " << 1000./rate << endl;
829 sprintf(cmd,
"gILEVEL = %lu;",level);
EXPORT(
size_t,gILEVEL,cmd);
841 cout<<
"thresholds in units of noise variance: Eo="<<Eo<<
" Emax="<<Eo*2<<endl;
843 sprintf(info,
"-RES:%d-THR:%g",
i,Eo);
847 cout<<
"live time in zero lag: "<<TL<<endl;
853 sprintf(cmd,
"gILEVEL = %lu;",level);
EXPORT(
size_t,gILEVEL,cmd);
862 vSS[
n].SetMap(&WS[n]);
863 vSS[
n].SetHalo(
mTau);
866 vSS[1].SetMap(&WS[1]);
867 vSS[1].SetHalo(
mTau);
873 if(
cfg.
simulation) {cout<<
"ifactor|clusters|pixels ";cout.flush();}
874 else {cout<<
"lag|clusters|pixels "; cout.flush();}
875 int csize_tot=0;
int psize_tot=0;
882 wc.
cpf(*(pwc),
false);
889 pwc->
write(
jfile,
"coherence",
"clusters",0,cycle);
891 cout<<cycle<<
"|"<<pwc->
csize()<<
"|"<<pwc->
size()<<
" ";cout.flush();
892 csize_tot+=pwc->
csize(); psize_tot+=pwc->
size();
901 TList*
fList = gDirectory->GetList();
903 TIter nextobj(fList);
904 while ((obj = (TObject *) nextobj())) {
905 if(
TString(obj->GetName()).Contains(
"clusters"))
delete obj;
908 for(
int n=0;
n<
nIFO;
n++) {vSS[
n].UpdateSparseTable();}
916 vSS[
n].Write(wsname,TObject::kWriteDelete);
919 watchCoh.Stop(); cout<<endl;
920 PrintElapsedTime(watchCoh.RealTime(),
"Coherence Elapsed Time for this level : ");
921 cout<<endl; watchCoh.Reset();
929 char sfactor[8];
sprintf(sfactor,
"%d",ifactor);
965 {cout <<
"cwb2G::SuperCluster - Error opening : " <<
jname << endl;
EXIT(1);}
968 if(
froot==NULL) {cout <<
"cwb2G::SuperCluster - Error opening : " <<
froot->GetPath() << endl;
EXIT(1);}
969 TDirectory* wdir = (TDirectory*)
froot->Get(
"histogram");
970 if(wdir==NULL) wdir =
froot->mkdir(
"histogram");
990 cout <<
"Loading sparse TF map ... " << endl;
1001 cout <<
"cwb2G::SuperCluster : sparse map " << swname
1002 <<
" not exist in job file" << endl;
EXIT(1);
1005 pD[
n]->
vSS.push_back(SS);
1013 if(ifile!=NULL)
sprintf(cmd,
"gIFILE = (void*)%p;",ifile);
1014 else sprintf(cmd,
"gIFILE = NULL;");
1015 EXPORT(
void*,gIFILE,cmd);
1033 if(ifile!=NULL) wc.
read(ifile,
"coherence",
"clusters",0,cycle);
1034 else wc.
read(
jfile,
"coherence",
"clusters",0,cycle);
1037 for(
int i=nRES-1;
i>=0;
i--)
1040 for(
int i=nRES-1;
i>=0;
i--)
1043 cout<<
"-----------------------------------------------------"<<endl;
1044 char cycle_name[32];
1046 else sprintf(cycle_name,
" lag=%d",cycle);
1047 cout<<
"-> Processing " <<cycle_name<<
" ..."<<endl;
1048 cout<<
" --------------------------------------------------"<<endl;
1049 cout<<
" coher clusters|pixels : "
1050 <<setfill(
' ')<<setw(6)<<wc.
csize()<<
"|"<<wc.
size()<<endl;
1056 cout<<
" super clusters|pixels : "
1057 <<setfill(
' ')<<setw(6)<<wc.
esize(0)<<
"|"<<wc.
psize(0)<<endl;
1062 cout<<
" defrag clusters|pixels : "
1063 <<setfill(
' ')<<setw(6)<<wc.
esize(0)<<
"|"<<wc.
psize(0)<<
"\n";
1068 pwc->
cpf(wc,
false);
1079 double pfrac = ptot>0 ? double(psel)/double(ptot) : 0.;
1081 if(count<10000)
break;
1083 cout<<
" subnet clusters|pixels : "
1084 <<setfill(
' ')<<setw(6)<<
NET.
events()<<
"|"<<pwc->
psize(-1)<<
"\n";
1089 cout<<
" defrag clusters|pixels : "
1090 <<setfill(
' ')<<setw(6)<<
NET.
events()<<
"|"<<pwc->
psize(-1)<<
"\n";
1094 nnn += pwc->
psize(-1);
1098 pwc->
write(
jfile,
"supercluster",
"clusters",0,cycle);
1099 pwc->
write(
jfile,
"supercluster",
"clusters",-1,cycle);
1103 cout<<endl;cout.flush();
1107 cout<<endl<<
"Supercluster done"<<endl;
1108 if(mmm) cout<<
"total clusters|pixels|frac : "
1109 <<setfill(
' ')<<setw(6)<<nevt<<
"|"<<nnn<<
"|"<<nnn/double(mmm)<<
"\n";
1110 else cout<<
"total clusters : "<<nevt<<
"\n";
1111 cout<<endl;cout.flush();
1114 if(mmm)
sprintf(info,
"-NEVT:%d-PSIZE:%d-FRAC:%g",nevt,nnn,nnn/
double(mmm));
1115 else sprintf(info,
"-NEVT:%d",nevt);
1152 vector<TString> delObjList;
1155 delObjList.push_back(
"coherence");
1159 char cdrms_name[32];
sprintf(cdrms_name,
"rms/rms-f%d",ifactor);
1160 char cdcstrain_name[32];
sprintf(cdcstrain_name,
"cstrain/cstrain-f%d",ifactor);
1161 delObjList.push_back(cdrms_name);
1162 delObjList.push_back(cdcstrain_name);
1204 EXPORT(
float*,gSLAGSHIFT,TString::Format(
"gSLAGSHIFT = (float*)%p;",
slagShift).Data());
1209 jfile = (xname==
jname) ?
new TFile(xname,
"UPDATE") :
new TFile(xname);
1211 {cout <<
"cwb2G::Likelihood - Error : file " << xname.Data() <<
" not found" << endl;
EXIT(1);}
1221 ifile =
new TFile(
jname,
"UPDATE");
1222 if(ifile==NULL||!ifile->IsOpen()) {
1223 cout <<
"cwb2G::Likelihood - Error : file " <<
jname <<
" not found" << endl;
EXIT(1); }
1230 if(xname!=
jname) ifile->Close();
1238 cout <<
"Loading sparse TF map ... " << endl;
1247 cout <<
"cwb2G::Likelihood : sparse map " << swname
1248 <<
" not exist in job file" << endl;
EXIT(1);
1251 pD[
n]->
vSS.push_back(SS);
1265 EXPORT(
int,gLRETRY,
"gLRETRY = 0;")
1267 EXPORT(
int,gRET,
"gRET = 0;")
1271 int gRET=0;
IMPORT(
int,gRET)
if(gRET==-1)
continue;
1273 int gLRETRY=0;
IMPORT(
int,gLRETRY) LRETRY=gLRETRY;
1281 vector<int> clist = pwc->
read(
jfile,
"supercluster",
"clusters",0,cycle);
1285 char cycle_name[32];
1287 else sprintf(cycle_name,
" lag=%d",cycle);
1288 cout<<
"-------------------------------------------------------"<<endl;
1289 cout<<
"-> Processing " << clist.size() <<
" clusters in" << cycle_name<<endl;
1290 cout<<
" ----------------------------------------------------"<<endl;cout.flush();
1296 int nselected_core_pixels = 0;
1297 int nrejected_weak_pixels = 0;
1298 int nrejected_loud_pixels = 0;
1299 for(
int k=0;
k<(
int)clist.size();
k++) {
1302 pwc->
read(
jfile,
"supercluster",
"clusters",nmax,cycle,0,clist[
k]);
1308 int id = size_t(cid.
data[cid.
size()-1]+0.1);
1316 int selected_core_pixels = 0;
1331 int rejected_weak_pixels = 0;
1332 int rejected_loud_pixels = 0;
1337 cout<<
" cluster-id|pixels: "<<setfill(
' ')<<setw(5)<<clist[
k]<<
"|"<<pwc->
size()-npixels;
1338 if(detected) cout <<
"\t -> SELECTED !!!" << endl;
1339 else cout <<
"\t <- rejected " << endl;
1346 ifile =
new TFile(
jname,
"UPDATE");
1347 if(ifile==NULL||!ifile->IsOpen()) {
1348 cout <<
"cwb2G::Likelihood - Error : file " <<
jname <<
" not found" << endl;
EXIT(1); }
1350 pwc->
write(ifile,
"likelihood",
"clusters",0,cycle);
1351 pwc->
write(ifile,
"likelihood",
"clusters",-1,cycle,0,k+1);
1352 if(detected) cout<<
"saved"<<endl;cout.flush();
1354 if(xname!=
jname) ifile->Close();
1357 if(detected) nevents++;
1358 if(gLRETRY==0) npixels=pwc->
size();
1359 if(!detected && gLRETRY==LRETRY) {
1361 EXPORT(
int,gLRETRY,TString::Format(
"gLRETRY = %d;",gLRETRY).Data())
1371 ifile =
new TFile(
jname,
"UPDATE");
1372 if(ifile==NULL||!ifile->IsOpen()) {
1373 cout <<
"cwb2G::Likelihood - Error : file " <<
jname <<
" not found" << endl;
EXIT(1); }
1378 cout<<
"dump ced to job file ..." <<endl;
1379 TDirectory* cdced = NULL;
1380 cdced = (TDirectory*)ifile->Get(
"ced");
1381 if(cdced == NULL) cdced = ifile->mkdir(
"ced");
1384 cout<<
"dump ced to disk ..." <<endl;
1404 if(ced->
Write(ofactor,fullCED)) ceddir = 1;
1406 if(xname!=
jname) ifile->Close();
1414 clist = pwc->
read(
jfile,
"supercluster",
"clusters",0,cycle);
1415 if(pwc->
cList.size()) {
1417 for(
int p=0;p<
npix;p++) pwc->
pList.pop_back();
1423 }
else gLRETRY=LRETRY;
1424 EXPORT(
int,gLRETRY,TString::Format(
"gLRETRY = %d;",gLRETRY).Data())
1438 cout<<endl<<endl;cout.flush();
1443 sprintf(info,
"-NEVT:%d",NEVENTS);
1450 vector<TString> delObjList;
1474 TDirectory* sdir = (TDirectory*)jfile->Get(tdir);
1475 if(sdir==NULL) sdir = jfile->mkdir(tdir);
1482 std::vector<SSeries<double> >
vSS;
1483 for(
int n=0;
n<
nIFO;
n++) vSS.push_back(ss);
1491 vSS[
n].SetMap(
pTF[n]);
1492 vSS[
n].SetHalo(
mTau);
1496 vSS[1].SetMap(
pTF[1]);
1497 vSS[1].SetHalo(
mTau);
1507 wc.
read(jfile,tname,
"clusters",0,cycle);
1510 if(tname==
"coherence") {
1511 wc.
read(jfile,tname,
"clusters",-2,cycle,-vSS[0].wrate());
1513 wc.
read(jfile,tname,
"clusters",-1,cycle,vSS[0].wrate());
1523 for(
int n=0;
n<
nIFO;
n++) {vSS[
n].UpdateSparseTable();}
1529 for(
int n=0;
n<
nIFO;
n++) {ncore+=vSS[
n].GetSparseSize();ncluster+=vSS[
n].GetSparseSize(0);}
1530 ccluster = 2*(vSS[0].GetHaloSlice()+vSS[0].GetHaloSlice(
true))+1;
1531 ccluster*= 2*vSS[0].GetHaloLayer()+1;
1552 vSS[
n].Write(wsname,TObject::kWriteDelete);
1557 cout <<
"----------------- FINAL SPARSE STATISTIC / DETECTOR -------------------" << endl;
1558 cout <<
"npix_core_tot|npix_cluster_tot|3*npix_cluster_tot|ccluster_tot|ratio : " << endl;
1559 cout << ncore_tot <<
" | " << ncluster_tot <<
" | " << 3*ncluster_tot
1560 <<
" | " << ccluster_tot <<
" | " << (ccluster_tot?double(3*ncluster_tot)/(ccluster_tot):0) << endl;
1580 cout <<
"cwb2G::FillSparseTFmap ..." << endl;
1587 pD[
n]->
vSS.push_back(SS);
1593 pD[1]->
vSS.push_back(SS);
1605 wc.
read(jfile,
"coherence",
"clusters",0,cycle);
1608 if(tname==
"coherence") {
1609 wc.
read(jfile,tname,
"clusters",-2,cycle,-
pD[0]->
vSS[
i].wrate());
1611 wc.
read(jfile,tname,
"clusters",-1,cycle,
pD[0]->
vSS[
i].wrate());
1643 {cout <<
"cwb2G::SaveWaveforms - NULL input root file : " <<
jname << endl;
EXIT(1);}
1645 {cout <<
"cwb2G::SaveWaveforms - save mode must be 1/2/3 " << endl;
EXIT(1);}
1648 TDirectory*
wf = (TDirectory*)jfile->Get(
"waveform");
1649 if(wf==NULL) wf=jfile->mkdir(
"waveform");
1650 char cdwf_name[32];
sprintf(cdwf_name,
"waveform-f%d",ifactor);
1651 TDirectory* cdwf = (TDirectory*)wf->Get(cdwf_name);
1652 if(cdwf==NULL) cdwf=wf->mkdir(cdwf_name);
1656 pD->Write(pD->
Name,TObject::kSingleKey);
1679 {cout <<
"cwb2G::LoadWaveforms - NULL input root file : " <<
iname << endl;
EXIT(1);}
1681 {cout <<
"cwb2G::LoadWaveforms - save mode must be 1/2/3 " << endl;
EXIT(1);}
1685 char cdwf_name[32];
sprintf(cdwf_name,
"waveform/waveform-f%d",ifactor);
1687 if(pd==NULL)
return;
char channelNamesMDC[NIFO_MAX][50]
monster wdmMRA
list of pixel pointers for MRA
detector * getifo(size_t n)
param: detector index
virtual size_t defragment(double T, double F, TH2F *=NULL)
T - maximum time gap in seconds F - maximum frequency gap in Hz.
virtual void resize(unsigned int)
CWB::frame fr[2 *NIFO_MAX]
void PrintElapsedTime(int job_elapsed_time, TString info)
virtual size_t size() const
void LoadWaveforms(TFile *ifile, detector *pD, int ifactor, int wfSAVE=1)
size_t write(const char *file, int app=0)
#define REGRESSION_FILTER_LENGTH
void white(double dT=0, int wtype=1, double offset=0., double stride=0.)
what it does: see algorithm description in wseries.hh
static size_t GetProcInfo(bool mvirtual=true)
std::vector< vector_int > cRate
void WriteSparseTFmap(TFile *jfile, int ifactor, TString tdir, TString tname)
void setMatrix(double edge=0., double f=1.)
void SaveWaveforms(TFile *jfile, detector *pD, int ifactor, int wfSAVE=1)
void FileGarbageCollector(TString ifName, TString ofName="", vector< TString > delObjList=vector< TString >())
std::vector< netcluster > wc_List
size_t add(detector *)
param: detector structure return number of detectors in the network
printf("total live time: non-zero lags = %10.1f \n", liveTot)
bool singleDetector
used for the stage stuff
WSeries< double > * pTF[NIFO_MAX]
pointers to detectors
void setAntenna(detector *)
param: detector (use theta, phi index array)
std::vector< double > * getmdcTime()
size_t setsnr(wavearray< double > &, std::vector< double > *, std::vector< double > *, double=5., double=8.)
fprintf(stdout,"start=%f duration=%f rate=%f\n", x.start(), x.size()/x.rate(), x.rate())
WDM< double > * pwdm[NRES_MAX]
virtual void rate(double r)
#define REGRESSION_MATRIX_FRACTION
bool Likelihood(int ifactor, char *ced_dir, netevent *output=NULL, TTree *net_tree=NULL, char *outDump=NULL)
long getNetworkPixels(int LAG, double Eo, double DD=1., TH1F *hist=NULL)
TString iname
stage benchmark
cout<< "skymap size : "<< L<< endl;for(int l=0;l< L;l++) sm.set(l, l);sm > const_cast< char * >("skymap.dat")
detector * pD[NIFO_MAX]
noise variability
size_t setIndexMode(size_t=0)
void bandpass(wavearray< DataType_t > &ts, double flow, double fhigh, int n=-1)
TFile * jfile
output root file
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
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
void add(const wavearray< DataType_t > &, int=0, int=0, int=0)
std::vector< vector_float > sArea
std::vector< SSeries< double > > vSS[NIFO_MAX]
virtual double ReadData(double mdcShift, int ifactor)
void Coherence(int ifactor)
size_t setcore(bool core, int id=0)
void SetOptions(int simulation, double rho, double inRate, bool useSparse=false, char *gtype=const_cast< char * >("png"), int paletteId=0)
virtual size_t supercluster(char atype, double S, bool core)
param: statistic: E - excess power, L - likelihood param: selection threshold T for likelihood cluste...
std::vector< vector_int > cList
size_t add(WSeries< double > &target, char *name, double fL=0., double fH=0.)
virtual void start(double s)
std::vector< double > mdcTime
void setTDFilter(int nCoeffs, int L=1)
long subNetCut(int lag, float subnet=0.6, float subcut=0.33, TH2F *hist=NULL)
network NET
pointers to WSeries
size_t cluster(int kt, int kf)
param: time gap in pixels return: number of reconstructed clusters
long likelihood2G(char mode, int lag, int ID, TH2F *hist=NULL)
virtual double mean() const
std::vector< vector_float > p_Map
void dopen(const char *fname, char *mode, bool header=true)
cout<< "Selected Pixels : "<< nPix<< endl;wc.cluster(1, 1);SSeries< double > ss
long likelihoodWP(char mode, int lag, int ID, TH2F *hist=NULL)
void output2G(TTree *, network *, size_t, int, double)
double setVeto(double=5.)
param: time window around injections
void PrintAnalysisInfo(CWB_STAGE stage, TString comment, TString info, bool out=true, bool log=true)
#define IMPORT(TYPE, VAR)
double maxEnergy(wavearray< DataType_t > &ts, Wavelet &w, double=0, int=1, int=0, TH1F *=NULL)
void SuperCluster(int ifactor)
std::vector< netpixel > pList
wavearray< double > * getHoT()
param: no parameters
gwavearray< double > * gx
void setDelayIndex(double rate)
param: MDC log file
std::vector< std::string > mdcList
void Resample(const wavearray< DataType_t > &, double, int=6)
#define MIN_SKYRES_HEALPIX
void apply(double threshold=0., char c='a')
void FillSparseTFmap(TFile *jfile, int ifactor, TString tname)
int getLayer(wavearray< DataType_t > &w, double n)
param: n - layer number
std::vector< vector_int > p_Ind
double dataShift[NIFO_MAX]
std::vector< float > cFreq
int Write(double factor, bool fullCED=true)
char channelNamesRaw[NIFO_MAX][50]
friend void CWB_Plugin(TFile *jfile, CWB::config *, network *, WSeries< double > *, TString, int)
COHERENCE.
void SetChannelName(char *chName)
void PrintStageInfo(CWB_STAGE stage, TString comment, bool out=true, bool log=true, TString fname="")
void solve(double th, int nE=0, char c='s')
char jname[1024]
job file object
#define REGRESSION_SOLVE_EIGEN_THR
std::vector< wavearray< double > * > IWFP
size_t cpf(const netcluster &, bool=false, int=0)
double THRESHOLD(double bpp)
param: selected fraction of LTF pixels assuming Gaussian noise
void setDelay(const char *="L1")
size_t loadTDampSSE(network &net, char c, size_t BATCH=10000, size_t LOUD=0)
wavearray< double > getClean()
#define REGRESSION_APPLY_THR
#define EXPORT(TYPE, VAR, CMD)
std::vector< float > cTime
WSeries< double > * getTFmap()
param: no parameters
unsigned int jobfOptions
history object
int SetSkyMask(network *net, CWB::config *cfg, char *options, char skycoord, double skyres=-1)
void readFrames(char *filename, char *channel, wavearray< double > &w)
void Forward(int n=-1)
param: wavelet - n is number of steps (-1 means full decomposition)
netcluster * getwc(size_t n)
param: delay index
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
std::vector< clusterdata > cData
virtual wavearray< double > select(char *, double)
void setMRAcatalog(char *fn)
double factors[FACTORS_MAX]
void DataConditioning(int ifactor)
wavearray< double > * hot[NIFO_MAX]
wavelet pointers: pwdm[0] - l_high, wdm[nRES-1] l_low
cout<< "live time after cat 2 : "<< detSegs_ctime<< endl;if(detSegs_ctime< segTHR){cout<< "job segment live time after cat2 < "<< segTHR<< " sec, job terminated !!!"<< endl;exit(1);}double Tb=detSegs[0].start;double Te=detSegs[0].stop;double dT=Te-Tb;char file[512], tdf00[512], tdf90[512], buFFer[1024];int rnID=int(gRandom->Rndm(13)*1.e9);if(simulation){i=NET.readMDClog(injectionList, double(long(Tb))-mdcShift);printf("GPS: %16.6f saved, injections: %d\n", double(long(Tb)), i);frTB[nIFO].shiftBurstMDCLog(NET.mdcList, ifos, mdcShift);for(int i=0;i< NET.mdcTime.size();i++) NET.mdcTime[i]+=mdcShift;vector< waveSegment > mdcSegs(NET.mdcTime.size());for(int k=0;k< NET.mdcTime.size();k++){mdcSegs[k].start=NET.mdcTime[k]-gap;mdcSegs[k].stop=NET.mdcTime[k]+gap;}vector< waveSegment > mdcSegs_dq2=slagTB.mergeSegLists(detSegs_dq2, mdcSegs);double mdcSegs_ctime=slagTB.getTimeSegList(mdcSegs_dq2);cout<< "live time in zero lag after cat2+inj : "<< mdcSegs_ctime<< endl;if(mdcSegs_ctime==0){cout<< "job segment with zero cat2+inj live time in zero lag, job terminated !!!"<< endl;exit(1);}}if(dump_infos_and_exit) exit(0);if(mask >0.) NET.setSkyMask(mask, skyMaskFile);for(i=0;i< nIFO;i++){frTB[i].readFrames(FRF[i], channelNamesRaw[i], x);x.start(x.start()+dataShift[i]);x.start(x.start()-segLen *(segID[i]-segID[0]));if(singleDetector) TB.resampleToPowerOfTwo(x);sprintf(file,"%s/%s_%d_%s_%d_%d.dat", nodedir, ifo[i], int(Tb), data_label, runID, rnID);if(dump_sensitivity_and_exit){sprintf(file,"%s/sensitivity_%s_%d_%s_job%d.txt", dump_dir, ifo[i], int(Tb), data_label, runID);cout<< endl<< "Dump Sensitivity : "<< file<< endl<< endl;TB.makeSpectrum(file, x);continue;}if(dcCal[i]>0.) x *=dcCal[i];if(fResample >0){x.FFT(1);x.resize(fResample/x.rate()*x.size());x.FFT(-1);x.rate(fResample);}pTF[i]=pD[i]-> getTFmap()
std::vector< SSeries< double > > vSS
size_t read(const char *)
double ReadData(double mdcShift, int ifactor)
#define REGRESSION_SOLVE_EIGEN_NUM
#define REGRESSION_SOLVE_REGULATOR
virtual void resize(unsigned int)
void Inverse(int n=-1)
param: n - number of steps (-1 means full reconstruction)
void putLayer(wavearray< DataType_t > &, double n)
param: n - layer number
size_t setsim(WSeries< double > &, std::vector< double > *, double=5., double=8., bool saveWF=false)
void setSkyMaps(double, double=0., double=180., double=0., double=360.)
param: sky map granularity step, degrees param: theta begin, degrees param: theta end...
virtual WSeries< double > white(double, int, double=0., double=0.)
what it does: each wavelet layer is devided into k intervals.