ATLAS Offline Software
Loading...
Searching...
No Matches
EventInfoByteStreamxAODCnv.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
7
9#include "GaudiKernel/MsgStream.h"
10#include "GaudiKernel/StatusCode.h"
11#include "GaudiKernel/DataObject.h"
12#include "GaudiKernel/IRegistry.h"
13
16
18
20 : Converter(storageType(), classID(), svcloc)
21 , AthMessaging(svcloc != nullptr ? msgSvc() : nullptr, "EventInfoByteStreamxAODCnv")
22{
23}
24
29
34
36{
37 ATH_MSG_DEBUG("Initialize");
38 CHECK(Converter::initialize());
39 return StatusCode::SUCCESS;
40}
41
43{
44 ATH_MSG_DEBUG("Finalize");
45
46 StatusCode sc = Converter::finalize();
47 if (sc.isFailure()) {
48 ATH_MSG_WARNING("Converter::finalize() failed");
49 }
50 return sc;
51}
52
53StatusCode EventInfoByteStreamxAODCnv::createObj(IOpaqueAddress* pAddr, DataObject*& pObj)
54{
55 ByteStreamAddress *pRE_Addr{nullptr};
56 pRE_Addr = dynamic_cast<ByteStreamAddress*>(pAddr);
57 if (!pRE_Addr) {
58 ATH_MSG_ERROR("Cannot cast to ByteStreamAddress ");
59 return StatusCode::FAILURE;
60 }
61
62 ATH_MSG_DEBUG("Creating Objects");
63
64 const std::string nm = *(pRE_Addr->par());
65 const std::string nmAux = nm + "Aux.";
66
67 xAOD::EventInfo* pEvtInfo = new xAOD::EventInfo();
69 pEvtInfo->setStore(link);
70 pObj = SG::asStorable(pEvtInfo);
71
72 ATH_MSG_DEBUG(" New EventInfo made, run/event= " << pEvtInfo->runNumber() << " " << pEvtInfo->eventNumber());
73
74 return StatusCode::SUCCESS;
75}
76
77StatusCode EventInfoByteStreamxAODCnv::createRep(DataObject* /*pObj*/, IOpaqueAddress*& /*pAddr*/)
78{
79 ATH_MSG_DEBUG("Nothing to be done for xAOD::EventInfo createReps");
80 return StatusCode::SUCCESS;
81}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
uint32_t CLID
The Class ID type.
static Double_t sc
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
static constexpr long storageType()
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr) override
converter method to write object
EventInfoByteStreamxAODCnv(ISvcLocator *svcloc)
virtual StatusCode initialize() override
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj) override
converter method to create object
virtual StatusCode finalize() override
void setStore(const SG::IConstAuxStore *store)
Set the store associated with this object.
uint32_t runNumber() const
The current event's run number.
uint64_t eventNumber() const
The current event's event number.
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
EventInfo_v1 EventInfo
Definition of the latest event info version.