ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
EL::Detail::TEventModule Class Reference

#include <TEventModule.h>

Inheritance diagram for EL::Detail::TEventModule:
Collaboration diagram for EL::Detail::TEventModule:

Public Member Functions

 TEventModule (const std::string &name)
 effects: standard constructor. More...
 
 ~TEventModule ()
 effects: standard destructor. More...
 
virtual StatusCode onInitialize (ModuleData &data) override
 action just before algorithms are initialized More...
 
virtual StatusCode postFinalize (ModuleData &data) override
 actions after algorithms have been finalized More...
 
virtual StatusCode onNewInputFile (ModuleData &data) override
 actions after opening a new input file More...
 
virtual StatusCode postCloseInputFile (ModuleData &data) override
 actions after CloseInputFile is called on the algorithms More...
 
virtual StatusCode onExecute (ModuleData &data) override
 actions just before execute is called on algorithms More...
 
virtual StatusCode firstInitialize (ModuleData &data)
 action at the the very beginning of the worker job More...
 
virtual StatusCode preFileInitialize (ModuleData &data)
 action before opening the first file in the worker job More...
 
virtual StatusCode processInputs (ModuleData &data, IInputModuleActions &actions)
 process all input files More...
 
virtual StatusCode postFirstEvent (ModuleData &data)
 action after processing first event More...
 
virtual StatusCode onCloseInputFile (ModuleData &data)
 actions before closing an input file More...
 
virtual StatusCode onFileExecute (ModuleData &data)
 actions just before fileExecute is called on algorithms More...
 
virtual StatusCode onFinalize (ModuleData &data)
 actions just before algorithms are finalized More...
 
virtual StatusCode onWorkerEnd (ModuleData &data)
 action at the end of the worker job More...
 
virtual StatusCode postFileClose (ModuleData &data)
 action at end of the worker job More...
 
virtual void reportInputFailure (ModuleData &data)
 report that we failed to open our input file More...
 

Private Attributes

std::unique_ptr< xAOD::TEventm_event
 description: the event structure used More...
 
std::unique_ptr< xAOD::TStorem_store
 
std::unique_ptr< asg::SgTEventm_evtStore
 
bool m_useStats
 description: whether we collect D3PDPerfStats statistics More...
 

Detailed Description

Definition at line 31 of file TEventModule.h.

Constructor & Destructor Documentation

◆ TEventModule()

EL::Detail::TEventModule::TEventModule ( const std::string &  name)

effects: standard constructor.

guarantee: no-fail

Definition at line 40 of file TEventModule.cxx.

42  : Module (name)
43  {}

◆ ~TEventModule()

EL::Detail::TEventModule::~TEventModule ( )

effects: standard destructor.

guarantee: no-fail

Definition at line 47 of file TEventModule.cxx.

49  {}

Member Function Documentation

◆ firstInitialize()

StatusCode EL::Detail::Module::firstInitialize ( ModuleData data)
virtualinherited

action at the the very beginning of the worker job

This gets called as early as possible in the worker initialization. Essentially all that should happen before this is to load all the modules. The main purpose is to start any benchmarks that are meant to capture the initialization process as well.

Reimplemented in EL::Detail::MemoryMonitorModule, EL::Detail::AlgorithmMemoryModule, EL::Detail::AlgorithmTimerModule, and EL::Detail::StopwatchModule.

Definition at line 25 of file Module.cxx.

27  {
28  return ::StatusCode::SUCCESS;
29  }

◆ onCloseInputFile()

StatusCode EL::Detail::Module::onCloseInputFile ( ModuleData data)
virtualinherited

actions before closing an input file

Reimplemented in EL::Detail::AlgorithmStateModule, and EL::Detail::TreeCacheModule.

Definition at line 43 of file Module.cxx.

45  {
46  return ::StatusCode::SUCCESS;
47  }

◆ onExecute()

StatusCode EL::Detail::TEventModule::onExecute ( ModuleData data)
overridevirtual

actions just before execute is called on algorithms

For now that is mostly used to point input modules to the right event

Reimplemented from EL::Detail::Module.

Definition at line 177 of file TEventModule.cxx.

179  {
180  m_store->clear ();
181  if (m_event->getEntry (data.m_inputTreeEntry) < 0)
182  RCU_THROW_MSG ("failed to read from xAOD");
183  return StatusCode::SUCCESS;
184  }

◆ onFileExecute()

StatusCode EL::Detail::Module::onFileExecute ( ModuleData data)
virtualinherited

actions just before fileExecute is called on algorithms

Reimplemented in EL::Detail::AlgorithmStateModule, EL::Detail::FileExecutedModule, and EL::Detail::StopwatchModule.

Definition at line 65 of file Module.cxx.

67  {
68  return ::StatusCode::SUCCESS;
69  }

◆ onFinalize()

StatusCode EL::Detail::Module::onFinalize ( ModuleData data)
virtualinherited

actions just before algorithms are finalized

Reimplemented in EL::Detail::AlgorithmStateModule, and EL::Detail::MemoryMonitorModule.

Definition at line 89 of file Module.cxx.

91  {
92  return ::StatusCode::SUCCESS;
93  }

◆ onInitialize()

StatusCode EL::Detail::TEventModule::onInitialize ( ModuleData data)
overridevirtual

action just before algorithms are initialized

This is typically used for any setup that this module needs to do.

Reimplemented from EL::Detail::Module.

Definition at line 53 of file TEventModule.cxx.

55  {
56  if (m_event != nullptr || m_store != nullptr)
57  {
58  ANA_MSG_ERROR ("module initialized twice");
59  return StatusCode::FAILURE;
60  }
61  if (data.m_tevent != nullptr || data.m_tstore != nullptr)
62  {
63  ANA_MSG_ERROR ("duplicate TEventModule??");
64  return StatusCode::FAILURE;
65  }
66 
67  std::string modeStr = data.m_metaData->castString
69  if (!modeStr.empty())
70  {
72  if (modeStr == Job::optXaodAccessMode_class)
74  else if (modeStr == Job::optXaodAccessMode_branch)
76  else if (modeStr == Job::optXaodAccessMode_athena)
78  else
79  {
80  ANA_MSG_ERROR ("unknown XAOD access mode: " << modeStr);
81  return StatusCode::FAILURE;
82  }
83  m_event.reset (new xAOD::TEvent (mode));
84  } else
85  {
86  m_event.reset (new xAOD::TEvent);
87  }
88  if (data.m_metaData->castDouble (Job::optXAODSummaryReport, 1) == 0)
90 
91  m_store.reset (new xAOD::TStore);
92 
93  m_evtStore = std::make_unique<asg::SgTEvent> (m_event.get(), m_store.get());
94 
95  m_useStats = data.m_metaData->castBool (Job::optXAODPerfStats, false);
96  if (m_useStats)
98 
99  data.m_tevent = m_event.get();
100  data.m_tstore = m_store.get();
101  data.m_evtStore = m_evtStore.get();
102 
103  // Perform a sanity check.
104  if (!data.m_inputFile)
105  {
106  ANA_MSG_ERROR ("File is not available during initialization?!?");
107  return StatusCode::FAILURE;
108  }
109  // Set up the reading from the first input file, which should be
110  // open already. But note that no event is loaded with getEntry(...)
111  // yet, as we don't want to allow users to access the first event
112  // during initialisation. Only the in-file metadata...
113  ANA_CHECK (m_event->readFrom (data.m_inputFile.get()));
114 
115  return StatusCode::SUCCESS;
116  }

◆ onNewInputFile()

StatusCode EL::Detail::TEventModule::onNewInputFile ( ModuleData data)
overridevirtual

actions after opening a new input file

Reimplemented from EL::Detail::Module.

Definition at line 143 of file TEventModule.cxx.

145  {
146  if (m_event == nullptr || m_store == nullptr)
147  {
148  ANA_MSG_ERROR ("module not inititalized");
149  return StatusCode::FAILURE;
150  }
151  ANA_CHECK (m_event->readFrom (data.m_inputFile.get()));
152  if ((m_event->getEntries() > 0) && (m_event->getEntry (0) < 0))
153  {
154  ANA_MSG_ERROR ("Failed to load first entry from file");
155  return StatusCode::FAILURE;
156  }
157  m_store->clear ();
158  return StatusCode::SUCCESS;
159  }

◆ onWorkerEnd()

StatusCode EL::Detail::Module::onWorkerEnd ( ModuleData data)
virtualinherited

action at the end of the worker job

This is mostly meant/used to print job summary statements at the very end of worker job, and actually have them show up at or at least near the end of any log file.

Reimplemented in EL::Detail::MemoryMonitorModule, EL::Detail::StopwatchModule, and EL::Detail::LeakCheckModule.

Definition at line 101 of file Module.cxx.

103  {
104  return ::StatusCode::SUCCESS;
105  }

◆ postCloseInputFile()

StatusCode EL::Detail::TEventModule::postCloseInputFile ( ModuleData data)
overridevirtual

actions after CloseInputFile is called on the algorithms

Right now that is only used to disconnect the TEvent object from the input file.

Reimplemented from EL::Detail::Module.

Definition at line 163 of file TEventModule.cxx.

165  {
166  if (m_event == nullptr || m_store == nullptr)
167  {
168  ANA_MSG_ERROR ("module not inititalized");
169  return StatusCode::FAILURE;
170  }
171  ANA_CHECK (m_event->readFrom ((TFile *)nullptr));
172  return StatusCode::SUCCESS;
173  }

◆ postFileClose()

StatusCode EL::Detail::Module::postFileClose ( ModuleData data)
virtualinherited

action at end of the worker job

Executed just right before worker exit successfully at this stage all outputs have been created

Reimplemented in EL::Detail::GridReportingModule, and EL::Detail::PostClosedOutputsModule.

Definition at line 107 of file Module.cxx.

109  {
110  return ::StatusCode::SUCCESS;
111  }

◆ postFinalize()

StatusCode EL::Detail::TEventModule::postFinalize ( ModuleData data)
overridevirtual

actions after algorithms have been finalized

This is usually used to calculate some job summary information that is to be stored it in the histogram output file.

Reimplemented from EL::Detail::Module.

Definition at line 120 of file TEventModule.cxx.

122  {
123  if (m_useStats)
124  {
126  std::unique_ptr<xAOD::ReadStats> stats
128  stats->SetName (Job::optXAODReadStats.c_str());
129  stats->Print ();
130  data.addOutput (std::move (stats));
131  }
132  data.m_evtStore = nullptr;
133  data.m_tevent = nullptr;
134  data.m_tstore = nullptr;
135  m_evtStore.reset ();
136  m_event.reset ();
137  m_store.reset ();
138  return StatusCode::SUCCESS;
139  }

◆ postFirstEvent()

StatusCode EL::Detail::Module::postFirstEvent ( ModuleData data)
virtualinherited

action after processing first event

This is mostly meant to set up benchmarks that record per-event performance. While a lot of initialization happens during initialize() there is a fair amount of initialization that happens on the first event, so when recording per-event performance the first event is sort of "special" and may need to be omitted.

Reimplemented in EL::Detail::MemoryMonitorModule, and EL::Detail::LeakCheckModule.

Definition at line 55 of file Module.cxx.

57  {
58  return ::StatusCode::SUCCESS;
59  }

◆ preFileInitialize()

StatusCode EL::Detail::Module::preFileInitialize ( ModuleData data)
virtualinherited

action before opening the first file in the worker job

This is mostly meant to allow loading the dictionaries before any files and associated information is loaded.

Definition at line 31 of file Module.cxx.

33  {
34  return ::StatusCode::SUCCESS;
35  }

◆ processInputs()

StatusCode EL::Detail::Module::processInputs ( ModuleData data,
IInputModuleActions actions 
)
virtualinherited

process all input files

This deviates slightly from the usual pattern for module functions in that I pass in the possible actions as an argument. See IInputModuleActions for details.

Reimplemented in EL::Detail::BatchInputModule, and EL::Detail::DirectInputModule.

Definition at line 83 of file Module.cxx.

85  {
86  return ::StatusCode::SUCCESS;
87  }

◆ reportInputFailure()

void EL::Detail::Module::reportInputFailure ( ModuleData data)
virtualinherited

report that we failed to open our input file

Reimplemented in EL::Detail::GridReportingModule.

Definition at line 61 of file Module.cxx.

63  {}

Member Data Documentation

◆ m_event

std::unique_ptr<xAOD::TEvent> EL::Detail::TEventModule::m_event
private

description: the event structure used

Definition at line 70 of file TEventModule.h.

◆ m_evtStore

std::unique_ptr<asg::SgTEvent> EL::Detail::TEventModule::m_evtStore
private

Definition at line 72 of file TEventModule.h.

◆ m_store

std::unique_ptr<xAOD::TStore> EL::Detail::TEventModule::m_store
private

Definition at line 71 of file TEventModule.h.

◆ m_useStats

bool EL::Detail::TEventModule::m_useStats
private

description: whether we collect D3PDPerfStats statistics

Definition at line 76 of file TEventModule.h.


The documentation for this class was generated from the following files:
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
EL::Job::optXaodAccessMode
static const std::string optXaodAccessMode
description: the option to select the access mode for xAODs.
Definition: Job.h:397
xAOD::PerfStats::start
void start(bool clear=true)
Start the statistics collection.
xAOD::TEvent::kAthenaAccess
@ kAthenaAccess
Access containers/objects like Athena does.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:101
xAOD::TFileAccessTracer::enableDataSubmission
static void enableDataSubmission(::Bool_t value)
Function for turning data submission on/off.
Definition: TFileAccessTracer.cxx:281
EL::Job::optXaodAccessMode_class
static const std::string optXaodAccessMode_class
Definition: Job.h:399
ANA_MSG_ERROR
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:294
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
xAOD::TEvent::kClassAccess
@ kClassAccess
Access auxiliary data using the aux containers.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:100
trigbs_dumpHLTContentInBS.stats
stats
Definition: trigbs_dumpHLTContentInBS.py:91
EL::Job::optXAODSummaryReport
static const std::string optXAODSummaryReport
the option to turn on/off the xAOD summary reporting at the end of the job
Definition: Job.h:406
EL::Detail::TEventModule::m_evtStore
std::unique_ptr< asg::SgTEvent > m_evtStore
Definition: TEventModule.h:72
EL::Detail::TEventModule::m_event
std::unique_ptr< xAOD::TEvent > m_event
description: the event structure used
Definition: TEventModule.h:70
EL::Job::optXAODPerfStats
static const std::string optXAODPerfStats
description: the name of the option for turning on XAODPerfStats.
Definition: Job.h:353
Preparation.mode
mode
Definition: Preparation.py:94
EL::Detail::TEventModule::m_store
std::unique_ptr< xAOD::TStore > m_store
Definition: TEventModule.h:71
xAOD::IOStats::instance
static IOStats & instance()
Singleton object accessor.
Definition: IOStats.cxx:11
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
EL::Job::optXaodAccessMode_branch
static const std::string optXaodAccessMode_branch
Definition: Job.h:398
xAOD::PerfStats::instance
static PerfStats & instance()
Function accessing the singleton instance.
xAOD::TEvent::EAuxMode
EAuxMode
Auxiliary store "mode".
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:98
xAOD::TStore
A relatively simple transient store for objects created in analysis.
Definition: TStore.h:44
EL::Job::optXaodAccessMode_athena
static const std::string optXaodAccessMode_athena
Definition: Job.h:400
xAOD::PerfStats::stop
void stop()
Stop the statistics collection.
xAOD::TEvent::kBranchAccess
@ kBranchAccess
Access auxiliary data branch-by-branch.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:99
RCU_THROW_MSG
#define RCU_THROW_MSG(message)
Definition: PrintMsg.h:58
xAOD::ReadStats
Class describing the access statistics of a collection of branches.
Definition: ReadStats.h:123
xAOD::TEvent
Tool for accessing xAOD files outside of Athena.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:84
EL::Job::optXAODReadStats
static const std::string optXAODReadStats
description: the name of the XAODPerfStats object produced as I gather it, as well as the name of the...
Definition: Job.h:362
EL::Detail::TEventModule::m_useStats
bool m_useStats
description: whether we collect D3PDPerfStats statistics
Definition: TEventModule.h:76