ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaExamples
AthExHive
src
condEx
CondAlgZ.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 "
CondAlgZ.h
"
6
#include "
StoreGate/ReadCondHandle.h
"
7
#include "
StoreGate/WriteCondHandle.h
"
8
9
10
StatusCode
CondAlgZ::initialize
() {
11
ATH_MSG_DEBUG
(
"initialize "
<< name());
12
13
ATH_CHECK
(
m_rchk1
.initialize() );
14
ATH_CHECK
(
m_rchk2
.initialize() );
15
ATH_CHECK
(
m_rchk3
.initialize() );
16
17
ATH_CHECK
(
m_wch
.initialize() );
18
19
return
StatusCode::SUCCESS;
20
}
21
22
StatusCode
CondAlgZ::execute
(
const
EventContext& ctx)
const
{
23
ATH_MSG_DEBUG
(
"execute "
<< name());
24
EventIDBase now(ctx.eventID());
25
26
SG::ReadCondHandle<CondDataObj>
rch1(
m_rchk1
, ctx);
27
SG::ReadCondHandle<CondDataObjY>
rch2(
m_rchk2
, ctx);
28
SG::ReadCondHandle<CondDataObjY>
rch3(
m_rchk3
, ctx);
29
30
const
CondDataObj
*cdo1 = *rch1;
31
const
CondDataObjY
*cdo2 = *rch2;
32
const
CondDataObjY
*cdo3 = *rch3;
33
34
ATH_MSG_DEBUG
(
" rh1: "
<< cdo1->
val
() <<
" rh2: "
<< cdo2->
val
()
35
<<
" rh3: "
<< cdo3->
val
());
36
37
SG::WriteCondHandle<CondDataObjZ>
wch(
m_wch
,ctx);
38
39
// do we have a valid m_wch for current time?
40
if
( wch.
isValid
(now) ) {
41
ATH_MSG_DEBUG
(
"Found valid write handle for "
<< wch.
key
());
42
return
StatusCode::SUCCESS;
43
}
44
45
ATH_MSG_DEBUG
(
" CondHandle "
<< wch.
key
()
46
<<
" not valid."
);
47
48
wch.
addDependency
(rch1);
49
wch.
addDependency
(rch2,rch3);
50
51
float
val = rch1->val() + rch2->val() + rch3->val();
52
53
if
(wch.
record
( std::make_unique<CondDataObjZ>
54
(
CondDataObjZ
(val) ) ).isFailure()) {
55
ATH_MSG_ERROR
(
"could not record CondDataObjZ "
<< wch.
key
()
56
<<
" val: "
<< val
57
<<
" with EventRange "
<< wch.
getRange
() );
58
return
StatusCode::FAILURE;
59
}
60
61
ATH_MSG_INFO
(
"recorded new CDO "
<< wch.
key
() <<
" = "
<< val
62
<<
" with range "
<< wch.
getRange
() );
63
64
return
StatusCode::SUCCESS;
65
66
}
67
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
CondAlgZ.h
ReadCondHandle.h
WriteCondHandle.h
CondAlgZ::m_rchk2
SG::ReadCondHandleKey< CondDataObjY > m_rchk2
Definition
CondAlgZ.h:28
CondAlgZ::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
CondAlgZ.cxx:22
CondAlgZ::m_rchk3
SG::ReadCondHandleKey< CondDataObjY > m_rchk3
Definition
CondAlgZ.h:29
CondAlgZ::initialize
virtual StatusCode initialize() override
Definition
CondAlgZ.cxx:10
CondAlgZ::m_rchk1
SG::ReadCondHandleKey< CondDataObj > m_rchk1
Definition
CondAlgZ.h:27
CondAlgZ::m_wch
SG::WriteCondHandleKey< CondDataObjZ > m_wch
Definition
CondAlgZ.h:31
CondDataObjY
Definition
CondDataObjY.h:8
CondDataObjY::val
void val(float f)
Definition
CondDataObjY.h:16
CondDataObjZ
Definition
CondDataObjZ.h:8
CondDataObj
Definition
CondDataObj.h:8
CondDataObj::val
void val(int i)
Definition
CondDataObj.h:16
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
SG::WriteCondHandle
Definition
WriteCondHandle.h:26
SG::WriteCondHandle::key
const std::string & key() const
Definition
WriteCondHandle.h:44
SG::WriteCondHandle::addDependency
void addDependency(const EventIDRange &range)
Definition
WriteCondHandle.h:279
SG::WriteCondHandle::getRange
const EventIDRange & getRange() const
Definition
WriteCondHandle.h:93
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
Generated on
for ATLAS Offline Software by
1.17.0