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
FairParSet.cxx
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file FairParSet.cxx
1
//*-- AUTHOR : Ilse Koenig
2
//*-- Created : 20/10/2004
3
5
// FairParSet
6
//
7
// Base class for all parameter containers
9
10
#include "
FairParSet.h
"
11
12
#include "
FairRuntimeDb.h
"
13
14
#include <iostream>
15
16
using
std::cout;
17
18
ClassImp
(
FairParSet
)
19
20
FairParSet
::
FairParSet
(const
char
*
name
,const
char
*
title
,const
char
* context)
21
: TNamed(name,title),
22
detName(""),
23
status(kFALSE),
24
changed(kFALSE),
25
paramContext(context),
26
author
(""),
27
description(""),
28
fLogger(
FairLogger
::GetLogger())
29
{
30
for
(Int_t i=0; i<3; i++) {versions[i]=-1;}
31
}
32
33
Bool_t
FairParSet::init
()
34
{
35
// intitializes the container from an input in run time
36
// database. If this is not successful it is initialized from
37
// the second input. If this failes too, it returns an error.
38
// (calls internally the init function in the derived class)
39
FairRuntimeDb
* rtdb=
FairRuntimeDb::instance
();
40
//FairRunAna* fRun =FairRunAna::Instance();
41
// cout << "-I- FairParSet::init() " << GetName() << endl;
42
43
Bool_t allFound=kFALSE;
44
FairParIo
* io=0;
45
if
(rtdb) {
46
io=rtdb->
getFirstInput
();
47
if
(io) { allFound=
init
(io); }
48
if
(!allFound) {
49
io=rtdb->
getSecondInput
();
50
//cout << "-I FairParSet::init() 2 " << io << std::endl;
51
if
(io) { allFound=
init
(io); }
52
}
else
{
setInputVersion
(-1,2); }
53
}
54
if
(allFound) {
return
kTRUE; }
55
fLogger
->
Error
(
MESSAGE_ORIGIN
,
"init() %s not initialized"
,GetName());
56
return
kFALSE;
57
}
58
59
Int_t
FairParSet::write
()
60
{
61
// writes the container to the output defined in the runtime database
62
// returns the output version in the ROOT file
63
// returns -1 if error occured
64
// (calls internally the init function in the derived class)
65
FairParIo
* output=
FairRuntimeDb::instance
()->
getOutput
();
66
if
(output) {
return
write
(output); }
67
fLogger
->
Error
(
MESSAGE_ORIGIN
,
"write() %s could not be written to output"
,GetName());
68
return
-1;
69
}
70
71
void
FairParSet::print
()
72
{
73
// prints information about container (versions,status,hasChanged...)
74
cout<<
"----- "
<<GetName()<<
" -----"
<<
'\n'
;
75
if
(!
paramContext
.IsNull()) { cout<<
"Context/Purpose: "
<<
paramContext
<<
'\n'
; }
76
if
(!
author
.IsNull()) { cout<<
"Author: "
<<
author
<<
'\n'
; }
77
if
(!
description
.IsNull()) { cout<<
"Description: "
<<
description
<<
'\n'
; }
78
cout<<
"first input version: "
<<
versions
[1]<<
'\n'
;
79
cout<<
"second input version: "
<<versions[2]<<
'\n'
;
80
if
(
changed
) { cout<<
"has changed"
<<
'\n'
; }
81
else
{ cout<<
"has not changed"
<<
'\n'
; }
82
if
(
status
) { cout<<
"is static"
<<
'\n'
; }
83
else
{ cout<<
"is not static"
<<
'\n'
; }
84
}
85
86
void
FairParSet::resetInputVersions
()
87
{
88
// resets the input versions if the container is not static
89
if
(!
status
) {
90
for
(Int_t i=0; i<3; i++) {
versions
[i]=-1;}
91
changed
=kFALSE;
92
}
93
}
EicRoot
blob
master
parbase
FairParSet.cxx
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:36
using
1.8.2 with
EIC GitHub integration