ATLAS Offline Software
Loading...
Searching...
No Matches
Algorithm.cxx File Reference
#include <EventLoop/Algorithm.h>
#include <EventLoop/StatusCode.h>
#include <EventLoop/Worker.h>
#include <RootCoreUtils/Assert.h>
#include <TH1.h>
#include <AsgMessaging/MsgLevel.h>
#include <AsgMessaging/MsgStream.h>
#include <stdexcept>
Include dependency graph for Algorithm.cxx:

Go to the source code of this file.

Functions

 ClassImp (EL::Algorithm) namespace EL

Function Documentation

◆ ClassImp()

ClassImp ( EL::Algorithm )
Author
Nils Krumnack

Definition at line 27 of file Algorithm.cxx.

30{
31 void Algorithm ::
32 testInvariant () const
33 {}
34
35
36
37 IWorker *Algorithm ::
38 wk () const
39 {
40 RCU_READ_INVARIANT (this);
41 return m_wk;
42 }
43
44
45
46 void Algorithm ::
47 book (const TH1& hist)
48 {
50 wk()->addOutput (hist.Clone());
51 }
52
53
54
55 TH1 *Algorithm ::
56 hist (const std::string& name) const
57 {
58 RCU_READ_INVARIANT (this);
59 return dynamic_cast<TH1*>(wk()->getOutputHist (name));
60 }
61
62
63
64 Algorithm ::
65 Algorithm ()
66 : m_wk (0)
67 {
68 RCU_NEW_INVARIANT (this);
69 }
70
71
72
73 Algorithm ::
74 ~Algorithm ()
75 {
76 delete m_msg;
77 }
78
79
80
81 asg::SgEvent *Algorithm ::
82 evtStore() const
83 {
85 if (m_evtStorePtr)
86 return m_evtStorePtr;
87 m_evtStore = asg::SgEvent (wk()->xaodEvent(), wk()->xaodStore());
88 m_evtStorePtr = &m_evtStore;
89 return m_evtStorePtr;
90 }
91
92
93
94 MsgStream& Algorithm ::
95 msg () const
96 {
97 RCU_READ_INVARIANT (this);
98 if (m_msg == 0 || m_msgName != GetName())
99 {
100 delete m_msg;
101 m_msg = nullptr;
102 m_msgName = GetName();
103 std::string name;
104 if (m_msgName.empty())
105 name = "UnnamedAlgorithm";
106 else
107 name = m_msgName;
108 m_msg = new MsgStream (name);
109 m_msg->setLevel (MSG::Level (m_msgLevel));
110 }
111 return *m_msg;
112 }
113
114
115
116 MsgStream& Algorithm ::
117 msg (int level) const
118 {
119 RCU_READ_INVARIANT (this);
120 MsgStream& result = msg ();
121 result << MSG::Level (level);
122 return result;
123 }
124
125
126
127 bool Algorithm ::
128 msgLvl (int lvl) const
129 {
130 RCU_READ_INVARIANT (this);
131 return m_msgLevel <= lvl;
132 }
133
134
135
136 void Algorithm ::
137 setMsgLevel (int level)
138 {
139 RCU_READ_INVARIANT (this);
140 if (m_msg)
141 m_msg->setLevel (MSG::Level (level));
142 m_msgLevel = level;
143 }
144
145
146
147 StatusCode Algorithm ::
148 setupJob (Job& /*job*/)
149 {
151 return StatusCode::SUCCESS;
152 }
153
154
155
156 StatusCode Algorithm ::
157 fileExecute ()
158 {
160 return StatusCode::SUCCESS;
161 }
162
163
164
165 StatusCode Algorithm ::
166 endOfFile ()
167 {
169 return StatusCode::SUCCESS;
170 }
171
172
173
174 StatusCode Algorithm ::
175 changeInput (bool /*firstFile*/)
176 {
178 return StatusCode::SUCCESS;
179 }
180
181
182
183 StatusCode Algorithm ::
184 initialize ()
185 {
187 return StatusCode::SUCCESS;
188 }
189
190
191
192 StatusCode Algorithm ::
193 histInitialize ()
194 {
196 return StatusCode::SUCCESS;
197 }
198
199
200
201 StatusCode Algorithm ::
202 execute ()
203 {
205 return StatusCode::SUCCESS;
206 }
207
208
209
210 StatusCode Algorithm ::
211 postExecute ()
212 {
214 return StatusCode::SUCCESS;
215 }
216
217
218
219 StatusCode Algorithm ::
220 finalize ()
221 {
223 return StatusCode::SUCCESS;
224 }
225
226
227
228 StatusCode Algorithm ::
229 histFinalize ()
230 {
232 return StatusCode::SUCCESS;
233 }
234
235
236
237 bool Algorithm ::
238 hasName (const std::string& name) const
239 {
241 return GetName() == name;
242 }
243
244
245
246 void Algorithm ::
247 sysSetupJob (Job& job)
248 {
250 if (setupJob (job) != StatusCode::SUCCESS)
251 throw std::runtime_error ("Algorithm::setupJob returned StatusCode::FAILURE");
252 }
253
254
255
256 const std::string& Algorithm ::
257 name() const
258 {
260 m_nameCache = GetName();
261 return m_nameCache;
262 }
263}
#define RCU_CHANGE_INVARIANT(x)
Definition Assert.h:219
#define RCU_NEW_INVARIANT(x)
Definition Assert.h:221
#define RCU_READ_INVARIANT(x)
Definition Assert.h:217
Wrapper for Event to make it look like StoreGate.
Definition SgEvent.h:44
::StatusCode StatusCode
StatusCode definition for legacy code.
MsgStream & msg
Definition testRead.cxx:32