Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TestTObjectGWavearray.C
Go to the documentation of this file.
1 {
2  //
3  // Write & Read gwavearray object to/from root file
4  // Author : Gabriele Vedovato
5 
6  gwavearray<double> x1(1024*4);
7  x1.rate(1024*4);
8  double dt=1/x1.rate();
9  for(int i=0;i<x1.size();i++) x1[i]=sin(2*PI*100*dt*i);
10 
11  wavearray<double> x2(1024*4);
12  x2.rate(1024*4);
13  for(int i=0;i<x2.size();i++) x2[i]=sin(2*PI*100*dt*i);
14 
15  gwavearray<double> x3(&x2);
16 
17  TFile *froot = new TFile("gwavearray_test.root", "RECREATE");
18  x1.Write("X1");
19  x2.Write("X2");
20  x3.Write("X3");
21  froot->Close();
22 
23  TFile *f = new TFile("gwavearray_test.root");
24 
25  f->ls();
26 
27  gwavearray<double>* w3 = (gwavearray<double>*)f->Get("X3");
28  cout << w3->size() << endl;
29  for(int i=0;i<10;i++) cout << i << " " << w3->data[i] << endl;
30  w3->DrawFFT();
31  //w3->Draw(GWAT_FFT);
32  gwavearray<double>* w1 = (gwavearray<double>*)f->Get("X1");
33  w1->DrawFFT();
34 
35  f->Close();
36 
37  //exit(0);
38 }
virtual size_t size() const
Definition: wavearray.hh:127
tuple f
Definition: cwb_online.py:91
double dt
i drho i
#define PI
Definition: watfun.hh:14
TFile * froot
DataType_t * data
Definition: wavearray.hh:301
watplot * DrawFFT(TString options="ALP", Color_t color=kBlack)
Definition: gwavearray.cc:185