Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CWB_Plugin_1G_DataConditioning.C
Go to the documentation of this file.
1 #define XIFO 4
2 
3 #pragma GCC system_header
4 
5 #include "cwb.hh"
6 #include "config.hh"
7 #include "network.hh"
8 #include "wavearray.hh"
9 #include "TString.h"
10 #include "TObjArray.h"
11 #include "TObjString.h"
12 #include "TRandom.h"
13 #include "Toolbox.hh"
14 
15 void
17 //!DATA_CONDITIONING
18 // Plugin which implement the 1G data conditioning
19 
20  cout << endl;
21  cout << "-----> CWB_Plugin_1G_DataConditioning.C" << endl;
22  cout << "ifo " << ifo.Data() << endl;
23  cout << "type " << type << endl;
24  cout << endl;
25 
26  if(type==CWB_PLUGIN_CONFIG) {
27  cfg->dcPlugin=true; // disable built-in dc
28  }
29 
30  if(type==CWB_PLUGIN_DATA) {
31 /*
32  CWB::Toolbox TB;
33  char file[1024];
34  sprintf(file,"%s/sensitivity_%s_%d_%s_job%lu.txt",cfg->dump_dir,ifo.Data(),int(x->start()),cfg->data_label,net->nRun);
35  //sprintf(file,"%s/sensitivity_%s_%d_%s_job%lu.txt",".",ifo.Data(),int(x->start()),"prova",net->nRun);
36  cout << endl << "Dump Sensitivity : " << file << endl << endl;
37  TB.makeSpectrum(file, *x, 8, cfg->segEdge);
38 
39  int nIFO=net->ifoListSize();
40  if(TString(ifo).CompareTo(net->ifoName[nIFO-1])==0) gSystem->Exit(0); // last ifo
41 */
42  }
43 
44  if(type==CWB_PLUGIN_REGRESSION) { // 1G like Data Conditioning
45 
46  // get ifo id
47  int id=-1;
48  for(int n=0;n<cfg->nIFO;n++) if(ifo==net->ifoName[n]) {id=n;break;}
49  if(id<0) {cout << "Plugin : Error - bad ifo id" << endl; gSystem->Exit(1);}
50 
51  detector* pD = net->getifo(id);
52  WSeries<double>* pTF = pD->getTFmap();
53 
55 
56  Meyer<double> S(1024,2); // set wavelet for production
59 
60  pTF->Forward(*hot,S,cfg->levelD);
61  pTF->lprFilter(2,0,cfg->Tlpr,4.);
62  pTF->setlow(cfg->fLow);
63  pD->white(cfg->whiteWindow,1,cfg->segEdge,cfg->whiteStride);
64 /* already implemented in 2G
65  if(cfg->simulation) {
66  w.Forward(*hot,S,cfg->levelD);
67  int level = w.getLevel(); // level of decompostion
68  int fWidth = w.rate()/(1<<level)/2; // layer width
69  int iCut = int(cfg->fLow/fWidth); // max layer to cut
70  // set to 0 f<fLow to avoid whitening issues when psd noise is not well defined for f<fLow
71  for(int j=0;j<iCut;j++) {w.getLayer(x,j);x=0;w.putLayer(x,j);}
72  pD->setsim(w,net->getmdcTime(),cfg->gap/2.,cfg->segEdge,true);
73  }
74 */
75  pTF->Inverse(cfg->levelD-cfg->levelF);
76  pTF->lprFilter(2,0,cfg->Tlpr,4.);
77  pTF->sethigh(cfg->fHigh);
78  pD->bandPass(); // band pass filtering
79  pTF->Inverse();
80  *hot = *pTF; // save conditioned TS
81  }
82 
83  if(type==CWB_PLUGIN_WHITE) {
84 /*
85  CWB::Toolbox TB;
86  int level=-1;
87  if(TString(cfg->analysis)=="1G") {
88  level=x->getLevel();
89  x->Inverse(-1);
90  }
91  // dump spectrum
92  char file[1024];
93  sprintf(file,"%s/sensitivity_white_%s_%d_%s_job%lu.txt",cfg->dump_dir,ifo.Data(),int(x->start()),cfg->data_label,net->nRun);
94  cout << endl << "Dump Sensitivity : " << file << endl << endl;
95  TB.makeSpectrum(file, *x, 8, cfg->segEdge);
96  int nIFO=net->ifoListSize();
97  if(TString(ifo).CompareTo(net->ifoName[nIFO-1])==0) gSystem->Exit(0); // last ifo
98  if(TString(cfg->analysis)=="1G") x->Forward(level);
99 */
100  }
101 
102  return;
103 }
std::vector< char * > ifoName
Definition: network.hh:591
void sethigh(double f)
Definition: wseries.hh:114
detector * getifo(size_t n)
param: detector index
Definition: network.hh:418
CWB::config * cfg
Definition: TestCWB_Plugin.C:5
void white(double dT=0, int wtype=1, double offset=0., double stride=0.)
what it does: see algorithm description in wseries.hh
Definition: detector.hh:240
int levelF
Definition: config.hh:135
int n
Definition: cwb_net.C:10
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<< "\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
double whiteWindow
Definition: config.hh:171
double fLow
Definition: config.hh:122
bool dcPlugin
Definition: config.hh:348
void setlow(double f)
Definition: wseries.hh:107
int levelD
Definition: config.hh:136
char ifo[NIFO_MAX][8]
network ** net
NOISE_MDC_SIMULATION.
double Tlpr
Definition: config.hh:126
wavearray< double > w
Definition: Test1.C:27
double segEdge
Definition: config.hh:146
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
jfile
Definition: cwb_job_obj.C:25
wavearray< double > hot[2]
WSeries< double > pTF[nRES]
Definition: revMonster.cc:8
void bandPass(double f1, double f2, double a=0.)
Definition: detector.hh:265
double whiteStride
Definition: config.hh:172
double fHigh
Definition: config.hh:123
WSeries< double > * getTFmap()
param: no parameters
Definition: detector.hh:161
Definition: Meyer.hh:18
virtual void lprFilter(double, int=0, double=0., double=0.)
Definition: wseries.cc:1108
void Forward(int n=-1)
param: wavelet - n is number of steps (-1 means full decomposition)
Definition: wseries.cc:228
Meyer< double > S(1024, 2)
int nIFO
Definition: config.hh:102
void Inverse(int n=-1)
param: n - number of steps (-1 means full reconstruction)
Definition: wseries.cc:273
detector ** pD