ATLAS Offline Software
RodHeaderByteStreamCnv.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 
6 #include <vector>
7 #include <stdint.h>
8 
11 
13 #include "ByteStreamData/ROBData.h"
14 
16 
17 #include "GaudiKernel/DataObject.h"
18 #include "GaudiKernel/IOpaqueAddress.h"
19 #include "GaudiKernel/ISvcLocator.h"
20 #include "GaudiKernel/StatusCode.h"
21 
25 
27 
29 
30 #include "RodHeaderByteStreamCnv.h"
31 
32 namespace LVL1BS {
33 
35  : AthConstConverter( storageType(), classID(), svcloc, "RodHeaderByteStreamCnv" ),
36  m_tool("LVL1BS::RodHeaderByteStreamTool/RodHeaderByteStreamTool")
37 {
38 }
39 
41 {
42 }
43 
44 // CLID
45 
47 {
49 }
50 
52 {
54 }
55 
56 // Init method gets all necessary services etc.
57 
58 
60 {
62  ATH_CHECK( m_tool.retrieve() );
63 
64  return StatusCode::SUCCESS;
65 }
66 
67 // createObj should create the RDO from bytestream.
68 
70  DataObject*& pObj ) const
71 {
72  ByteStreamAddress *pBS_Addr;
73  pBS_Addr = dynamic_cast<ByteStreamAddress *>( pAddr );
74  if ( !pBS_Addr ) {
75  ATH_MSG_ERROR( " Can not cast to ByteStreamAddress " );
76  return StatusCode::FAILURE;
77  }
78 
79  const std::string nm = *( pBS_Addr->par() );
80  // size check
81  auto rhCollection = std::make_unique<DataVector<LVL1::RODHeader> >();
82  ATH_CHECK( m_tool->convert(nm, rhCollection.get()) );
83 
84  pObj = SG::asStorable(std::move(rhCollection));
85 
86  return StatusCode::SUCCESS;
87 }
88 
89 } // end namespace
ID
std::vector< Identifier > ID
Definition: CalibHitIDCheck.h:24
StorableConversions.h
convert to and from a SG storable
ROBData.h
Defines the ROB data entity. The ROB data is an abstract entity that is used to discase the raw event...
initialize
void initialize()
Definition: run_EoverP.cxx:894
LVL1BS::RodHeaderByteStreamCnv::createObjConst
virtual StatusCode createObjConst(IOpaqueAddress *pAddr, DataObject *&pObj) const override
Create RodHeaders from ByteStream.
Definition: RodHeaderByteStreamCnv.cxx:69
SG::asStorable
DataObject * asStorable(T *pObject)
Definition: StorableConversions.h:158
AthConstConverter
Gaudi converter base class with const interfaces.
Definition: AthConstConverter.h:33
RodHeaderByteStreamCnv.h
RODHeader.h
LVL1BS::RodHeaderByteStreamCnv::initialize
virtual StatusCode initialize() override
Definition: RodHeaderByteStreamCnv.cxx:59
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LVL1BS::RodHeaderByteStreamCnv::~RodHeaderByteStreamCnv
virtual ~RodHeaderByteStreamCnv()
Definition: RodHeaderByteStreamCnv.cxx:40
ClassID_traits.h
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
RawEvent.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ByteStreamAddress
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
Definition: ByteStreamAddress.h:28
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ByteStreamAddress.h
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
LVL1BS::RodHeaderByteStreamCnv::RodHeaderByteStreamCnv
RodHeaderByteStreamCnv(ISvcLocator *svcloc)
Definition: RodHeaderByteStreamCnv.cxx:34
ByteStreamAddress::storageType
static constexpr long storageType()
Definition: ByteStreamAddress.h:51
errorcheck.h
Helpers for checking error return status codes and reporting errors.
LVL1BS::RodHeaderByteStreamCnv::m_tool
ToolHandle< LVL1BS::RodHeaderByteStreamTool > m_tool
Tool that does the actual work.
Definition: RodHeaderByteStreamCnv.h:50
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
CalibCoolCompareRT.nm
nm
Definition: CalibCoolCompareRT.py:110
LVL1BS
Definition: ZdcByteStreamReadV1V2Tool.h:47
LVL1BS::RodHeaderByteStreamCnv::classID
static const CLID & classID()
Definition: RodHeaderByteStreamCnv.cxx:46
LVL1BS::RodHeaderByteStreamCnv::storageType
static long storageType()
Definition: RodHeaderByteStreamCnv.cxx:51
IROBDataProviderSvc.h
RodHeaderByteStreamTool.h