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-2026 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 {} not valid. Getting new info for dbKey \"{}\" from CondDb"
,
38
wch1.
key
(), wch1.
dbKey
());
39
40
EventIDRange
r
;
41
IASCIICondDbSvc::dbData_t
val;
42
if
(
m_cds
->getRange(wch1.
dbKey
(), ctx,
r
, val).isFailure()) {
43
ATH_MSG_ERROR
(
" could not find dbKey \"{}\" in CondSvc registry"
,
44
wch1.
dbKey
());
45
return
StatusCode::FAILURE;
46
}
47
48
CondDataObjY
* cdo =
new
CondDataObjY
( val );
49
if
(wch1.
record
(
r
, cdo).isFailure()) {
50
ATH_MSG_ERROR
(
"could not record CondDataObjY {} = {} with EventRange {}"
,
51
wch1.
key
(), *cdo,
static_cast<
std::string
>
(
r
));
52
return
StatusCode::FAILURE;
53
}
54
ATH_MSG_INFO
(
"recorded new CDO {} = {} with range {}"
,
55
wch1.
key
(), *cdo,
static_cast<
std::string
>
(
r
));
56
}
57
58
// do we have a valid wch for current time?
59
if
( wch2.
isValid
(now) ) {
60
ATH_MSG_DEBUG
(
" Found a valid write handle for {}"
, wch2.
key
());
61
}
62
else
{
63
64
ATH_MSG_DEBUG
(
" CondHandle {} not valid. Getting new info for dbKey \"{}\" from CondDb"
,
65
wch2.
key
(), wch2.
dbKey
());
66
67
EventIDRange
r
;
68
IASCIICondDbSvc::dbData_t
val;
69
if
(
m_cds
->getRange(wch2.
dbKey
(), ctx,
r
, val).isFailure()) {
70
ATH_MSG_ERROR
(
" could not find dbKey \"{}\" in CondSvc registry"
,
71
wch2.
dbKey
());
72
return
StatusCode::FAILURE;
73
}
74
75
CondDataObjY
* cdo =
new
CondDataObjY
( val );
76
if
(wch2.
record
(
r
, cdo).isFailure()) {
77
ATH_MSG_ERROR
(
"could not record CondDataObjY {} = {} with EventRange {}"
,
78
wch2.
key
(), *cdo,
static_cast<
std::string
>
(
r
));
79
return
StatusCode::FAILURE;
80
}
81
ATH_MSG_INFO
(
"recorded new CDO {} = {} with range {}"
,
82
wch2.
key
(), *cdo,
static_cast<
std::string
>
(
r
));
83
}
84
85
return
StatusCode::SUCCESS;
86
87
}
88
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
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