ATLAS Offline Software
EventInfoByteStreamxAODCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 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 
17 #include "StoreGate/StoreGateSvc.h"
18 
20  : Converter(storageType(), classID(), svcloc)
21  , AthMessaging(svcloc != nullptr ? msgSvc() : nullptr, "EventInfoByteStreamxAODCnv")
22 {
23 }
24 
26 {
28 }
29 
31 {
33 }
34 
36 {
37  ATH_MSG_DEBUG("Initialize");
39  return StatusCode::SUCCESS;
40 }
41 
43 {
44  ATH_MSG_DEBUG("Finalize");
45 
47  if (sc.isFailure()) {
48  ATH_MSG_WARNING("Converter::finalize() failed");
49  }
50  return sc;
51 }
52 
53 StatusCode 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();
68  DataLink<xAOD::EventAuxInfo> link(nmAux);
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 
77 StatusCode EventInfoByteStreamxAODCnv::createRep(DataObject* /*pObj*/, IOpaqueAddress*& /*pAddr*/)
78 {
79  ATH_MSG_DEBUG("Nothing to be done for xAOD::EventInfo createReps");
80  return StatusCode::SUCCESS;
81 }
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:53
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition: IEventInfoCnvTool.h:17
xAOD::EventInfo_v1::eventNumber
uint64_t eventNumber() const
The current event's event number.
EventInfoByteStreamxAODCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj) override
converter method to create object
Definition: EventInfoByteStreamxAODCnv.cxx:53
initialize
void initialize()
Definition: run_EoverP.cxx:894
SG::asStorable
DataObject * asStorable(T *pObject)
Definition: StorableConversions.h:158
EventInfoByteStreamxAODCnv::storageType
static long storageType()
Definition: EventInfoByteStreamxAODCnv.cxx:30
EventInfoByteStreamxAODCnv::initialize
virtual StatusCode initialize() override
Definition: EventInfoByteStreamxAODCnv.cxx:35
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
ClassID_traits::ID
static const CLID & ID()
the CLID of T
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:50
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EventInfoByteStreamxAODCnv::classID
static const CLID & classID()
Definition: EventInfoByteStreamxAODCnv.cxx:25
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
SG::AuxElement::setStore
void setStore(const SG::IConstAuxStore *store)
Set the store associated with this object.
Definition: AuxElement.cxx:221
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ByteStreamAddress
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
Definition: ByteStreamAddress.h:28
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
ByteStreamAddress.h
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
ByteStreamAddress::storageType
static constexpr long storageType()
Definition: ByteStreamAddress.h:51
EventAuxInfo.h
EventInfoByteStreamxAODCnv::EventInfoByteStreamxAODCnv
EventInfoByteStreamxAODCnv(ISvcLocator *svcloc)
Definition: EventInfoByteStreamxAODCnv.cxx:19
Converter
Definition: Converter.h:27
errorcheck.h
Helpers for checking error return status codes and reporting errors.
EventInfo.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
CalibCoolCompareRT.nm
nm
Definition: CalibCoolCompareRT.py:110
EventInfoByteStreamxAODCnv.h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
EventInfoByteStreamxAODCnv::createRep
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr) override
converter method to write object
Definition: EventInfoByteStreamxAODCnv.cxx:77
StoreGateSvc.h
EventInfoByteStreamxAODCnv::finalize
virtual StatusCode finalize() override
Definition: EventInfoByteStreamxAODCnv.cxx:42