ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
EL::Worker Class Referencefinal

#include <Worker.h>

Inheritance diagram for EL::Worker:
Collaboration diagram for EL::Worker:

Public Member Functions

void testInvariant () const
 effects: test the invariant of this object guarantee: no-fail More...
 
virtual ~Worker ()
 effects: standard destructor guarantee: no-fail More...
 
void addOutput (TObject *output_swallow) final override
 effects: add an object to the output. More...
 
void addOutputList (const std::string &name, TObject *output_swallow) override
 effects: add a given object to the output. More...
 
TObject * getOutputHist (const std::string &name) const final override
 get the output histogram with the given name More...
 
TFile * getOutputFile (const std::string &label) const override
 effects: get the output file that goes into the dataset with the given label. More...
 
TFile * getOutputFileNull (const std::string &label) const override
 effects: get the output file that goes into the dataset with the given label. More...
 
::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 specified, called at the wrong time note: See getOutputFile for failure types... More...
 
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 More...
 
const SH::MetaObjectmetaData () const override
 description: the sample meta-data we are working on guarantee: no-fail invariant: metaData != 0 rationale: this can be used for accessing sample meta-data More...
 
TTree * tree () const override
 description: the tree we are running on guarantee: no-fail More...
 
Long64_t treeEntry () const override
 description: the entry in the tree we are reading guarantee: no-fail More...
 
TFile * inputFile () const override
 description: the file we are reading the current tree from guarantee: no-fail More...
 
std::string inputFileName () const override
 the name of the file we are reading the current tree from, without the path component More...
 
TTree * triggerConfig () const override
 description: the trigger config tree from the input file, or NULL if we did not find it guarantee: strong failures: i/o errors More...
 
xAOD::TEventxaodEvent () const override
 description: the xAOD event and store guarantee: strong failures: out of memory I failures: TEventSvc not configured postcondition: result != 0 More...
 
xAOD::TStorexaodStore () const override
 
EL::AlgorithmgetAlg (const std::string &name) const override
 effects: returns the algorithms with the given name or NULL if there is none guarantee: strong failures: out of memory II More...
 
void skipEvent () override
 effects: skip the current event, i.e. More...
 
virtual bool filterPassed () const noexcept final override
 whether the current algorithm passed its filter criterion for the current event More...
 
virtual void setFilterPassed (bool val_filterPassed) noexcept final override
 set the value of filterPassed More...
 
 Worker ()
 standard constructor More...
 
::StatusCode directExecute (const SH::SamplePtr &sample, const Job &job, const std::string &location, const SH::MetaObject &options)
 run the job More...
 
::StatusCode batchExecute (unsigned job_id, const char *confFile)
 effects: do what is needed to execute the given job segment guarantee: basic failures: job specific More...
 
::StatusCode gridExecute (const std::string &sampleName, Long64_t SkipEvents, Long64_t nEventsPerJob)
 

Protected Member Functions

void setMetaData (const SH::MetaObject *val_metaData)
 set the metaData More...
 
void setOutputHist (const std::string &val_outputTarget)
 set the histogram output list More...
 
void setSegmentName (const std::string &val_segmentName)
 set the segment name More...
 
void setJobConfig (JobConfig &&jobConfig)
 set the JobConfig More...
 
void addModule (std::unique_ptr< Detail::Module > module)
 add the given module to this worker More...
 
::StatusCode initialize ()
 initialize the worker More...
 
::StatusCode processInputs ()
 process all the inputs More...
 
::StatusCode finalize ()
 finalize the worker More...
 
::StatusCode processEvents (EventRange &eventRange) override
 process the given event range More...
 
::StatusCode openInputFile (const std::string &inputFileUrl) override
 open the given input file without processing it More...
 
::StatusCode addOutputStream (const std::string &label, Detail::OutputStreamData output)
 effects: add another output file guarantee: strong failures: low level errors II failures: label already used More...
 
Long64_t inputFileNumEntries () const override
 the number of events in the input file More...
 
uint64_t eventsProcessed () const noexcept
 the number of events that have been processed More...
 

Private Types

enum  GridErrorCodes { EC_FAIL = 220, EC_ABORT = 221, EC_NOTFINISHED = 222, EC_BADINPUT = 223 }
 
typedef std::map< std::string, TH1 * >::const_iterator OutputHistMapIter
 the output map More...
 
typedef std::map< std::pair< std::string, std::string >, TTree * >::const_iterator OutputTreeMapIter
 description: the list of output trees More...
 

Private Member Functions

void gridCreateJobSummary (uint64_t eventsProcessed)
 
void addOutput (std::unique_ptr< TObject > output)
 add the given output object to the histogram output stream More...
 

Static Private Member Functions

static bool fileOpenErrorFilter (int level, bool, const char *, const char *)
 Error handler for file opening. More...
 

Private Attributes

std::map< std::string, TH1 * > m_outputHistMap
 
std::map< std::pair< std::string, std::string >, TTree * > m_outputTreeMap
 
std::vector< std::unique_ptr< Detail::Module > > m_modules
 the list of modules we hold More...
 
bool m_newInputFile {false}
 whether this is a new input file (i.e. More...
 
std::string m_outputTarget
 the target file to which we will write the histogram output More...
 
std::string m_segmentName
 the name of the segment we are processing More...
 
bool m_algorithmsInitialized {false}
 whether the algorithms are initialized More...
 
bool m_firstEvent {true}
 whether we are still to process the first event More...
 
std::vector< Detail::AlgorithmDatam_algs
 the list of algorithms More...
 
std::string m_inputFileUrl
 the input file url of the currently opened file More...
 
std::unique_ptr< TFile > m_inputFile
 the input file pointer of the currently opened filed More...
 
TTree * m_inputTree {nullptr}
 the (main) tree in the input file More...
 
uint64_t m_inputTreeEntry {0}
 the entry in the input tree we are currently looking at More...
 
bool m_skipEvent = false
 whether we are skipping the current event More...
 
const SH::MetaObjectm_metaData {nullptr}
 the meta-data we use More...
 
uint64_t m_eventsProcessed {0}
 the number of events that have been processed More...
 
OutputStreamData * m_histOutput {nullptr}
 the histogram output stream More...
 
std::unique_ptr< TTree > m_jobStats
 Tree saving per-job statistics information. More...
 
xAOD::TEventm_tevent {nullptr}
 the TEvent structure, if we use one More...
 
xAOD::TStorem_tstore {nullptr}
 the TStore structure, if we use one More...
 
asg::SgTEventm_evtStore {nullptr}
 the SgTEvent structure, if we use one More...
 
Workerm_worker {nullptr}
 the worker (to pass on to the algorithms) More...
 
std::map< std::string, std::shared_ptr< Detail::OutputStreamData > > m_outputs
 the list of output files More...
 

Detailed Description

Definition at line 24 of file Worker.h.

Member Typedef Documentation

◆ OutputHistMapIter

typedef std::map<std::string,TH1*>::const_iterator EL::Worker::OutputHistMapIter
private

the output map

Definition at line 410 of file Worker.h.

◆ OutputTreeMapIter

typedef std::map<std::pair<std::string,std::string>,TTree*>::const_iterator EL::Worker::OutputTreeMapIter
private

description: the list of output trees

Definition at line 417 of file Worker.h.

Member Enumeration Documentation

◆ GridErrorCodes

Enumerator
EC_FAIL 
EC_ABORT 
EC_NOTFINISHED 
EC_BADINPUT 

Definition at line 249 of file Worker.h.

249  {
250  EC_FAIL = 220,
251  EC_ABORT = 221,
252  EC_NOTFINISHED = 222,
253  EC_BADINPUT = 223
254  };

Constructor & Destructor Documentation

◆ ~Worker()

EL::Worker::~Worker ( )
virtual

effects: standard destructor guarantee: no-fail

Definition at line 79 of file Worker.cxx.

81  {
82  RCU_DESTROY_INVARIANT (this);
83  }

◆ Worker()

EL::Worker::Worker ( )

standard constructor

Guarantee
strong
Failures
out of memory I

Definition at line 323 of file Worker.cxx.

325  {
326  m_worker = this;
327 
328  RCU_NEW_INVARIANT (this);
329  }

Member Function Documentation

◆ addModule()

void EL::Worker::addModule ( std::unique_ptr< Detail::Module module)
protected

add the given module to this worker

Guarantee
strong
Failures
out of memory I

Definition at line 760 of file Worker.cxx.

762  {
763  RCU_CHANGE_INVARIANT (this);
764  RCU_REQUIRE (module != nullptr);
765  m_modules.push_back (std::move (module));
766  }

◆ addOutput() [1/2]

void EL::Detail::ModuleData::addOutput ( std::unique_ptr< TObject >  output)
inherited

add the given output object to the histogram output stream

Guarantee
basic
Failures
out of memory II

Definition at line 33 of file ModuleData.cxx.

35  {
36  RCU_ASSERT (m_histOutput != nullptr);
37  m_histOutput->addOutput (std::move (output));
38  }

◆ addOutput() [2/2]

void EL::Worker::addOutput ( TObject *  output_swallow)
finaloverridevirtual

effects: add an object to the output.

the worker takes over ownership of the object, but the caller may maintain a reference to it guarantee: basic, argument is always swallowed failures: out of memory I requires: output_swallow != 0 warning: so far I placed no requirements on the output objects. I may do that at a later stage though, possibly breaking existing code.

Implements EL::IHistogramWorker.

Definition at line 87 of file Worker.cxx.

89  {
90  std::unique_ptr<TObject> output (output_swallow);
91 
92  RCU_CHANGE_INVARIANT (this);
93  RCU_REQUIRE_SOFT (output_swallow != 0);
94 
95  RCU::SetDirectory (output_swallow, 0);
96  ModuleData::addOutput (std::move (output));
97  }

◆ addOutputList()

void EL::Worker::addOutputList ( const std::string &  name,
TObject *  output_swallow 
)
overridevirtual

effects: add a given object to the output.

instead of trying to merge the outputs from multiple jobs the output file will contain a TList of the given name with the objects from all the output. guarantee: basic, argument is always swallowed failures: out of memory II requires: output_swallow != 0 rationale: This was primarily build to allow the GRL output to be collected from EventLoop jobs, but it can be used for any kind of output that can not or should not be merged.

Implements EL::IWorker.

Definition at line 101 of file Worker.cxx.

103  {
104  std::unique_ptr<TObject> output (output_swallow);
105 
106  RCU_CHANGE_INVARIANT (this);
107  RCU_REQUIRE_SOFT (output_swallow != 0);
108 
109  RCU::SetDirectory (output_swallow, 0);
110  std::unique_ptr<TList> list (new TList);
111  list->SetName (name.c_str());
112  list->Add (output.release());
113  addOutput (list.release());
114  }

◆ addOutputStream()

StatusCode EL::Worker::addOutputStream ( const std::string &  label,
Detail::OutputStreamData  output 
)
protected

effects: add another output file guarantee: strong failures: low level errors II failures: label already used

Definition at line 712 of file Worker.cxx.

715  {
716  using namespace msgEventLoop;
717  RCU_CHANGE_INVARIANT (this);
718 
719  if (m_outputs.find (label) != m_outputs.end())
720  {
721  ANA_MSG_ERROR ("output file already defined for label: " + label);
722  return ::StatusCode::FAILURE;
723  }
724  if (data.file() == nullptr)
725  {
726  ANA_MSG_ERROR ("output stream does not have a file attached");
727  return ::StatusCode::FAILURE;
728  }
729  if (data.mainStreamName().empty())
730  data.setMainStreamName (label);
731  m_outputs.insert (std::make_pair (label, std::make_shared<Detail::OutputStreamData>(std::move (data))));
732  return ::StatusCode::SUCCESS;
733  }

◆ addTree()

StatusCode EL::Worker::addTree ( const TTree &  tree,
const std::string &  stream 
)
finaloverridevirtual

effects: adds a tree to an output file specified by the stream/label failures: Incorrect stream/label specified, called at the wrong time note: See getOutputFile for failure types...

Implements EL::ITreeWorker.

Definition at line 154 of file Worker.cxx.

156  {
157  using namespace msgEventLoop;
158  RCU_READ_INVARIANT( this );
159 
160  auto outputIter = m_outputs.find (stream);
161  if (outputIter == m_outputs.end())
162  {
163  ANA_MSG_ERROR ( "No output file with stream name \"" + stream +
164  "\" found" );
165  return ::StatusCode::FAILURE;
166  }
167 
168  outputIter->second->addClone (tree);
169 
170  // Return gracefully:
171  return ::StatusCode::SUCCESS;
172  }

◆ batchExecute()

StatusCode EL::Worker::batchExecute ( unsigned  job_id,
const char *  confFile 
)

effects: do what is needed to execute the given job segment guarantee: basic failures: job specific

Definition at line 816 of file Worker.cxx.

818  {
819  using namespace msgEventLoop;
820  RCU_CHANGE_INVARIANT (this);
821 
822  try
823  {
824  std::unique_ptr<TFile> file (TFile::Open (confFile, "READ"));
825  if (file.get() == nullptr || file->IsZombie())
826  {
827  ANA_MSG_ERROR ("failed to open file: " << confFile);
828  return ::StatusCode::FAILURE;
829  }
830 
831  std::unique_ptr<BatchJob> job (dynamic_cast<BatchJob*>(file->Get ("job")));
832  if (job.get() == nullptr)
833  {
834  ANA_MSG_ERROR ("failed to retrieve BatchJob object");
835  return ::StatusCode::FAILURE;
836  }
837 
838  if (job_id >= job->segments.size())
839  {
840  ANA_MSG_ERROR ("invalid job-id " << job_id << ", max is " << job->segments.size());
841  return ::StatusCode::FAILURE;
842  }
843  BatchSegment *segment = &job->segments[job_id];
844  RCU_ASSERT (segment->job_id == job_id);
845  RCU_ASSERT (segment->sample < job->samples.size());
846  BatchSample *sample = &job->samples[segment->sample];
847 
848  gSystem->Exec ("pwd");
849  gSystem->MakeDirectory ("output");
850 
851  setMetaData (&sample->meta);
852  setOutputHist (job->location + "/fetch");
853  setSegmentName (segment->fullName);
854 
855  setJobConfig (JobConfig (job->job.jobConfig()));
856 
857  for (Job::outputIter out = job->job.outputBegin(),
858  end = job->job.outputEnd(); out != end; ++ out)
859  {
860  Detail::OutputStreamData data {
861  out->output()->makeWriter (segment->sampleName, segment->segmentName, ".root")};
862  ANA_CHECK (addOutputStream (out->label(), std::move (data)));
863  }
864 
865  {
866  auto module = std::make_unique<Detail::BatchInputModule> ("BatchInputModule");
867  Long64_t maxEvents = metaData()->castDouble (Job::optMaxEvents, -1);
868  if (maxEvents != -1)
869  module->maxEvents = maxEvents;
870  module->sample = sample;
871  module->segment = segment;
872  addModule (std::move (module));
873  }
874 
875  ANA_CHECK (initialize ());
877  ANA_CHECK (finalize ());
878 
879  std::ostringstream job_name;
880  job_name << job_id;
881  std::ofstream completed ((job->location + "/status/completed-" + job_name.str()).c_str());
882  return ::StatusCode::SUCCESS;
883  } catch (...)
884  {
885  Detail::report_exception (std::current_exception());
886  return ::StatusCode::FAILURE;
887  }
888  }

◆ directExecute()

StatusCode EL::Worker::directExecute ( const SH::SamplePtr sample,
const Job job,
const std::string &  location,
const SH::MetaObject options 
)

run the job

Guarantee
basic

Definition at line 770 of file Worker.cxx.

773  {
774  using namespace msgEventLoop;
775  RCU_CHANGE_INVARIANT (this);
776 
777  SH::MetaObject meta (*sample->meta());
778  meta.fetchDefaults (options);
779 
780  setMetaData (&meta);
781  setOutputHist (location);
782  setSegmentName (sample->name());
783 
784  ANA_MSG_INFO ("Running sample: " << sample->name());
785 
786  setJobConfig (JobConfig (job.jobConfig()));
787 
788  for (Job::outputIter out = job.outputBegin(),
789  end = job.outputEnd(); out != end; ++ out)
790  {
791  Detail::OutputStreamData data {
792  out->output()->makeWriter (sample->name(), "", ".root")};
793  ANA_CHECK (addOutputStream (out->label(), std::move (data)));
794  }
795 
796  {
797  auto module = std::make_unique<Detail::DirectInputModule> ("DirectInputModule");
798  module->fileList = sample->makeFileList();
799  Long64_t maxEvents = metaData()->castDouble (Job::optMaxEvents, -1);
800  if (maxEvents != -1)
801  module->maxEvents = maxEvents;
803  if (skipEvents != 0)
804  module->skipEvents = skipEvents;
805  addModule (std::move (module));
806  }
807 
808  ANA_CHECK (initialize ());
810  ANA_CHECK (finalize ());
811  return ::StatusCode::SUCCESS;
812  }

◆ eventsProcessed()

uint64_t EL::Worker::eventsProcessed ( ) const
protectednoexcept

the number of events that have been processed

Guarantee
no-fail

Definition at line 751 of file Worker.cxx.

753  {
754  RCU_READ_INVARIANT (this);
755  return m_eventsProcessed;
756  }

◆ fileOpenErrorFilter()

bool EL::Worker::fileOpenErrorFilter ( int  level,
bool  ,
const char *  s1,
const char *  s2 
)
staticprivate

Error handler for file opening.

Definition at line 611 of file Worker.cxx.

613  {
614  // Don't fail on missing dictionary messages.
615  if (strstr (s2, "no streamer or dictionary") != nullptr) {
616  return true;
617  }
618 
619  // For messages above warning level (SysError, Error, Fatal)
620  if( level > kWarning ) {
621  // We won't output further; ROOT should have already put something in the log file
622  std::string msg = "ROOT error detected in Worker.cxx: ";
623  msg += s1;
624  msg += " ";
625  msg += s2;
626  throw std::runtime_error(msg);
627 
628  // No need for further error handling
629  return false;
630  }
631 
632  // Pass to the default error handlers
633  return true;
634  }

◆ filterPassed()

bool EL::Worker::filterPassed ( ) const
finaloverridevirtualnoexcept

whether the current algorithm passed its filter criterion for the current event

Guarantee
no-fail

Implements EL::IFilterWorker.

Definition at line 305 of file Worker.cxx.

307  {
308  RCU_READ_INVARIANT (this);
309  return !m_skipEvent;
310  }

◆ finalize()

StatusCode EL::Worker::finalize ( )
protected

finalize the worker

This method ought to be called after all events have been processed. It is meant to ensure that the job is ended properly and all outputs are written out and files are closed.

Guarantee
basic
Failures
finalization failures

Definition at line 480 of file Worker.cxx.

482  {
483  using namespace msgEventLoop;
484 
485  RCU_CHANGE_INVARIANT (this);
486 
487  if (m_algorithmsInitialized == false)
488  {
489  ANA_MSG_ERROR ("algorithms never got initialized");
490  return StatusCode::FAILURE;
491  }
492 
493  ANA_CHECK (openInputFile (""));
494  for (auto& module : m_modules)
495  ANA_CHECK (module->onFinalize (*this));
496  for (auto& output : m_outputs)
497  {
498  if (output.first != Job::histogramStreamName && output.second->mainStreamName() == output.first)
499  {
500  output.second->saveOutput ();
501  output.second->close ();
502  std::string path = output.second->finalFileName ();
503  if (!path.empty())
504  addOutputList ("EventLoop_OutputStream_" + output.first, new TObjString (path.c_str()));
505  }
506  }
507  for (auto& module : m_modules)
508  ANA_CHECK (module->postFinalize (*this));
509  if (m_jobStats->GetListOfBranches()->GetEntries() > 0)
510  {
511  if (m_jobStats->Fill() <= 0)
512  {
513  ANA_MSG_ERROR ("failed to fill the job statistics tree");
514  return ::StatusCode::FAILURE;
515  }
516  ModuleData::addOutput (std::move (m_jobStats));
517  }
519  for (auto& module : m_modules)
520  ANA_CHECK (module->onWorkerEnd (*this));
522  m_histOutput->close ();
523 
524  for (auto& module : m_modules){
525  ANA_CHECK (module->postFileClose(*this));
526  }
527  ANA_MSG_INFO ("worker finished successfully");
528  return ::StatusCode::SUCCESS;
529  }

◆ getAlg()

Algorithm * EL::Worker::getAlg ( const std::string &  name) const
overridevirtual

effects: returns the algorithms with the given name or NULL if there is none guarantee: strong failures: out of memory II

Implements EL::IWorker.

Definition at line 282 of file Worker.cxx.

284  {
285  RCU_READ_INVARIANT (this);
286  for (auto& alg : m_algs)
287  {
288  if (alg->hasName (name))
289  return alg.m_algorithm->getLegacyAlg();
290  }
291  return 0;
292  }

◆ getOutputFile()

TFile * EL::Worker::getOutputFile ( const std::string &  label) const
overridevirtual

effects: get the output file that goes into the dataset with the given label.

this dataset has to be registered before the job is submitted. typically that happens in the doSetupJob method. guarantee: strong failures: no dataset with the given label postcondition: result != 0 note: the default value for the argument corresponds to the default label value in the OutputInfo class.

Implements EL::IWorker.

Definition at line 130 of file Worker.cxx.

132  {
133  RCU_READ_INVARIANT (this);
134  TFile *result = getOutputFileNull (label);
135  if (result == 0)
136  RCU_THROW_MSG ("no output dataset defined with label: " + label);
137  return result;
138  }

◆ getOutputFileNull()

TFile * EL::Worker::getOutputFileNull ( const std::string &  label) const
overridevirtual

effects: get the output file that goes into the dataset with the given label.

this dataset has to be registered before the job is submitted. typically that happens in the doSetupJob method. guarantee: strong failures: internal errors note: the default value for the argument corresponds to the default label value in the OutputInfo class. rationale: this method was added to support optional output files, i.e.: the algorithm leaves it to the user whether or not the output file gets configured. then the algorithm just checks whether the output file is there. if so it fills it, otherwise it ignores it.

Implements EL::IWorker.

Definition at line 142 of file Worker.cxx.

144  {
145  RCU_READ_INVARIANT (this);
146  auto iter = m_outputs.find (label);
147  if (iter == m_outputs.end())
148  return 0;
149  return iter->second->file();
150  }

◆ getOutputHist()

TObject * EL::Worker::getOutputHist ( const std::string &  name) const
finaloverridevirtual

get the output histogram with the given name

This is mostly meant, so that I can emulate the Athena histogram mechanism.

Guarantee
strong
Failures
object not found
Postcondition
result != 0

Implements EL::IHistogramWorker.

Definition at line 118 of file Worker.cxx.

120  {
121  RCU_READ_INVARIANT (this);
122 
123  TObject *result = m_histOutput->getOutputHist (name);
124  if (result == nullptr) RCU_THROW_MSG ("unknown output histogram: " + name);
125  return result;
126  }

◆ getOutputTree()

TTree * EL::Worker::getOutputTree ( const std::string &  name,
const std::string &  stream 
) const
finaloverridevirtual

effects: get the tree that was added to an output file earlier failures: Tree doesn't exist

Implements EL::ITreeWorker.

Definition at line 176 of file Worker.cxx.

178  {
179  using namespace msgEventLoop;
180  RCU_READ_INVARIANT( this );
181 
182  auto outputIter = m_outputs.find (stream);
183  if (outputIter == m_outputs.end())
184  {
185  RCU_THROW_MSG ( "No output file with stream name \"" + stream
186  + "\" found" );
187  }
188 
189  TTree *result = outputIter->second->getOutputTree( name );
190  if( result == nullptr ) {
191  RCU_THROW_MSG ( "No tree with name \"" + name + "\" in stream \"" +
192  stream + "\"" );
193  }
194  return result;
195  }

◆ gridCreateJobSummary()

void EL::Worker::gridCreateJobSummary ( uint64_t  eventsProcessed)
private

◆ gridExecute()

StatusCode EL::Worker::gridExecute ( const std::string &  sampleName,
Long64_t  SkipEvents,
Long64_t  nEventsPerJob 
)

Definition at line 892 of file Worker.cxx.

894  {
895  using namespace msgEventLoop;
896  RCU_CHANGE_INVARIANT (this);
897 
898  ANA_MSG_INFO ("Running with ROOT version " << gROOT->GetVersion()
899  << " (" << gROOT->GetVersionDate() << ")");
900 
901  ANA_MSG_INFO ("Loading EventLoop grid job");
902 
903 
904  TList bigOutputs;
905  std::unique_ptr<JobConfig> jobConfig;
906  SH::MetaObject *mo = 0;
907 
908  std::unique_ptr<TFile> f (TFile::Open("jobdef.root"));
909  if (f == nullptr || f->IsZombie()) {
910  ANA_MSG_ERROR ("Could not read jobdef");
911  return ::StatusCode::FAILURE;
912  }
913 
914  mo = dynamic_cast<SH::MetaObject*>(f->Get(sampleName.c_str()));
915  if (!mo)
916  mo = dynamic_cast<SH::MetaObject*>(f->Get("defaultMetaObject"));
917  if (!mo) {
918  ANA_MSG_ERROR ("Could not read in sample meta object");
919  return ::StatusCode::FAILURE;
920  }
921 
922  jobConfig.reset (dynamic_cast<JobConfig*>(f->Get("jobConfig")));
923  if (jobConfig == nullptr)
924  {
925  ANA_MSG_ERROR ("failed to read jobConfig object");
926  return ::StatusCode::FAILURE;
927  }
928 
929  {
930  std::unique_ptr<TList> outs ((TList*)f->Get("outputs"));
931  if (outs == nullptr)
932  {
933  ANA_MSG_ERROR ("Could not read list of outputs");
934  return ::StatusCode::FAILURE;
935  }
936 
937  TIter itr(outs.get());
938  TObject *obj = 0;
939  while ((obj = itr())) {
940  EL::OutputStream * out = dynamic_cast<EL::OutputStream*>(obj);
941  if (out) {
942  bigOutputs.Add(out);
943  }
944  else {
945  ANA_MSG_ERROR ("Encountered unexpected entry in list of outputs");
946  return ::StatusCode::FAILURE;
947  }
948  }
949  }
950 
951  f->Close();
952  f.reset ();
953 
954  const std::string location = ".";
955 
956  mo->setBool (Job::optGridReporting, true);
957  setMetaData (mo);
958  setOutputHist (location);
959  setSegmentName ("output");
960 
961  ANA_MSG_INFO ("Starting EventLoop Grid worker");
962 
963  {//Create and register the "big" output files with base class
964  TIter itr(&bigOutputs);
965  TObject *obj = 0;
966  while ((obj = itr())) {
967  EL::OutputStream *os = dynamic_cast<EL::OutputStream*>(obj);
968  if (os == nullptr)
969  {
970  ANA_MSG_ERROR ("Bad input");
971  return ::StatusCode::FAILURE;
972  }
973  {
974  Detail::OutputStreamData data {
975  location + "/" + os->label() + ".root", "RECREATE"};
976  ANA_CHECK (addOutputStream (os->label(), std::move (data)));
977  }
978  }
979  }
980 
981  setJobConfig (std::move (*jobConfig));
982 
983  {
984  auto module = std::make_unique<Detail::DirectInputModule> ("DirectInputModule");
985  std::ifstream infile("input.txt");
986  while (infile) {
987  std::string sLine;
988  if (!getline(infile, sLine)) break;
989  std::istringstream ssLine(sLine);
990  while (ssLine) {
991  std::string sFile;
992  if (!getline(ssLine, sFile, ',')) break;
993  module->fileList.push_back(sFile);
994  }
995  }
996  if (module->fileList.size() == 0) {
997  ANA_MSG_ERROR ("no input files provided");
998  //User was expecting input after all.
999  gSystem->Exit(EC_BADINPUT);
1000  }
1001 
1002  if (nEventsPerJob != -1)
1003  module->maxEvents = nEventsPerJob;
1004  if (SkipEvents != 0)
1005  module->skipEvents = SkipEvents;
1006  addModule (std::move (module));
1007  }
1008 
1009  ANA_CHECK (initialize());
1010  ANA_CHECK (processInputs ());
1011  ANA_CHECK (finalize ());
1012 
1013  int nEvents = eventsProcessed();
1014  ANA_MSG_INFO ("Loop finished.");
1015  ANA_MSG_INFO ("Read/processed " << nEvents << " events.");
1016 
1017  ANA_MSG_INFO ("EventLoop Grid worker finished");
1018  ANA_MSG_INFO ("Saving output");
1019  return ::StatusCode::SUCCESS;
1020  }

◆ initialize()

StatusCode EL::Worker::initialize ( )
protected

initialize the worker

This method ought to be called after the options on the worker are set and before any events are processed. It is meant to make sure everything is ready and set up for event processing.

Guarantee
basic
Failures
initialization failures

Definition at line 376 of file Worker.cxx.

378  {
379  using namespace msgEventLoop;
380  RCU_CHANGE_INVARIANT (this);
381 
382  const bool xAODInput = m_metaData->castBool (Job::optXAODInput, false);
383 
384  ANA_MSG_INFO ("xAODInput = " << xAODInput);
385  if (metaData()->castBool (Job::optAlgorithmMemoryMonitor, false))
386  m_modules.push_back (std::make_unique<Detail::MemoryMonitorModule> ("EarlyMemoryMonitorModule"));
387  if (xAODInput)
388  m_modules.push_back (std::make_unique<Detail::TEventModule> ("TEventModule"));
389  auto factoryPreload = metaData()->castString (Job::optFactoryPreload, "");
390  if (!factoryPreload.empty())
391  {
392  auto module = std::make_unique<Detail::FactoryPreloadModule> ("FactoryPreloadModule");
393  module->preloader = factoryPreload;
394  m_modules.push_back (std::move (module));
395  }
396  m_modules.push_back (std::make_unique<Detail::LeakCheckModule> ("LeakCheckModule"));
397  m_modules.push_back (std::make_unique<Detail::StopwatchModule> ("StopwatchModule"));
398  if (metaData()->castBool (Job::optGridReporting, false))
399  m_modules.push_back (std::make_unique<Detail::GridReportingModule>("GridReportingModule"));
400  if (metaData()->castBool (Job::optAlgorithmTimer, false))
401  m_modules.push_back (std::make_unique<Detail::AlgorithmTimerModule> ("AlgorithmTimerModule"));
402  if (metaData()->castBool (Job::optAlgorithmMemoryMonitor, false))
403  m_modules.push_back (std::make_unique<Detail::AlgorithmMemoryModule> ("AlgorithmMemoryModule"));
404  m_modules.push_back (std::make_unique<Detail::FileExecutedModule> ("FileExecutedModule"));
405  m_modules.push_back (std::make_unique<Detail::EventCountModule> ("EventCountModule"));
406  m_modules.push_back (std::make_unique<Detail::WorkerConfigModule> ("WorkerConfigModule"));
407  m_modules.push_back (std::make_unique<Detail::AlgorithmStateModule> ("AlgorithmStateModule"));
408  m_modules.push_back (std::make_unique<Detail::PostClosedOutputsModule> ("PostClosedOutputsModule"));
409  if (metaData()->castBool (Job::optAlgorithmMemoryMonitor, false))
410  m_modules.push_back (std::make_unique<Detail::MemoryMonitorModule> ("LateMemoryMonitorModule"));
411 
412  if (m_outputs.find (Job::histogramStreamName) == m_outputs.end())
413  {
414  Detail::OutputStreamData data {
415  m_outputTarget + "/hist-" + m_segmentName + ".root", "RECREATE"};
417  }
420  if (auto aliases = metaData()->castString (Job::optStreamAliases, ""); !aliases.empty())
421  {
422  // the format of aliases is "alias1=realname1,alias2=realname2"
423  std::istringstream iss (aliases);
424  std::string alias;
425  while (std::getline (iss, alias, ','))
426  {
427  auto pos = alias.find ('=');
428  if (pos == std::string::npos)
429  {
430  ANA_MSG_ERROR ("Invalid alias format: " << alias);
431  return ::StatusCode::FAILURE;
432  }
433  auto aliasName = alias.substr (0, pos);
434  auto realName = alias.substr (pos + 1);
435  auto realOutput = m_outputs.find (realName);
436  if (realOutput == m_outputs.end())
437  {
438  ANA_MSG_ERROR ("output stream " << realName << " not found for alias " << aliasName);
439  return ::StatusCode::FAILURE;
440  }
441  auto [aliasOutput, success] = m_outputs.emplace (aliasName, realOutput->second);
442  if (!success)
443  {
444  ANA_MSG_ERROR ("output stream " << aliasName << " already exists, can't make alias");
445  return ::StatusCode::FAILURE;
446  }
447  }
448  }
449 
450  m_jobStats = std::make_unique<TTree>
451  ("EventLoop_JobStats", "EventLoop job statistics");
452  m_jobStats->SetDirectory (nullptr);
453 
454  ANA_MSG_INFO ("calling firstInitialize on all modules");
455  for (auto& module : m_modules)
456  ANA_CHECK (module->firstInitialize (*this));
457  ANA_MSG_INFO ("calling preFileInitialize on all modules");
458  for (auto& module : m_modules)
459  ANA_CHECK (module->preFileInitialize (*this));
460 
461  return ::StatusCode::SUCCESS;
462  }

◆ inputFile()

TFile * EL::Worker::inputFile ( ) const
overridevirtual

description: the file we are reading the current tree from guarantee: no-fail

Implements EL::IWorker.

Definition at line 226 of file Worker.cxx.

228  {
229  RCU_READ_INVARIANT (this);
230  return m_inputFile.get();
231  }

◆ inputFileName()

std::string EL::Worker::inputFileName ( ) const
overridevirtual

the name of the file we are reading the current tree from, without the path component

Guarantee
no-fail

Implements EL::IWorker.

Definition at line 235 of file Worker.cxx.

237  {
238  // no invariant used
239  std::string path = inputFile()->GetName();
240  auto split = path.rfind ('/');
241  if (split != std::string::npos)
242  return path.substr (split + 1);
243  else
244  return path;
245  }

◆ inputFileNumEntries()

Long64_t EL::Worker::inputFileNumEntries ( ) const
overrideprotectedvirtual

the number of events in the input file

Guarantee
no-fail
Precondition
inputFile() != 0

Implements EL::Detail::IInputModuleActions.

Definition at line 737 of file Worker.cxx.

739  {
740  RCU_READ_INVARIANT (this);
741  RCU_REQUIRE (inputFile() != 0);
742 
743  if (m_inputTree != 0)
744  return m_inputTree->GetEntries();
745  else
746  return 0;
747  }

◆ metaData()

const SH::MetaObject * EL::Worker::metaData ( ) const
overridevirtual

description: the sample meta-data we are working on guarantee: no-fail invariant: metaData != 0 rationale: this can be used for accessing sample meta-data

Implements EL::IWorker.

Definition at line 199 of file Worker.cxx.

201  {
202  RCU_READ_INVARIANT (this);
203  return m_metaData;
204  }

◆ openInputFile()

StatusCode EL::Worker::openInputFile ( const std::string &  inputFileUrl)
overrideprotectedvirtual

open the given input file without processing it

This is mostly to allow the driver to query the number of events in the input file without processing it, usually to determine the range of events to process.

Guarantee
basic
Failures
file can't be opened

Implements EL::Detail::IInputModuleActions.

Definition at line 636 of file Worker.cxx.

638  {
639  using namespace msgEventLoop;
640 
641  // Enable custom error handling in a nice way
643 
644  RCU_CHANGE_INVARIANT (this);
645 
646  if (m_inputFileUrl == inputFileUrl)
647  return ::StatusCode::SUCCESS;
648 
649  if (!m_inputFileUrl.empty())
650  {
651  if (m_newInputFile == false)
652  {
653  for (auto& module : m_modules)
654  ANA_CHECK (module->onCloseInputFile (*this));
655  for (auto& module : m_modules)
656  ANA_CHECK (module->postCloseInputFile (*this));
657  }
658  m_newInputFile = false;
659  m_inputTree = nullptr;
660  m_inputFile.reset ();
661  m_inputFileUrl.clear ();
662  }
663 
664  if (inputFileUrl.empty())
665  return ::StatusCode::SUCCESS;
666 
667  ANA_MSG_INFO ("Opening file " << inputFileUrl);
668  std::unique_ptr<TFile> inputFile;
669  try
670  {
671  inputFile = SH::openFile (inputFileUrl, *metaData());
672  } catch (...)
673  {
674  Detail::report_exception (std::current_exception());
675  }
676  if (inputFile.get() == 0)
677  {
678  ANA_MSG_ERROR ("failed to open file " << inputFileUrl);
679  for (auto& module : m_modules)
680  module->reportInputFailure (*this);
681  return ::StatusCode::FAILURE;
682  }
683  if (inputFile->IsZombie())
684  {
685  ANA_MSG_ERROR ("input file is a zombie: " << inputFileUrl);
686  for (auto& module : m_modules)
687  module->reportInputFailure (*this);
688  return ::StatusCode::FAILURE;
689  }
690 
691  TTree *tree = 0;
692  const std::string treeName
694  tree = dynamic_cast<TTree*>(inputFile->Get (treeName.c_str()));
695  if (tree == nullptr)
696  {
697  ANA_MSG_INFO ("tree " << treeName << " not found in input file: " << inputFileUrl);
698  ANA_MSG_INFO ("treating this like a tree with no events");
699  }
700 
701  m_newInputFile = true;
702  m_inputTree = tree;
703  m_inputTreeEntry = 0;
704  m_inputFile = std::move (inputFile);
705  m_inputFileUrl = std::move (inputFileUrl);
706 
707  return ::StatusCode::SUCCESS;
708  }

◆ processEvents()

StatusCode EL::Worker::processEvents ( EventRange eventRange)
overrideprotectedvirtual

process the given event range

This will update eventRange if the end is set to eof

Guarantee
basic
Failures
file can't be opened
event range exceeds length of file
processing failures

Implements EL::Detail::IInputModuleActions.

Definition at line 533 of file Worker.cxx.

535  {
536  using namespace msgEventLoop;
537 
538  RCU_CHANGE_INVARIANT (this);
539  RCU_REQUIRE (!eventRange.m_url.empty());
540  RCU_REQUIRE (eventRange.m_beginEvent >= 0);
541  RCU_REQUIRE (eventRange.m_endEvent == EventRange::eof || eventRange.m_endEvent >= eventRange.m_beginEvent);
542 
543  ANA_CHECK (openInputFile (eventRange.m_url));
544 
545  if (eventRange.m_beginEvent > inputFileNumEntries())
546  {
547  ANA_MSG_ERROR ("first event (" << eventRange.m_beginEvent << ") points beyond last event in file (" << inputFileNumEntries() << ")");
548  return ::StatusCode::FAILURE;
549  }
550  if (eventRange.m_endEvent == EventRange::eof)
551  {
552  eventRange.m_endEvent = inputFileNumEntries();
553  } else if (eventRange.m_endEvent > inputFileNumEntries())
554  {
555  ANA_MSG_ERROR ("end event (" << eventRange.m_endEvent << ") points beyond last event in file (" << inputFileNumEntries() << ")");
556  return ::StatusCode::FAILURE;
557  }
558 
559  m_inputTreeEntry = eventRange.m_beginEvent;
560 
561  if (m_algorithmsInitialized == false)
562  {
563  for (auto& module : m_modules)
564  ANA_CHECK (module->onInitialize (*this));
566  }
567 
568  if (m_newInputFile)
569  {
570  m_newInputFile = false;
571  for (auto& module : m_modules)
572  ANA_CHECK (module->onNewInputFile (*this));
573  }
574 
575  if (eventRange.m_beginEvent == 0)
576  {
577  for (auto& module : m_modules)
578  ANA_CHECK (module->onFileExecute (*this));
579  }
580 
581  ANA_MSG_INFO ("Processing events " << eventRange.m_beginEvent << "-" << eventRange.m_endEvent << " in file " << eventRange.m_url);
582 
583  for (uint64_t event = eventRange.m_beginEvent;
584  event != uint64_t (eventRange.m_endEvent);
585  ++ event)
586  {
588  for (auto& module : m_modules)
589  {
590  if (module->onExecute (*this).isFailure())
591  {
592  ANA_MSG_ERROR ("processing event " << treeEntry() << " on file " << inputFileName());
593  return ::StatusCode::FAILURE;
594  }
595  }
596  if (m_firstEvent)
597  {
598  m_firstEvent = false;
599  for (auto& module : m_modules)
600  ANA_CHECK (module->postFirstEvent (*this));
601  }
602  m_eventsProcessed += 1;
603  if (m_eventsProcessed % 10000 == 0)
604  ANA_MSG_INFO ("Processed " << m_eventsProcessed << " events");
605  }
606  return ::StatusCode::SUCCESS;
607  }

◆ processInputs()

StatusCode EL::Worker::processInputs ( )
protected

process all the inputs

This method ought to be called after initialize and before finalize. It will rely on the defined modules to steer it to the files and events it ought to process.

Definition at line 466 of file Worker.cxx.

468  {
469  using namespace msgEventLoop;
470 
471  RCU_CHANGE_INVARIANT (this);
472 
473  for (auto& module : m_modules)
474  ANA_CHECK (module->processInputs (*this, *this));
475  return ::StatusCode::SUCCESS;
476  }

◆ setFilterPassed()

void EL::Worker::setFilterPassed ( bool  val_filterPassed)
finaloverridevirtualnoexcept

set the value of filterPassed

Guarantee
no-fail

Implements EL::IFilterWorker.

Definition at line 314 of file Worker.cxx.

316  {
317  RCU_CHANGE_INVARIANT (this);
318  m_skipEvent = !val_filterPassed;
319  }

◆ setJobConfig()

void EL::Worker::setJobConfig ( JobConfig &&  jobConfig)
protected

set the JobConfig

This takes care of adding the algorithms, etc. (only algorithms for now, 03 Feb 17).

Note the rvalue calling convention here: Algorithms are objects that get modified, so if you use them more than once you need to copy/clone them. However, in practice no driver should need that (though many do for now, 03 Feb 17), as drivers generally stream the JobConfig in for one-time use.

Guarantee
basic
Failures
job configuration/streaming errors

Definition at line 364 of file Worker.cxx.

366  {
367  RCU_CHANGE_INVARIANT (this);
368  for (std::unique_ptr<IAlgorithmWrapper>& alg : jobConfig.extractAlgorithms())
369  {
370  m_algs.push_back (std::move (alg));
371  }
372  }

◆ setMetaData()

void EL::Worker::setMetaData ( const SH::MetaObject val_metaData)
protected

set the metaData

Guarantee
no-fail

Definition at line 333 of file Worker.cxx.

335  {
336  RCU_CHANGE_INVARIANT (this);
337  RCU_REQUIRE (val_metaData != 0);
338 
339  m_metaData = val_metaData;
340  }

◆ setOutputHist()

void EL::Worker::setOutputHist ( const std::string &  val_outputTarget)
protected

set the histogram output list

Guarantee
no-fail

Definition at line 344 of file Worker.cxx.

346  {
347  RCU_CHANGE_INVARIANT (this);
348 
349  m_outputTarget = val_outputTarget;
350  }

◆ setSegmentName()

void EL::Worker::setSegmentName ( const std::string &  val_segmentName)
protected

set the segment name

Guarantee
no-fail

Definition at line 354 of file Worker.cxx.

356  {
357  RCU_CHANGE_INVARIANT (this);
358 
359  m_segmentName = val_segmentName;
360  }

◆ skipEvent()

void EL::Worker::skipEvent ( )
overridevirtual

effects: skip the current event, i.e.

skip the rest of the algorithms for this event guarantee: no-fail rationale: if you have an analysis strategy in which you divide work into multiple algorithms you may want to have dedicated algorithms for event selection that then skip later algorithms that fill histograms

Implements EL::IWorker.

Definition at line 296 of file Worker.cxx.

298  {
299  RCU_CHANGE_INVARIANT (this);
300  m_skipEvent = true;
301  }

◆ testInvariant()

void EL::Worker::testInvariant ( ) const

effects: test the invariant of this object guarantee: no-fail

Definition at line 67 of file Worker.cxx.

69  {
70  RCU_INVARIANT (this != nullptr);
71  for (std::size_t iter = 0, end = m_algs.size(); iter != end; ++ iter)
72  {
73  RCU_INVARIANT (m_algs[iter].m_algorithm != nullptr);
74  }
75  }

◆ tree()

TTree * EL::Worker::tree ( ) const
overridevirtual

description: the tree we are running on guarantee: no-fail

Implements EL::IWorker.

Definition at line 208 of file Worker.cxx.

210  {
211  RCU_READ_INVARIANT (this);
212  return m_inputTree;
213  }

◆ treeEntry()

Long64_t EL::Worker::treeEntry ( ) const
overridevirtual

description: the entry in the tree we are reading guarantee: no-fail

Implements EL::IWorker.

Definition at line 217 of file Worker.cxx.

219  {
220  RCU_READ_INVARIANT (this);
221  return m_inputTreeEntry;
222  }

◆ triggerConfig()

TTree * EL::Worker::triggerConfig ( ) const
overridevirtual

description: the trigger config tree from the input file, or NULL if we did not find it guarantee: strong failures: i/o errors

Implements EL::IWorker.

Definition at line 249 of file Worker.cxx.

251  {
252  RCU_READ_INVARIANT (this);
253  return dynamic_cast<TTree*>(inputFile()->Get("physicsMeta/TrigConfTree"));
254  }

◆ xaodEvent()

xAOD::TEvent * EL::Worker::xaodEvent ( ) const
overridevirtual

description: the xAOD event and store guarantee: strong failures: out of memory I failures: TEventSvc not configured postcondition: result != 0

Implements EL::IWorker.

Definition at line 258 of file Worker.cxx.

260  {
261  RCU_READ_INVARIANT (this);
262 
263  if (m_tevent == nullptr)
264  RCU_THROW_MSG ("Job not configured for xAOD support");
265  return m_tevent;
266  }

◆ xaodStore()

xAOD::TStore * EL::Worker::xaodStore ( ) const
overridevirtual

Implements EL::IWorker.

Definition at line 270 of file Worker.cxx.

272  {
273  RCU_READ_INVARIANT (this);
274 
275  if (m_tstore == nullptr)
276  RCU_THROW_MSG ("Job not configured for xAOD support");
277  return m_tstore;
278  }

Member Data Documentation

◆ m_algorithmsInitialized

bool EL::Worker::m_algorithmsInitialized {false}
private

whether the algorithms are initialized

Definition at line 444 of file Worker.h.

◆ m_algs

std::vector<Detail::AlgorithmData> EL::Detail::ModuleData::m_algs
inherited

the list of algorithms

Definition at line 66 of file ModuleData.h.

◆ m_eventsProcessed

uint64_t EL::Detail::ModuleData::m_eventsProcessed {0}
inherited

the number of events that have been processed

Definition at line 88 of file ModuleData.h.

◆ m_evtStore

asg::SgTEvent* EL::Detail::ModuleData::m_evtStore {nullptr}
inherited

the SgTEvent structure, if we use one

Definition at line 103 of file ModuleData.h.

◆ m_firstEvent

bool EL::Worker::m_firstEvent {true}
private

whether we are still to process the first event

Definition at line 449 of file Worker.h.

◆ m_histOutput

OutputStreamData* EL::Detail::ModuleData::m_histOutput {nullptr}
inherited

the histogram output stream

Definition at line 91 of file ModuleData.h.

◆ m_inputFile

std::unique_ptr<TFile> EL::Detail::ModuleData::m_inputFile
inherited

the input file pointer of the currently opened filed

Definition at line 72 of file ModuleData.h.

◆ m_inputFileUrl

std::string EL::Detail::ModuleData::m_inputFileUrl
inherited

the input file url of the currently opened file

Definition at line 69 of file ModuleData.h.

◆ m_inputTree

TTree* EL::Detail::ModuleData::m_inputTree {nullptr}
inherited

the (main) tree in the input file

Definition at line 75 of file ModuleData.h.

◆ m_inputTreeEntry

uint64_t EL::Detail::ModuleData::m_inputTreeEntry {0}
inherited

the entry in the input tree we are currently looking at

Definition at line 79 of file ModuleData.h.

◆ m_jobStats

std::unique_ptr<TTree> EL::Detail::ModuleData::m_jobStats
inherited

Tree saving per-job statistics information.

Definition at line 94 of file ModuleData.h.

◆ m_metaData

const SH::MetaObject* EL::Detail::ModuleData::m_metaData {nullptr}
inherited

the meta-data we use

Definition at line 85 of file ModuleData.h.

◆ m_modules

std::vector<std::unique_ptr<Detail::Module> > EL::Worker::m_modules
private

the list of modules we hold

Definition at line 423 of file Worker.h.

◆ m_newInputFile

bool EL::Worker::m_newInputFile {false}
private

whether this is a new input file (i.e.

one that has not yet been connected to the algorithms)

Definition at line 429 of file Worker.h.

◆ m_outputHistMap

std::map<std::string,TH1*> EL::Worker::m_outputHistMap
private

Definition at line 411 of file Worker.h.

◆ m_outputs

std::map<std::string,std::shared_ptr<Detail::OutputStreamData> > EL::Detail::ModuleData::m_outputs
inherited

the list of output files

Definition at line 109 of file ModuleData.h.

◆ m_outputTarget

std::string EL::Worker::m_outputTarget
private

the target file to which we will write the histogram output

Definition at line 434 of file Worker.h.

◆ m_outputTreeMap

std::map<std::pair<std::string,std::string>,TTree*> EL::Worker::m_outputTreeMap
private

Definition at line 418 of file Worker.h.

◆ m_segmentName

std::string EL::Worker::m_segmentName
private

the name of the segment we are processing

Definition at line 439 of file Worker.h.

◆ m_skipEvent

bool EL::Detail::ModuleData::m_skipEvent = false
inherited

whether we are skipping the current event

Definition at line 82 of file ModuleData.h.

◆ m_tevent

xAOD::TEvent* EL::Detail::ModuleData::m_tevent {nullptr}
inherited

the TEvent structure, if we use one

Definition at line 97 of file ModuleData.h.

◆ m_tstore

xAOD::TStore* EL::Detail::ModuleData::m_tstore {nullptr}
inherited

the TStore structure, if we use one

Definition at line 100 of file ModuleData.h.

◆ m_worker

Worker* EL::Detail::ModuleData::m_worker {nullptr}
inherited

the worker (to pass on to the algorithms)

Definition at line 106 of file ModuleData.h.


The documentation for this class was generated from the following files:
nEvents
const int nEvents
Definition: fbtTestBasics.cxx:78
EL::Worker::finalize
::StatusCode finalize()
finalize the worker
Definition: Worker.cxx:481
EL::Job::optMaxEvents
static const std::string optMaxEvents
description: the name of the option used for setting the maximum number of events to process per samp...
Definition: Job.h:225
EL::Detail::OutputStreamData::addOutput
void addOutput(std::unique_ptr< TObject > outputObject)
add the given output object to this stream
Definition: OutputStreamData.cxx:224
EL::Worker::m_newInputFile
bool m_newInputFile
whether this is a new input file (i.e.
Definition: Worker.h:429
EL::Worker::addOutput
void addOutput(TObject *output_swallow) final override
effects: add an object to the output.
Definition: Worker.cxx:88
EL::Worker::m_firstEvent
bool m_firstEvent
whether we are still to process the first event
Definition: Worker.h:449
EL::Worker::m_modules
std::vector< std::unique_ptr< Detail::Module > > m_modules
the list of modules we hold
Definition: Worker.h:423
EL::Worker::m_outputTarget
std::string m_outputTarget
the target file to which we will write the histogram output
Definition: Worker.h:434
HelloWorldOptions.job
job
Definition: HelloWorldOptions.py:18
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
ReadCellNoiseFromCoolCompare.s1
s1
Definition: ReadCellNoiseFromCoolCompare.py:378
createLinkingScheme.iter
iter
Definition: createLinkingScheme.py:62
EL::Worker::getOutputFileNull
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
EL::Detail::OutputStreamData::getOutputHist
TObject * getOutputHist(const std::string &name) const noexcept
get the output histogram with the given name, or nullptr if there is no histogam with such a name
Definition: OutputStreamData.cxx:313
EL::Detail::ModuleData::m_inputTree
TTree * m_inputTree
the (main) tree in the input file
Definition: ModuleData.h:75
get_generator_info.result
result
Definition: get_generator_info.py:21
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
run.infile
string infile
Definition: run.py:13
EL::Worker::eventsProcessed
uint64_t eventsProcessed() const noexcept
the number of events that have been processed
Definition: Worker.cxx:752
SH::MetaObject
A class that manages meta-data to be associated with an object.
Definition: MetaObject.h:56
EL::Worker::inputFileName
std::string inputFileName() const override
the name of the file we are reading the current tree from, without the path component
Definition: Worker.cxx:236
SH::MetaObject::castBool
bool castBool(const std::string &name, bool def_val=false, CastMode mode=CAST_ERROR_THROW) const
the meta-data boolean with the given name
EL::OutputStream
Definition: OutputStream.h:34
EL::Worker::inputFile
TFile * inputFile() const override
description: the file we are reading the current tree from guarantee: no-fail
Definition: Worker.cxx:227
Execution.SkipEvents
SkipEvents
Definition: Execution.py:91
EL::Worker::addModule
void addModule(std::unique_ptr< Detail::Module > module)
add the given module to this worker
Definition: Worker.cxx:761
EL::Worker::EC_FAIL
@ EC_FAIL
Definition: Worker.h:250
RCU_REQUIRE
#define RCU_REQUIRE(x)
Definition: Assert.h:208
EL::Worker::openInputFile
::StatusCode openInputFile(const std::string &inputFileUrl) override
open the given input file without processing it
Definition: Worker.cxx:637
EL::Worker::EC_NOTFINISHED
@ EC_NOTFINISHED
Definition: Worker.h:252
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:70
EL::Worker::m_algorithmsInitialized
bool m_algorithmsInitialized
whether the algorithms are initialized
Definition: Worker.h:444
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
EL::Worker::EC_ABORT
@ EC_ABORT
Definition: Worker.h:251
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
EL::Detail::OutputStreamData::close
void close()
close this file
Definition: OutputStreamData.cxx:173
EL::Job::optFactoryPreload
static const std::string optFactoryPreload
a boolean flag for whether to perform a component factory preload
Definition: Job.h:214
SH::MetaObject::setBool
void setBool(const std::string &name, bool value)
set the meta-data boolean with the given name
skel.nEventsPerJob
nEventsPerJob
Definition: skel.ABtoEVGEN.py:552
EL::Detail::ModuleData::m_inputFile
std::unique_ptr< TFile > m_inputFile
the input file pointer of the currently opened filed
Definition: ModuleData.h:72
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
EL::Detail::ModuleData::m_jobStats
std::unique_ptr< TTree > m_jobStats
Tree saving per-job statistics information.
Definition: ModuleData.h:94
EL::Job::optXAODInput
static const std::string optXAODInput
the option to select whether our input is xAODs
Definition: Job.h:393
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:92
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
jetMakeRefSamples.skipEvents
int skipEvents
Definition: jetMakeRefSamples.py:55
python.SCT_ByteStreamErrorsTestAlgConfig.maxEvents
maxEvents
Definition: SCT_ByteStreamErrorsTestAlgConfig.py:43
EL::Detail::ModuleData::m_outputs
std::map< std::string, std::shared_ptr< Detail::OutputStreamData > > m_outputs
the list of output files
Definition: ModuleData.h:109
EL::Worker::fileOpenErrorFilter
static bool fileOpenErrorFilter(int level, bool, const char *, const char *)
Error handler for file opening.
Definition: Worker.cxx:612
EL::Job::optStreamAliases
static const std::string optStreamAliases
an option for stream aliases
Definition: Job.h:217
python.PyAthena.module
module
Definition: PyAthena.py:131
JobConfig
Definition: CoolFix.cxx:83
EL::Worker::metaData
const SH::MetaObject * metaData() const override
description: the sample meta-data we are working on guarantee: no-fail invariant: metaData !...
Definition: Worker.cxx:200
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:116
RCU_REQUIRE_SOFT
#define RCU_REQUIRE_SOFT(x)
Definition: Assert.h:153
EL::Worker::setSegmentName
void setSegmentName(const std::string &val_segmentName)
set the segment name
Definition: Worker.cxx:355
EL::Worker::setOutputHist
void setOutputHist(const std::string &val_outputTarget)
set the histogram output list
Definition: Worker.cxx:345
EL::Detail::ModuleData::m_tstore
xAOD::TStore * m_tstore
the TStore structure, if we use one
Definition: ModuleData.h:100
COOLRates.alias
alias
Definition: COOLRates.py:1172
ANA_MSG_INFO
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:290
add-xsec-uncert-quadrature-N.label
label
Definition: add-xsec-uncert-quadrature-N.py:104
file
TFile * file
Definition: tile_monitor.h:29
dumpFileToPlots.treeName
string treeName
Definition: dumpFileToPlots.py:19
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
SH::openFile
std::unique_ptr< TFile > openFile(const std::string &name, const MetaObject &options)
open a file with the given options
Definition: ToolsOther.cxx:35
hist_file_dump.f
f
Definition: hist_file_dump.py:140
EL::EventRange::eof
static constexpr Long64_t eof
the special value to indicate that the range includes all events until the end of the file
Definition: EventRange.h:34
SH::MetaObject::castString
std::string castString(const std::string &name, const std::string &def_val="", CastMode mode=CAST_ERROR_THROW) const
the meta-data string with the given name
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
python.AtlRunQueryLib.options
options
Definition: AtlRunQueryLib.py:378
EL::Worker::inputFileNumEntries
Long64_t inputFileNumEntries() const override
the number of events in the input file
Definition: Worker.cxx:738
SH::MetaFields::treeName
static const std::string treeName
the name of the tree in the sample
Definition: MetaFields.h:52
EL::Worker::setJobConfig
void setJobConfig(JobConfig &&jobConfig)
set the JobConfig
Definition: Worker.cxx:365
RCU_INVARIANT
#define RCU_INVARIANT(x)
Definition: Assert.h:201
beamspotman.jobConfig
dictionary jobConfig
Definition: beamspotman.py:1069
EL::Job::optAlgorithmTimer
static const std::string optAlgorithmTimer
a boolean flag for whether to add a timer for the algorithms
Definition: Job.h:205
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
merge.output
output
Definition: merge.py:16
EL::Job::histogramStreamName
static const std::string histogramStreamName
the name of the histogram output stream
Definition: Job.h:605
EL::Worker::EC_BADINPUT
@ EC_BADINPUT
Definition: Worker.h:253
EL::Job::optAlgorithmMemoryMonitor
static const std::string optAlgorithmMemoryMonitor
a boolean flag for whether to add a memory monitor for the algorithms
Definition: Job.h:210
EL::Worker::addOutputStream
::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:713
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
RCU::SetDirectory
bool SetDirectory(TObject *object, TDirectory *directory)
effects: set the directory this object is associated with returns: whether the object type actively k...
Definition: RootUtils.cxx:28
RootUtils::WithRootErrorHandler
Run a MT piece of code with an alternate root error handler.
Definition: WithRootErrorHandler.h:56
RegSelToolConfig.alg
alg
Definition: RegSelToolConfig.py:332
EL::Detail::ModuleData::m_inputTreeEntry
uint64_t m_inputTreeEntry
the entry in the input tree we are currently looking at
Definition: ModuleData.h:79
EL::Detail::ModuleData::m_algs
std::vector< Detail::AlgorithmData > m_algs
the list of algorithms
Definition: ModuleData.h:66
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:16
EL::Detail::ModuleData::m_inputFileUrl
std::string m_inputFileUrl
the input file url of the currently opened file
Definition: ModuleData.h:69
EL::Detail::ModuleData::m_histOutput
OutputStreamData * m_histOutput
the histogram output stream
Definition: ModuleData.h:91
EL::Detail::ModuleData::m_eventsProcessed
uint64_t m_eventsProcessed
the number of events that have been processed
Definition: ModuleData.h:88
RCU_DESTROY_INVARIANT
#define RCU_DESTROY_INVARIANT(x)
Definition: Assert.h:235
EL::Detail::ModuleData::m_tevent
xAOD::TEvent * m_tevent
the TEvent structure, if we use one
Definition: ModuleData.h:97
EL::Job::outputIter
const OutputStream * outputIter
Definition: Job.h:143
ReadCellNoiseFromCoolCompare.s2
s2
Definition: ReadCellNoiseFromCoolCompare.py:379
SH::MetaObject::castDouble
double castDouble(const std::string &name, double def_val=0, CastMode mode=CAST_ERROR_THROW) const
the meta-data double with the given name
EL::Detail::ModuleData::m_skipEvent
bool m_skipEvent
whether we are skipping the current event
Definition: ModuleData.h:82
RCU_CHANGE_INVARIANT
#define RCU_CHANGE_INVARIANT(x)
Definition: Assert.h:231
EL::Worker::setMetaData
void setMetaData(const SH::MetaObject *val_metaData)
set the metaData
Definition: Worker.cxx:334
EL::Worker::treeEntry
Long64_t treeEntry() const override
description: the entry in the tree we are reading guarantee: no-fail
Definition: Worker.cxx:218
RCU_THROW_MSG
#define RCU_THROW_MSG(message)
Definition: PrintMsg.h:58
EL::Job::optSkipEvents
static const std::string optSkipEvents
description: the name of the option used for skipping a certain number of events in the beginning rat...
Definition: Job.h:233
EL::Worker::initialize
::StatusCode initialize()
initialize the worker
Definition: Worker.cxx:377
SH::MetaFields::treeName_default
static const std::string treeName_default
the default value of treeName
Definition: MetaFields.h:55
EL::Detail::OutputStreamData::saveOutput
void saveOutput()
write the list of output objects to disk and clear it
Definition: OutputStreamData.cxx:192
EL::Detail::ModuleData::m_worker
Worker * m_worker
the worker (to pass on to the algorithms)
Definition: ModuleData.h:106
python.PyAthena.obj
obj
Definition: PyAthena.py:132
RCU_ASSERT
#define RCU_ASSERT(x)
Definition: Assert.h:222
checkJobs.completed
completed
Definition: checkJobs.py:23
EL::Detail::ModuleData::m_metaData
const SH::MetaObject * m_metaData
the meta-data we use
Definition: ModuleData.h:85
RCU_READ_INVARIANT
#define RCU_READ_INVARIANT(x)
Definition: Assert.h:229
EL::Detail::report_exception
void report_exception(std::exception_ptr eptr)
print out the currently evaluated exception
Definition: PhysicsAnalysis/D3PDTools/EventLoop/Root/MessageCheck.cxx:27
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
EL::Worker::tree
TTree * tree() const override
description: the tree we are running on guarantee: no-fail
Definition: Worker.cxx:209
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
getEFTrackSample.sampleName
sampleName
Definition: getEFTrackSample.py:13
EL::Worker::addOutputList
void addOutputList(const std::string &name, TObject *output_swallow) override
effects: add a given object to the output.
Definition: Worker.cxx:102
EL::Worker::processInputs
::StatusCode processInputs()
process all the inputs
Definition: Worker.cxx:467
EL::Job::optGridReporting
static const std::string optGridReporting
whether to use grid reporting even when not running on the grid
Definition: Job.h:497
EL::Worker::m_segmentName
std::string m_segmentName
the name of the segment we are processing
Definition: Worker.h:439
NSWL1::PadTriggerAdapter::segment
Muon::NSW_PadTriggerSegment segment(const NSWL1::PadTrigger &data)
Definition: PadTriggerAdapter.cxx:5
RCU_NEW_INVARIANT
#define RCU_NEW_INVARIANT(x)
Definition: Assert.h:233