ATLAS Offline Software
AlgA.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 "AlgA.h"
6 #include "StoreGate/ReadHandle.h"
8 
9 #include "GaudiKernel/ServiceHandle.h"
10 
11 #include <thread>
12 #include <chrono>
13 #include <ctime>
14 #include <memory>
15 
16 AlgA::AlgA( const std::string& name,
17  ISvcLocator* pSvcLocator ) :
18  ::AthAlgorithm( name, pSvcLocator )
19 {
20 }
21 
22 //---------------------------------------------------------------------------
23 
25 
27  ATH_MSG_DEBUG("initialize " << name());
28 
32 
33  return StatusCode::SUCCESS;
34 }
35 
36 //---------------------------------------------------------------------------
37 
39  ATH_MSG_DEBUG("finalize " << name());
40  return StatusCode::SUCCESS;
41 }
42 
43 //---------------------------------------------------------------------------
44 
46 
47  ATH_MSG_DEBUG("execute " << name());
48 
50  ATH_MSG_INFO(" EventInfo: r: " << evt->runNumber()
51  << " e: " << evt->eventNumber()
52  << " evt: " << Gaudi::Hive::currentContextEvt() );
53 
54 
55  unsigned int i = Gaudi::Hive::currentContextEvt() + 1;
56 
58  ATH_CHECK( wh1.record( std::make_unique<HiveDataObj>
59  ( 10000 +
60  evt->eventNumber()*100 +
61  i) )
62  );
63  ATH_MSG_INFO(" write: " << wh1.key() << " = " << wh1->val() );
64 
65 
67  ATH_CHECK( wh2.record( std::make_unique< HiveDataObj >( 10050+i ) ) );
68  ATH_MSG_INFO(" write: " << wh2.key() << " = " << wh2->val() );
69 
70  return StatusCode::SUCCESS;
71 
72 }
73 
AlgA::execute
virtual StatusCode execute() override
Definition: AlgA.cxx:45
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AlgA::m_wrh1
SG::WriteHandleKey< HiveDataObj > m_wrh1
Definition: AlgA.h:32
AlgA::finalize
virtual StatusCode finalize() override
Definition: AlgA.cxx:38
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
WriteHandle.h
Handle class for recording to StoreGate.
AlgA::m_wrh2
SG::WriteHandleKey< HiveDataObj > m_wrh2
Definition: AlgA.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:92
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
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
AlgA.h
AthAlgorithm
Definition: AthAlgorithm.h:47
AlgA::AlgA
AlgA(const std::string &name, ISvcLocator *pSvcLocator)
Definition: AlgA.cxx:16
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
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
AlgA::~AlgA
virtual ~AlgA()
Definition: AlgA.cxx:24
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
AlgA::initialize
virtual StatusCode initialize() override
Definition: AlgA.cxx:26
HiveDataObj::val
void val(int i)
Definition: HiveDataObj.h:22
ReadHandle.h
Handle class for reading from StoreGate.
AlgA::m_evt
SG::ReadHandleKey< xAOD::EventInfo > m_evt
Definition: AlgA.h:34