ATLAS Offline Software
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$
14 #include "xAODTestReadCView.h"
17 #include "StoreGate/ReadHandle.h"
18 #include "StoreGate/WriteHandle.h"
19 #include <memory>
20 #include <sstream>
21 
22 
23 namespace DMTest {
24 
25 
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 
57 StatusCode 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 
DMTest::xAODTestReadCView::xAODTestReadCView
xAODTestReadCView(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: xAODTestReadCView.cxx:31
python.trigbs_prescaleL1.ost
ost
Definition: trigbs_prescaleL1.py:104
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
DMTest::xAODTestReadCView::m_writeKey
SG::WriteHandleKey< DMTest::CView > m_writeKey
Definition: xAODTestReadCView.h:64
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
DMTest::xAODTestReadCView::initialize
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
Definition: xAODTestReadCView.cxx:45
DMTest::C_v1
Definition: C_v1.h:27
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
DMTest::xAODTestReadCView::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
Definition: xAODTestReadCView.cxx:57
WriteHandle.h
Handle class for recording to StoreGate.
DMTest::xAODTestReadCView::m_cviewKey
SG::ReadHandleKey< DMTest::CView > m_cviewKey
Definition: xAODTestReadCView.h:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
C.h
Class used for testing xAOD data reading/writing.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CView.h
Class used for testing ViewVector reading/writing.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
DMTest::xAODTestReadCView::finalize
virtual StatusCode finalize() override
Algorithm finalization; called at the end of the job.
Definition: xAODTestReadCView.cxx:83
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
xAODTestReadCView.h
Algorithm to test reading xAOD data (CView)
SG::ConstAccessor< T, AuxAllocator_t< T > >::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
ReadHandle.h
Handle class for reading from StoreGate.
python.compressB64.c
def c
Definition: compressB64.py:93
DMTest
Definition: B.h:23