ATLAS Offline Software
AlgT.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 "AlgT.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 AlgT::AlgT( const std::string& name,
17  ISvcLocator* pSvcLocator ) :
18  ::AthAlgorithm( name, pSvcLocator )
19 {}
20 
21 //---------------------------------------------------------------------------
22 
24 
26  ATH_MSG_DEBUG("initialize " << name());
27 
28  if (m_rdh1.key() != "") ATH_CHECK( m_rdh1.initialize() );
31 
32  if ( m_tool1.retrieve().isFailure() ) {
34  (m_tool1.propertyName() << ": Failed to retrieve tool "
35  << m_tool1.type());
36  return StatusCode::FAILURE;
37  } else {
38  ATH_MSG_INFO("retreived " << m_tool1.name());
39  }
40 
41  if ( m_tool2.retrieve().isFailure() ) {
43  (m_tool2.propertyName() << ": Failed to retrieve tool "
44  << m_tool2.type());
45  return StatusCode::FAILURE;
46  }else {
47  ATH_MSG_INFO("retreived " << m_tool2.name());
48  }
49 
50 
51  if ( m_tool3.retrieve().isFailure() ) {
53  (m_tool3.propertyName() << ": Failed to retrieve tool "
54  << m_tool3.type());
55  return StatusCode::FAILURE;
56  }else {
57  ATH_MSG_INFO("retreived " << m_tool3.name());
58  }
59 
60 
61 
62  return StatusCode::SUCCESS;
63 }
64 
65 //---------------------------------------------------------------------------
66 
68  ATH_MSG_DEBUG("finalize " << name());
69  return StatusCode::SUCCESS;
70 }
71 
72 //---------------------------------------------------------------------------
73 
75 
76  ATH_MSG_DEBUG("execute " << name());
77 
79  ATH_MSG_INFO(" EventInfo: r: " << evt->runNumber()
80  << " e: " << evt->eventNumber() );
81 
82 
84  ATH_CHECK( wh1.record( std::make_unique<HiveDataObj> (10000 + evt->eventNumber())));
85 
86  ATH_MSG_INFO(" write: " << wh1.key() << " = " << wh1->val() );
87 
88 
89  ATH_CHECK(m_tool1->doSomething());
90  ATH_CHECK(m_tool2->doSomething());
91  ATH_CHECK(m_tool3->doSomething());
92 
93 
94  return StatusCode::SUCCESS;
95 
96 }
97 
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
AlgT::initialize
virtual StatusCode initialize() override
Definition: AlgT.cxx:25
AlgT::finalize
virtual StatusCode finalize() override
Definition: AlgT.cxx:67
WriteHandle.h
Handle class for recording to StoreGate.
AlgT::m_tool3
ToolHandle< IHiveTool > m_tool3
Definition: AlgT.h:42
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
AlgT::m_rdh1
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition: AlgT.h:36
AlgT::m_wrh1
SG::WriteHandleKey< HiveDataObj > m_wrh1
Definition: AlgT.h:37
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
AlgT::~AlgT
virtual ~AlgT()
Definition: AlgT.cxx:23
AthAlgorithm
Definition: AthAlgorithm.h:47
AlgT::AlgT
AlgT(const std::string &name, ISvcLocator *pSvcLocator)
Definition: AlgT.cxx:16
AlgT::m_tool1
ToolHandle< IHiveTool > m_tool1
Definition: AlgT.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
AlgT::execute
virtual StatusCode execute() override
Definition: AlgT.cxx:74
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
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
AlgT.h
HiveDataObj::val
void val(int i)
Definition: HiveDataObj.h:22
ReadHandle.h
Handle class for reading from StoreGate.
AlgT::m_evt
SG::ReadHandleKey< xAOD::EventInfo > m_evt
Definition: AlgT.h:35
AlgT::m_tool2
ToolHandle< IHiveTool > m_tool2
Definition: AlgT.h:41