ATLAS Offline Software
Loading...
Searching...
No Matches
HiveAlgE.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "HiveAlgE.h"
6
7HiveAlgE::HiveAlgE( const std::string& name,
8 ISvcLocator* pSvcLocator ) :
9 ::HiveAlgBase( name, pSvcLocator )
10{
11}
12
13/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
14HiveAlgE::~HiveAlgE() = default;
15
16/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
18 ATH_MSG_DEBUG("initialize " << name());
19
20 ATH_CHECK( m_rdh1.initialize() );
21 ATH_CHECK( m_rdh2.initialize() );
22 ATH_CHECK( m_wrh1.initialize() );
23
24 // initialize base class
26}
27
28/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
29StatusCode HiveAlgE::execute() {
30
31 ATH_MSG_DEBUG("execute " << name());
32
33 sleep();
34
36 if (!rdh1.isValid()) {
37 ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << rdh1.key());
38 return StatusCode::FAILURE;
39 }
40
42 if (!rdh2.isValid()) {
43 ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << rdh2.key());
44 return StatusCode::FAILURE;
45 }
46
47 ATH_MSG_INFO(" read: " << rdh1.key() << " = " << rdh1->val() );
48 ATH_MSG_INFO(" read: " << rdh2.key() << " = " << rdh2->val() );
49
51 ATH_CHECK(wrh1.record(std::make_unique< HiveDataObj >(500000 + rdh1->val() + rdh2->val()/10)));
52
53 ATH_MSG_INFO(" write: " << wrh1.key() << " = " << wrh1->val() );
54
55
56 return StatusCode::SUCCESS;
57
58}
59
#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)
Simple Algorithm that reads a HiveDataObj created by HiveAlgB, and one by HiveAlgC,...
unsigned int sleep()
HiveAlgBase(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize() override
virtual StatusCode execute() override
Definition HiveAlgE.cxx:29
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition HiveAlgE.h:38
SG::ReadHandleKey< HiveDataObj > m_rdh2
Definition HiveAlgE.h:40
HiveAlgE(const std::string &name, ISvcLocator *pSvcLocator)
Definition HiveAlgE.cxx:7
virtual StatusCode initialize() override
Definition HiveAlgE.cxx:17
SG::WriteHandleKey< HiveDataObj > m_wrh1
Definition HiveAlgE.h:42
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.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.