Logo coherent WaveBurst  
Library Reference Guide
Logo
CWB_Plugin_bandPass.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 #define XIFO 4
20 
21 #pragma GCC system_header
22 
23 #include "cwb.hh"
24 #include "config.hh"
25 #include "network.hh"
26 #include "wavearray.hh"
27 #include "TString.h"
28 #include "TObjArray.h"
29 #include "TObjString.h"
30 #include "TRandom.h"
31 #include "Toolbox.hh"
32 
33 #define DUMP_WHITE_PSD
34 
35 struct fBand {
36  double flow;
37  double fhigh;
38 };
39 
40 #define nBAND 6
41 
42 fBand fband[nBAND]={
43  {77,83},
44  {116,125},
45  {175,185},
46  {196,204},
47  {491,497},
48  {573,580}
49  };
50 
51 void
53 //!DATA_CONDITIONING
54 // Plugin which implement the bandFilter data conditioning on whitened data
55 
56  cout << endl;
57  cout << "-----> CWB_Plugin_bandPass.C" << endl;
58  cout << "ifo " << ifo.Data() << endl;
59  cout << "type " << type << endl;
60  cout << endl;
61 
62  if(type==CWB_PLUGIN_WHITE) {
64  int level=-1;
65  if(TString(cfg->analysis)=="1G") {
66  level=x->getLevel();
67  x->Inverse(-1);
68  }
69 
71 
72  int layers = px->rate()/2;
73  WDM<double> wdm(layers,layers,6,10); // df = (px->rate()/2)/layers
74  detector D;
75  D.getTFmap()->Forward(*px,wdm);
76  for(int i=0;i<nBAND;i++) D.bandCut(fband[i].flow,fband[i].fhigh); // band cut filter
77  D.getTFmap()->Inverse(); // return to time domain
78  *px = *D.getTFmap(); // get band filtered data
79 
80 #ifdef DUMP_WHITE_PSD
81  // dump spectrum
82  char file[1024];
83  sprintf(file,"%s/sensitivity_white_%s_%d_%s_job%lu.txt",
84  cfg->dump_dir,ifo.Data(),int(x->start()),cfg->data_label,net->nRun);
85  cout << endl << "Dump Sensitivity : " << file << endl << endl;
86  TB.makeSpectrum(file, *x);
87  int nIFO=net->ifoListSize();
88  if(TString(ifo).CompareTo(net->ifoName[nIFO-1])==0) gSystem->Exit(0); // last ifo
89 #endif
90 
91  if(TString(cfg->analysis)=="1G") x->Forward(level);
92  }
93 
94  return;
95 }
std::vector< char * > ifoName
Definition: network.hh:609
CWB::config * cfg
char analysis[8]
Definition: config.hh:117
virtual void rate(double r)
Definition: wavearray.hh:141
TString("c")
size_t nRun
Definition: network.hh:572
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
WDM< double > wdm(nLAYERS, nLAYERS, 6, 10)
CWB::Toolbox TB
int layers
fBand fband[nBAND]
virtual void start(double s)
Definition: wavearray.hh:137
i drho i
char ifo[NIFO_MAX][8]
network ** net
NOISE_MDC_SIMULATION.
size_t ifoListSize()
Definition: network.hh:431
#define nIFO
int getLevel()
Definition: wseries.hh:109
jfile
Definition: cwb_job_obj.C:43
wavearray< double > * px
i() int(T_cor *100))
double fhigh
double D[50000]
double flow
#define nBAND
WSeries< double > * getTFmap()
param: no parameters
Definition: detector.hh:179
char dump_dir[1024]
Definition: config.hh:328
void Forward(int n=-1)
param: wavelet - n is number of steps (-1 means full decomposition)
Definition: wseries.cc:246
static void makeSpectrum(wavearray< double > &psd, wavearray< double > x, double chuncklen=8, double scratchlen=0, bool oneside=true)
Definition: Toolbox.cc:5489
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
char data_label[1024]
Definition: config.hh:332
void Inverse(int n=-1)
param: n - number of steps (-1 means full reconstruction)
Definition: wseries.cc:291
void bandCut(double f1, double f2)
Definition: detector.hh:286