ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
DataModelTest
DataModelTestDataCommon
src
MetaReaderAlg.cxx
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration.
3
*/
4
// $Id$
11
12
13
#include "
MetaReaderAlg.h
"
14
#include "
DataModelTestDataCommon/S1.h
"
15
#include "
PersistentDataModel/DataHeader.h
"
16
17
namespace
DMTest
{
18
19
25
MetaReaderAlg::MetaReaderAlg
(
const
std::string &name, ISvcLocator *pSvcLocator)
26
:
AthReentrantAlgorithm
(name, pSvcLocator),
27
m_s1Key
(
"MetaS1"
),
28
m_cKey
(
"MetaC"
)
29
{
30
}
31
32
36
StatusCode
MetaReaderAlg::initialize
()
37
{
38
ATH_CHECK
(
m_s1Key
.initialize() );
39
ATH_CHECK
(
m_cKey
.initialize() );
40
return
StatusCode::SUCCESS;
41
}
42
43
48
StatusCode
MetaReaderAlg::execute
(
const
EventContext& ctx)
const
49
{
50
// Get proper dbkey.
51
const
DataHeader
* thisDH =
nullptr
;
52
ATH_CHECK
(
evtStore
()->retrieve(thisDH,
"EventSelector"
) );
53
std::string sid = thisDH->
begin
()->getToken()->dbID().toString();
54
55
// Make a new key with the correct dbkey.
56
SG::ReadMetaHandleKey<DMTest::S1>
s1Key (
m_s1Key
.key(), sid);
57
ATH_CHECK
( s1Key.
initialize
() );
58
SG::ReadMetaHandle<DMTest::S1>
s1 (s1Key, ctx);
59
ATH_MSG_INFO
(
"MetaS1: "
<< s1->m_x);
60
61
// Make a new key with the correct dbkey.
62
SG::ReadMetaHandleKey<DMTest::C>
cKey (
m_cKey
.key(), sid);
63
ATH_CHECK
( cKey.
initialize
() );
64
SG::ReadMetaHandle<DMTest::C>
c (cKey, ctx);
65
ATH_MSG_INFO
(
"MetaC: "
<< c->anInt() <<
" "
<< c->aFloat());
66
return
StatusCode::SUCCESS;
67
}
68
69
70
}
// namespace DMTest
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
DataHeader.h
This file contains the class definition for the DataHeader and DataHeaderElement classes.
MetaReaderAlg.h
S1.h
For symlink tests.
AthCommonAlgorithm< Gaudi::Algorithm >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
Definition
AthCommonDataStore.h:85
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
DMTest::MetaReaderAlg::MetaReaderAlg
MetaReaderAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
MetaReaderAlg.cxx:25
DMTest::MetaReaderAlg::m_cKey
SG::ReadMetaHandleKey< DMTest::C > m_cKey
Definition
MetaReaderAlg.h:55
DMTest::MetaReaderAlg::m_s1Key
SG::ReadMetaHandleKey< DMTest::S1 > m_s1Key
Definition
MetaReaderAlg.h:54
DMTest::MetaReaderAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm execute method.
Definition
MetaReaderAlg.cxx:48
DMTest::MetaReaderAlg::initialize
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
Definition
MetaReaderAlg.cxx:36
DataHeader
This class provides the layout for summary information stored for data written to POOL.
Definition
DataHeader.h:123
DataHeader::begin
std::vector< DataHeaderElement >::const_iterator begin() const
Definition
DataHeader.cxx:249
SG::MetaHandleKey::initialize
StatusCode initialize()
SG::ReadMetaHandleKey
Definition
ReadMetaHandleKey.h:18
SG::ReadMetaHandle
Definition
ReadMetaHandle.h:27
DMTest
Definition
B.h:23
Generated on
for ATLAS Offline Software by
1.17.0