EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
FairGenericParTSQLIo.cxx
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file FairGenericParTSQLIo.cxx
1
/***************************************
2
* Author: M.Babai (M.Babai@rug.nl) *
3
* License: *
4
* Version: *
5
***************************************/
6
#include "
FairGenericParTSQLIo.h
"
7
8
#include "
FairParSet.h
"
9
#include "
FairParGenericSet.h
"
10
#include "
FairParamList.h
"
11
12
#include "TList.h"
13
14
15
ClassImp
(
FairGenericParTSQLIo
)
16
17
18
FairGenericParTSQLIo
::
FairGenericParTSQLIo
()
19
:
FairDetParTSQLIo
()
20
{
21
fName =
"FairGenericParIo"
;
22
}
23
32
FairGenericParTSQLIo::FairGenericParTSQLIo
(
FairDbMultConnector
const
& cons,
33
int
const
dbNum)
34
:
FairDetParTSQLIo
(cons, dbNum)
35
{
36
fName =
"FairGenericParIo"
;
37
}
38
40
FairGenericParTSQLIo::~FairGenericParTSQLIo
()
41
{
42
std::cout <<
"\n\n\t<DEBUG>~FairGenericParTSQLIo() Destroy\n\n"
;
43
}
44
45
Bool_t
FairGenericParTSQLIo::read
(
FairParGenericSet
* par)
46
{
47
/*
48
* Initialize paramter from the data base.
49
*/
50
std::cout <<
"\t<DEBUG>FairGenericParTSQLIo::read(FairParGenericSet* par)"
51
<<
"\n Reading parameters form the database.\n"
;
52
par->Print();
53
std::cout <<
"============= End of reading params ==========\n"
;
54
return
kTRUE;
55
}
56
57
Bool_t
FairGenericParTSQLIo::init
(
FairParSet
* pPar)
58
{
59
std::cout <<
"\n\n\t<DEBUG>FairGenericParTSQLIo::init(FairParSet* pars, int* n)\n\n"
;
60
61
if
(pPar->InheritsFrom(
"FairParGenericSet"
)) {
62
std::cout <<
"@@@@@@ <Init From db> @@@@@@@\n\n"
;
63
return
read
((
FairParGenericSet
*)pPar);
64
}
65
Error(
"FairGenericParTSQLIo::init(FairParSet*, Int_t*)"
,
66
"%s does not inherit from FairParGenericSet"
, pPar->GetName());
67
return
false
;
68
}
69
70
Int_t
FairGenericParTSQLIo::write
(
FairParSet
* par)
71
{
72
std::cout <<
"\n===================================================\n"
73
<<
"\t<DEBUG>FairGenericParTSQLIo::Write(FairParSet* par)\n"
;
74
if
(par->InheritsFrom(
"FairParGenericSet"
)) {
75
return
writeSet
((
FairParGenericSet
*)par);
76
}
77
Error(
"FairGenericParOraIo::write(FairParSet*)"
,
78
"%s does not inherit from FairParGenericSet"
,par->GetName());
79
return
-1;
80
}
81
82
Int_t
FairGenericParTSQLIo::writeSet
(
FairParGenericSet
* par)
83
{
84
if
(!par) {
85
std::cerr <<
"No par not initialized\n"
;
86
return
-1;
87
}
88
89
std::cout <<
"\t<DEBUG>FairGenericParTSQLIo::writeSet(FairParGenericSet* par)\n"
90
<<
" Name is "
<< par->GetName()
91
<<
" Context = "
<< par->
getParamContext
()
92
<<
"\n--------------- Storage of "
<< par->GetName()<<
" ---------------\n"
93
<<
"Class name = "
<< par->ClassName() << std::endl;
94
95
// Initialize the par list object
96
FairParamList
* paramList =
new
FairParamList
();
97
par->
putParams
(paramList);
98
99
// Get the list to insert.
100
TList* pList = paramList->
getList
();
101
TIter next(pList);
102
FairParamObj
* po;
103
104
/*
105
* Build a list of Insert queries and sumbit all in one go. Or build
106
* a query per paramobject and insert directly.
107
*/
108
while
((po=(
FairParamObj
*)next())) {
109
std::cout <<
" po.Name = "
<< po->GetName() <<
'\n'
110
<<
" po.val = "
<< po->
getParamValue
()<<
'\n'
111
<<
" po.Type = "
<< po->
getParamType
() <<
'\n'
112
<<
" po.Basic = "
<< po->
isBasicType
() <<
'\n'
113
<<
" po.Bytes = "
<< po->
getBytesPerValue
()<<
'\n'
114
<<
" po.getClassVersion = "
<< po->
getClassVersion
() <<
'\n'
115
<<
" po.getLength = "
<< po->
getLength
() <<
'\n'
116
<<
" po.getNumParams = "
<< po->
getNumParams
()<<
'\n'
117
<<
"____________________________\n"
;
118
po->
print
();
119
std::cout <<
"\n++++++++++++++++++++++++\n"
;
120
}
121
std::cout <<
"\n========== END OF STORAGE ========================\n"
;
122
return
1;
123
}
EicRoot
blob
master
parbase
dbIO
FairGenericParTSQLIo.cxx
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:36
using
1.8.2 with
EIC GitHub integration