ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1ResultByteStream
src
CTPByteStreamCnv.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
// Gaudi/Athena include(s):
7
#include "GaudiKernel/MsgStream.h"
8
#include "
ByteStreamCnvSvcBase/ByteStreamAddress.h
"
9
#include "
ByteStreamData/RawEvent.h
"
10
#include "
ByteStreamData/ROBData.h
"
11
12
#include "
AthenaKernel/StorableConversions.h
"
13
14
// Trigger include(s):
15
#include "
TrigT1Result/CTP_RDO.h
"
16
17
// Local include(s):
18
#include "
CTPByteStreamCnv.h
"
19
24
CTPByteStreamCnv::CTPByteStreamCnv
( ISvcLocator* svcloc )
25
:
Converter
(
storageType
(),
classID
(), svcloc ),
26
m_tool
(
"CTPByteStreamTool"
),
27
m_robDataProvider
(
"ROBDataProviderSvc"
,
"CTPByteStreamCnv"
),
28
m_ByteStreamEventAccess
(
"ByteStreamCnvSvc"
,
"CTPByteStreamCnv"
) {
29
30
}
31
36
CLID
CTPByteStreamCnv::classID
() {
37
38
return
ClassID_traits< CTP_RDO >::ID
();
39
40
}
41
42
long
CTPByteStreamCnv::storageType
() {
43
return
ByteStreamAddress::storageType
();
44
}
45
49
StatusCode
CTPByteStreamCnv::initialize
() {
50
51
//
52
// Initialise the base class:
53
//
54
ATH_CHECK
( Converter::initialize() );
55
56
MsgStream log( msgSvc(),
"CTPByteStreamCnv"
);
57
log << MSG::DEBUG <<
"CTPByteStreamCnv in initialize() "
<<
endmsg
;
58
59
//
60
// Get ByteStreamCnvSvc:
61
//
62
ATH_CHECK
(
m_ByteStreamEventAccess
.retrieve() );
63
log << MSG::DEBUG <<
"Connected to ByteStreamEventAccess interface"
<<
endmsg
;
64
65
//
66
// Get CTPByteStreamTool:
67
//
68
ATH_CHECK
(
m_tool
.retrieve() );
69
log << MSG::DEBUG <<
"Connected to CTPByteStreamTool"
<<
endmsg
;
70
71
//
72
// Get ROBDataProvider:
73
//
74
if
(
m_robDataProvider
.retrieve().isFailure() ) {
75
log << MSG::WARNING <<
"Can't get ROBDataProviderSvc"
<<
endmsg
;
76
// return is disabled for Write BS which does not requre ROBDataProviderSvc
77
}
else
{
78
log << MSG::DEBUG <<
"Connected to ROBDataProviderSvc"
<<
endmsg
;
79
}
80
81
return
StatusCode::SUCCESS;
82
}
83
89
StatusCode
CTPByteStreamCnv::createObj
( IOpaqueAddress* pAddr, DataObject*& pObj ) {
90
91
MsgStream log( msgSvc(),
"CTPByteStreamCnv"
);
92
log << MSG::DEBUG <<
"createObj() called"
<<
endmsg
;
93
94
ByteStreamAddress
* pBS_Addr{};
95
ATH_CHECK
( (pBS_Addr =
dynamic_cast<
ByteStreamAddress
*
>
(pAddr)) !=
nullptr
);
96
97
const
EventContext& ctx = pBS_Addr->
getEventContext
();
98
99
log << MSG::DEBUG <<
"Creating Objects: "
<< *( pBS_Addr->par() ) <<
endmsg
;
100
101
//
102
// Get the SourceID:
103
//
104
const
uint32_t robId =
m_srcIdMap
.getRobID(
m_srcIdMap
.getRodID() );
105
106
log << MSG::DEBUG <<
"expected ROB sub-detector ID: "
<< std::hex
107
<< robId << std::dec <<
endmsg
;
108
109
std::vector< uint32_t > vID;
110
vID.push_back( robId );
111
112
//
113
// Get the ROB fragment:
114
//
115
IROBDataProviderSvc::VROBFRAG
robFrags;
116
m_robDataProvider
->getROBData( ctx, vID, robFrags );
117
118
//
119
// Size check:
120
//
121
if
( robFrags.size() != 1 ) {
122
log << MSG::WARNING <<
"Number of ROB fragments is "
<< robFrags.size() <<
endmsg
;
123
log << MSG::WARNING <<
"Creating empty CTP_RDO object"
<<
endmsg
;
124
125
CTP_RDO
* result =
new
CTP_RDO
(3,0,0);
126
pObj =
SG::asStorable
( result );
127
return
StatusCode::SUCCESS;
128
}
129
130
//
131
// Do the actual conversion:
132
//
133
IROBDataProviderSvc::VROBFRAG::const_iterator it = robFrags.begin();
134
CTP_RDO
* result = 0;
135
136
ATH_CHECK
(
m_tool
->convert(
ROBData
( *it ).getROBFragment(), result ) );
137
pObj =
SG::asStorable
( result ) ;
138
139
return
StatusCode::SUCCESS;
140
}
141
147
StatusCode
CTPByteStreamCnv::createRep
( DataObject* pObj, IOpaqueAddress*& pAddr ) {
148
149
MsgStream log( msgSvc(),
"CTPByteStreamCnv"
);
150
log << MSG::DEBUG <<
"createRep() called"
<<
endmsg
;
151
152
RawEventWrite
*
re
=
m_ByteStreamEventAccess
->getRawEvent();
153
154
CTP_RDO
* result;
155
if
( !
SG::fromStorable
( pObj, result ) ) {
156
log << MSG::ERROR <<
" Cannot cast to CTP_RDO"
<<
endmsg
;
157
return
StatusCode::FAILURE;
158
}
159
160
ByteStreamAddress
* addr =
new
ByteStreamAddress
(
classID
(), pObj->registry()->name(),
""
);
161
162
pAddr = addr;
163
164
// Convert to ByteStream
165
return
m_tool
->convert( result,
re
);
166
}
re
const std::regex re(r_e)
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ByteStreamAddress.h
CTPByteStreamCnv.h
CTP_RDO.h
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
ROBData.h
Defines the ROB data entity. The ROB data is an abstract entity that is used to decouple the raw even...
ROBData
ROBData_T< OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment, OFFLINE_FRAGMENTS_NAMESPACE::PointerType > ROBData
Definition
ROBData.h:225
RawEvent.h
RawEventWrite
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::FullEventFragment RawEventWrite
data type for writing raw event
Definition
RawEvent.h:39
StorableConversions.h
convert to and from a SG storable
CTP_RDO
CTP_RDO
Definition
TrigT1EventTPCnv.cxx:102
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
CTPByteStreamCnv::createRep
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr) override
Function creating the CTP ROB fragment from a CTP_RDO object.
Definition
CTPByteStreamCnv.cxx:147
CTPByteStreamCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj) override
Function creating the CTP_RDO object from a CTP ROB fragment.
Definition
CTPByteStreamCnv.cxx:89
CTPByteStreamCnv::m_tool
ToolHandle< CTPByteStreamTool > m_tool
Tool doing the actual conversion.
Definition
CTPByteStreamCnv.h:57
CTPByteStreamCnv::classID
static CLID classID()
Function needed by the framework.
Definition
CTPByteStreamCnv.cxx:36
CTPByteStreamCnv::CTPByteStreamCnv
CTPByteStreamCnv(ISvcLocator *svcloc)
Standard constructor.
Definition
CTPByteStreamCnv.cxx:24
CTPByteStreamCnv::initialize
virtual StatusCode initialize() override
Function connecting to all the needed services/tools.
Definition
CTPByteStreamCnv.cxx:49
CTPByteStreamCnv::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Service used when reading the BS data.
Definition
CTPByteStreamCnv.h:63
CTPByteStreamCnv::m_srcIdMap
CTPSrcIdMap m_srcIdMap
Object storing the various IDs of the CTP fragment.
Definition
CTPByteStreamCnv.h:60
CTPByteStreamCnv::storageType
static long storageType()
Function needed by the framework.
Definition
CTPByteStreamCnv.cxx:42
CTPByteStreamCnv::m_ByteStreamEventAccess
ServiceHandle< IByteStreamEventAccess > m_ByteStreamEventAccess
Service used when writing the BS data.
Definition
CTPByteStreamCnv.h:65
CTP_RDO
Definition
CTP_RDO.h:20
Converter::Converter
Converter()
Definition
Converter.h:29
IROBDataProviderSvc::VROBFRAG
std::vector< const ROBF * > VROBFRAG
Definition
IROBDataProviderSvc.h:25
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::ID
static constexpr CLID ID()
Definition
Control/AthenaKernel/AthenaKernel/ClassID_traits.h:44
Generated on
for ATLAS Offline Software by
1.17.0