ATLAS Offline Software
Loading...
Searching...
No Matches
TileMuRcvContByteStreamCnv.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 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
23
24// Tile includes
28
29
30#include <string>
31
32
34 : AthConstConverter(storageType(), classID(),svcloc, "TileMuRcvContByteStreamCnv")
35 , m_tool("TileMuRcvContByteStreamTool")
36 , m_byteStreamCnvSvc("ByteStreamCnvSvc", name())
37 , m_storeGate("StoreGateSvc", name())
38 , m_robSvc("ROBDataProviderSvc", name())
39 , m_decoder("TileROD_Decoder")
40{
41}
42
46
50
52{
53 ATH_CHECK(Converter::initialize());
54
55 ATH_MSG_DEBUG(" initialize ");
56
57 // Get ByteStreamCnvSvc
58 ATH_CHECK( m_byteStreamCnvSvc.retrieve() );
59
60 // retrieve Tool
61 ATH_CHECK( m_decoder.retrieve() );
62
63 ATH_CHECK( m_tool.retrieve() );
64
65 ATH_CHECK( m_robSvc.retrieve() );
66
67 ATH_CHECK( m_storeGate.retrieve() );
68
69 return StatusCode::SUCCESS ;
70}
71
72
73StatusCode TileMuRcvContByteStreamCnv::createObjConst(IOpaqueAddress* pAddr, DataObject*& pObj) const
74{
75
76 ATH_MSG_DEBUG( " Executing createObj method" );
77
78 ByteStreamAddress* pRE_Addr;
79 pRE_Addr = dynamic_cast<ByteStreamAddress*>(pAddr);
80 if(!pRE_Addr) {
81 ATH_MSG_ERROR( " Can not cast to ByteStreamAddress " );
82 return StatusCode::FAILURE;
83 }
84
85 const RawEvent* re = m_robSvc->getEvent(Gaudi::Hive::currentContext());
86 if (!re) {
87 ATH_MSG_ERROR( "Could not get raw event from ByteStreamInputSvc" );
88 return StatusCode::FAILURE;
89 }
90
91 auto cont = std::make_unique<TileMuonReceiverContainer>();
92
93 StatusCode sc=m_decoder->convertTMDBDecision(re,cont.get());
94 if (sc!=StatusCode::SUCCESS) {
95 ATH_MSG_WARNING( "Conversion tool returned an error. TileMuonReceiverContainer might be empty." );
96 }
97
98 pObj = SG::asStorable( std::move(cont) );
99
100 return StatusCode::SUCCESS;
101}
102
103StatusCode TileMuRcvContByteStreamCnv::createRepConst(DataObject* pObj, IOpaqueAddress*& pAddr) const
104{
105 ATH_MSG_DEBUG( " Executing createRep method" );
106
107 // get Full Event Assembler
109 std::string key("Tile");
110
111 ATH_CHECK( m_byteStreamCnvSvc->getFullEventAssembler(fea, key) );
112
113 // create TileMuonReceiverContainer
114 //
115 TileMuonReceiverContainer* muRcvCont(0);
116 SG::fromStorable(pObj, muRcvCont);
117 if(!muRcvCont){
118 ATH_MSG_ERROR( " Can not cast to TileMuonReceiverContainer " );
119 return StatusCode::FAILURE;
120 }
121
122 std::string name = pObj->registry()->name();
124
125 pAddr = addr;
126
127 // call TileMuRcvContByteStreamTool
128 ATH_CHECK( m_tool->convert(muRcvCont,fea) );
129
130 return StatusCode::SUCCESS;
131}
132
134{
135 return Converter::finalize();
136}
const boost::regex re(r_e)
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
macros to associate a CLID to a type
Helpers for checking error return status codes and reporting errors.
uint32_t CLID
The Class ID type.
static Double_t sc
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition RawEvent.h:37
Incident sent after a store is cleared.
TileContainer< TileMuonReceiverObj > TileMuonReceiverContainer
AthConstConverter(long storage_type, const CLID &class_type, ISvcLocator *svc, const std::string &name)
const std::string & name() const
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
static constexpr long storageType()
Template class for assembling a full atlas raw event from subfragments.
ToolHandle< BYTESTREAMTOOL > m_tool
Pointer to TileMuRcvContByteStreamTool.
ToolHandle< TileROD_Decoder > m_decoder
Pointer to TileROD_Decoder.
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
virtual StatusCode finalize() override
TileMuRcvContByteStreamCnv(ISvcLocator *svcloc)
ServiceHandle< StoreGateSvc > m_storeGate
Pointer to StoreGateSvc.
virtual StatusCode initialize() override
virtual StatusCode createRepConst(DataObject *pObj, IOpaqueAddress *&pAddr) const override
Convert the transient object to the requested representation.
ServiceHandle< IROBDataProviderSvc > m_robSvc
Pointer to IROBDataProviderSvc.
virtual StatusCode createObjConst(IOpaqueAddress *pAddr, DataObject *&pObj) const override
Create the transient representation of an object.
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)