ATLAS Offline Software
Loading...
Searching...
No Matches
Algorithm.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef EVENT_LOOP_ALGORITHM_HH
6#define EVENT_LOOP_ALGORITHM_HH
7
8
9#include <EventLoop/Global.h>
10
11#include <TNamed.h>
13#include <AsgTools/SgTEvent.h>
15
16class TH1;
17class MsgStream;
18
19namespace EL
20{
21 class Algorithm : public TNamed, public INamedInterface
22 {
23 //
24 // public interface
25 //
26
29 public:
30 void testInvariant () const;
31
32
36 public:
38
39
42 public:
44
45
48 public:
49 IWorker *wk () const;
50
51
57 public:
58 void book (const TH1& hist);
59
60
66 public:
67 TH1 *hist (const std::string& name) const;
68
69
81 public:
83
84
85
95
101 public:
102 MsgStream& msg () const;
103
104
111 public:
112 MsgStream& msg (int level) const;
113
114
118 public:
119 bool msgLvl (int lvl) const;
120
121
126 public:
127 void setMsgLevel (int level);
128
130
131
132
133 //
134 // virtual interface
135 //
136
145 private:
146 virtual StatusCode setupJob (Job& job);
147
148
168 private:
170
171
177 private:
179
180
201 private:
202 virtual StatusCode changeInput (bool firstFile);
203
204
215 private:
217
218
226 private:
228
229
233 private:
234 virtual StatusCode execute ();
235
236
243 private:
245
246
253 private:
255
256
263 private:
265
266
273 private:
274 virtual bool hasName (const std::string& name) const;
275
276
277
278 //
279 // inherited interface
280 //
281
282 public:
283 virtual const std::string& name() const;
284
285
286 //
287 // friend interface for Job
288 //
289
290#if 1
291 friend class AlgorithmWrapper;
292 friend class Job;
293 private:
294#else
295 public:
296#endif
297
306 void sysSetupJob (Job& job);
307
308
309
310 //
311 // private interface
312 //
313
317 friend class AlgorithmWrapper;
318
319 // description: members directly corresponding to accessors
320 private:
322
324 private:
325 mutable asg::SgTEvent *m_evtStorePtr = nullptr;
326
328 private:
330
332 private:
333 mutable MsgStream *m_msg = nullptr;
334
337 private:
338 mutable std::string m_msgName;
339
341 private:
342 int m_msgLevel = 3;
343
345 private:
346 mutable std::string m_nameCache;
347
349 };
350}
351
352#endif
TH1 * hist(const std::string &name) const
get the histogram with the given name
std::string m_nameCache
the cache for name
Definition Algorithm.h:346
void sysSetupJob(Job &job)
effects: give the algorithm a chance to intialize the job with anything this algorithm needs.
virtual const std::string & name() const
virtual StatusCode postExecute()
effects: do the post-processing for the event guarantee: basic failures: algorithm dependent rational...
friend class AlgorithmWrapper
rationale: the worker is essentially controlling the algorithm.
Definition Algorithm.h:291
IWorker * m_wk
Definition Algorithm.h:321
MsgStream & msg() const
messaging interface
virtual StatusCode execute()
effects: process the next event guarantee: basic failures: algorithm dependent
virtual StatusCode finalize()
effects: do everything that needs to be done after completing work on this worker guarantee: basic fa...
virtual StatusCode histInitialize()
effects: this is a pre-initialization routine that is called before changeInput is called.
virtual StatusCode endOfFile()
effects: do the post-processing for each input file guarantee: basic failures: algorithm dependent ra...
virtual StatusCode changeInput(bool firstFile)
effects: do all changes to work with a new input file, e.g.
std::string m_msgName
the algorithm name for which the message stream has been instantiated
Definition Algorithm.h:338
MsgStream * m_msg
the message stream, if it has been instantiated
Definition Algorithm.h:333
virtual StatusCode setupJob(Job &job)
effects: give the algorithm a chance to intialize the job with anything this algorithm needs.
~Algorithm()
effects: standard destructor guarantee: no-fail
MsgStream & msg(int level) const
the message stream for this object, configured for the given level
asg::SgTEvent * m_evtStorePtr
the value of evtStore
Definition Algorithm.h:325
void setMsgLevel(int level)
set the message level for the message stream for this object
friend class Job
Definition Algorithm.h:292
void book(const TH1 &hist)
book the given histogram
void testInvariant() const
effects: test the invariant of this object guarantee: no-fail
ClassDef(Algorithm, 1)
int m_msgLevel
the message level configured
Definition Algorithm.h:342
asg::SgTEvent m_evtStore
when configured, the object returned by evtStore
Definition Algorithm.h:329
virtual StatusCode histFinalize()
effects: this is a post-initialization routine that is called after finalize has been called.
Algorithm()
effects: standard default constructor guarantee: strong failures: low level errors I
asg::SgTEvent * evtStore() const
get the (main) event store for this algorithm
virtual StatusCode initialize()
effects: do everything that needs to be done before running the algorithm, e.g.
bool msgLvl(int lvl) const
whether we are configured to print messages at the given level
virtual bool hasName(const std::string &name) const
returns: whether this algorithm has the given name guarantee: basic failures: algorithm dependent rat...
virtual StatusCode fileExecute()
effects: do all the processing that needs to be done once per file
IWorker * wk() const
description: the worker that is controlling us guarantee: no-fail
the interface for algorithms to access IWorker
Definition IWorker.h:40
Wrapper for TEvent to make it look like StoreGate.
Definition SgTEvent.h:44
This module defines the arguments passed from the BATCH driver to the BATCH worker.
::StatusCode StatusCode
StatusCode definition for legacy code.