ATLAS Offline Software
Loading...
Searching...
No Matches
Algorithm.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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/SgEvent.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 // we never copy algorithms, they get created using TObject::Clone()
46 // and their dicitionary
47 public:
48 Algorithm (const Algorithm&) = delete;
49 Algorithm& operator = (const Algorithm&) = delete;
50
51
54 public:
55 IWorker *wk () const;
56
57
63 public:
64 void book (const TH1& hist);
65
66
72 public:
73 TH1 *hist (const std::string& name) const;
74
75
87 public:
89
90
91
101
107 public:
108 MsgStream& msg () const;
109
110
117 public:
118 MsgStream& msg (int level) const;
119
120
124 public:
125 bool msgLvl (int lvl) const;
126
127
132 public:
133 void setMsgLevel (int level);
134
136
137
138
139 //
140 // virtual interface
141 //
142
151 private:
152 virtual StatusCode setupJob (Job& job);
153
154
174 private:
176
177
183 private:
185
186
207 private:
208 virtual StatusCode changeInput (bool firstFile);
209
210
221 private:
223
224
232 private:
234
235
239 private:
240 virtual StatusCode execute ();
241
242
249 private:
251
252
259 private:
261
262
269 private:
271
272
279 private:
280 virtual bool hasName (const std::string& name) const;
281
282
283
284 //
285 // inherited interface
286 //
287
288 public:
289 virtual const std::string& name() const;
290
291
292 //
293 // friend interface for Job
294 //
295
296 friend class AlgorithmWrapper;
297 friend class Job;
298 private:
299
308 void sysSetupJob (Job& job);
309
310
311
312 //
313 // private interface
314 //
315
316 // description: members directly corresponding to accessors
317 private:
319
321 private:
322 mutable asg::SgEvent *m_evtStorePtr = nullptr;
323
325 private:
327
329 private:
330 mutable MsgStream *m_msg = nullptr;
331
334 private:
335 mutable std::string m_msgName;
336
338 private:
339 int m_msgLevel = 3;
340
342 private:
343 mutable std::string m_nameCache;
344
346 };
347}
348
349#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:343
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...
IWorker * m_wk
Definition Algorithm.h:318
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:335
MsgStream * m_msg
the message stream, if it has been instantiated
Definition Algorithm.h:330
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
void setMsgLevel(int level)
set the message level for the message stream for this object
friend class Job
Definition Algorithm.h:297
asg::SgEvent * m_evtStorePtr
the value of evtStore
Definition Algorithm.h:322
void book(const TH1 &hist)
book the given histogram
void testInvariant() const
effects: test the invariant of this object guarantee: no-fail
friend class AlgorithmWrapper
Definition Algorithm.h:296
ClassDef(Algorithm, 1)
asg::SgEvent m_evtStore
when configured, the object returned by evtStore
Definition Algorithm.h:326
int m_msgLevel
the message level configured
Definition Algorithm.h:339
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
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
Algorithm & operator=(const Algorithm &)=delete
Algorithm(const Algorithm &)=delete
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
asg::SgEvent * evtStore() const
get the (main) event store for this algorithm
the interface for algorithms to access IWorker
Definition IWorker.h:40
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.