ATLAS Offline Software
Loading...
Searching...
No Matches
Algorithm.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7//
8// includes
9//
10
11#include <EventLoop/Algorithm.h>
12
14#include <EventLoop/Worker.h>
17#include <TH1.h>
18
21
22//
23// method implementations
24//
25
27
28namespace EL
29{
30 void Algorithm ::
31 testInvariant () const
32 {
33 RCU_INVARIANT (this != 0);
34 }
35
36
37
38 IWorker *Algorithm ::
39 wk () const
40 {
41 RCU_READ_INVARIANT (this);
42 return m_wk;
43 }
44
45
46
47 void Algorithm ::
48 book (const TH1& hist)
49 {
51 wk()->addOutput (hist.Clone());
52 }
53
54
55
56 TH1 *Algorithm ::
57 hist (const std::string& name) const
58 {
59 RCU_READ_INVARIANT (this);
60 return dynamic_cast<TH1*>(wk()->getOutputHist (name));
61 }
62
63
64
65 Algorithm ::
66 Algorithm ()
67 : m_wk (0)
68 {
69 RCU_NEW_INVARIANT (this);
70 }
71
72
73
74 Algorithm ::
75 ~Algorithm ()
76 {
77 delete m_msg;
78 }
79
80
81
82 asg::SgEvent *Algorithm ::
83 evtStore() const
84 {
86 if (m_evtStorePtr)
87 return m_evtStorePtr;
88 m_evtStore = asg::SgEvent (wk()->xaodEvent(), wk()->xaodStore());
89 m_evtStorePtr = &m_evtStore;
90 return m_evtStorePtr;
91 }
92
93
94
95 MsgStream& Algorithm ::
96 msg () const
97 {
98 RCU_READ_INVARIANT (this);
99 if (m_msg == 0 || m_msgName != GetName())
100 {
101 delete m_msg;
102 m_msg = nullptr;
103 m_msgName = GetName();
104 std::string name;
105 if (m_msgName.empty())
106 name = "UnnamedAlgorithm";
107 else
108 name = m_msgName;
109 m_msg = new MsgStream (name);
110 m_msg->setLevel (MSG::Level (m_msgLevel));
111 }
112 return *m_msg;
113 }
114
115
116
117 MsgStream& Algorithm ::
118 msg (int level) const
119 {
120 RCU_READ_INVARIANT (this);
121 MsgStream& result = msg ();
122 result << MSG::Level (level);
123 return result;
124 }
125
126
127
128 bool Algorithm ::
129 msgLvl (int lvl) const
130 {
131 RCU_READ_INVARIANT (this);
132 return m_msgLevel <= lvl;
133 }
134
135
136
137 void Algorithm ::
138 setMsgLevel (int level)
139 {
140 RCU_READ_INVARIANT (this);
141 if (m_msg)
142 m_msg->setLevel (MSG::Level (level));
143 m_msgLevel = level;
144 }
145
146
147
148 StatusCode Algorithm ::
149 setupJob (Job& /*job*/)
150 {
152 return StatusCode::SUCCESS;
153 }
154
155
156
157 StatusCode Algorithm ::
158 fileExecute ()
159 {
161 return StatusCode::SUCCESS;
162 }
163
164
165
166 StatusCode Algorithm ::
167 endOfFile ()
168 {
170 return StatusCode::SUCCESS;
171 }
172
173
174
175 StatusCode Algorithm ::
176 changeInput (bool /*firstFile*/)
177 {
179 return StatusCode::SUCCESS;
180 }
181
182
183
184 StatusCode Algorithm ::
185 initialize ()
186 {
188 return StatusCode::SUCCESS;
189 }
190
191
192
193 StatusCode Algorithm ::
194 histInitialize ()
195 {
197 return StatusCode::SUCCESS;
198 }
199
200
201
202 StatusCode Algorithm ::
203 execute ()
204 {
206 return StatusCode::SUCCESS;
207 }
208
209
210
211 StatusCode Algorithm ::
212 postExecute ()
213 {
215 return StatusCode::SUCCESS;
216 }
217
218
219
220 StatusCode Algorithm ::
221 finalize ()
222 {
224 return StatusCode::SUCCESS;
225 }
226
227
228
229 StatusCode Algorithm ::
230 histFinalize ()
231 {
233 return StatusCode::SUCCESS;
234 }
235
236
237
238 bool Algorithm ::
239 hasName (const std::string& name) const
240 {
242 return GetName() == name;
243 }
244
245
246
247 void Algorithm ::
248 sysSetupJob (Job& job)
249 {
251 if (setupJob (job) != StatusCode::SUCCESS)
252 RCU_THROW_MSG ("Algorithm::setupJob returned StatusCode::FAILURE");
253 }
254
255
256
257 const std::string& Algorithm ::
258 name() const
259 {
261 m_nameCache = GetName();
262 return m_nameCache;
263 }
264}
ClassImp(EL::Algorithm) namespace EL
Definition Algorithm.cxx:26
#define RCU_INVARIANT(x)
Definition Assert.h:196
#define RCU_CHANGE_INVARIANT(x)
Definition Assert.h:226
#define RCU_NEW_INVARIANT(x)
Definition Assert.h:228
#define RCU_READ_INVARIANT(x)
Definition Assert.h:224
Definition of message levels and a helper function.
#define RCU_THROW_MSG(message)
Definition PrintMsg.h:53
Wrapper for Event to make it look like StoreGate.
Definition SgEvent.h:44
This module defines the arguments passed from the BATCH driver to the BATCH worker.
::StatusCode StatusCode
StatusCode definition for legacy code.
MsgStream & msg
Definition testRead.cxx:32