Logo coherent WaveBurst  
Library Reference Guide
Logo
CWB_Plugin_gw_data_find.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 //!NOISE_MDC_SIMULATION
20 // Plugin used to retrive 'on the fly' the frame file paths using gw_data_find
21 
22 #define XIFO 4
23 
24 #pragma GCC system_header
25 
26 #include "cwb.hh"
27 #include "config.hh"
28 #include "network.hh"
29 #include "wavearray.hh"
30 #include "TString.h"
31 #include "TObjArray.h"
32 #include "TObjString.h"
33 #include "TRandom.h"
34 #include "TComplex.h"
35 #include "TMath.h"
36 #include "cwb2G.hh"
37 #include "mdc.hh"
38 #include <vector>
39 
40 double Tb = 0;
41 double Te = 0;
42 
43 #define FRAME_SCRATCH_TIME 10000 // seconds before and after the segment range
44 
45 void
47 
48  if(type==CWB_PLUGIN_CONFIG) {
49  cfg->mdcPlugin=true; // disable read mdc from frames
50  cfg->dataPlugin=true; // disable read data from frames
51  }
52 
53  if(type==CWB_PLUGIN_INIT_JOB) {
54 
55  if(Tb!=0 || Te!=0) return;
56 
57  cout << "Execute CWB_Plugin_gw_data_find.C : Inject On The Fly MDC ..." << endl;
58 
59  // get data range
60  cwb2G* gCWB2G; IMPORT(cwb2G*,gCWB2G)
61  Tb = gCWB2G->Tb-FRAME_SCRATCH_TIME;
62  Te = gCWB2G->Te+FRAME_SCRATCH_TIME;
63  //cout << "CWB_Plugin_gw_data_find.C - " << "Tb : " << int(Tb) << " Te : " << int(Te) << endl;
64 
65 
66  for(int n=0;n<cfg->nIFO;n++) {
67 
68  // get observatory
69  TString observatory="";
70  if(TString(net->getifo(n)->Name)=="L1") observatory="L";
71  if(TString(net->getifo(n)->Name)=="H1") observatory="H";
72  if(TString(net->getifo(n)->Name)=="V1") observatory="V";
73  cout << "observatory : " << observatory << " type : " << type << endl;
74  if(observatory=="") {cout << "CWB_Plugin_gw_data_find.C : observatory not defined !!!" << endl;gSystem->Exit(1);}
75 
76  // get type
77  TString type = cfg->frFiles[n];
78  if(type=="") {cout << "CWB_Plugin_gw_data_find.C : type not defined !!!" << endl;gSystem->Exit(1);}
79 
80  // build gw_data_find command
81  char cmd[1024];
82  sprintf(cmd,"gw_data_find --observatory %s --type %s --gps-start-time %g --gps-end-time %g --url file > %s/%s_gw_data_find.frames",
83  observatory.Data(), type.Data(), Tb, Te, cfg->input_dir, net->getifo(n)->Name);
84 
85  // create frame files list
86  cout << cmd << endl;
87  gSystem->Exec(cmd);
88 
89  // set frame file list in the configuration object
90  sprintf(cfg->frFiles[n],"%s/%s_gw_data_find.frames", cfg->input_dir, net->getifo(n)->Name);
91 
92  // cout << "CWB_Plugin_gw_data_find.C : frFiles : " << cfg->frFiles[n] << endl;
93  }
94 
95  cfg->mdcPlugin=false; // enable read mdc from frames
96  cfg->dataPlugin=false; // enable read data from frames
97 
98  gCWB2G->InitJob();
99  }
100 }
detector * getifo(size_t n)
param: detector index
Definition: network.hh:436
CWB::config * cfg
double Te
Definition: cwb.hh:282
bool mdcPlugin
Definition: config.hh:365
bool dataPlugin
Definition: config.hh:364
int n
Definition: cwb_net.C:28
TString("c")
double Tb
Definition: cwb.hh:281
virtual double InitJob()
Definition: cwb.cc:1248
#define FRAME_SCRATCH_TIME
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
double Te
void CWB_Plugin(TFile *jfile, CWB::config *cfg, network *net, WSeries< double > *x, TString ifo, int type)
COHERENCE.
char ifo[NIFO_MAX][8]
Definition: cwb2G.hh:33
network ** net
NOISE_MDC_SIMULATION.
jfile
Definition: cwb_job_obj.C:43
char input_dir[1024]
Definition: config.hh:317
#define IMPORT(TYPE, VAR)
Definition: cwb.hh:69
double Tb
char Name[16]
Definition: detector.hh:327
char cmd[1024]
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
int nIFO
Definition: config.hh:120
char frFiles[2 *NIFO_MAX][1024]
Definition: config.hh:342