Logo coherent WaveBurst  
Library Reference Guide
Logo
ReadStrainFromJobFile.C
Go to the documentation of this file.
1 //
2 // Draw read & display strain & mdc from job strain file
3 // Author : Gabriele Vedovato
4 
5 {
6  //#define DISPLAY_TIME
7  #define DISPLAY_PSD
8  //#define DISPLAY_MDC
9  #define JOB_STRAIN_FILE "data/strain_931158378_44_ADV_SIM_SGQ9_L1H1V1_2G_MSA_job1.root"
10 
11  int nIFO = 3;
12  TString ifo[3] = {"L1","H1","V1"};
13  wavearray<double> hot[3]; //! temporary time series
16  double factor=10.*sqrt(nIFO);
18 
19  // open input job file
20  TFile* jfile = new TFile(jname);
21  if(jfile==NULL||!jfile->IsOpen())
22  {cout << "Error : file " << jname << " not found" << endl;exit(1);}
23 
24  for(int i=0; i<nIFO; i++) {
25  // read ifo strain from temporary job file
26  px = (wavearray<double>*)jfile->Get(TString("strain/")+ifo[i]);
27  hot[i] = *px; delete px;
28 #ifdef DISPLAY_MDC
29  hot[i]=0;
30 #endif
31 
32  px = (wavearray<double>*)jfile->Get(TString("mdc/")+ifo[i]);
33  (*px)*=factor;
34  hot[i].add(*px);
35  delete px;
36 
37  cout.precision(14);
38  cout << hot[i].size() << " " << hot[i].rate() << " " << hot[i].start() << endl;
39  }
40 
41 #if defined (DISPLAY_TIME) || defined (DISPLAY_PSD)
42  for(int n=0;n<nIFO;n++) hot[n].start(0);
43  watplot plot(const_cast<char*>("plot"),200,20,800,500);
44  char gtitle[256];
45  sprintf(gtitle,"Network : ");
46  for(int n=0;n<nIFO;n++) {
47  if(n==0) sprintf(gtitle,"%s %s (black) ", gtitle, ifo[n].Data());
48  if(n==1) sprintf(gtitle,"%s %s (red) ", gtitle, ifo[n].Data());
49  if(n==2) sprintf(gtitle,"%s %s (green) ", gtitle, ifo[n].Data());
50  }
51 
52 #ifdef DISPLAY_TIME
53  plot.gtitle(gtitle,"time (sec)","strain");
54  plot.goptions(const_cast<char*>("alp"), 1, 0., 0.);
55 #endif
56 
57 #ifdef DISPLAY_PSD
58  double flow=64;
59  double fhigh=2048;
60  double tstart = hot[0].start();
61  double tstop = tstart+hot[0].size()/hot[0].rate();
62  plot.gtitle(gtitle,"frequency (Hz)","strain/#sqrt{Hz}");
63  plot.goptions(const_cast<char*>("alp logx logy"), 1, tstart, tstop, true, flow,fhigh, true, 4);
64 #endif
65 
66  for(int n=0;n<nIFO;n++) hot[n] >> plot;
67 #endif
68 
69 }
double flow
void gtitle(TString title="", TString xtitle="", TString ytitle="")
Definition: watplot.cc:1256
virtual void rate(double r)
Definition: wavearray.hh:141
plot gtitle(gtitle,"frequency (Hz)","strain/#sqrt{Hz}")
int n
Definition: cwb_net.C:28
TString("c")
double fhigh
void add(const wavearray< DataType_t > &, int=0, int=0, int=0)
Definition: wavearray.cc:746
virtual void start(double s)
Definition: wavearray.hh:137
i drho i
double tstart
#define nIFO
virtual size_t size() const
Definition: wavearray.hh:145
double factor
x plot
wavearray< double > * px
void goptions(char *opt=NULL, int col=1, double t1=0., double t2=0., bool fft=false, float f1=0., float f2=0., bool psd=false, float t3=0., bool oneside=false)
Definition: watplot.cc:1221
wavearray< double > hot[3]
TString jname
wavearray< double > x
temporary time series
#define JOB_STRAIN_FILE
sprintf(tfres,"(1/%g)x(%g) (sec)x(Hz)", 2 *df, df)
TFile * jfile
double tstop
TString ifo[3]
exit(0)