Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TestTObjectNetcluster.C
Go to the documentation of this file.
1 {
2  //
3  // Write & Read netcluster object to/from root file
4  // Author : Gabriele Vedovato
5 
6  netcluster nc;
7 
9  pix.frequency=100;
10 
11  nc.append(pix);
12 
13  TFile *froot = new TFile("test.root", "RECREATE");
14  if(froot==NULL) {
15  cout << "Failed to create file !!! " << endl;
16  gSystem->Exit(1);
17  }
18 
19  nc.Write("cluster");
20  froot->Close();
21 
22  TFile *f = new TFile("test.root");
23  if(f==NULL) {
24  cout << "Failed to open file test.root !!! " << endl;
25  gSystem->Exit(1);
26  }
27 
28  f->ls();
29 
30  netcluster* nc2 = (netcluster*)f->Get("cluster");
31  if(nc2==NULL) {
32  cout << "Object cluster not exist !!! " << endl;
33  gSystem->Exit(1);
34  }
35 
36  netpixel* pix2 = nc2->getPixel(0,0);
37  cout << "pix2 frequency " << pix2->frequency << endl;
38 
39  f->Close();
40 
41  exit(0);
42 }
TFile * froot
size_t frequency
Definition: netpixel.hh:93
TFile * f
netpixel * pix2
netcluster * nc2
virtual size_t append(netcluster &wc)
param: input netcluster return size of appended pixel list
Definition: netcluster.cc:750
exit(0)
netpixel pix
netpixel * getPixel(size_t n, size_t i)
Definition: netcluster.hh:395