ATLAS Offline Software
AlgE.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 "AlgE.h"
6 #include "StoreGate/ReadHandle.h"
8 
9 #include "GaudiKernel/ServiceHandle.h"
10 #include <thread>
11 #include <chrono>
12 #include <memory>
13 
14 
15 AlgE::AlgE( 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 
35 
36  ATH_MSG_INFO( "m_rdh1 id: " << m_rdh1.fullKey() );
37  ATH_MSG_INFO( "m_rch1 id: " << m_rch1.fullKey() );
38  ATH_MSG_INFO( "m_rch2 id: " << m_rch2.fullKey() );
39  ATH_MSG_INFO( "m_rch3 id: " << m_rch3.fullKey() );
40  ATH_MSG_INFO( "m_rch4 id: " << m_rch4.fullKey() );
41 
42  return StatusCode::SUCCESS;
43 }
44 
45 //---------------------------------------------------------------------------
46 
48  ATH_MSG_DEBUG("finalize " << name());
49  return StatusCode::SUCCESS;
50 }
51 
52 //---------------------------------------------------------------------------
53 
55  ATH_MSG_DEBUG("execute " << name());
56 
58  if (!rh1.isValid()) {
59  ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << m_rdh1.key());
60  return StatusCode::FAILURE;
61  }
62 
63  ATH_MSG_INFO(" read: " << rh1.key() << " = " << rh1->val() );
64 
69 
70  EventIDBase t( getContext().eventID() );
71 
72 
73  float val {0.0};
74 
75  const CondDataObj* cdo = *ch1;
76  if (cdo != 0) {
77  ATH_MSG_INFO(" CDO1: " << *cdo );
78  val += cdo->val();
79  } else {
80  ATH_MSG_ERROR(" CDO1 ptr == zero");
81  }
82 
83  const CondDataObjY* cdoy = *ch2;
84  if (cdoy != 0) {
85  ATH_MSG_INFO(" CDO2: " << *cdoy );
86  val += cdoy->val();
87  } else {
88  ATH_MSG_ERROR(" CDO2 ptr == zero");
89  }
90 
91  cdoy = *ch3;
92  if (cdoy != 0) {
93  ATH_MSG_INFO(" CDO3: " << *cdoy );
94  val += cdoy->val();
95  } else {
96  ATH_MSG_ERROR(" CDO3 ptr == zero");
97  }
98 
99  const CondDataObjZ *cdoz = *ch4;
100  if (cdoz != 0) {
101  ATH_MSG_INFO(" CDO4: " << *cdoz );
102 
103  if (cdoz->val() != val) {
104  ATH_MSG_ERROR(" value of CDO4 is incorrect ");
105  }
106 
107  } else {
108  ATH_MSG_ERROR(" CDO# ptr == zero");
109  }
110 
111 
112  ATH_MSG_INFO("TEST: " << getContext().eventID().event_number() << " "
113  << rh1->val() << " " << **ch1 << " " << **ch2 << " " << **ch3
114  << " " << **ch4);
115 
116  return StatusCode::SUCCESS;
117 
118 }
119 
CondDataObjZ::val
void val(float f)
Definition: CondDataObjZ.h:16
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CondDataObjZ
Definition: CondDataObjZ.h:8
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
CondDataObjY::val
void val(float f)
Definition: CondDataObjY.h:16
AlgE::m_rch2
SG::ReadCondHandleKey< CondDataObjY > m_rch2
Definition: AlgE.h:37
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
AlgE.h
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
CondDataObjY
Definition: CondDataObjY.h:8
AlgE::m_rch4
SG::ReadCondHandleKey< CondDataObjZ > m_rch4
Definition: AlgE.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
AlgE::finalize
virtual StatusCode finalize() override
Definition: AlgE.cxx:47
AlgE::AlgE
AlgE(const std::string &name, ISvcLocator *pSvcLocator)
Definition: AlgE.cxx:15
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
AlgE::m_rch1
SG::ReadCondHandleKey< CondDataObj > m_rch1
Definition: AlgE.h:36
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?
AlgE::~AlgE
virtual ~AlgE()
Definition: AlgE.cxx:23
AlgE::execute
virtual StatusCode execute() override
Definition: AlgE.cxx:54
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
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
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
AlgE::m_rdh1
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition: AlgE.h:34
AlgE::m_rch3
SG::ReadCondHandleKey< CondDataObjY > m_rch3
Definition: AlgE.h:38
CondDataObj::val
void val(int i)
Definition: CondDataObj.h:16
HiveDataObj::val
void val(int i)
Definition: HiveDataObj.h:22
ReadHandle.h
Handle class for reading from StoreGate.
AlgE::initialize
virtual StatusCode initialize() override
Definition: AlgE.cxx:27