ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthViews
src_dflow
AthViews/src_dflow/DFlowAlg2.cxx
Go to the documentation of this file.
1
2
3
/*
4
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
5
*/
6
7
// DFlowAlg2.cxx
8
// Implementation file for class DFlowAlg2
9
// Author: S.Binet<binet@cern.ch>
11
12
// AthExStoreGateExample includes
13
#include "
DFlowAlg2.h
"
14
15
// STL includes
16
17
// FrameWork includes
18
#include "Gaudi/Property.h"
19
#include "
StoreGate/ReadHandle.h
"
20
#include "
StoreGate/WriteHandle.h
"
21
#include "
StoreGate/UpdateHandle.h
"
22
23
namespace
AthViews
{
24
25
// Athena Algorithm's Hooks
27
StatusCode
DFlowAlg2::initialize
()
28
{
29
ATH_MSG_INFO
(
"Initializing "
<< name() <<
"..."
);
30
31
CHECK
(
m_r_int
.initialize() );
32
CHECK
(
m_ints
.initialize() );
33
CHECK
(
m_testUpdate
.initialize() );
34
35
return
StatusCode::SUCCESS;
36
}
37
38
StatusCode
DFlowAlg2::finalize
()
39
{
40
ATH_MSG_INFO
(
"Finalizing "
<< name() <<
"..."
);
41
42
return
StatusCode::SUCCESS;
43
}
44
45
StatusCode
DFlowAlg2::execute
(
const
EventContext& ctx)
const
46
{
47
ATH_MSG_DEBUG
(
"Executing "
<< name() <<
"..."
);
48
49
SG::ReadHandle< int >
inputHandle(
m_r_int
, ctx );
50
ATH_MSG_INFO
(
"================================"
);
51
ATH_MSG_INFO
(
"myint r-handle..."
);
52
ATH_MSG_INFO
(
"name: ["
<< inputHandle.
name
() <<
"]"
);
53
ATH_MSG_INFO
(
"store ["
<< inputHandle.
store
() <<
"]"
);
54
ATH_MSG_INFO
(
"clid: ["
<< inputHandle.
clid
() <<
"]"
);
55
56
ATH_MSG_INFO
(
"ptr: "
<< inputHandle.
cptr
());
57
if
( inputHandle.
isValid
() )
58
{
59
ATH_MSG_INFO
(
"val: "
<< *( inputHandle.
cptr
() ) );
60
}
61
62
SG::WriteHandle< std::vector< int >
> outputHandle(
m_ints
, ctx );
63
ATH_MSG_INFO
(
"ints w-handle..."
);
64
ATH_CHECK
( outputHandle.
record
( std::make_unique< std::vector< int > >() ) );
65
outputHandle->push_back( 10 );
66
67
if
( inputHandle.
isValid
() )
68
{
69
outputHandle->push_back( *inputHandle );
70
}
71
72
ATH_MSG_INFO
(
"size:"
<< outputHandle->size() );
73
for
(
int
i = 0,
imax
= outputHandle->size(); i !=
imax
; ++i )
74
{
75
ATH_MSG_INFO
(
"val["
<< i <<
"]= "
<< outputHandle->at( i ) );
76
}
77
78
// Test update handles
79
SG::UpdateHandle< HiveDataObj >
testUpdate(
m_testUpdate
, ctx );
80
ATH_MSG_INFO
(
"Update handle before: "
<< testUpdate->val() );
81
testUpdate->val( 1234 );
82
ATH_MSG_INFO
(
"Update handle after: "
<< testUpdate->val() );
83
*testUpdate = 4321;
84
ATH_MSG_INFO
(
"Update handle new: "
<< testUpdate->val() );
85
86
return
StatusCode::SUCCESS;
87
}
88
89
}
//> end namespace AthViews
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
DFlowAlg2.h
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
imax
int imax(int i, int j)
Definition
TileLaserTimingTool.cxx:33
UpdateHandle.h
Handle class for modifying an existing object in StoreGate.
AthViews::DFlowAlg2::initialize
virtual StatusCode initialize() override
Definition
AthViews/src_dflow/DFlowAlg2.cxx:27
AthViews::DFlowAlg2::m_ints
SG::WriteHandleKey< std::vector< int > > m_ints
Definition
AthViews/src_dflow/DFlowAlg2.h:39
AthViews::DFlowAlg2::m_r_int
SG::ReadHandleKey< int > m_r_int
Definition
AthViews/src_dflow/DFlowAlg2.h:38
AthViews::DFlowAlg2::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
AthViews/src_dflow/DFlowAlg2.cxx:45
AthViews::DFlowAlg2::finalize
virtual StatusCode finalize() override
Definition
AthViews/src_dflow/DFlowAlg2.cxx:38
AthViews::DFlowAlg2::m_testUpdate
SG::UpdateHandleKey< HiveDataObj > m_testUpdate
Definition
AthViews/src_dflow/DFlowAlg2.h:40
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
SG::UpdateHandle
Definition
UpdateHandle.h:91
SG::VarHandleBase::store
std::string store() const
Return the name of the store holding the object we are proxying.
Definition
StoreGate/src/VarHandleBase.cxx:382
SG::VarHandleBase::clid
CLID clid() const
Return the class ID for the referenced object.
SG::VarHandleBase::name
const std::string & name() const
Return the StoreGate ID for the referenced object.
Definition
AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:75
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
AthViews
Definition
ViewDataVerifier.cxx:18
Generated on
for ATLAS Offline Software by
1.17.0