ATLAS Offline Software
HiveAlgA.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 "HiveAlgA.h"
6 #include "GaudiKernel/ThreadLocalContext.h"
7 
8 HiveAlgA::HiveAlgA( const std::string& name,
9  ISvcLocator* pSvcLocator ) :
10  ::HiveAlgBase( name, pSvcLocator )
11 {
12 }
13 
15 
16 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
17 
19  ATH_MSG_DEBUG("initialize " << name());
20 
24 
25  // make sure we initialize the base class
26  return HiveAlgBase::initialize();
27 }
28 
29 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
30 
32  ATH_MSG_DEBUG("finalize " << name());
33  return StatusCode::SUCCESS;
34 }
35 
36 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
37 
39 
40  ATH_MSG_DEBUG("execute " << name());
41 
43  if (!evt.isValid()) {
44  ATH_MSG_ERROR ("Could not retrieve EventInfo");
45  return StatusCode::FAILURE;
46  } else {
47  ATH_MSG_INFO(" EventInfo: r: " << evt->runNumber()
48  << " e: " << evt->eventNumber() );
49  }
50 
51  sleep();
52 
53  unsigned int i = Gaudi::Hive::currentContextEvt();
54 
56  ATH_CHECK(wrh1.record(std::make_unique< HiveDataObj >(10000 + evt->eventNumber()*100 + i)));
57 
59  ATH_CHECK(wrh2.record(std::make_unique< HiveDataObj >(10050+i)));
60 
61  ATH_MSG_INFO(" write: " << wrh1.key() << " = " << wrh1->val() );
62  ATH_MSG_INFO(" write: " << wrh2.key() << " = " << wrh2->val() );
63 
64  return StatusCode::SUCCESS;
65 }
66 
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
HiveAlgBase::sleep
unsigned int sleep()
Definition: HiveAlgBase.cxx:42
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
HiveAlgBase::initialize
virtual StatusCode initialize() override
Definition: HiveAlgBase.cxx:25
HiveAlgA.h
Simple Algorithm that reads the EventInfo obj, and writes two HiveDataObjs to the store.
HiveAlgA::m_wrh2
SG::WriteHandleKey< HiveDataObj > m_wrh2
Definition: HiveAlgA.h:43
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
HiveAlgA::finalize
virtual StatusCode finalize() override
Definition: HiveAlgA.cxx:31
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HiveAlgA::initialize
virtual StatusCode initialize() override
Definition: HiveAlgA.cxx:18
HiveAlgA::m_evt
SG::ReadHandleKey< xAOD::EventInfo > m_evt
Definition: HiveAlgA.h:40
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
HiveAlgA::~HiveAlgA
~HiveAlgA()
Definition: HiveAlgA.cxx:14
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
HiveAlgBase
Definition: HiveAlgBase.h:26
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
HiveAlgA::execute
virtual StatusCode execute() override
Definition: HiveAlgA.cxx:38
SG::VarHandleBase::key
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleBase.cxx:64
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
HiveAlgA::m_wrh1
SG::WriteHandleKey< HiveDataObj > m_wrh1
Definition: HiveAlgA.h:42
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
HiveAlgA::HiveAlgA
HiveAlgA(const std::string &name, ISvcLocator *pSvcLocator)
Definition: HiveAlgA.cxx:8
HiveDataObj::val
void val(int i)
Definition: HiveDataObj.h:22