ATLAS Offline Software
Loading...
Searching...
No Matches
xAODTestReadCView.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id$
12
13
14#include "xAODTestReadCView.h"
19#include <memory>
20#include <sstream>
21
22
23namespace DMTest {
24
25
31xAODTestReadCView::xAODTestReadCView (const std::string &name,
32 ISvcLocator *pSvcLocator)
33 : AthReentrantAlgorithm (name, pSvcLocator),
34 m_cviewKey ("cview"),
35 m_writeKey ("")
36{
37 declareProperty ("CViewKey", m_cviewKey);
38 declareProperty ("WriteKey", m_writeKey);
39}
40
41
46{
47 ATH_CHECK( m_cviewKey.initialize() );
48 if (!m_writeKey.key().empty())
49 ATH_CHECK( m_writeKey.initialize() );
50 return StatusCode::SUCCESS;
51}
52
53
57StatusCode xAODTestReadCView::execute (const EventContext& ctx) const
58{
60
61 static const C::Accessor<int> anInt10 ("anInt10");
62 std::ostringstream ost;
63 ost << m_cviewKey.key() << ":";
64 for (const C* c : *cview) {
65 ost << " " << c->anInt();
66 if (anInt10.isAvailable(*c))
67 ost << "(" << anInt10(*c) << ")";
68 }
69 ATH_MSG_INFO (ost.str());
70
71 if (!m_writeKey.key().empty()) {
73 ATH_CHECK( writeview.record(std::make_unique<DMTest::CView> (*cview)) );
74 }
75
76 return StatusCode::SUCCESS;
77}
78
79
84{
85 return StatusCode::SUCCESS;
86}
87
88
89} // namespace DMTest
90
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
Class used for testing ViewVector reading/writing.
Class used for testing xAOD data reading/writing.
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
An algorithm that can be simultaneously executed in multiple threads.
virtual StatusCode finalize() override
Algorithm finalization; called at the end of the job.
xAODTestReadCView(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
SG::ReadHandleKey< DMTest::CView > m_cviewKey
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
SG::WriteHandleKey< DMTest::CView > m_writeKey
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Definition B.h:23
C_v1 C
Definition C.h:26
Algorithm to test reading xAOD data (CView)