ATLAS Offline Software
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>
14 #include <EventLoop/StatusCode.h>
15 
16 class TH1;
17 class MsgStream;
18 
19 namespace 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:
147 
148 
168  private:
170 
171 
177  private:
178  virtual StatusCode endOfFile ();
179 
180 
201  private:
202  virtual StatusCode changeInput (bool firstFile);
203 
204 
215  private:
216  virtual StatusCode initialize ();
217 
218 
226  private:
228 
229 
233  private:
234  virtual StatusCode execute ();
235 
236 
243  private:
245 
246 
253  private:
254  virtual StatusCode finalize ();
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
EL::Algorithm::sysSetupJob
void sysSetupJob(Job &job)
effects: give the algorithm a chance to intialize the job with anything this algorithm needs.
EL::Algorithm::fileExecute
virtual StatusCode fileExecute()
effects: do all the processing that needs to be done once per file
EL::Algorithm::testInvariant
void testInvariant() const
effects: test the invariant of this object guarantee: no-fail
EL::Algorithm::setMsgLevel
void setMsgLevel(int level)
set the message level for the message stream for this object
EL::Algorithm::execute
virtual StatusCode execute()
effects: process the next event guarantee: basic failures: algorithm dependent
EL::Algorithm::m_msgName
std::string m_msgName
the algorithm name for which the message stream has been instantiated
Definition: Algorithm.h:338
EL::Algorithm::msgLvl
bool msgLvl(int lvl) const
whether we are configured to print messages at the given level
INamedInterface.h
EL::Algorithm::m_evtStorePtr
asg::SgTEvent * m_evtStorePtr
the value of evtStore
Definition: Algorithm.h:325
EL::Algorithm::postExecute
virtual StatusCode postExecute()
effects: do the post-processing for the event guarantee: basic failures: algorithm dependent rational...
EL::Algorithm::hist
TH1 * hist(const std::string &name) const
get the histogram with the given name
EL::Algorithm::changeInput
virtual StatusCode changeInput(bool firstFile)
effects: do all changes to work with a new input file, e.g.
EL::Algorithm::finalize
virtual StatusCode finalize()
effects: do everything that needs to be done after completing work on this worker guarantee: basic fa...
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
EL::Algorithm::m_msg
MsgStream * m_msg
the message stream, if it has been instantiated
Definition: Algorithm.h:333
EL::Algorithm::evtStore
asg::SgTEvent * evtStore() const
get the (main) event store for this algorithm
EL::Algorithm
Definition: Algorithm.h:22
EL::Algorithm::m_nameCache
std::string m_nameCache
the cache for name
Definition: Algorithm.h:346
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EL::IWorker
the interface for algorithms to access IWorker
Definition: IWorker.h:40
EL::Algorithm::initialize
virtual StatusCode initialize()
effects: do everything that needs to be done before running the algorithm, e.g.
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
EL::Algorithm::wk
IWorker * wk() const
description: the worker that is controlling us guarantee: no-fail
EL::Algorithm::name
virtual const std::string & name() const
EL::Algorithm::msg
MsgStream & msg() const
messaging interface
EL::Algorithm::m_msgLevel
int m_msgLevel
the message level configured
Definition: Algorithm.h:342
asg::SgTEvent
Wrapper for TEvent to make it look like StoreGate.
Definition: SgTEvent.h:44
EL::Algorithm::Algorithm
Algorithm()
effects: standard default constructor guarantee: strong failures: low level errors I
EL::Algorithm::~Algorithm
~Algorithm()
effects: standard destructor guarantee: no-fail
EL::Algorithm::m_wk
IWorker * m_wk
Definition: Algorithm.h:321
EL::Algorithm::histInitialize
virtual StatusCode histInitialize()
effects: this is a pre-initialization routine that is called before changeInput is called.
EL::Algorithm::book
void book(const TH1 &hist)
book the given histogram
EL::Algorithm::msg
MsgStream & msg(int level) const
the message stream for this object, configured for the given level
TH1
Definition: rootspy.cxx:268
StatusCode.h
EL::Algorithm::hasName
virtual bool hasName(const std::string &name) const
returns: whether this algorithm has the given name guarantee: basic failures: algorithm dependent rat...
EL::Algorithm::ClassDef
ClassDef(Algorithm, 1)
EL::Algorithm::histFinalize
virtual StatusCode histFinalize()
effects: this is a post-initialization routine that is called after finalize has been called.
EL::Algorithm::endOfFile
virtual StatusCode endOfFile()
effects: do the post-processing for each input file guarantee: basic failures: algorithm dependent ra...
EL::Job
Definition: Job.h:51
test_interactive_athena.job
job
Definition: test_interactive_athena.py:6
EL::Algorithm::setupJob
virtual StatusCode setupJob(Job &job)
effects: give the algorithm a chance to intialize the job with anything this algorithm needs.
Global.h
EL::Algorithm::m_evtStore
asg::SgTEvent m_evtStore
when configured, the object returned by evtStore
Definition: Algorithm.h:329
SgTEvent.h
EL::AlgorithmWrapper
an IAlgorithmWrapper for AnaAlgorithm
Definition: AlgorithmWrapper.h:23