Logo coherent WaveBurst  
Library Reference Guide
Logo
TestTObjectNetpixel.C
Go to the documentation of this file.
1 {
2  //
3  // Write & Read netpixel object to/from root file
4  // Author : Gabriele Vedovato
5 
7  pix.frequency=100;
8 
9  TFile *froot = new TFile("test.root", "RECREATE");
10  if(froot==NULL) {
11  cout << "Failed to create file !!! " << endl;
12  gSystem->Exit(1);
13  }
14 
15  pix.Write("netpixel");
16  froot->Close();
17 
18  TFile *f = new TFile("test.root");
19  if(f==NULL) {
20  cout << "Failed to open file test.root !!! " << endl;
21  gSystem->Exit(1);
22  }
23 
24  f->ls();
25 
26  netpixel* pix2 = (netpixel*)f->Get("netpixel");
27  if(pix2==NULL) {
28  cout << "Object pixel not exist !!! " << endl;
29  gSystem->Exit(1);
30  }
31 
32  cout << "pix2 frequency " << pix2->frequency << endl;
33 
34  f->Close();
35 
36  exit(0);
37 }
netpixel * pix2
size_t frequency
Definition: netpixel.hh:111
TFile * f
netpixel pix(nifo)
exit(0)
TFile * froot