Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
TestCDBTTree.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file TestCDBTTree.C
1
#include <
cdbobjects/CDBTTree.h
>
2
3
R__LOAD_LIBRARY(libcdbobjects.so)
4
5
void
TestCDBTTree
(const std::
string
&
fname
= "
test
.
root
")
6
{
7
CDBTTree
*cdbttree =
new
CDBTTree
(
fname
);
8
cdbttree->
SetSingleFloatValue
(
"Test"
,25);
9
cdbttree->
SetSingleFloatValue
(
"Test2"
,22);
10
cdbttree->
SetSingleFloatValue
(
"Test3"
,23);
11
cdbttree->
SetSingleFloatValue
(
"Test4"
,24);
12
cdbttree->
SetSingleIntValue
(
"Tes2"
,24);
13
cdbttree->
SetSingleDoubleValue
(
"Tes2"
,TMath::Pi());
14
cdbttree->
SetSingleUInt64Value
(
"Tes2"
,12486346984672562);
15
cdbttree->
CommitSingle
();
16
cdbttree->
SetFloatValue
(2,
"Tst"
,25);
17
cdbttree->
SetFloatValue
(2,
"Tt2"
,22);
18
cdbttree->
SetFloatValue
(2,
"Tes"
,23);
19
cdbttree->
SetFloatValue
(2,
"gaga"
,24);
20
cdbttree->
SetFloatValue
(4,
"Tst"
,5);
21
cdbttree->
SetFloatValue
(4,
"Tt2"
,2);
22
cdbttree->
SetFloatValue
(4,
"Tes"
,3);
23
cdbttree->
SetFloatValue
(4,
"Tara"
,7);
24
cdbttree->
SetIntValue
(10,
"blar"
,2864);
25
cdbttree->
SetUInt64Value
(10,
"blatr"
,28);
26
for
(
int
i
=0;
i
<10;
i
++)
27
{
28
string
varname =
"dvar"
+
to_string
(
i
);
29
cdbttree->
SetDoubleValue
(23,varname,28875342.867);
30
}
31
cdbttree->
Commit
();
32
cdbttree->
Print
();
33
cdbttree->
WriteCDBTTree
();
34
delete
cdbttree;
35
gSystem->Exit(0);
36
}
37
38
CDBTTree
*
TestWrite
(
const
std::string
&
fname
=
"test.root"
)
39
{
40
CDBTTree
*cdbttree =
new
CDBTTree
(
fname
);
41
cdbttree->
SetSingleFloatValue
(
"Test"
,25);
42
cdbttree->
SetSingleFloatValue
(
"Test2"
,22);
43
cdbttree->
SetSingleFloatValue
(
"Test3"
,23);
44
cdbttree->
SetSingleFloatValue
(
"Test4"
,24);
45
cdbttree->
SetSingleIntValue
(
"Tes2"
,24);
46
cdbttree->
SetSingleDoubleValue
(
"Tes2"
,TMath::Pi());
47
cdbttree->
SetSingleUInt64Value
(
"Tes2"
,12486346984672562);
48
cdbttree->
CommitSingle
();
49
cdbttree->
SetFloatValue
(2,
"Tst"
,25);
50
cdbttree->
SetFloatValue
(2,
"Tt2"
,22);
51
cdbttree->
SetFloatValue
(2,
"Tes"
,23);
52
cdbttree->
SetFloatValue
(2,
"gaga"
,24);
53
cdbttree->
SetFloatValue
(4,
"Tst"
,5);
54
cdbttree->
SetFloatValue
(4,
"Tt2"
,2);
55
cdbttree->
SetFloatValue
(4,
"Tes"
,3);
56
cdbttree->
SetFloatValue
(4,
"Tara"
,7);
57
cdbttree->
SetIntValue
(10,
"blar"
,2864);
58
cdbttree->
SetUInt64Value
(10,
"blatr"
,28);
59
for
(
int
i
=0;
i
<100;
i
++)
60
{
61
string
varname =
"dvar"
;
62
string
varname2 =
"dvar2"
;
63
string
varname3 =
"dvar3"
;
64
string
varname4 =
"dvar4"
;
65
for
(
int
j
=0;
j
<25;
j
++)
66
{
67
cdbttree->
SetDoubleValue
(
j
,varname,28875342.867*
j
);
68
cdbttree->
SetDoubleValue
(
j
,varname2,2.867*
j
);
69
cdbttree->
SetDoubleValue
(
j
,varname3,28875.8*
j
);
70
cdbttree->
SetDoubleValue
(
j
,varname4,28875342*
j
);
71
}
72
}
73
return
cdbttree;
74
}
75
76
void
Read
(
const
std::string
&
fname
=
"test.root"
)
77
{
78
CDBTTree
*cdbttree =
new
CDBTTree
(
fname
);
79
cdbttree->
LoadCalibrations
();
80
cout <<
"Test2: "
<< cdbttree->
GetSingleFloatValue
(
"Test2"
) << endl;
81
cout <<
"Tt2(2): "
<< cdbttree->
GetFloatValue
(2,
"Tt2"
) << endl;
82
cout <<
"Tt2(4): "
<< cdbttree->
GetFloatValue
(4,
"Tt2"
) << endl;
83
cout <<
"blar: "
<< cdbttree->
GetIntValue
(10,
"blar"
) << endl;
84
cout <<
"int Tt2(4): "
<< cdbttree->
GetIntValue
(4,
"Tt2"
) << endl;
85
cout <<
"dvar5: "
<< cdbttree->
GetDoubleValue
(23,
"dvar5"
);
86
cdbttree->
Print
();
87
delete
cdbttree;
88
gSystem->Exit(0);
89
}
macros
blob
master
CDBTest
TestCDBTTree.C
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:26
using
1.8.2 with
sPHENIX GitHub integration