ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthViews
src_dflow
ViewMergeAlg.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
// AthExStoreGateExample includes
6
#include "
ViewMergeAlg.h
"
7
#include "
AthViews/ViewHelper.h
"
8
9
// STL includes
10
11
// FrameWork includes
12
#include "Gaudi/Property.h"
13
#include "
StoreGate/ReadHandle.h
"
14
#include "
StoreGate/WriteHandle.h
"
15
16
namespace
AthViews
{
17
18
StatusCode
ViewMergeAlg::initialize
()
19
{
20
ATH_MSG_INFO
(
"Initializing "
<< name() <<
"..."
);
21
22
CHECK
(
m_r_ints
.initialize() );
23
CHECK
(
m_w_ints
.initialize() );
24
CHECK
(
m_r_views
.initialize() );
25
26
return
StatusCode::SUCCESS;
27
}
28
29
StatusCode
ViewMergeAlg::finalize
()
30
{
31
ATH_MSG_INFO
(
"Finalizing "
<< name() <<
"..."
);
32
33
return
StatusCode::SUCCESS;
34
}
35
36
StatusCode
ViewMergeAlg::execute
(
const
EventContext& ctx)
const
37
{
38
ATH_MSG_DEBUG
(
"Executing "
<< name() <<
"..."
);
39
40
//Merge results
41
std::vector< int > outputVector;
42
SG::ReadHandle< ViewContainer >
inputViews(
m_r_views
, ctx );
43
ViewHelper::ViewMerger
merger(
evtStore
().
get
(),
msg
() );
44
CHECK
( merger.
mergeViewCollection
( *inputViews,
//Vector of views (inside ReadHandle)
45
m_r_ints
,
//ReadHandleKey to access the views
46
ctx,
//The context of this algorithm
47
outputVector ) );
//Container to merge results into
48
49
//Output the merged data
50
SG::WriteHandle< std::vector< int >
> outputHandle(
m_w_ints
, ctx );
51
CHECK
( outputHandle.
record
( std::make_unique< std::vector< int > >( outputVector ) ) );
52
if
( !outputHandle.
isValid
() )
53
{
54
ATH_MSG_INFO
(
"Unable to load main event store for output"
);
55
}
56
57
for
(
int
const
test : outputVector )
58
{
59
ATH_MSG_INFO
( test );
60
}
61
62
return
StatusCode::SUCCESS;
63
}
64
65
}
//> end namespace AthViews
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
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.
ViewHelper.h
ViewMergeAlg.h
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
AthCommonAlgorithm< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition
AthCommonMsg.h:24
AthViews::ViewMergeAlg::m_r_views
SG::ReadHandleKey< ViewContainer > m_r_views
Definition
ViewMergeAlg.h:34
AthViews::ViewMergeAlg::m_w_ints
SG::WriteHandleKey< std::vector< int > > m_w_ints
Definition
ViewMergeAlg.h:32
AthViews::ViewMergeAlg::m_r_ints
SG::ReadHandleKey< std::vector< int > > m_r_ints
Definition
ViewMergeAlg.h:33
AthViews::ViewMergeAlg::initialize
virtual StatusCode initialize() override
Definition
ViewMergeAlg.cxx:18
AthViews::ViewMergeAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
ViewMergeAlg.cxx:36
AthViews::ViewMergeAlg::finalize
virtual StatusCode finalize() override
Definition
ViewMergeAlg.cxx:29
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
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.
SG::WriteHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
ViewHelper::ViewMerger
Definition
ViewHelper.h:135
ViewHelper::ViewMerger::mergeViewCollection
StatusCode mergeViewCollection(ViewContainer const &viewVector, SG::ReadHandleKey< T > const &queryKey, EventContext const &sourceContext, T &outputData)
Definition
ViewHelper.h:144
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition
hcg.cxx:132
AthViews
Definition
ViewDataVerifier.cxx:18
Generated on
for ATLAS Offline Software by
1.17.0