ATLAS Offline Software
AlgD.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 "AlgD.h"
6 #include "StoreGate/ReadHandle.h"
8 
9 #include "GaudiKernel/ServiceHandle.h"
10 #include <thread>
11 #include <chrono>
12 #include <memory>
13 
14 
15 AlgD::AlgD( const std::string& name,
16  ISvcLocator* pSvcLocator ) :
17  ::AthAlgorithm( name, pSvcLocator )
18 {
19 }
20 
21 //---------------------------------------------------------------------------
22 
24 
25 //---------------------------------------------------------------------------
26 
28  ATH_MSG_DEBUG("initialize " << name());
29 
33 
34  ATH_MSG_INFO( "m_rdh1 id: " << m_rdh1.fullKey() );
35  ATH_MSG_INFO( "m_rch1 id: " << m_rch1.fullKey() );
36  ATH_MSG_INFO( "m_rch2 id: " << m_rch2.fullKey() );
37 
38  return StatusCode::SUCCESS;
39 }
40 
41 //---------------------------------------------------------------------------
42 
44  ATH_MSG_DEBUG("finalize " << name());
45  return StatusCode::SUCCESS;
46 }
47 
48 //---------------------------------------------------------------------------
49 
51  ATH_MSG_DEBUG("execute " << name());
52 
54  if (!rh1.isValid()) {
55  ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << m_rdh1.key());
56  return StatusCode::FAILURE;
57  }
58 
59  ATH_MSG_INFO(" read: " << rh1.key() << " = " << rh1->val() );
60 
63 
64  EventIDBase t( getContext().eventID() );
65 
66  // const CondDataObj *cdo = m_rch.retrieve(t);
67  // const CondDataObj *cdo = m_rch.retrieve();
68  const CondDataObj *cdo = *ch1;
69  if (cdo != 0) {
70  ATH_MSG_INFO(" CDO1: " << *cdo );
71  } else {
72  ATH_MSG_ERROR(" CDO1 ptr == zero");
73  }
74 
75  cdo = *ch2;
76  if (cdo != 0) {
77  ATH_MSG_INFO(" CDO2: " << *cdo );
78  } else {
79  ATH_MSG_ERROR(" CDO2 ptr == zero");
80  }
81 
82  ATH_MSG_INFO("test: " << getContext().eventID().event_number() << " "
83  << rh1->val() << " " << **ch1 << " " << **ch2);
84 
85  return StatusCode::SUCCESS;
86 
87 }
88 
AlgD::initialize
virtual StatusCode initialize() override
Definition: AlgD.cxx:27
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AlgD::m_rdh1
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition: AlgD.h:32
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AlgD.h
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
ReadCondHandle.h
AlgD::finalize
virtual StatusCode finalize() override
Definition: AlgD.cxx:43
AlgD::AlgD
AlgD(const std::string &name, ISvcLocator *pSvcLocator)
Definition: AlgD.cxx:15
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
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
AlgD::m_rch1
SG::ReadCondHandleKey< CondDataObj > m_rch1
Definition: AlgD.h:34
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CondDataObj
Definition: CondDataObj.h:8
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
AthAlgorithm
Definition: AthAlgorithm.h:47
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
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
AlgD::execute
virtual StatusCode execute() override
Definition: AlgD.cxx:50
AlgD::m_rch2
SG::ReadCondHandleKey< CondDataObj > m_rch2
Definition: AlgD.h:35
HiveDataObj::val
void val(int i)
Definition: HiveDataObj.h:22
ReadHandle.h
Handle class for reading from StoreGate.
AlgD::~AlgD
virtual ~AlgD()
Definition: AlgD.cxx:23