ATLAS Offline Software
Loading...
Searching...
No Matches
HiveAlgA.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "HiveAlgA.h"
6
7HiveAlgA::HiveAlgA( const std::string& name,
8 ISvcLocator* pSvcLocator ) :
9 ::HiveAlgBase( name, pSvcLocator )
10{
11}
12
13HiveAlgA::~HiveAlgA() = default;
14
15/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
16
18 ATH_MSG_DEBUG("initialize " << name());
19
20 ATH_CHECK( m_evt.initialize() );
21 ATH_CHECK( m_wrh1.initialize() );
22 ATH_CHECK( m_wrh2.initialize() );
23
24 // make sure we initialize the base class
26}
27
28/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
29
30StatusCode HiveAlgA::execute(const EventContext& ctx) const {
31
32 ATH_MSG_DEBUG("execute " << name());
33
35 if (!evt.isValid()) {
36 ATH_MSG_ERROR ("Could not retrieve EventInfo");
37 return StatusCode::FAILURE;
38 } else {
39 ATH_MSG_INFO(" EventInfo: r: " << evt->runNumber()
40 << " e: " << evt->eventNumber() );
41 }
42
43 sleep(ctx);
44
45 unsigned int i = ctx.evt();
46
48 ATH_CHECK(wrh1.record(std::make_unique< HiveDataObj >(10000 + evt->eventNumber()*100 + i)));
49
51 ATH_CHECK(wrh2.record(std::make_unique< HiveDataObj >(10050+i)));
52
53 ATH_MSG_INFO(" write: " << wrh1.key() << " = " << wrh1->val() );
54 ATH_MSG_INFO(" write: " << wrh2.key() << " = " << wrh2->val() );
55
56 return StatusCode::SUCCESS;
57}
58
#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
virtual StatusCode execute(const EventContext &ctx) const override
Definition HiveAlgA.cxx:30
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:7
virtual StatusCode initialize() override
Definition HiveAlgA.cxx:17
HiveAlgBase(const std::string &name, ISvcLocator *pSvcLocator)
unsigned int sleep(const EventContext &ctx) const
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.