ATLAS Offline Software
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$
13 #include "MetaReaderAlg.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 
37 {
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.
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
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
SG::ReadMetaHandleKey< DMTest::S1 >
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::MetaHandleKey::initialize
StatusCode initialize()
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::begin
std::vector< DataHeaderElement >::const_iterator begin() const
Definition: DataHeader.cxx:255
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
DataHeader
This class provides the layout for summary information stored for data written to POOL.
Definition: DataHeader.h:124
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataHeader.h
This file contains the class definition for the DataHeader and DataHeaderElement classes.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
SG::ReadMetaHandle
Definition: MetaCont.h:21
MetaReaderAlg.h
S1.h
For symlink tests.
DMTest::MetaReaderAlg::m_s1Key
SG::ReadMetaHandleKey< DMTest::S1 > m_s1Key
Definition: MetaReaderAlg.h:54
DMTest::MetaReaderAlg::m_cKey
SG::ReadMetaHandleKey< DMTest::C > m_cKey
Definition: MetaReaderAlg.h:55
DMTest::MetaReaderAlg::MetaReaderAlg
MetaReaderAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: MetaReaderAlg.cxx:25
python.compressB64.c
def c
Definition: compressB64.py:93
DMTest
Definition: B.h:23