ATLAS Offline Software
AlgB.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "AlgB.h"
6 #include "StoreGate/ReadHandle.h"
8 #include "GaudiKernel/ServiceHandle.h"
9 #include <thread>
10 #include <chrono>
11 #include <memory>
12 
13 AlgB::AlgB( const std::string& name,
14  ISvcLocator* pSvcLocator ) :
15  ::AthAlgorithm( name, pSvcLocator )
16 {
17 }
18 
20 
22  ATH_MSG_DEBUG("initialize " << name());
23 
26 
27  return StatusCode::SUCCESS;
28 }
29 
31  ATH_MSG_DEBUG("finalize " << name());
32  return StatusCode::SUCCESS;
33 }
34 
36  ATH_MSG_DEBUG("execute " << name());
37 
39  if (!rh1.isValid()) {
40  ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << m_rdh1.key());
41  return StatusCode::FAILURE;
42  }
43 
44  ATH_MSG_INFO(" read: " << rh1.key() << " = " << rh1->val() );
45 
47  ATH_CHECK( wh1.record( std::make_unique< HiveDataObj >
48  ( 3300 + rh1->val() ) ) );
49 
50  ATH_MSG_INFO(" write: " << wh1.key() << " = " << wh1->val() );
51  ATH_CHECK(wh1.isValid());
52 
53  return StatusCode::SUCCESS;
54 
55 }
56 
AlgB::finalize
virtual StatusCode finalize() override
Definition: AlgB.cxx:30
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AlgB::m_wrh1
SG::WriteHandleKey< HiveDataObj > m_wrh1
Definition: AlgB.h:31
AlgB::~AlgB
virtual ~AlgB()
Definition: AlgB.cxx:19
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AlgB::execute
virtual StatusCode execute() override
Definition: AlgB.cxx:35
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
AlgB.h
WriteHandle.h
Handle class for recording to StoreGate.
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
AthAlgorithm
Definition: AthAlgorithm.h:47
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
AlgB::m_rdh1
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition: AlgB.h:30
SG::VarHandleBase::key
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:64
AlgB::initialize
virtual StatusCode initialize() override
Definition: AlgB.cxx:21
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
AlgB::AlgB
AlgB(const std::string &name, ISvcLocator *pSvcLocator)
Definition: AlgB.cxx:13
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
HiveDataObj::val
void val(int i)
Definition: HiveDataObj.h:22
ReadHandle.h
Handle class for reading from StoreGate.