ATLAS Offline Software
TileMuRcvContByteStreamCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // Gaudi includes
6 #include "GaudiKernel/MsgStream.h"
7 #include "GaudiKernel/StatusCode.h"
8 #include "GaudiKernel/DataObject.h"
9 #include "GaudiKernel/IRegistry.h"
10 #include "GaudiKernel/IToolSvc.h"
11 
12 // Athena includes
14 
20 
22 #include "AthenaKernel/CLASS_DEF.h"
23 
24 // Tile includes
28 
29 
30 #include <string>
31 
32 
34  : AthConstConverter(storageType(), classID(),svcloc, "TileMuRcvContByteStreamCnv")
35  , m_tool("TileMuRcvContByteStreamTool")
36  , m_byteStreamEventAccess("ByteStreamCnvSvc", name())
37  , m_byteStreamCnvSvc(0)
38  , m_storeGate("StoreGateSvc", name())
39  , m_robSvc("ROBDataProviderSvc", name())
40  , m_decoder("TileROD_Decoder")
41 {
42 }
43 
46 }
47 
50 }
51 
53 {
55 
56  ATH_MSG_DEBUG(" initialize ");
57 
58  // Get ByteStreamCnvSvc
59  ATH_CHECK( m_byteStreamEventAccess.retrieve() );
61 
62  // retrieve Tool
63  ATH_CHECK( m_decoder.retrieve() );
64 
65  ATH_CHECK( m_tool.retrieve() );
66 
67  ATH_CHECK( m_robSvc.retrieve() );
68 
69  ATH_CHECK( m_storeGate.retrieve() );
70 
71  return StatusCode::SUCCESS ;
72 }
73 
74 
75 StatusCode TileMuRcvContByteStreamCnv::createObjConst(IOpaqueAddress* pAddr, DataObject*& pObj) const
76 {
77 
78  ATH_MSG_DEBUG( " Executing createObj method" );
79 
80  ByteStreamAddress* pRE_Addr;
81  pRE_Addr = dynamic_cast<ByteStreamAddress*>(pAddr);
82  if(!pRE_Addr) {
83  ATH_MSG_ERROR( " Can not cast to ByteStreamAddress " );
84  return StatusCode::FAILURE;
85  }
86 
87  const RawEvent* re = m_robSvc->getEvent();
88  if (!re) {
89  ATH_MSG_ERROR( "Could not get raw event from ByteStreamInputSvc" );
90  return StatusCode::FAILURE;
91  }
92 
93  auto cont = std::make_unique<TileMuonReceiverContainer>();
94 
95  StatusCode sc=m_decoder->convertTMDBDecision(re,cont.get());
96  if (sc!=StatusCode::SUCCESS) {
97  ATH_MSG_WARNING( "Conversion tool returned an error. TileMuonReceiverContainer might be empty." );
98  }
99 
100  pObj = SG::asStorable( std::move(cont) );
101 
102  return StatusCode::SUCCESS;
103 }
104 
105 StatusCode TileMuRcvContByteStreamCnv::createRepConst(DataObject* pObj, IOpaqueAddress*& pAddr) const
106 {
107  ATH_MSG_DEBUG( " Executing createRep method" );
108 
109  // get Full Event Assembler
111  std::string key("Tile");
112 
114 
115  // create TileMuonReceiverContainer
116  //
117  TileMuonReceiverContainer* muRcvCont(0);
118  SG::fromStorable(pObj, muRcvCont);
119  if(!muRcvCont){
120  ATH_MSG_ERROR( " Can not cast to TileMuonReceiverContainer " );
121  return StatusCode::FAILURE;
122  }
123 
124  std::string name = pObj->registry()->name();
125  ByteStreamAddress* addr = new ByteStreamAddress(classID(), name, "");
126 
127  pAddr = addr;
128 
129  // call TileMuRcvContByteStreamTool
130  ATH_CHECK( m_tool->convert(muRcvCont,fea) );
131 
132  return StatusCode::SUCCESS;
133 }
134 
136 {
137  return Converter::finalize();
138 }
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:53
TileMuRcvContByteStreamCnv::finalize
virtual StatusCode finalize() override
Definition: TileMuRcvContByteStreamCnv.cxx:135
FullEventAssembler
Template class for assembling a full atlas raw event from subfragments.
Definition: FullEventAssembler.h:40
SG::fromStorable
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)
Definition: StorableConversions.h:180
initialize
void initialize()
Definition: run_EoverP.cxx:894
RawEvent
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition: RawEvent.h:37
SG::asStorable
DataObject * asStorable(T *pObject)
Definition: StorableConversions.h:158
AthConstConverter
Gaudi converter base class with const interfaces.
Definition: AthConstConverter.h:33
TileMuRcvContByteStreamCnv::storageType
static long storageType()
Definition: TileMuRcvContByteStreamCnv.cxx:48
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
TileMuRcvContByteStreamCnv::m_byteStreamCnvSvc
ByteStreamCnvSvc * m_byteStreamCnvSvc
Definition: TileMuRcvContByteStreamCnv.h:58
TileMuRcvContByteStreamCnv::m_tool
ToolHandle< BYTESTREAMTOOL > m_tool
Pointer to TileMuRcvContByteStreamTool.
Definition: TileMuRcvContByteStreamCnv.h:55
ClassID_traits::ID
static const CLID & ID()
the CLID of T
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:50
ByteStreamCnvSvc
Gaudi Conversion Service class for ByteStream Persistency.
Definition: ByteStreamCnvSvc.h:34
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TileROD_Decoder.h
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
ByteStreamAddress
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
Definition: ByteStreamAddress.h:28
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ByteStreamAddress.h
ByteStreamCnvSvc.h
TileMuRcvContByteStreamCnv::TileMuRcvContByteStreamCnv
TileMuRcvContByteStreamCnv(ISvcLocator *svcloc)
Definition: TileMuRcvContByteStreamCnv.cxx:33
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
TileMuRcvContByteStreamCnv::m_storeGate
ServiceHandle< StoreGateSvc > m_storeGate
Pointer to StoreGateSvc.
Definition: TileMuRcvContByteStreamCnv.h:61
TileMuRcvContByteStreamCnv::initialize
virtual StatusCode initialize() override
Definition: TileMuRcvContByteStreamCnv.cxx:52
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
errorcheck.h
Helpers for checking error return status codes and reporting errors.
TileMuRcvContByteStreamCnv::classID
static const CLID & classID()
Definition: TileMuRcvContByteStreamCnv.cxx:44
TileMuRcvContByteStreamCnv::createObjConst
virtual StatusCode createObjConst(IOpaqueAddress *pAddr, DataObject *&pObj) const override
Create the transient representation of an object.
Definition: TileMuRcvContByteStreamCnv.cxx:75
StoreClearedIncident.h
Incident sent after a store is cleared.
TileMuRcvContByteStreamCnv::m_decoder
ToolHandle< TileROD_Decoder > m_decoder
Pointer to TileROD_Decoder.
Definition: TileMuRcvContByteStreamCnv.h:67
TileMuRcvContByteStreamCnv::m_robSvc
ServiceHandle< IROBDataProviderSvc > m_robSvc
Pointer to IROBDataProviderSvc.
Definition: TileMuRcvContByteStreamCnv.h:64
TileMuRcvContByteStreamCnv::createRepConst
virtual StatusCode createRepConst(DataObject *pObj, IOpaqueAddress *&pAddr) const override
Convert the transient object to the requested representation.
Definition: TileMuRcvContByteStreamCnv.cxx:105
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
re
const boost::regex re(r_e)
TileMuRcvContByteStreamCnv.h
TileMuRcvContByteStreamCnv::m_byteStreamEventAccess
ServiceHandle< IByteStreamEventAccess > m_byteStreamEventAccess
Definition: TileMuRcvContByteStreamCnv.h:57
ByteStreamCnvSvcBase.h
ByteStreamCnvSvc::getFullEventAssembler
StatusCode getFullEventAssembler(T *&t, const std::string &nm)
Access to FullEventAssembler.
Definition: ByteStreamCnvSvc.h:121
TileMuRcvContByteStreamTool.h
TileContainer
Definition: TileContainer.h:38
CLASS_DEF.h
macros to associate a CLID to a type
IROBDataProviderSvc.h
AthConstConverter::name
std::string name() const
Definition: AthConstConverter.h:67
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37