ATLAS Offline Software
Loading...
Searching...
No Matches
TileLaserObjByteStreamCnv.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//author Renato Febbraro
6//renato.febbraro@cern.ch
7//date February 2008
8
9// Gaudi includes
10#include "GaudiKernel/StatusCode.h"
11#include "GaudiKernel/DataObject.h"
12#include "GaudiKernel/IRegistry.h"
13#include "GaudiKernel/IToolSvc.h"
14
15// Athena includes
18
24
26
27// Tile includes
34
35
36
38 : AthConstConverter(storageType(), classID(), svcloc, "TileLaserObjByteStreamCnv")
39 , m_robSvc("ROBDataProviderSvc", name())
40 , m_decoder("TileROD_Decoder")
41 , m_ROBID()
42 , m_hid2re(0)
43{
44}
45
47
49
51
52 ATH_CHECK(Converter::initialize());
53
54 ATH_MSG_DEBUG(" initialize ");
55
56 ATH_CHECK( m_robSvc.retrieve() );
57
58 // retrieve Tool
59 ATH_CHECK( m_decoder.retrieve() );
60
61 m_hid2re = m_decoder->getHid2re();
62
63 m_ROBID.clear();
64 // m_ROBID.push_back( 0x500000 );
65 // m_ROBID.push_back( 0x520010 );
66 m_ROBID.push_back( m_hid2re->getRobFromFragID(LASER_OBJ_FRAG) );
67
68 return StatusCode::SUCCESS ;
69}
70
71
72StatusCode TileLaserObjByteStreamCnv::createObjConst(IOpaqueAddress* pAddr, DataObject*& pObj) const
73{
74 ATH_MSG_DEBUG( " Executing createObj method" );
75
76 ByteStreamAddress *pRE_Addr;
77 pRE_Addr = dynamic_cast<ByteStreamAddress*>(pAddr);
78 if(!pRE_Addr) {
79 ATH_MSG_ERROR( " Can not cast to ByteStreamAddress " );
80 return StatusCode::FAILURE;
81 }
82
83 /*FIND ROB*/
84 std::vector<const ROBDataProviderSvc::ROBF*> robf;
85 m_robSvc->getROBData(Gaudi::Hive::currentContext(), m_ROBID, robf);
86
87 // create TileLaserObject
88 auto cont = std::make_unique<TileLaserObject>() ;
89 m_decoder->setLaserVersion(*cont);
90
91 if (robf.size() > 0 ) {
92 m_decoder->fillTileLaserObj(robf[0], *cont);
93 } else {
94 ATH_MSG_DEBUG( " No LASTROD fragment in BS, TileLaserObject will be empty." );
95 }
96
97 pObj = SG::asStorable( std::move(cont) ) ;
98
99 return StatusCode::SUCCESS;
100}
101
102StatusCode TileLaserObjByteStreamCnv::createRepConst(DataObject* /* pObj */, IOpaqueAddress*& /* pAddr */) const
103{
104 // No conversion from TileLaserObj to BS
105
106 ATH_MSG_ERROR( " Can not create BS from TileLaserObject " );
107
108 return StatusCode::FAILURE ;
109}
110
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(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.
convert to and from a SG storable
#define LASER_OBJ_FRAG
Definition TileTBFrag.h:49
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()
virtual StatusCode createRepConst(DataObject *pObj, IOpaqueAddress *&pAddr) const override
Convert the transient object to the requested representation.
const TileHid2RESrcID * m_hid2re
Pointer to TileHid2RESrcID.
ServiceHandle< IROBDataProviderSvc > m_robSvc
Pointer to IROBDataProviderSvc.
TileLaserObjByteStreamCnv(ISvcLocator *svcloc)
virtual StatusCode createObjConst(IOpaqueAddress *pAddr, DataObject *&pObj) const override
Create the transient representation of an object.
virtual StatusCode initialize() override
ToolHandle< TileROD_Decoder > m_decoder
Pointer to TileROD_Decoder.
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)