Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TestTObjectGWavearray2.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 x2.resize(1024);
19  x2.Write("clusters-lev:1-lag:678");
20 x2.resize(2*1024);
21  x2.Write("clusters-lev:2-lag:678");
22 x2.resize(4*1024);
23  x2.Write("clusters-lev:3-lag:678");
24  froot->Close();
25 
26  TFile *f = new TFile("gwavearray_test.root");
27 
28  f->ls();
29 
30  gwavearray<double>* w1 = (gwavearray<double>*)f->Get("clusters-lev:1-lag:678");
31  cout << w1->size() << endl;
32 
33  gwavearray<double>* w2 = (gwavearray<double>*)f->Get("clusters-lev:2-lag:678");
34  cout << w2->size() << endl;
35 
36  gwavearray<double>* w3 = (gwavearray<double>*)f->Get("clusters-lev:3-lag:678");
37  cout << w3->size() << endl;
38 
39  f->Close();
40 
41  //exit(0);
42 }
virtual size_t size() const
Definition: wavearray.hh:127
tuple f
Definition: cwb_online.py:91
i drho i
#define PI
Definition: watfun.hh:14
TFile * froot
double dt