ATLAS Offline Software
xAODTestWriteCVecConst.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 "xAODTestWriteCVecConst.h"
20 
21 
22 namespace DMTest {
23 
24 
31  ISvcLocator *pSvcLocator)
32  : AthReentrantAlgorithm (name, pSvcLocator),
33  m_cvecKey ("cvecConst")
34 {
35  declareProperty ("CVecKey", m_cvecKey);
36 }
37 
38 
43 {
44  ATH_CHECK( m_cvecKey.initialize() );
45  return StatusCode::SUCCESS;
46 }
47 
48 
52 StatusCode xAODTestWriteCVecConst::execute (const EventContext& ctx) const
53 {
54  auto coll = std::make_unique<DMTest::CVec>();
55  auto store = std::make_unique<DMTest::CAuxContainer>();
56  coll->setStore (store.get());
57 
59  CHECK( cvec.record (std::move(coll), std::move(store)) );
60 
61  size_t count = ctx.evt();
62  for (int i=0; i < 10; i++) {
63  cvec->push_back (new DMTest::C);
64  C& c = *cvec->back();
65  c.setAnInt (count * 100 + i+1);
66  c.setAFloat (count * 200 + (float)i*0.1);
67  }
68 
69  return StatusCode::SUCCESS;
70 }
71 
72 
77 {
78  return StatusCode::SUCCESS;
79 }
80 
81 
82 } // namespace DMTest
83 
SGTest::store
TestStore store
Definition: TestStore.cxx:23
DMTest::xAODTestWriteCVecConst::m_cvecKey
SG::WriteHandleKey< DMTest::CVec > m_cvecKey
Definition: xAODTestWriteCVecConst.h:62
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
DMTest::xAODTestWriteCVecConst::initialize
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
Definition: xAODTestWriteCVecConst.cxx:42
CAuxContainer.h
Class used for testing xAOD data reading/writing.
DMTest::xAODTestWriteCVecConst::xAODTestWriteCVecConst
xAODTestWriteCVecConst(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: xAODTestWriteCVecConst.cxx:30
DMTest::C_v1
Definition: C_v1.h:27
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
AuxDataOption.h
Hold information about an option setting request.
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.
lumiFormat.i
int i
Definition: lumiFormat.py:85
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.
DMTest::xAODTestWriteCVecConst::finalize
virtual StatusCode finalize() override
Algorithm finalization; called at the end of the job.
Definition: xAODTestWriteCVecConst.cxx:76
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
DataVector::back
const T * back() const
Access the last element in the collection as an rvalue.
xAODTestWriteCVecConst.h
Test recording a const aux obj via WriteHandle.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
errorcheck.h
Helpers for checking error return status codes and reporting errors.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
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.
DMTest::xAODTestWriteCVecConst::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
Definition: xAODTestWriteCVecConst.cxx:52
python.compressB64.c
def c
Definition: compressB64.py:93
DMTest
Definition: B.h:23