ATLAS Offline Software
Loading...
Searching...
No Matches
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
10HiveAlgM::HiveAlgM( const std::string& name,
11 ISvcLocator* pSvcLocator ) :
12 ::HiveAlgBase( name, pSvcLocator )
13{}
14
16
18 ATH_MSG_DEBUG("initialize " << name());
19
20 ATH_CHECK( m_rdh1.initialize() );
21 ATH_CHECK( m_rdh2.initialize() );
22
24}
25
26StatusCode HiveAlgM::finalize() {
27 ATH_MSG_DEBUG("finalize " << name());
28 return StatusCode::SUCCESS;
29}
30
31StatusCode HiveAlgM::execute() {
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
unsigned int sleep()
HiveAlgBase(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize() override
StatusCode finalize()
Definition HiveAlgM.cxx:26
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition HiveAlgM.h:32
SG::ReadHandleKey< HiveDataObj > m_rdh2
Definition HiveAlgM.h:33
StatusCode initialize()
Definition HiveAlgM.cxx:17
Gaudi::Property< int > m_off
Definition HiveAlgM.h:31
StatusCode execute()
Definition HiveAlgM.cxx:31
HiveAlgM(const std::string &name, ISvcLocator *pSvcLocator)
Definition HiveAlgM.cxx:10
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.