ATLAS Offline Software
Loading...
Searching...
No Matches
xAODTestReadCView.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
10
11
12#include "xAODTestReadCView.h"
17#include <memory>
18#include <print>
19#include <sstream>
20
21
22namespace DMTest {
23
24
30xAODTestReadCView::xAODTestReadCView (const std::string &name,
31 ISvcLocator *pSvcLocator)
32 : AthReentrantAlgorithm (name, pSvcLocator),
33 m_cviewKey ("cview"),
34 m_writeKey ("")
35{
36 declareProperty ("CViewKey", m_cviewKey);
37 declareProperty ("WriteKey", m_writeKey);
38}
39
40
45{
46 ATH_CHECK( m_cviewKey.initialize() );
47 if (!m_writeKey.key().empty())
48 ATH_CHECK( m_writeKey.initialize() );
49 return StatusCode::SUCCESS;
50}
51
52
56StatusCode xAODTestReadCView::execute (const EventContext& ctx) const
57{
59
60 static const C::Accessor<int> anInt10 ("anInt10");
61 std::ostringstream ost;
62 std::print (ost, "{}:", m_cviewKey.key());
63 for (const C* c : *cview) {
64 std::print (ost, " {}", c->anInt());
65 if (anInt10.isAvailable(*c))
66 std::print (ost, "({})", anInt10(*c));
67 }
68 ATH_MSG_INFO (ost.str());
69
70 if (!m_writeKey.key().empty()) {
72 ATH_CHECK( writeview.record(std::make_unique<DMTest::CView> (*cview)) );
73 }
74
75 return StatusCode::SUCCESS;
76}
77
78
83{
84 return StatusCode::SUCCESS;
85}
86
87
88} // namespace DMTest
89
#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.
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).