ATLAS Offline Software
xAODTestWriteCView.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id$
14 #include "xAODTestWriteCView.h"
15 #include "xAODTestWriteHelper.h"
20 
21 
22 namespace DMTest {
23 
24 
31  ISvcLocator *pSvcLocator)
32  : AthReentrantAlgorithm (name, pSvcLocator),
33  m_cvecKey ("cvec"),
34  m_cviewKey ("cview")
35 {
36  declareProperty ("CVecKey", m_cvecKey);
37  declareProperty ("CViewKey", m_cviewKey);
38 }
39 
40 
45 {
46  ATH_CHECK( m_cvecKey.initialize() );
47  ATH_CHECK( m_cviewKey.initialize() );
48  return StatusCode::SUCCESS;
49 }
50 
51 
55 StatusCode xAODTestWriteCView::execute (const EventContext& ctx) const
56 {
58  auto cview = std::make_unique<ConstDataVector<DMTest::CView> >(SG::VIEW_ELEMENTS);
59  for (int i = cvec->size()-1; i >= 0; --i)
60  cview->push_back ((*cvec)[i]);
61 
63  CHECK( DMTest::recordView1 (cviewH, std::move(cview)) );
64 
65  return StatusCode::SUCCESS;
66 }
67 
68 
73 {
74  return StatusCode::SUCCESS;
75 }
76 
77 
78 } // namespace DMTest
79 
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
ConstDataVector.h
DataVector adapter that acts like it holds const pointers.
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::xAODTestWriteCView::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
Definition: xAODTestWriteCView.cxx:55
DMTest::xAODTestWriteCView::m_cvecKey
SG::ReadHandleKey< DMTest::CVec > m_cvecKey
Definition: xAODTestWriteCView.h:65
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
CVec.h
Class used for testing xAOD data reading/writing.
DMTest::xAODTestWriteCView::m_cviewKey
SG::WriteHandleKey< ConstDataVector< DMTest::CView > > m_cviewKey
Definition: xAODTestWriteCView.h:66
lumiFormat.i
int i
Definition: lumiFormat.py:92
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
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
CView.h
Class used for testing ViewVector reading/writing.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
errorcheck.h
Helpers for checking error return status codes and reporting errors.
DMTest::xAODTestWriteCView::finalize
virtual StatusCode finalize() override
Algorithm finalization; called at the end of the job.
Definition: xAODTestWriteCView.cxx:72
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
xAODTestWriteHelper.h
Test recording ViewVector w/o having CLASS_DEF visible in compilation unit.
DMTest::xAODTestWriteCView::initialize
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
Definition: xAODTestWriteCView.cxx:44
DMTest::recordView1
StatusCode recordView1(SG::WriteHandle< ConstDataVector< ViewVector< DMTest::CVec > > > &h, std::unique_ptr< ConstDataVector< ViewVector< DMTest::CVec > > > view)
Definition: xAODTestWriteHelper.cxx:21
DMTest::xAODTestWriteCView::xAODTestWriteCView
xAODTestWriteCView(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: xAODTestWriteCView.cxx:30
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
xAODTestWriteCView.h
Algorithm to test writing an xAOD view vector (cview)
DMTest
Definition: B.h:23