Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TestTObjectWSeries.C
Go to the documentation of this file.
1 {
2  //
3  // Write & Read wavearray, Wseries objects to/from root file
4  // Author : Gabriele Vedovato
5 
6 
7  wavearray<double> x1(1024*128);
8  x1.rate(1024*4);
9  for(int i=0;i<x1.size();i++) x1[i]=i;
10 
11  Meyer<double> S(512,2);
12  WSeries<double> w1(x1,S);
13  w1.Forward(1);
14  cout << "w1 level " << w1.getLevel() << endl;
15 
16  TFile *froot = new TFile("test.root", "RECREATE");
17  if(froot==NULL) {
18  cout << "Failed to create file !!! " << endl;
19  gSystem->Exit(1);
20  }
21 
22  w1.Write("WSeries<double>");
23  froot->Close();
24 
25  TFile *f = new TFile("test.root");
26  if(f==NULL) {
27  cout << "Failed to open file test.root !!! " << endl;
28  gSystem->Exit(1);
29  }
30 
31  f->ls();
32 
33  WSeries<double>* w = (WSeries<double>*)f->Get("WSeries<double>;1");
34  if(w==NULL) {
35  cout << "Object WSeries not exist !!! " << endl;
36  gSystem->Exit(1);
37  }
38 
39  cout << w->size() << endl;
40  cout << "w level " << w->getLevel() << endl;
41  for(int i=0;i<10;i++) cout << i << " " << w->data[i] << endl;
42 
43  f->Close();
44 
45  exit(0);
46 }
virtual size_t size() const
Definition: wavearray.hh:127
TFile * f
i drho i
int getLevel()
Definition: wseries.hh:91
TFile * froot
WSeries< double > * w
Definition: Meyer.hh:18
Meyer< double > S(1024, 2)
DataType_t * data
Definition: wavearray.hh:301
exit(0)