Logo coherent WaveBurst  
Library Reference Guide
Logo
CWB_Plugin_MakeWhiteFrame.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 void
35 //!DATA_CONDITIONING
36 // Plugin to produce frames of whitened data
37 // To display data with FrDisplay do (Ex) :
38 // FrDisplayPROC -t L1:LDAS-STRAIN \
39 // -i report/dump/white_H1_S6A_BKG_L1H1V1_HF_2G_run2_job535-932501639-600.gwf
40 //
41 
42  cout << endl;
43  cout << "-----> CWB_Plugin_MakeWhiteFrame.C" << endl;
44  cout << "ifo " << ifo.Data() << endl;
45  cout << "type " << type << endl;
46  cout << endl;
47 
49 
50  // get ifo id
51  int id=-1;
52  for(int n=0;n<cfg->nIFO;n++) if(ifo==net->ifoName[n]) {id=n;break;}
53  if(id<0) {cout << "Plugin : Error - bad ifo id" << endl; gSystem->Exit(1);}
54 
55  // transform to time domain
56  int level=-1;
57  if(TString(cfg->analysis)=="1G") {
58  level=x->getLevel();
59  x->Inverse(-1);
60  }
61 
62  // save cleaned data into frame
63  wavearray<double> X = *x;
64  // remove scratch
65  int os = cfg->segEdge*x->rate();
66  X.start(x->start()+cfg->segEdge);
67  X.stop(x->stop()-cfg->segEdge);
68  X.resize(x->size()-2*os);
69  for(int i=0;i<X.size()-2*os;i++) X[i]=X[i+os];
70 
71  // create frame file
72  char frFile[1024];
73  char frName[1024];
74  char chName[1024];
75  sprintf(frFile,"%s/white_%s_%s_job%lu-%lu-%lu.gwf",
76  cfg->dump_dir,ifo.Data(),cfg->data_label,net->nRun,
77  int(X.start()),(int)(X.stop()-X.start()));
78  sprintf(frName,"WFRAME");
79  sprintf(chName,cfg->channelNamesRaw[id]);
80  // open frame file
81  CWB::frame fr(frFile,chName,"WRITE");
82  // write frame to file
83  fr.writeFrame(X, frName, chName);
84  cout << "CWB_Plugin_MakeWhiteFrame.C : write " << frFile << endl;
85 
86  fr.close();
87 
88  int nIFO=net->ifoListSize();
89  if(TString(ifo).CompareTo(net->ifoName[nIFO-1])==0) gSystem->Exit(0); // last ifo
90  if(TString(cfg->analysis)=="1G") x->Forward(level);
91  }
92 
93  return;
94 }
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
int n
Definition: cwb_net.C:28
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
void close()
Definition: frame.cc:296
CWB::frame fr(FRLIST_NAME)
void writeFrame(wavearray< double > x, TString frName, TString chName)
Definition: frame.cc:175
virtual void start(double s)
Definition: wavearray.hh:137
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
COHERENCE.
i drho i
char ifo[NIFO_MAX][8]
network ** net
NOISE_MDC_SIMULATION.
size_t ifoListSize()
Definition: network.hh:431
double segEdge
Definition: config.hh:164
#define nIFO
virtual size_t size() const
Definition: wavearray.hh:145
int getLevel()
Definition: wseries.hh:109
TString chName[NIFO_MAX]
jfile
Definition: cwb_job_obj.C:43
i() int(T_cor *100))
char channelNamesRaw[NIFO_MAX][50]
Definition: config.hh:310
TString frName[NIFO_MAX]
virtual void stop(double s)
Definition: wavearray.hh:139
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
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
int nIFO
Definition: config.hh:120
char data_label[1024]
Definition: config.hh:332
virtual void resize(unsigned int)
Definition: wavearray.cc:463
void Inverse(int n=-1)
param: n - number of steps (-1 means full reconstruction)
Definition: wseries.cc:291
char os[1024]