ATLAS Offline Software
HiveAlgM.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 "HiveAlgM.h"
6 #include <thread>
7 #include <chrono>
8 #include <memory>
9 
10 HiveAlgM::HiveAlgM( const std::string& name,
11  ISvcLocator* pSvcLocator ) :
12  ::HiveAlgBase( name, pSvcLocator )
13 {}
14 
16 
18  ATH_MSG_DEBUG("initialize " << name());
19 
22 
23  return HiveAlgBase::initialize ();
24 }
25 
27  ATH_MSG_DEBUG("finalize " << name());
28  return StatusCode::SUCCESS;
29 }
30 
32 
33  ATH_MSG_DEBUG("execute " << name());
34 
35  sleep();
36 
38  if (!rdh1.isValid()) {
39  ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << rdh1.key());
40  return StatusCode::FAILURE;
41  }
42 
44  if (!rdh2.isValid()) {
45  ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << rdh2.key());
46  return StatusCode::FAILURE;
47  }
48 
49  ATH_MSG_INFO(" read: " << rdh1.key() << " = " << rdh1->val() );
50  ATH_MSG_INFO(" read: " << rdh2.key() << " = " << rdh2->val() );
51 
52  if ( rdh2->val() != (rdh1->val() + m_off) ) {
53  ATH_MSG_ERROR (rdh2.key() << " != " << rdh1.key() << " + " << (int) m_off);
54  } else {
55  ATH_MSG_INFO( "loop is ok");
56  }
57 
58  return StatusCode::SUCCESS;
59 
60 }
61 
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
HiveAlgBase::sleep
unsigned int sleep()
Definition: HiveAlgBase.cxx:42
HiveAlgBase::initialize
virtual StatusCode initialize() override
Definition: HiveAlgBase.cxx:25
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
HiveAlgM::initialize
StatusCode initialize()
Definition: HiveAlgM.cxx:17
HiveAlgM::execute
StatusCode execute()
Definition: HiveAlgM.cxx:31
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
HiveAlgM::~HiveAlgM
~HiveAlgM()
Definition: HiveAlgM.cxx:15
HiveAlgM::m_rdh1
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition: HiveAlgM.h:32
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
HiveAlgM::m_rdh2
SG::ReadHandleKey< HiveDataObj > m_rdh2
Definition: HiveAlgM.h:33
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
HiveAlgBase
Definition: HiveAlgBase.h:26
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
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
HiveAlgM::m_off
Gaudi::Property< int > m_off
Definition: HiveAlgM.h:31
HiveAlgM::finalize
StatusCode finalize()
Definition: HiveAlgM.cxx:26
HiveAlgM.h
HiveDataObj::val
void val(int i)
Definition: HiveDataObj.h:22
HiveAlgM::HiveAlgM
HiveAlgM(const std::string &name, ISvcLocator *pSvcLocator)
Definition: HiveAlgM.cxx:10