ATLAS Offline Software
Loading...
Searching...
No Matches
CondReaderAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
10
11
12#include "CondReaderAlg.h"
15#include "GaudiKernel/Chrono.h"
16
17
18namespace DMTest {
19
20
26CondReaderAlg::CondReaderAlg (const std::string& name, ISvcLocator *pSvcLocator)
27 : AthReentrantAlgorithm (name, pSvcLocator),
28 m_chronoSvc ("ChronoStatSvc", name),
29 m_attrListKey ("/DMTest/TestAttrList"),
30 m_scondKey ("scond", "DMTest"),
31 m_s2Key ("/DMTest/S2"),
32 m_s3Key(""),
33 m_rltestKey (""),
34 m_tstestKey ("")
35{
36 declareProperty ("ChronoSvc", m_chronoSvc);
37 declareProperty ("AttrListKey", m_attrListKey);
38 declareProperty ("SCondKey", m_scondKey);
39 declareProperty ("S2Key", m_s2Key);
40 declareProperty ("S3Key", m_s3Key);
41 declareProperty ("RLTestKey", m_rltestKey);
42 declareProperty ("TSTestKey", m_tstestKey);
43 declareProperty ("Spins", m_spins = 0);
44}
45
46
51{
52 ATH_CHECK( m_chronoSvc.retrieve() );
53 ATH_CHECK( m_eventInfoKey.initialize() );
54 ATH_CHECK( m_attrListKey.initialize() );
55 ATH_CHECK( m_scondKey.initialize() );
56
57 // Allow running without POOL payload
58 if ( !m_s2Key.key().empty()) ATH_CHECK( m_s2Key.initialize() );
59
60 if ( !m_s3Key.key().empty()) ATH_CHECK( m_s3Key.initialize() );
61 if ( !m_rltestKey.key().empty()) ATH_CHECK( m_rltestKey.initialize() );
62 if ( !m_tstestKey.key().empty()) ATH_CHECK( m_tstestKey.initialize() );
63
64 return StatusCode::SUCCESS;
65}
66
67
71StatusCode CondReaderAlg::execute (const EventContext& ctx) const
72{
74
75 ATH_MSG_INFO ("Event " << eventInfo->eventNumber() <<
76 " LBN " << eventInfo->lumiBlock());
77
79 ATH_MSG_INFO (" xint " << (**attrList)["xint"]);
80
82 ATH_MSG_INFO (" scond " << s1->m_x );
83
84 if (!m_s2Key.key().empty()) {
86 ATH_MSG_INFO (" s2 " << s2->m_x );
87 }
88
89 if (!m_rltestKey.key().empty()) {
91 ATH_MSG_INFO (" rl " << (**rl)["xint"]);
92 }
93
94 if (!m_tstestKey.key().empty()) {
96 ATH_MSG_INFO (" ts " << (**ts)["xint"]);
97 }
98
99 if (!m_s3Key.key().empty()) {
101 ATH_MSG_INFO (" s3 " << s3->m_x );
102 }
103
104 {
105 std::string xint = "xint";
106 Chrono chrono (&*m_chronoSvc, "spin time");
107 int xx [[maybe_unused]] = 0;
108 for (size_t i = 0; i < m_spins; i++) {
109 {
111 // cppcheck-suppress internalAstError; work around cppcheck 2.0 parse failure
112 xx += (**attrList)[xint].template data<int>();
113 }
114 {
116 xx += s1->m_x;
117 }
118 {
120 xx += s2->m_x;
121 }
122 }
123 }
124
125 return StatusCode::SUCCESS;
126}
127
128
129} // namespace DMTest
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
Testing conditions handling.
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
Handle class for reading from StoreGate.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
An algorithm that can be simultaneously executed in multiple threads.
SG::ReadCondHandleKey< AthenaAttributeList > m_tstestKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
SG::ReadCondHandleKey< AthenaAttributeList > m_attrListKey
SG::ReadCondHandleKey< DMTest::S1 > m_scondKey
CondReaderAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
SG::ReadCondHandleKey< AthenaAttributeList > m_rltestKey
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
ServiceHandle< IChronoStatSvc > m_chronoSvc
SG::ReadCondHandleKey< DMTest::S3 > m_s3Key
SG::ReadCondHandleKey< DMTest::S1 > m_s2Key
int ts
Definition globals.cxx:24
Definition B.h:23