ATLAS Offline Software
Loading...
Searching...
No Matches
AlgE.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "AlgE.h"
8
9AlgE::AlgE( const std::string& name,
10 ISvcLocator* pSvcLocator ) :
11 ::AthAlgorithm( name, pSvcLocator )
12{
13}
14
15//---------------------------------------------------------------------------
16
17StatusCode AlgE::initialize() {
18 ATH_MSG_DEBUG("initialize " << name());
19
20 ATH_CHECK( m_rdh1.initialize() );
21 ATH_CHECK( m_rch1.initialize() );
22 ATH_CHECK( m_rch2.initialize() );
23 ATH_CHECK( m_rch3.initialize() );
24 ATH_CHECK( m_rch4.initialize() );
25
26 ATH_MSG_INFO( "m_rdh1 id: " << m_rdh1.fullKey() );
27 ATH_MSG_INFO( "m_rch1 id: " << m_rch1.fullKey() );
28 ATH_MSG_INFO( "m_rch2 id: " << m_rch2.fullKey() );
29 ATH_MSG_INFO( "m_rch3 id: " << m_rch3.fullKey() );
30 ATH_MSG_INFO( "m_rch4 id: " << m_rch4.fullKey() );
31
32 return StatusCode::SUCCESS;
33}
34
35//---------------------------------------------------------------------------
36
37StatusCode AlgE::execute() {
38 ATH_MSG_DEBUG("execute " << name());
39
41 if (!rh1.isValid()) {
42 ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << m_rdh1.key());
43 return StatusCode::FAILURE;
44 }
45
46 ATH_MSG_INFO(" read: " << rh1.key() << " = " << rh1->val() );
47
52
53 EventIDBase t( getContext().eventID() );
54
55
56 float val {0.0};
57
58 const CondDataObj* cdo = *ch1;
59 if (cdo != 0) {
60 ATH_MSG_INFO(" CDO1: " << *cdo );
61 val += cdo->val();
62 } else {
63 ATH_MSG_ERROR(" CDO1 ptr == zero");
64 }
65
66 const CondDataObjY* cdoy = *ch2;
67 if (cdoy != 0) {
68 ATH_MSG_INFO(" CDO2: " << *cdoy );
69 val += cdoy->val();
70 } else {
71 ATH_MSG_ERROR(" CDO2 ptr == zero");
72 }
73
74 cdoy = *ch3;
75 if (cdoy != 0) {
76 ATH_MSG_INFO(" CDO3: " << *cdoy );
77 val += cdoy->val();
78 } else {
79 ATH_MSG_ERROR(" CDO3 ptr == zero");
80 }
81
82 const CondDataObjZ *cdoz = *ch4;
83 if (cdoz != 0) {
84 ATH_MSG_INFO(" CDO4: " << *cdoz );
85
86 if (cdoz->val() != val) {
87 ATH_MSG_ERROR(" value of CDO4 is incorrect ");
88 }
89
90 } else {
91 ATH_MSG_ERROR(" CDO# ptr == zero");
92 }
93
94
95 ATH_MSG_INFO("TEST: " << getContext().eventID().event_number() << " "
96 << rh1->val() << " " << **ch1 << " " << **ch2 << " " << **ch3
97 << " " << **ch4);
98
99 return StatusCode::SUCCESS;
100
101}
102
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
Handle class for reading from StoreGate.
SG::ReadCondHandleKey< CondDataObjY > m_rch3
Definition AlgE.h:35
virtual StatusCode initialize() override
Definition AlgE.cxx:17
virtual StatusCode execute() override
Definition AlgE.cxx:37
AlgE(const std::string &name, ISvcLocator *pSvcLocator)
Definition AlgE.cxx:9
SG::ReadHandleKey< HiveDataObj > m_rdh1
Definition AlgE.h:31
SG::ReadCondHandleKey< CondDataObj > m_rch1
Definition AlgE.h:33
SG::ReadCondHandleKey< CondDataObjY > m_rch2
Definition AlgE.h:34
SG::ReadCondHandleKey< CondDataObjZ > m_rch4
Definition AlgE.h:37
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
void val(float f)
void val(float f)
void val(int i)
Definition CondDataObj.h:16
virtual bool isValid() override final
Can the handle be successfully dereferenced?
virtual const std::string & key() const override final
Return the StoreGate ID for the referenced object.