ATLAS Offline Software
AllocTestWriteWithoutAlloc.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration.
3  */
14 
15 
16 namespace DMTest {
17 
18 
23 {
24  ATH_CHECK( m_containerKey.initialize() );
25  return StatusCode::SUCCESS;
26 }
27 
28 
32 StatusCode AllocTestWriteWithoutAlloc::execute (const EventContext& ctx) const
33 {
34  static const SG::AuxElement::Accessor<int> atInt3 ("atInt3");
35  static const SG::AuxElement::Accessor<int> atInt4 ("atInt4");
36 
38  ATH_CHECK( cont.record (std::make_unique<AllocTestContainer>(),
39  std::make_unique<AllocTestAuxContainer>()) );
40 
41  for (size_t i = 0; i < 10; i++) {
42  cont->push_back (std::make_unique<AllocTest>());
43  cont->back()->setAtInt1 (ctx.evt()*100 + i);
44  cont->back()->setAtInt2 (ctx.evt()*100 + i + 10);
45  atInt3(*cont->back()) = ctx.evt()*100 + i + 20;
46  atInt4(*cont->back()) = ctx.evt()*100 + i + 30;
47  }
48  return StatusCode::SUCCESS;
49 }
50 
51 
52 } // namespace DMTest
AllocTestWriteWithoutAlloc.h
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
DMTest::AllocTestWriteWithoutAlloc::m_containerKey
SG::WriteHandleKey< AllocTestContainer > m_containerKey
Definition: AllocTestWriteWithoutAlloc.h:53
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
DMTest::AllocTestWriteWithoutAlloc::initialize
virtual StatusCode initialize() override
Gaudi initialize method.
Definition: AllocTestWriteWithoutAlloc.cxx:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AllocTestAuxContainer.h
Testing an xAOD object with a non-standard memory allocator.
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
DMTest::AllocTestWriteWithoutAlloc::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
Definition: AllocTestWriteWithoutAlloc.cxx:32
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
DMTest
Definition: B.h:23