ATLAS Offline Software
Loading...
Searching...
No Matches
Worker.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_WORKER_HH
6#define EVENT_LOOP_WORKER_HH
7
8#include <EventLoop/Global.h>
9
12#include <EventLoop/IWorker.h>
13#include <map>
14#include <memory>
17#include <Rtypes.h>
18
19namespace EL
20{
21 class Worker final : public IWorker, private Detail::ModuleData, private Detail::IInputModuleActions
22 {
23 //
24 // public interface
25 //
26
29 public:
30 void testInvariant () const;
31
32
35 public:
36 virtual ~Worker ();
37
38
48 public:
49 void addOutput (TObject *output_swallow) final override;
50
51
62 public:
63 void addOutputList (const std::string& name, TObject *output_swallow) override;
64
65
75 public:
76 TObject *getOutputHist (const std::string& name) const final override;
77
78
88 public:
89 TFile *getOutputFile (const std::string& label) const override;
90
91
105 public:
106 TFile *getOutputFileNull (const std::string& label) const override;
107
108
112 public:
113 ::StatusCode addTree( const TTree& tree,
114 const std::string& stream ) final override;
115
116
119 public:
120 TTree* getOutputTree( const std::string& name,
121 const std::string& stream ) const final override;
122
123
128 public:
129 const SH::MetaObject *metaData () const override;
130
131
134 public:
135 TTree *tree () const override;
136
137
140 public:
141 Long64_t treeEntry () const override;
142
143
146 public:
147 TFile *inputFile () const override;
148
149
152 public:
153 bool hasInputEvents () const override;
154
155
160 public:
161 std::string inputFileName () const override;
162
163
168 public:
169 TTree *triggerConfig () const override;
170
171
177 public:
178 xAOD::Event *xaodEvent () const override;
179 xAOD::TStore *xaodStore () const override;
180
181
186 public:
187 EL::Algorithm *getAlg (const std::string& name) const override;
188
189
197 public:
198 void skipEvent () override;
199
200
205 public:
206 virtual bool filterPassed () const noexcept final override;
207
211 public:
212 virtual void setFilterPassed (bool val_filterPassed) noexcept final override;
213
214
215
216 //
217 // public interface for the drivers
218 //
219
225 public:
226 Worker ();
227
228
229
230 //
231 // old interface for the drivers
232 //
233
237 public:
238 ::StatusCode directExecute (const SH::Sample& sample, const Job& job,
239 const std::string& location, const SH::MetaObject& options);
240
241
245 public:
246 ::StatusCode batchExecute (unsigned job_id, const char *confFile);
247
248 public:
249 ::StatusCode gridExecute (const std::string& sampleName, Long64_t SkipEvents, Long64_t nEventsPerJob);
250
251 private:
258
259
263 protected:
264 void setMetaData (const SH::MetaObject *val_metaData);
265
266
270 protected:
271 void setOutputHist (const std::string& val_outputTarget);
272
273
277 protected:
278 void setSegmentName (const std::string& val_segmentName);
279
280
296 protected:
297 void setJobConfig (JobConfig&& jobConfig);
298
299
310 protected:
312
313
319 protected:
321
322
333 protected:
335
336
347 protected:
348 ::StatusCode processEvents (EventRange& eventRange) override;
349
350
361 protected:
362 ::StatusCode openInputFile (const std::string& inputFileUrl) override;
363
364
369 protected:
370 ::StatusCode addOutputStream (const std::string& label,
372
373
378 protected:
379 Long64_t inputFileNumEntries () const override;
380
381
385 protected:
386 uint64_t eventsProcessed () const noexcept;
387
388
389
390 //
391 // private interface
392 //
393
395 private:
396 static bool fileOpenErrorFilter(int level, bool, const char*, const char *);
397
398
400 private:
402
403
405 private:
406 bool m_firstInputFile {true};
407
408
411 private:
412 bool m_newInputFile {false};
413
414
416 private:
417 std::string m_outputTarget;
418
419
421 private:
422 std::string m_segmentName;
423
424
426 private:
428
429
431 private:
432 bool m_firstEvent {true};
433
434
436 private:
437 std::vector<asg::AsgComponentConfig> m_moduleConfig;
438 };
439}
440
441#endif
the actions that Module::processInputs can perform
all data needed to manage a given output stream
the interface for algorithms to access IWorker
Definition IWorker.h:40
the job configuration that is independent of driver and dataset
Definition JobConfig.h:45
Definition Job.h:42
Long64_t treeEntry() const override
description: the entry in the tree we are reading guarantee: no-fail
Definition Worker.cxx:216
std::string inputFileName() const override
the name of the file we are reading the current tree from, without the path component
Definition Worker.cxx:241
@ EC_NOTFINISHED
Definition Worker.h:255
@ EC_BADINPUT
Definition Worker.h:256
void testInvariant() const
effects: test the invariant of this object guarantee: no-fail
Definition Worker.cxx:69
::StatusCode gridExecute(const std::string &sampleName, Long64_t SkipEvents, Long64_t nEventsPerJob)
Definition Worker.cxx:954
void addOutputList(const std::string &name, TObject *output_swallow) override
effects: add a given object to the output.
Definition Worker.cxx:102
::StatusCode addTree(const TTree &tree, const std::string &stream) final override
effects: adds a tree to an output file specified by the stream/label failures: Incorrect stream/label...
Definition Worker.cxx:155
TFile * inputFile() const override
description: the file we are reading the current tree from guarantee: no-fail
Definition Worker.cxx:225
void skipEvent() override
effects: skip the current event, i.e.
Definition Worker.cxx:306
TTree * getOutputTree(const std::string &name, const std::string &stream) const final override
effects: get the tree that was added to an output file earlier failures: Tree doesn't exist
Definition Worker.cxx:177
::StatusCode processEvents(EventRange &eventRange) override
process the given event range
Definition Worker.cxx:568
static bool fileOpenErrorFilter(int level, bool, const char *, const char *)
Error handler for file opening.
Definition Worker.cxx:646
void setOutputHist(const std::string &val_outputTarget)
set the histogram output list
Definition Worker.cxx:354
std::vector< asg::AsgComponentConfig > m_moduleConfig
the module configurations we use
Definition Worker.h:437
::StatusCode directExecute(const SH::Sample &sample, const Job &job, const std::string &location, const SH::MetaObject &options)
run the job
Definition Worker.cxx:817
::StatusCode addOutputStream(const std::string &label, Detail::OutputStreamData output)
effects: add another output file guarantee: strong failures: low level errors II failures: label alre...
Definition Worker.cxx:766
const SH::MetaObject * metaData() const override
description: the sample meta-data we are working on guarantee: no-fail invariant: metaData !...
Definition Worker.cxx:198
TFile * getOutputFile(const std::string &label) const override
effects: get the output file that goes into the dataset with the given label.
Definition Worker.cxx:131
TObject * getOutputHist(const std::string &name) const final override
get the output histogram with the given name
Definition Worker.cxx:119
virtual void setFilterPassed(bool val_filterPassed) noexcept final override
set the value of filterPassed
Definition Worker.cxx:324
std::string m_segmentName
the name of the segment we are processing
Definition Worker.h:422
::StatusCode finalize()
finalize the worker
Definition Worker.cxx:515
Worker()
standard constructor
Definition Worker.cxx:333
virtual bool filterPassed() const noexcept final override
whether the current algorithm passed its filter criterion for the current event
Definition Worker.cxx:315
bool m_firstInputFile
whether this is the first input file
Definition Worker.h:406
void setJobConfig(JobConfig &&jobConfig)
set the JobConfig
Definition Worker.cxx:374
::StatusCode openInputFile(const std::string &inputFileUrl) override
open the given input file without processing it
Definition Worker.cxx:668
EL::Algorithm * getAlg(const std::string &name) const override
effects: returns the algorithms with the given name or NULL if there is none guarantee: strong failur...
Definition Worker.cxx:292
uint64_t eventsProcessed() const noexcept
the number of events that have been processed
Definition Worker.cxx:808
bool m_newInputFile
whether this is a new input file (i.e.
Definition Worker.h:412
TTree * tree() const override
description: the tree we are running on guarantee: no-fail
Definition Worker.cxx:207
void setMetaData(const SH::MetaObject *val_metaData)
set the metaData
Definition Worker.cxx:343
TTree * triggerConfig() const override
description: the trigger config tree from the input file, or NULL if we did not find it guarantee: st...
Definition Worker.cxx:257
bool m_algorithmsInitialized
whether the algorithms are initialized
Definition Worker.h:427
std::vector< std::unique_ptr< Detail::Module > > m_modules
the list of modules we hold
Definition Worker.h:401
void addOutput(TObject *output_swallow) final override
effects: add an object to the output.
Definition Worker.cxx:88
virtual ~Worker()
effects: standard destructor guarantee: no-fail
Definition Worker.cxx:80
::StatusCode initialize()
initialize the worker
Definition Worker.cxx:386
TFile * getOutputFileNull(const std::string &label) const override
effects: get the output file that goes into the dataset with the given label.
Definition Worker.cxx:143
void setSegmentName(const std::string &val_segmentName)
set the segment name
Definition Worker.cxx:364
Long64_t inputFileNumEntries() const override
the number of events in the input file
Definition Worker.cxx:791
xAOD::TStore * xaodStore() const override
Definition Worker.cxx:280
::StatusCode processInputs()
process all the inputs
Definition Worker.cxx:500
::StatusCode batchExecute(unsigned job_id, const char *confFile)
effects: do what is needed to execute the given job segment guarantee: basic failures: job specific
Definition Worker.cxx:865
bool m_firstEvent
whether we are still to process the first event
Definition Worker.h:432
xAOD::Event * xaodEvent() const override
description: the xAOD event and store guarantee: strong failures: out of memory I failures: EventSvc ...
Definition Worker.cxx:268
bool hasInputEvents() const override
flag whether the most recently opened input file has events or not
Definition Worker.cxx:233
std::string m_outputTarget
the target file to which we will write the histogram output
Definition Worker.h:417
A class that manages meta-data to be associated with an object.
Definition MetaObject.h:48
a base class that manages a set of files belonging to a particular data set and the associated meta-d...
Definition Sample.h:49
STL class.
Base class for the event (xAOD::TEvent and xAOD::REvent) classes.
Definition Event.h:61
A relatively simple transient store for objects created in analysis.
Definition TStore.h:45
std::string label(const std::string &format, int i)
Definition label.h:19
This module defines the arguments passed from the BATCH driver to the BATCH worker.
::StatusCode StatusCode
StatusCode definition for legacy code.
STL namespace.
the data the EventLoop core classes are sharing with the Module implementation
Definition ModuleData.h:64
a range of events in a given file
Definition EventRange.h:22
#define private
Definition testRead.cxx:27