Logo coherent WaveBurst  
Library Reference Guide
Logo
cwb_xtalk.C
Go to the documentation of this file.
1 /*
2 # Copyright (C) 2019 Gabriele Vedovato
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17 
18 
19 // macro used to generate the Overlap Catalog
20 {
21 
22  #define NMAX_RES 32
23 
24  // get low resolution level
25  int cwb_xtalk_low_level=0;
26  if(gSystem->Getenv("CWB_XTALK_LOW_LEVEL")==NULL) {
27  cout << "cwb_xtalk.C - Error : environment CWB_XTALK_LOW_LEVEL is not defined!!!" << endl;exit(1);
28  } else {
29  if(TString(gSystem->Getenv("CWB_XTALK_LOW_LEVEL")).IsDigit()) {
30  cwb_xtalk_low_level=TString(gSystem->Getenv("CWB_XTALK_LOW_LEVEL")).Atoi();
31  } else {
32  cout << "cwb_xtalk.C - Error : environment CWB_XTALK_LOW_LEVEL is not defined!!!" << endl;exit(1);
33  }
34  }
35 
36  // get high resolution level
37  int cwb_xtalk_high_level=0;
38  if(gSystem->Getenv("CWB_XTALK_HIGH_LEVEL")==NULL) {
39  cout << "cwb_xtalk.C - Error : environment CWB_XTALK_HIGH_LEVEL is not defined!!!" << endl;exit(1);
40  } else {
41  if(TString(gSystem->Getenv("CWB_XTALK_HIGH_LEVEL")).IsDigit()) {
42  cwb_xtalk_high_level=TString(gSystem->Getenv("CWB_XTALK_HIGH_LEVEL")).Atoi();
43  } else {
44  cout << "cwb_xtalk.C - Error : environment CWB_XTALK_HIGH_LEVEL is not defined!!!" << endl;exit(1);
45  }
46  }
47 
48  int nRes = cwb_xtalk_high_level-cwb_xtalk_low_level+1;
49  if(nRes<=0) {
50  cout << "cwb_xtalk.C - Error : low res Level must be < high res level" << endl;exit(1);
51  }
52  if(nRes>NMAX_RES) {
53  cout << "cwb_xtalk.C - Error : number of max resolutions is : " << NMAX_RES << endl;exit(1);
54  }
55 
56  // get iNu : defines the sharpness of the 'edge' of the basis function in Fourier domain
58  if(gSystem->Getenv("CWB_XTALK_INU")!=NULL) {
59  if(TString(gSystem->Getenv("CWB_XTALK_INU")).IsDigit()) {
60  cwb_xtalk_iNu=TString(gSystem->Getenv("CWB_XTALK_INU")).Atoi();
61  } else {
62  cout << "cwb_xtalk.C - Error : environment CWB_XTALK_INU is not defined!!!" << endl;exit(1);
63  }
64  }
65 
66  // get precison : defines filter length by truncation error quantified by P = -log10(1 - norm_of_filter)
68  if(gSystem->Getenv("CWB_XTALK_PRECISION")!=NULL) {
69  if(TString(gSystem->Getenv("CWB_XTALK_HIGH_LEVEL")).IsDigit()) {
70  cwb_xtalk_precision=TString(gSystem->Getenv("CWB_XTALK_PRECISION")).Atoi();
71  } else {
72  cout << "cwb_xtalk.C - Error : environment CWB_XTALK_PRECISION is not defined!!!" << endl;exit(1);
73  }
74  }
75 
76  // define wdm
77  cout << "cwb_xtalk.C - define wdm ..." << endl;
79  for(int level=cwb_xtalk_low_level; level<=cwb_xtalk_high_level; level++) {
80  int layers = level>0 ? 1<<level : 0;
81  wdm[level-cwb_xtalk_low_level] = new WDM<double>(layers, layers, cwb_xtalk_iNu, cwb_xtalk_precision);
82  }
83 
84  // generate xtalk catalog
85  cout << "cwb_xtalk.C - generate xtalk catalog : be patient, it takes a while ..." << endl;
86  monster x(wdm, nRes);
87 
88  // write xtalk catalog
89  cout << "cwb_xtalk.C - write xtalk catalog ..." << endl;
90  char fName[1024];
91  sprintf(fName,"OverlapCatalog-ilLev%d-hLev%d-iNu%d-P%d.xbin",
92  cwb_xtalk_low_level,cwb_xtalk_high_level,cwb_xtalk_iNu,cwb_xtalk_precision);
93  x.write(fName);
94  cout << "OverlapCatalog Name : " << fName << endl;
95  gSystem->Exit(1);
96 }
void write(char *filename)
param: file name
Definition: monster.cc:295
TString("c")
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
int layers
int cwb_xtalk_precision
Definition: cwb_xtalk.C:67
int cwb_xtalk_iNu
Definition: cwb_xtalk.C:57
cout<< "cwb_xtalk.C - define wdm ..."<< endl;WDM< double > * wdm[NMAX_RES]
Definition: cwb_xtalk.C:78
#define NMAX_RES
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
char fName[256]
exit(0)