ATLAS Offline Software
Loading...
Searching...
No Matches
EventInfoWriterAlg.cxx
Go to the documentation of this file.
3
4#include "AlgHelpers.h"
5
6#include "H5Cpp.h"
7
9 ISvcLocator* loc):
10 AthAlgorithm(name, loc),
11 m_writer(nullptr)
12{
13}
14
16 ATH_CHECK(m_infoKey.initialize());
17 ATH_CHECK(m_output_svc.retrieve());
18
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
39 SG::ReadHandle event_info(m_infoKey);
40 ATH_CHECK(event_info.isValid());
41 m_writer->fill(*event_info);
42 return StatusCode::SUCCESS;
43}
44
46 m_writer->flush();
47 return StatusCode::SUCCESS;
48}
Primitive::Type getPrimitiveType(const std::string &name)
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Property< std::vector< std::string > > m_primitives
SG::ReadHandleKey< xAOD::EventInfo > m_infoKey
virtual StatusCode execute() override
EventInfoWriterAlg(const std::string &name, ISvcLocator *loc)
virtual StatusCode initialize() override
Gaudi::Property< std::string > m_dsName
std::unique_ptr< EventInfoWriter > m_writer
Gaudi::Property< std::map< std::string, std::string > > m_primToType
virtual StatusCode finalize() override
ServiceHandle< IH5GroupSvc > m_output_svc
Test Algorithm for checking TagInfoMgr and the storing of geometry and conditions tags in EventInfo,...
virtual bool isValid() override final
Can the handle be successfully dereferenced?