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
TestTObject.C
Go to the documentation of this file.
1
{
2
//
3
// Write & Read wavearray object 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
wavearray<double>
x2(1024*128);
12
x2.rate(1024*4);
13
for
(
int
i
=0;
i
<x2.size();
i
++) x2[
i
]=
i
+1000;
14
15
Meyer<double>
S
(512,2);
16
WSeries<double>
w1(x1,
S
);
17
WSeries<double>
w2(x2,
S
);
18
w2.Forward(2);
19
cout <<
"S level "
<<
S
.getLevel() << endl;
20
cout <<
"w1 level "
<< w1.getLevel() << endl;
21
cout <<
"w2 level "
<< w2.getLevel() << endl;
22
23
TFile *
froot
=
new
TFile(
"test.root"
,
"RECREATE"
);
24
S
.Write(
"S"
);
25
wavearray<double>
(w1).
Write
(
"w1"
);
26
w2.Write(
TString
(
"mdc"
)+
"w2"
);
27
froot->Close();
28
29
TFile *
f
=
new
TFile(
"test.root"
);
30
31
f->ls();
32
33
// Meyer<double>* S2 = (Meyer<double>*)f->Get("Meyer<double>;1");
34
// cout << "S2 level " << S2->getLevel() << endl;
35
36
//WSeries<double>* w = (WSeries<double>*)f->Get("w2");
37
//cout << "w level " << w->getLevel() << endl;
38
//w->Inverse(2);
39
40
//wavearray<double>* w = (wavearray<double>*)f->Get("w1");
41
//cout << w->size() << endl;
42
//for(int i=0;i<10;i++) cout << i << " " << w->data[i] << endl;
43
44
for
(
int
i
=0;
i
<w2.size();
i
++) w2.data[
i
]=0;
45
w2 = *(
wavearray<double>
*)f->Get(
TString
(
"mdc"
)+
"w2"
);
46
cout <<
"w2 level "
<< w2.getLevel() << endl;
47
w2.Inverse(2);
48
for
(
int
i
=0;
i
<10;
i
++) cout <<
i
<<
" "
<< w2.data[
i
] << endl;
49
50
/*
51
TIter nextkey(f.GetListOfKeys());
52
TKey *key;
53
while (key = (TKey*)nextkey()) {
54
WSeries<double> *w = (WSeries<double>*)key->ReadObj();
55
if(w==NULL) {cout << "Null object !!!" << endl;exit(1);}
56
cout << w.size() << endl;
57
for(int i=0;i<10;i++) cout << i << " " << w.data[i] << endl;
58
}
59
*/
60
61
f->Close();
62
63
exit
(0);
64
}
cwb_online.f
tuple f
Definition:
cwb_online.py:91
wavearray< double >
TString
TString("c")
Definition:
cwb_report_skymap.C:111
i
i drho i
Definition:
cwb_epparameters.C:85
Write
tlive_fix Write()
WSeries< double >
froot
TFile * froot
Definition:
TestReadWriteDetectorObject.C:11
Meyer
Definition:
Meyer.hh:18
S
Meyer< double > S(1024, 2)
exit
exit(0)