ATLAS Offline Software
Loading...
Searching...
No Matches
HiveAlgA.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 "HiveAlgA.h"
6#include "GaudiKernel/ThreadLocalContext.h"
7
8HiveAlgA::HiveAlgA( const std::string& name,
9 ISvcLocator* pSvcLocator ) :
10 ::HiveAlgBase( name, pSvcLocator )
11{
12}
13
14HiveAlgA::~HiveAlgA() = default;
15
16/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
17
19 ATH_MSG_DEBUG("initialize " << name());
20
21 ATH_CHECK( m_evt.initialize() );
22 ATH_CHECK( m_wrh1.initialize() );
23 ATH_CHECK( m_wrh2.initialize() );
24
25 // make sure we initialize the base class
27}
28
29/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
30
31StatusCode HiveAlgA::execute() {
32
33 ATH_MSG_DEBUG("execute " << name());
34
36 if (!evt.isValid()) {
37 ATH_MSG_ERROR ("Could not retrieve EventInfo");
38 return StatusCode::FAILURE;
39 } else {
40 ATH_MSG_INFO(" EventInfo: r: " << evt->runNumber()
41 << " e: " << evt->eventNumber() );
42 }
43
44 sleep();
45
46 unsigned int i = Gaudi::Hive::currentContextEvt();
47
49 ATH_CHECK(wrh1.record(std::make_unique< HiveDataObj >(10000 + evt->eventNumber()*100 + i)));
50
52 ATH_CHECK(wrh2.record(std::make_unique< HiveDataObj >(10050+i)));
53
54 ATH_MSG_INFO(" write: " << wrh1.key() << " = " << wrh1->val() );
55 ATH_MSG_INFO(" write: " << wrh2.key() << " = " << wrh2->val() );
56
57 return StatusCode::SUCCESS;
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 the EventInfo obj, and writes two HiveDataObjs to the store.
SG::WriteHandleKey< HiveDataObj > m_wrh2
Definition HiveAlgA.h:42
SG::WriteHandleKey< HiveDataObj > m_wrh1
Definition HiveAlgA.h:41
SG::ReadHandleKey< xAOD::EventInfo > m_evt
Definition HiveAlgA.h:39
HiveAlgA(const std::string &name, ISvcLocator *pSvcLocator)
Definition HiveAlgA.cxx:8
virtual StatusCode initialize() override
Definition HiveAlgA.cxx:18
virtual StatusCode execute() override
Definition HiveAlgA.cxx:31
unsigned int sleep()
HiveAlgBase(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize() override
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.