Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CWB_Plugin_gw_data_find.C
Go to the documentation of this file.
1 //!NOISE_MDC_SIMULATION
2 // Plugin used to retrive 'on the fly' the frame file paths using gw_data_find
3 
4 #define XIFO 4
5 
6 #pragma GCC system_header
7 
8 #include "cwb.hh"
9 #include "config.hh"
10 #include "network.hh"
11 #include "wavearray.hh"
12 #include "TString.h"
13 #include "TObjArray.h"
14 #include "TObjString.h"
15 #include "TRandom.h"
16 #include "TComplex.h"
17 #include "TMath.h"
18 #include "cwb2G.hh"
19 #include "mdc.hh"
20 #include <vector>
21 
22 double Tb = 0;
23 double Te = 0;
24 
25 #define FRAME_SCRATCH_TIME 10000 // seconds before and after the segment range
26 
27 void
29 
30  if(type==CWB_PLUGIN_CONFIG) {
31  cfg->mdcPlugin=true; // disable read mdc from frames
32  cfg->dataPlugin=true; // disable read data from frames
33  }
34 
35  if(type==CWB_PLUGIN_INIT_JOB) {
36 
37  if(Tb!=0 || Te!=0) return;
38 
39  cout << "Execute CWB_Plugin_gw_data_find.C : Inject On The Fly MDC ..." << endl;
40 
41  // get data range
42  cwb2G* gCWB2G; IMPORT(cwb2G*,gCWB2G)
43  Tb = gCWB2G->Tb-FRAME_SCRATCH_TIME;
44  Te = gCWB2G->Te+FRAME_SCRATCH_TIME;
45  //cout << "CWB_Plugin_gw_data_find.C - " << "Tb : " << int(Tb) << " Te : " << int(Te) << endl;
46 
47 
48  for(int n=0;n<cfg->nIFO;n++) {
49 
50  // get observatory
51  TString observatory="";
52  if(TString(net->getifo(n)->Name)=="L1") observatory="L";
53  if(TString(net->getifo(n)->Name)=="H1") observatory="H";
54  if(TString(net->getifo(n)->Name)=="V1") observatory="V";
55  cout << "observatory : " << observatory << " type : " << type << endl;
56  if(observatory=="") {cout << "CWB_Plugin_gw_data_find.C : observatory not defined !!!" << endl;gSystem->Exit(1);}
57 
58  // get type
59  TString type = cfg->frFiles[n];
60  if(type=="") {cout << "CWB_Plugin_gw_data_find.C : type not defined !!!" << endl;gSystem->Exit(1);}
61 
62  // build gw_data_find command
63  char cmd[1024];
64  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",
65  observatory.Data(), type.Data(), Tb, Te, cfg->input_dir, net->getifo(n)->Name);
66 
67  // create frame files list
68  cout << cmd << endl;
69  gSystem->Exec(cmd);
70 
71  // set frame file list in the configuration object
72  sprintf(cfg->frFiles[n],"%s/%s_gw_data_find.frames", cfg->input_dir, net->getifo(n)->Name);
73 
74  // cout << "CWB_Plugin_gw_data_find.C : frFiles : " << cfg->frFiles[n] << endl;
75  }
76 
77  cfg->mdcPlugin=false; // enable read mdc from frames
78  cfg->dataPlugin=false; // enable read data from frames
79 
80  gCWB2G->InitJob();
81  }
82 }
detector * getifo(size_t n)
param: detector index
Definition: network.hh:418
CWB::config * cfg
Definition: TestCWB_Plugin.C:5
double Te
Definition: cwb.hh:270
char cmd[1024]
bool mdcPlugin
Definition: config.hh:347
bool dataPlugin
Definition: config.hh:346
int n
Definition: cwb_net.C:10
TString("c")
double Tb
Definition: cwb.hh:269
virtual double InitJob()
Definition: cwb.cc:1230
#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<< "\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 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:15
network ** net
NOISE_MDC_SIMULATION.
jfile
Definition: cwb_job_obj.C:25
char input_dir[1024]
Definition: config.hh:299
#define IMPORT(TYPE, VAR)
Definition: cwb.hh:51
double Tb
char Name[16]
Definition: detector.hh:309
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
int nIFO
Definition: config.hh:102
char frFiles[2 *NIFO_MAX][1024]
Definition: config.hh:324