Coherent WaveBurst
Reference Guide
CWB Documentation
Main Page
Namespaces
All Classes
Files
gitlab
ROOT
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
SOFT
cWB
library
master_0bc430d
tools
cwb
tutorials
TestTObjectSkymap.C
Go to the documentation of this file.
1
{
2
//
3
// Write & Read skymap object to/from root file
4
// Author : Gabriele Vedovato
5
6
skymap
sm
(3);
7
8
for
(
int
l
=0;
l
<
sm
.size();
l
++)
sm
.set(
l
,
l
);
9
10
TFile *
froot
=
new
TFile(
"test.root"
,
"RECREATE"
);
11
if
(froot==NULL) {
12
cout <<
"Failed to create file !!! "
<< endl;
13
gSystem->Exit(1);
14
}
15
16
sm
.Write(
"skymap"
);
17
froot->Close();
18
19
TFile *
f
=
new
TFile(
"test.root"
);
20
if
(f==NULL) {
21
cout <<
"Failed to open file test.root !!! "
<< endl;
22
gSystem->Exit(1);
23
}
24
25
f->ls();
26
27
skymap
*
sm2
= (
skymap
*)f->Get(
"skymap"
);
28
if
(sm2==NULL) {
29
cout <<
"Object skymap not exist !!! "
<< endl;
30
gSystem->Exit(1);
31
}
32
33
for
(
int
l
=0;
l
<sm2->
size
();
l
++) cout <<
l
<<
" "
<< sm2->
get
(
l
) << endl;
34
35
f->Close();
36
37
exit
(0);
38
}
sm2
skymap * sm2
Definition:
TestTObjectSkymap.C:27
sm
sm
Definition:
DrawSkymapWithSkyplot.C:4
skymap
Definition:
skymap.hh:45
froot
TFile * froot
Definition:
TestReadWriteDetectorObject.C:11
exit
exit(0)
l
int l
Definition:
cbc_plots.C:434
f
TFile * f
Definition:
TestTObjectSkymap.C:19
skymap::get
double get(size_t i)
param: sky index
Definition:
skymap.cc:681
skymap::size
size_t size()
Definition:
skymap.hh:118