ATLAS Offline Software
xAODTestShallowCopyHVec.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
16 #include "xAODCore/ShallowCopy.h"
17 #include "StoreGate/ReadHandle.h"
18 #include "StoreGate/WriteHandle.h"
22 
23 
24 namespace DMTest {
25 
26 
31 {
32  ATH_CHECK( m_readKey.initialize() );
33  ATH_CHECK( m_writeKey.initialize() );
34  ATH_CHECK( m_aFloat20Key.initialize() );
35  return StatusCode::SUCCESS;
36 }
37 
38 
42 StatusCode xAODTestShallowCopyHVec::execute (const EventContext& ctx) const
43 {
44  size_t count = ctx.evt() + 1;
45 
46  {
49 
51  ATH_CHECK( copy.record (std::unique_ptr<DMTest::HVec>(ret.first),
52  std::unique_ptr<xAOD::ShallowAuxContainer>(ret.second)) );
53 
55  for (H* h : *ret.first)
56  aFloat20(*h) = count * 20000 + h->aFloat();
57  }
58 
59  return StatusCode::SUCCESS;
60 }
61 
62 
63 } // namespace DMTest
64 
ShallowCopy.h
DMTest::xAODTestShallowCopyHVec::m_readKey
SG::ReadHandleKey< DMTest::HVec > m_readKey
Definition: xAODTestShallowCopyHVec.h:52
DMTest::xAODTestShallowCopyHVec::m_aFloat20Key
SG::WriteDecorHandleKey< DMTest::HVec > m_aFloat20Key
Definition: xAODTestShallowCopyHVec.h:58
H.h
Test for xAOD schema evolution.
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
xAODTestShallowCopyHVec.h
Algorithm to test shallow-copy of xAOD data.
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
DMTest::xAODTestShallowCopyHVec::initialize
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
Definition: xAODTestShallowCopyHVec.cxx:30
DMTest::xAODTestShallowCopyHVec::m_writeKey
SG::WriteHandleKey< DMTest::HVec > m_writeKey
Definition: xAODTestShallowCopyHVec.h:55
HVec.h
CxxUtils::vec
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition: vec.h:207
WriteHandle.h
Handle class for recording to StoreGate.
ret
T ret(T t)
Definition: rootspy.cxx:260
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:99
WriteDecorHandle.h
Handle class for adding a decoration to an object.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
HAuxContainer.h
Test for xAOD schema evolution.
DMTest::xAODTestShallowCopyHVec::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
Definition: xAODTestShallowCopyHVec.cxx:42
errorcheck.h
Helpers for checking error return status codes and reporting errors.
xAOD::shallowCopyContainer
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, [[maybe_unused]] const EventContext &ctx)
Function making a shallow copy of a constant container.
Definition: ShallowCopy.h:110
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
h
AuxTypeRegistry.h
Handle mappings between names and auxid_t.
calibdata.copy
bool copy
Definition: calibdata.py:27
ReadHandle.h
Handle class for reading from StoreGate.
DMTest
Definition: B.h:23
DMTest::H_v2
Definition: H_v2.h:30