ATLAS Offline Software
TgcRdoContByteStreamCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <inttypes.h>
8 
9 #include <sstream>
10 
15 #include "GaudiKernel/DataObject.h"
16 #include "GaudiKernel/IToolSvc.h"
17 #include "GaudiKernel/MsgStream.h"
18 #include "GaudiKernel/StatusCode.h"
20 #include "MuonRDO/TgcRdoIdHash.h"
21 
22 const std::string const_cnvName = "TgcRdoContByteStreamCnv";
23 
24 // constructor
26  AthConstConverter(storageType(), classID(), svcloc, "TgcRdoContByteStreamCnv"), m_tool("Muon::TgcRdoContByteStreamTool") {}
27 
28 // class ID
30 
32 
33 // initialize
35  ATH_MSG_DEBUG(" initialize ");
37  ATH_CHECK(m_tool.retrieve());
38  return StatusCode::SUCCESS;
39 }
40 
41 // convert TGC RDOs in the container into ByteStream
42 StatusCode TgcRdoContByteStreamCnv::createRepConst(DataObject* pObj, IOpaqueAddress*& pAddr) const {
43  // retrieve TGC RDO container
44  TgcRdoContainer* cont(nullptr);
45  SG::fromStorable(pObj, cont);
46  if (!cont) {
47  ATH_MSG_ERROR(" Can not cast to TgcRdoContainer");
48  return StatusCode::FAILURE;
49  }
50 
51  // create address
52  std::string nm = pObj->registry()->name();
53  pAddr = new ByteStreamAddress(classID(), nm, "");
54 
55  // convert
56  return m_tool->convert(cont);
57 }
TgcRdoContByteStreamCnv.h
SG::fromStorable
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)
Definition: StorableConversions.h:167
StorableConversions.h
convert to and from a SG storable
initialize
void initialize()
Definition: run_EoverP.cxx:894
AthConstConverter
Gaudi converter base class with const interfaces.
Definition: AthConstConverter.h:33
ClassID_traits::ID
static const CLID & ID()
the CLID of T
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:50
TgcRdoContByteStreamCnv::initialize
virtual StatusCode initialize() override
Definition: TgcRdoContByteStreamCnv.cxx:34
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TgcRdoContainer
Definition: TgcRdoContainer.h:25
RawEvent.h
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
TgcRdoContByteStreamCnv::m_tool
ToolHandle< Muon::ITGC_RDOtoByteStreamTool > m_tool
Definition: TgcRdoContByteStreamCnv.h:47
ByteStreamAddress
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
Definition: ByteStreamAddress.h:28
TgcRdoContByteStreamCnv::storageType
static long storageType()
Definition: TgcRdoContByteStreamCnv.cxx:31
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ByteStreamAddress.h
TgcRdoContainer.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
TgcRdoContByteStreamCnv::TgcRdoContByteStreamCnv
TgcRdoContByteStreamCnv(ISvcLocator *svcloc)
Definition: TgcRdoContByteStreamCnv.cxx:25
TgcRdoContByteStreamCnv::classID
static const CLID & classID()
Definition: TgcRdoContByteStreamCnv.cxx:29
const_cnvName
const std::string const_cnvName
Definition: TgcRdoContByteStreamCnv.cxx:22
CalibCoolCompareRT.nm
nm
Definition: CalibCoolCompareRT.py:110
TgcRdoIdHash.h
ByteStreamCnvSvcBase.h
TgcRdoContByteStreamCnv::createRepConst
virtual StatusCode createRepConst(DataObject *pObj, IOpaqueAddress *&pAddr) const override
Convert the transient object to the requested representation.
Definition: TgcRdoContByteStreamCnv.cxx:42