ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaExamples
AthExHive
src
condEx
CondAlgY.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
CondAlgY.h
"
6
#include "
AthExHive/IASCIICondDbSvc.h
"
7
#include "
StoreGate/WriteCondHandle.h
"
8
9
10
StatusCode
CondAlgY::initialize
() {
11
ATH_MSG_DEBUG
(
"initialize "
<< name());
12
13
ATH_CHECK
(
m_cds
.retrieve() );
14
15
m_wch1
.setDbKey(
m_dbk1
);
16
m_wch2
.setDbKey(
m_dbk2
);
17
18
ATH_CHECK
(
m_wch1
.initialize() );
19
ATH_CHECK
(
m_wch2
.initialize() );
20
21
return
StatusCode::SUCCESS;
22
}
23
24
StatusCode
CondAlgY::execute
(
const
EventContext& ctx)
const
{
25
ATH_MSG_DEBUG
(
"execute "
<< name());
26
EventIDBase now(ctx.eventID());
27
28
SG::WriteCondHandle<CondDataObjY>
wch1(
m_wch1
,ctx);
29
SG::WriteCondHandle<CondDataObjY>
wch2(
m_wch2
,ctx);
30
31
// do we have a valid m_wch for current time?
32
if
( wch1.
isValid
(now) ) {
33
ATH_MSG_DEBUG
(
" Found a valid write handle for "
<< wch1.
key
());
34
}
35
else
{
36
37
ATH_MSG_DEBUG
(
" CondHandle "
<< wch1.
key
()
38
<<
" not valid. Getting new info for dbKey \""
39
<< wch1.
dbKey
() <<
"\" from CondDb"
);
40
41
EventIDRange
r
;
42
IASCIICondDbSvc::dbData_t
val;
43
if
(
m_cds
->getRange(wch1.
dbKey
(), ctx,
r
, val).isFailure()) {
44
ATH_MSG_ERROR
(
" could not find dbKey \""
<< wch1.
dbKey
()
45
<<
"\" in CondSvc registry"
);
46
return
StatusCode::FAILURE;
47
}
48
49
CondDataObjY
* cdo =
new
CondDataObjY
( val );
50
if
(wch1.
record
(
r
, cdo).isFailure()) {
51
ATH_MSG_ERROR
(
"could not record CondDataObjY "
<< wch1.
key
()
52
<<
" = "
<< *cdo
53
<<
" with EventRange "
<<
r
);
54
return
StatusCode::FAILURE;
55
}
56
ATH_MSG_INFO
(
"recorded new CDO "
<< wch1.
key
() <<
" = "
<< *cdo
57
<<
" with range "
<<
r
);
58
}
59
60
// do we have a valid wch for current time?
61
if
( wch2.
isValid
(now) ) {
62
ATH_MSG_DEBUG
(
" Found a valid write handle for "
<< wch2.
key
());
63
}
64
else
{
65
66
ATH_MSG_DEBUG
(
" CondHandle "
<< wch2.
key
()
67
<<
" not valid. Getting new info for dbKey \""
68
<< wch2.
dbKey
() <<
"\" from CondDb"
);
69
70
EventIDRange
r
;
71
IASCIICondDbSvc::dbData_t
val;
72
if
(
m_cds
->getRange(wch2.
dbKey
(), ctx,
r
, val).isFailure()) {
73
ATH_MSG_ERROR
(
" could not find dbKey \""
<< wch2.
dbKey
()
74
<<
"\" in CondSvc registry"
);
75
return
StatusCode::FAILURE;
76
}
77
78
CondDataObjY
* cdo =
new
CondDataObjY
( val );
79
if
(wch2.
record
(
r
, cdo).isFailure()) {
80
ATH_MSG_ERROR
(
"could not record CondDataObjY "
<< wch2.
key
()
81
<<
" = "
<< *cdo
82
<<
" with EventRange "
<<
r
);
83
return
StatusCode::FAILURE;
84
}
85
ATH_MSG_INFO
(
"recorded new CDO "
<< wch2.
key
() <<
" = "
<< *cdo
86
<<
" with range "
<<
r
);
87
}
88
89
return
StatusCode::SUCCESS;
90
91
}
92
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CondAlgY.h
IASCIICondDbSvc.h
WriteCondHandle.h
CondAlgY::m_wch1
SG::WriteCondHandleKey< CondDataObjY > m_wch1
Definition
CondAlgY.h:26
CondAlgY::m_wch2
SG::WriteCondHandleKey< CondDataObjY > m_wch2
Definition
CondAlgY.h:27
CondAlgY::initialize
virtual StatusCode initialize() override
Definition
CondAlgY.cxx:10
CondAlgY::m_dbk2
Gaudi::Property< std::string > m_dbk2
Definition
CondAlgY.h:30
CondAlgY::m_cds
ServiceHandle< IASCIICondDbSvc > m_cds
Definition
CondAlgY.h:32
CondAlgY::m_dbk1
Gaudi::Property< std::string > m_dbk1
Definition
CondAlgY.h:29
CondAlgY::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
CondAlgY.cxx:24
CondDataObjY
Definition
CondDataObjY.h:8
IASCIICondDbSvc::dbData_t
float dbData_t
Definition
IASCIICondDbSvc.h:19
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::key
const std::string & key() const
Definition
WriteCondHandle.h:44
SG::WriteCondHandle::dbKey
const std::string & dbKey() const
Definition
WriteCondHandle.h:91
SG::WriteCondHandle::record
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
Definition
WriteCondHandle.h:161
SG::WriteCondHandle::isValid
bool isValid() const
Definition
WriteCondHandle.h:252
r
int r
Definition
globals.cxx:22
Generated on
for ATLAS Offline Software by
1.17.0