ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloByteStream
src
CpmRoiByteStreamV1Cnv.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
#include <vector>
7
#include <stdint.h>
8
9
#include "
ByteStreamCnvSvcBase/ByteStreamAddress.h
"
10
#include "
ByteStreamCnvSvcBase/IROBDataProviderSvc.h
"
11
12
#include "
ByteStreamData/RawEvent.h
"
13
#include "
ByteStreamData/ROBData.h
"
14
15
#include "
AthContainers/DataVector.h
"
16
17
#include "GaudiKernel/DataObject.h"
18
#include "GaudiKernel/IOpaqueAddress.h"
19
#include "GaudiKernel/IRegistry.h"
20
#include "GaudiKernel/ISvcLocator.h"
21
#include "GaudiKernel/StatusCode.h"
22
23
#include "
AthenaKernel/ClassID_traits.h
"
24
#include "
AthenaKernel/StorableConversions.h
"
25
#include "
AthenaKernel/errorcheck.h
"
26
27
#include "
TrigT1CaloEvent/CPMRoI.h
"
28
29
#include "
CpmRoiByteStreamV1Cnv.h
"
30
#include "
CpmRoiByteStreamV1Tool.h
"
31
32
namespace
LVL1BS
{
33
34
CpmRoiByteStreamV1Cnv::CpmRoiByteStreamV1Cnv
( ISvcLocator* svcloc )
35
:
AthConstConverter
(
storageType
(),
classID
(), svcloc,
"CpmRoiByteStreamV1Cnv"
),
36
m_tool
(
"LVL1BS::CpmRoiByteStreamV1Tool/CpmRoiByteStreamV1Tool"
),
37
m_robDataProvider
(
"ROBDataProviderSvc"
,
name
())
38
{
39
}
40
41
CpmRoiByteStreamV1Cnv::~CpmRoiByteStreamV1Cnv
()
42
{
43
}
44
45
// CLID
46
47
CLID
CpmRoiByteStreamV1Cnv::classID
()
48
{
49
return
ClassID_traits<DataVector<LVL1::CPMRoI>
>::ID();
50
}
51
52
long
CpmRoiByteStreamV1Cnv::storageType
()
53
{
54
return
ByteStreamAddress::storageType
();
55
}
56
57
// Init method gets all necessary services etc.
58
59
60
StatusCode
CpmRoiByteStreamV1Cnv::initialize
()
61
{
62
ATH_CHECK
( Converter::initialize() );
63
ATH_CHECK
(
m_tool
.retrieve() );
64
65
// Get ROBDataProvider
66
StatusCode
sc
=
m_robDataProvider
.retrieve();
67
if
(
sc
.isFailure() ) {
68
ATH_MSG_WARNING
(
"Failed to retrieve service "
<<
m_robDataProvider
);
69
// return is disabled for Write BS which does not require ROBDataProviderSvc
70
// return sc ;
71
}
72
73
return
StatusCode::SUCCESS;
74
}
75
76
// createObj should create the RDO from bytestream.
77
78
StatusCode
CpmRoiByteStreamV1Cnv::createObjConst
( IOpaqueAddress* pAddr,
79
DataObject*& pObj )
const
80
{
81
ByteStreamAddress
* pBS_Addr{};
82
ATH_CHECK
( (pBS_Addr =
dynamic_cast<
ByteStreamAddress
*
>
(pAddr)) !=
nullptr
);
83
84
const
EventContext& ctx = pBS_Addr->
getEventContext
();
85
const
std::string nm = *( pBS_Addr->par() );
86
87
ATH_MSG_DEBUG
(
" Creating Objects "
<< nm );
88
89
// get SourceIDs
90
const
std::vector<uint32_t>& vID(
m_tool
->sourceIDs(nm));
91
92
// get ROB fragments
93
IROBDataProviderSvc::VROBFRAG
robFrags;
94
m_robDataProvider
->getROBData(ctx, vID, robFrags );
95
96
// size check
97
auto
roiCollection = std::make_unique<DataVector<LVL1::CPMRoI> >();
98
ATH_MSG_DEBUG
(
" Number of ROB fragments is "
<< robFrags.size() );
99
if
(robFrags.size() == 0) {
100
pObj =
SG::asStorable
(std::move(roiCollection)) ;
101
return
StatusCode::SUCCESS;
102
}
103
104
ATH_CHECK
(
m_tool
->convert(robFrags, roiCollection.get()) );
105
106
pObj =
SG::asStorable
(std::move(roiCollection));
107
108
return
StatusCode::SUCCESS;
109
}
110
111
// createRep should create the bytestream from RDOs.
112
113
StatusCode
CpmRoiByteStreamV1Cnv::createRepConst
( DataObject* pObj,
114
IOpaqueAddress*& pAddr )
const
115
{
116
DataVector<LVL1::CPMRoI>
* roiCollection = 0;
117
if
( !
SG::fromStorable
( pObj, roiCollection ) ) {
118
REPORT_ERROR
(StatusCode::FAILURE) <<
" Cannot cast to DataVector<CPMRoI>"
;
119
return
StatusCode::FAILURE;
120
}
121
122
const
std::string nm = pObj->registry()->name();
123
124
pAddr =
new
ByteStreamAddress
(
classID
(), nm,
""
);
125
126
// Convert to ByteStream
127
return
m_tool
->convert( roiCollection );
128
}
129
130
}
// end namespace
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ByteStreamAddress.h
ClassID_traits.h
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
errorcheck.h
Helpers for checking error return status codes and reporting errors.
REPORT_ERROR
#define REPORT_ERROR(SC)
Report an error.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:355
CpmRoiByteStreamV1Cnv.h
CpmRoiByteStreamV1Tool.h
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
IROBDataProviderSvc.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
ROBData.h
Defines the ROB data entity. The ROB data is an abstract entity that is used to decouple the raw even...
RawEvent.h
StorableConversions.h
convert to and from a SG storable
CPMRoI.h
AthConstConverter::AthConstConverter
AthConstConverter(long storage_type, const CLID &class_type, ISvcLocator *svc, const std::string &name)
Definition
AthConstConverter.h:35
AthConstConverter::name
const std::string & name() const
Definition
AthConstConverter.h:67
ByteStreamAddress
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
Definition
ByteStreamAddress.h:28
ByteStreamAddress::getEventContext
const EventContext & getEventContext() const
Definition
ByteStreamAddress.h:62
ByteStreamAddress::storageType
static constexpr long storageType()
Definition
ByteStreamAddress.h:51
DataVector
Derived DataVector<T>.
Definition
DataVector.h:795
IROBDataProviderSvc::VROBFRAG
std::vector< const ROBF * > VROBFRAG
Definition
IROBDataProviderSvc.h:27
LVL1BS::CpmRoiByteStreamV1Cnv::createObjConst
virtual StatusCode createObjConst(IOpaqueAddress *pAddr, DataObject *&pObj) const override
Create CPM RoIs from ByteStream.
Definition
CpmRoiByteStreamV1Cnv.cxx:78
LVL1BS::CpmRoiByteStreamV1Cnv::m_tool
ToolHandle< LVL1BS::CpmRoiByteStreamV1Tool > m_tool
Tool that does the actual work.
Definition
CpmRoiByteStreamV1Cnv.h:52
LVL1BS::CpmRoiByteStreamV1Cnv::initialize
virtual StatusCode initialize() override
Definition
CpmRoiByteStreamV1Cnv.cxx:60
LVL1BS::CpmRoiByteStreamV1Cnv::storageType
static long storageType()
Definition
CpmRoiByteStreamV1Cnv.cxx:52
LVL1BS::CpmRoiByteStreamV1Cnv::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Service for reading bytestream.
Definition
CpmRoiByteStreamV1Cnv.h:55
LVL1BS::CpmRoiByteStreamV1Cnv::classID
static CLID classID()
Definition
CpmRoiByteStreamV1Cnv.cxx:47
LVL1BS::CpmRoiByteStreamV1Cnv::createRepConst
virtual StatusCode createRepConst(DataObject *pObj, IOpaqueAddress *&pAddr) const override
Create ByteStream from CPM RoIs.
Definition
CpmRoiByteStreamV1Cnv.cxx:113
LVL1BS::CpmRoiByteStreamV1Cnv::~CpmRoiByteStreamV1Cnv
virtual ~CpmRoiByteStreamV1Cnv()
Definition
CpmRoiByteStreamV1Cnv.cxx:41
LVL1BS::CpmRoiByteStreamV1Cnv::CpmRoiByteStreamV1Cnv
CpmRoiByteStreamV1Cnv(ISvcLocator *svcloc)
Definition
CpmRoiByteStreamV1Cnv.cxx:34
LVL1BS
Definition
ZdcModifySlices.h:10
SG::fromStorable
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)
Definition
StorableConversions.h:169
SG::asStorable
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
Definition
DataObjectSharedPtr.h:31
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition
Control/AthenaKernel/AthenaKernel/ClassID_traits.h:37
Generated on
for ATLAS Offline Software by
1.17.0