ATLAS Offline Software
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 
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 }
EventInfoWriterConfig
Definition: EventInfoWriterConfig.h:13
EventInfoWriterConfig.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
EventInfoWriterAlg::EventInfoWriterAlg
EventInfoWriterAlg(const std::string &name, ISvcLocator *loc)
Definition: EventInfoWriterAlg.cxx:8
Primitive
Definition: Primitive.h:10
EventInfoWriterAlg::m_primToType
Gaudi::Property< std::map< std::string, std::string > > m_primToType
Definition: EventInfoWriterAlg.h:27
AlgHelpers.h
EventInfoWriterAlg::m_primitives
Gaudi::Property< std::vector< std::string > > m_primitives
Definition: EventInfoWriterAlg.h:24
EventInfoWriterAlg.h
EventInfoWriterAlg::m_writer
std::unique_ptr< EventInfoWriter > m_writer
Definition: EventInfoWriterAlg.h:38
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
EventInfoWriterAlg::m_dsName
Gaudi::Property< std::string > m_dsName
Definition: EventInfoWriterAlg.h:30
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
AthAlgorithm
Definition: AthAlgorithm.h:47
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
EventInfoWriterAlg::m_infoKey
SG::ReadHandleKey< xAOD::EventInfo > m_infoKey
Definition: EventInfoWriterAlg.h:33
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
WriteCaloSwCorrections.cfg
cfg
Definition: WriteCaloSwCorrections.py:23
EventInfoWriterAlg::finalize
virtual StatusCode finalize() override
Definition: EventInfoWriterAlg.cxx:45
EventInfoWriter
Test Algorithm for checking TagInfoMgr and the storing of geometry and conditions tags in EventInfo,...
Definition: AtlasTest/DatabaseTest/AthenaPoolTest/src/EventInfoWriter.h:39
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
EventInfoWriterAlg::execute
virtual StatusCode execute() override
Definition: EventInfoWriterAlg.cxx:38
getPrimitiveType
Primitive::Type getPrimitiveType(const std::string &name)
Definition: AlgHelpers.cxx:10
EventInfoWriterAlg::initialize
virtual StatusCode initialize() override
Definition: EventInfoWriterAlg.cxx:15
EventInfoWriterAlg::m_output_svc
ServiceHandle< IH5GroupSvc > m_output_svc
Definition: EventInfoWriterAlg.h:35