ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
JetTagging
JetH5Writer
src
EventInfoWriterAlg.cxx
Go to the documentation of this file.
1
#include "
src/EventInfoWriterAlg.h
"
2
#include "
JetH5Writer/EventInfoWriterConfig.h
"
3
4
#include "
AlgHelpers.h
"
5
6
#include "H5Cpp.h"
7
8
EventInfoWriterAlg::EventInfoWriterAlg
(
const
std::string& name,
9
ISvcLocator* loc):
10
AthAlgorithm
(name, loc),
11
m_writer
(nullptr)
12
{
13
}
14
15
StatusCode
EventInfoWriterAlg::initialize
() {
16
ATH_CHECK
(
m_infoKey
.initialize());
17
ATH_CHECK
(
m_output_svc
.retrieve());
18
19
EventInfoWriterConfig
cfg;
20
cfg.name =
m_dsName
.value();
21
if
(cfg.name.empty()) {
22
ATH_MSG_ERROR
(
"datasetName isn't specified in EventInfo writer"
);
23
return
StatusCode::FAILURE;
24
}
25
26
for
(
const
std::string& prim:
m_primitives
) {
27
if
(!
m_primToType
.value().count(prim)) {
28
ATH_MSG_ERROR
(prim <<
" not specified in type mapping"
);
29
}
30
std::string
type
=
m_primToType
.value().at(prim);
31
cfg.inputs.push_back(
Primitive
{
getPrimitiveType
(
type
), prim, prim});
32
}
33
m_writer
.reset(
new
EventInfoWriter
(*
m_output_svc
->group(), cfg));
34
35
return
StatusCode::SUCCESS;
36
}
37
38
StatusCode
EventInfoWriterAlg::execute
(
const
EventContext& ctx) {
39
SG::ReadHandle
event_info(
m_infoKey
, ctx);
40
ATH_CHECK
(event_info.
isValid
());
41
m_writer
->fill(*event_info);
42
return
StatusCode::SUCCESS;
43
}
44
45
StatusCode
EventInfoWriterAlg::finalize
() {
46
m_writer
->flush();
47
return
StatusCode::SUCCESS;
48
}
getPrimitiveType
Primitive::Type getPrimitiveType(const std::string &name)
Definition
AlgHelpers.cxx:10
AlgHelpers.h
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
EventInfoWriterAlg.h
EventInfoWriterConfig.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
EventInfoWriterAlg::m_primitives
Gaudi::Property< std::vector< std::string > > m_primitives
Definition
EventInfoWriterAlg.h:24
EventInfoWriterAlg::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
EventInfoWriterAlg.cxx:38
EventInfoWriterAlg::m_infoKey
SG::ReadHandleKey< xAOD::EventInfo > m_infoKey
Definition
EventInfoWriterAlg.h:33
EventInfoWriterAlg::EventInfoWriterAlg
EventInfoWriterAlg(const std::string &name, ISvcLocator *loc)
Definition
EventInfoWriterAlg.cxx:8
EventInfoWriterAlg::initialize
virtual StatusCode initialize() override
Definition
EventInfoWriterAlg.cxx:15
EventInfoWriterAlg::m_dsName
Gaudi::Property< std::string > m_dsName
Definition
EventInfoWriterAlg.h:30
EventInfoWriterAlg::m_writer
std::unique_ptr< EventInfoWriter > m_writer
Definition
EventInfoWriterAlg.h:38
EventInfoWriterAlg::m_primToType
Gaudi::Property< std::map< std::string, std::string > > m_primToType
Definition
EventInfoWriterAlg.h:27
EventInfoWriterAlg::finalize
virtual StatusCode finalize() override
Definition
EventInfoWriterAlg.cxx:45
EventInfoWriterAlg::m_output_svc
ServiceHandle< IH5GroupSvc > m_output_svc
Definition
EventInfoWriterAlg.h:35
EventInfoWriter
Test Algorithm for checking TagInfoMgr and the storing of geometry and conditions tags in EventInfo,...
Definition
AtlasTest/DatabaseTest/AthenaPoolTest/src/EventInfoWriter.h:39
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
EventInfoWriterConfig
Definition
EventInfoWriterConfig.h:13
type
Primitive
Definition
Primitive.h:10
Generated on
for ATLAS Offline Software by
1.17.0