coherent WaveBurst
Library Reference Guide
home
cWB_docker
git
cWB
library
tools
cwb
tutorials
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
8
netpixel
pix
;
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
}
froot
TFile * froot
Definition:
TestTObjectNetcluster.C:13
netpixel::frequency
size_t frequency
Definition:
netpixel.hh:111
f
TFile * f
Definition:
TestTObjectNetcluster.C:22
pix2
netpixel * pix2
Definition:
TestTObjectNetcluster.C:36
netcluster
Definition:
netcluster.hh:101
nc2
netcluster * nc2
Definition:
TestTObjectNetcluster.C:30
netpixel
Definition:
netpixel.hh:44
netcluster::append
virtual size_t append(netcluster &wc)
param: input netcluster return size of appended pixel list
Definition:
netcluster.cc:769
exit
exit(0)
pix
netpixel pix
Definition:
TestTObjectNetcluster.C:1
netcluster::getPixel
netpixel * getPixel(size_t n, size_t i)
Definition:
netcluster.hh:413