ATLAS Offline Software
Loading...
Searching...
No Matches
AlgA.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 "AlgA.h"
8
9#include <memory>
10
11AlgA::AlgA( const std::string& name,
12 ISvcLocator* pSvcLocator ) :
13 ::AthAlgorithm( name, pSvcLocator )
14{
15}
16
17//---------------------------------------------------------------------------
18
19StatusCode AlgA::initialize() {
20 ATH_MSG_DEBUG("initialize " << name());
21
22 ATH_CHECK( m_wrh1.initialize() );
23 ATH_CHECK( m_wrh2.initialize() );
24 ATH_CHECK( m_evt.initialize() );
25
26 return StatusCode::SUCCESS;
27}
28
29//---------------------------------------------------------------------------
30
31StatusCode AlgA::execute() {
32
33 ATH_MSG_DEBUG("execute " << name());
34
36 ATH_MSG_INFO(" EventInfo: r: " << evt->runNumber()
37 << " e: " << evt->eventNumber()
38 << " evt: " << Gaudi::Hive::currentContextEvt() );
39
40
41 unsigned int i = Gaudi::Hive::currentContextEvt() + 1;
42
44 ATH_CHECK( wh1.record( std::make_unique<HiveDataObj>
45 ( 10000 +
46 evt->eventNumber()*100 +
47 i) )
48 );
49 ATH_MSG_INFO(" write: " << wh1.key() << " = " << wh1->val() );
50
51
53 ATH_CHECK( wh2.record( std::make_unique< HiveDataObj >( 10050+i ) ) );
54 ATH_MSG_INFO(" write: " << wh2.key() << " = " << wh2->val() );
55
56 return StatusCode::SUCCESS;
57
58}
59
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
virtual StatusCode execute() override
Definition AlgA.cxx:31
AlgA(const std::string &name, ISvcLocator *pSvcLocator)
Definition AlgA.cxx:11
SG::WriteHandleKey< HiveDataObj > m_wrh2
Definition AlgA.h:30
SG::ReadHandleKey< xAOD::EventInfo > m_evt
Definition AlgA.h:31
SG::WriteHandleKey< HiveDataObj > m_wrh1
Definition AlgA.h:29
virtual StatusCode initialize() override
Definition AlgA.cxx:19
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
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.