ATLAS Offline Software
Loading...
Searching...
No Matches
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.
 ~TEventModule ()
 effects: standard destructor.
virtual StatusCode onInitialize (ModuleData &data) override
 action just before algorithms are initialized
virtual StatusCode postFinalize (ModuleData &data) override
 actions after algorithms have been finalized
virtual StatusCode onNewInputFile (ModuleData &data) override
 actions after opening a new input file
virtual StatusCode postCloseInputFile (ModuleData &data) override
 actions after CloseInputFile is called on the algorithms
virtual StatusCode onExecute (ModuleData &data) override
 actions just before execute is called on algorithms
virtual StatusCode firstInitialize (ModuleData &data)
 action at the the very beginning of the worker job
virtual StatusCode preFileInitialize (ModuleData &data)
 action before opening the first file in the worker job
virtual StatusCode processInputs (ModuleData &data, IInputModuleActions &actions)
 process all input files
virtual StatusCode postFirstEvent (ModuleData &data)
 action after processing first event
virtual StatusCode onCloseInputFile (ModuleData &data)
 actions before closing an input file
virtual StatusCode onFileExecute (ModuleData &data)
 actions just before fileExecute is called on algorithms
virtual StatusCode onFinalize (ModuleData &data)
 actions just before algorithms are finalized
virtual StatusCode onWorkerEnd (ModuleData &data)
 action at the end of the worker job
virtual StatusCode postFileClose (ModuleData &data)
 action at end of the worker job
virtual void reportInputFailure (ModuleData &data)
 report that we failed to open our input file

Private Attributes

std::unique_ptr< xAOD::TEventm_event
 description: the event structure used
std::unique_ptr< xAOD::TStorem_store
std::unique_ptr< asg::SgTEventm_evtStore
Gaudi::Property< bool > m_useStats {this, "useStats", false}
 description: whether we collect D3PDPerfStats statistics
Gaudi::Property< std::string > m_modeStr {this, "accessMode", ""}
Gaudi::Property< std::string > m_otherMetaDataTreeNamePattern {this, "otherMetaDataTreeNamePattern", ""}
Gaudi::Property< bool > m_summaryReport {this, "summaryReport", true}

Detailed Description

Definition at line 32 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::AlgorithmMemoryModule, EL::Detail::AlgorithmTimerModule, EL::Detail::MemoryMonitorModule, 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 176 of file TEventModule.cxx.

178 {
179 m_store->clear ();
180 if (m_event->getEntry (data.m_inputTreeEntry) < 0)
181 RCU_THROW_MSG ("failed to read from xAOD");
182 return StatusCode::SUCCESS;
183 }
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
#define RCU_THROW_MSG(message)
Definition PrintMsg.h:58
std::unique_ptr< xAOD::TStore > m_store
std::unique_ptr< xAOD::TEvent > m_event
description: the event structure used

◆ 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 if (!m_modeStr.value().empty())
68 {
72 else if (m_modeStr.value() == Job::optXaodAccessMode_branch)
74 else if (m_modeStr.value() == Job::optXaodAccessMode_athena)
76 else
77 {
78 ANA_MSG_ERROR ("unknown XAOD access mode: " << m_modeStr.value());
79 return StatusCode::FAILURE;
80 }
81 m_event.reset (new xAOD::TEvent (mode));
82 m_event->setOtherMetaDataTreeNamePattern( m_otherMetaDataTreeNamePattern );
83 } else
84 {
85 m_event.reset (new xAOD::TEvent);
86 m_event->setOtherMetaDataTreeNamePattern( m_otherMetaDataTreeNamePattern );
87 }
88 if (!m_summaryReport.value())
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 if (m_useStats.value())
97
98 data.m_tevent = m_event.get();
99 data.m_tstore = m_store.get();
100 data.m_evtStore = m_evtStore.get();
101
102 // Perform a sanity check.
103 if (!data.m_inputFile)
104 {
105 ANA_MSG_ERROR ("File is not available during initialization?!?");
106 return StatusCode::FAILURE;
107 }
108 // Set up the reading from the first input file, which should be
109 // open already. But note that no event is loaded with getEntry(...)
110 // yet, as we don't want to allow users to access the first event
111 // during initialisation. Only the in-file metadata...
112 ANA_CHECK (m_event->readFrom (data.m_inputFile.get()));
113
114 return StatusCode::SUCCESS;
115 }
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
#define ANA_CHECK(EXP)
check whether the given expression was successful
Gaudi::Property< bool > m_summaryReport
Gaudi::Property< std::string > m_modeStr
std::unique_ptr< asg::SgTEvent > m_evtStore
Gaudi::Property< std::string > m_otherMetaDataTreeNamePattern
Gaudi::Property< bool > m_useStats
description: whether we collect D3PDPerfStats statistics
static const std::string optXaodAccessMode_athena
Definition Job.h:403
static const std::string optXaodAccessMode_branch
Definition Job.h:401
static const std::string optXaodAccessMode_class
Definition Job.h:402
void start(bool clear=true)
Start the statistics collection.
static PerfStats & instance()
Function accessing the singleton instance.
@ kAthenaAccess
Access containers/objects like Athena does.
@ kClassAccess
Access auxiliary data using the aux containers.
@ kBranchAccess
Access auxiliary data branch-by-branch.
static void enableDataSubmission(::Bool_t value)
Function for turning data submission on/off.

◆ onNewInputFile()

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

actions after opening a new input file

Reimplemented from EL::Detail::Module.

Definition at line 142 of file TEventModule.cxx.

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

◆ 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::LeakCheckModule, EL::Detail::MemoryMonitorModule, and EL::Detail::StopwatchModule.

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 162 of file TEventModule.cxx.

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

◆ 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 119 of file TEventModule.cxx.

121 {
122 if (m_useStats.value())
123 {
125 std::unique_ptr<xAOD::ReadStats> stats
126 (new xAOD::ReadStats (xAOD::IOStats::instance().stats()));
127 stats->SetName (Job::optXAODReadStats.c_str());
128 stats->Print ();
129 data.addOutput (std::move (stats));
130 }
131 data.m_evtStore = nullptr;
132 data.m_tevent = nullptr;
133 data.m_tstore = nullptr;
134 m_evtStore.reset ();
135 m_event.reset ();
136 m_store.reset ();
137 return StatusCode::SUCCESS;
138 }
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:365
static IOStats & instance()
Singleton object accessor.
Definition IOStats.cxx:11
void stop()
Stop the statistics collection.

◆ 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::LeakCheckModule, and EL::Detail::MemoryMonitorModule.

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 71 of file TEventModule.h.

◆ m_evtStore

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

Definition at line 73 of file TEventModule.h.

◆ m_modeStr

Gaudi::Property<std::string> EL::Detail::TEventModule::m_modeStr {this, "accessMode", ""}
private

Definition at line 79 of file TEventModule.h.

79{this, "accessMode", ""};

◆ m_otherMetaDataTreeNamePattern

Gaudi::Property<std::string> EL::Detail::TEventModule::m_otherMetaDataTreeNamePattern {this, "otherMetaDataTreeNamePattern", ""}
private

Definition at line 80 of file TEventModule.h.

80{this, "otherMetaDataTreeNamePattern", ""};

◆ m_store

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

Definition at line 72 of file TEventModule.h.

◆ m_summaryReport

Gaudi::Property<bool> EL::Detail::TEventModule::m_summaryReport {this, "summaryReport", true}
private

Definition at line 81 of file TEventModule.h.

81{this, "summaryReport", true};

◆ m_useStats

Gaudi::Property<bool> EL::Detail::TEventModule::m_useStats {this, "useStats", false}
private

description: whether we collect D3PDPerfStats statistics

Definition at line 77 of file TEventModule.h.

77{this, "useStats", false};

The documentation for this class was generated from the following files: