ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
ForwardDetectors
ZDC
ZdcCnv
ZdcByteStream
src
ZdcByteStreamCnv.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
20
21
#include <cstdint>
22
#include <vector>
23
24
#include "
ByteStreamCnvSvcBase/ByteStreamAddress.h
"
25
#include "
ByteStreamCnvSvcBase/IByteStreamEventAccess.h
"
26
#include "
ByteStreamCnvSvcBase/IROBDataProviderSvc.h
"
27
#include "
ByteStreamData/RawEvent.h
"
28
#include "
ByteStreamData/ROBData.h
"
29
#include "
StoreGate/StoreGateSvc.h
"
30
#include "
AthenaKernel/ClassID_traits.h
"
31
#include "
AthContainers/DataVector.h
"
32
#include "GaudiKernel/DataObject.h"
33
#include "GaudiKernel/IOpaqueAddress.h"
34
#include "GaudiKernel/IRegistry.h"
35
#include "GaudiKernel/ISvcLocator.h"
36
#include "GaudiKernel/StatusCode.h"
37
#include "GaudiKernel/MsgStream.h"
38
#include "
AthenaKernel/StorableConversions.h
"
39
#include "
AthenaKernel/errorcheck.h
"
40
42
#include "
ZdcEvent/ZdcDigits.h
"
43
#include "
ZdcEvent/ZdcDigitsCollection.h
"
44
#include "
ZdcByteStream/ZdcByteStreamCnv.h
"
45
#include "
ZdcByteStream/ZdcByteStreamTool.h
"
46
#include "
ZdcByteStream/ZdcByteStreamReadV1V2Tool.h
"
47
48
//L1Calo include
49
#include "
TrigT1Interfaces/TrigT1CaloDefs.h
"
50
#include "
xAODTrigL1Calo/TriggerTower.h
"
51
#include "
xAODTrigL1Calo/TriggerTowerContainer.h
"
52
#include "
xAODTrigL1Calo/TriggerTowerAuxContainer.h
"
53
54
//==================================================================================================
55
ZdcByteStreamCnv::ZdcByteStreamCnv
(ISvcLocator* svcloc) :
56
AthConstConverter
(
storageType
(),
classID
(), svcloc,
"ZdcByteStreamCnv"
),
57
m_name
(
"ZdcByteStreamCnv"
),
58
//m_tool("ZdcByteStreamTool/ZdcByteStreamTool"), // old style
59
m_tool
(
"ZdcByteStreamReadV1V2Tool/ZdcByteStreamReadV1V2Tool"
),
// new style
60
m_robDataProvider
(
"ROBDataProviderSvc"
,
m_name
),
61
m_ByteStreamEventAccess
(
"ByteStreamCnvSvc"
,
m_name
),
62
m_evtStore
(
"StoreGateSvc"
,
m_name
)
63
{
64
}
65
//==================================================================================================
66
67
68
//==================================================================================================
69
ZdcByteStreamCnv::~ZdcByteStreamCnv
()
70
{
71
}
72
//==================================================================================================
73
74
75
//==================================================================================================
76
CLID
ZdcByteStreamCnv::classID
()
77
{
78
return
ClassID_traits<ZdcDigitsCollection>::ID
();
79
}
80
//==================================================================================================
81
82
//==================================================================================================
83
long
ZdcByteStreamCnv::storageType
()
84
{
85
return
ByteStreamAddress::storageType
();
86
}
87
//==================================================================================================
88
89
90
//==================================================================================================
91
StatusCode
ZdcByteStreamCnv::initialize
()
92
{
101
102
ATH_CHECK
( Converter::initialize() );
103
ATH_CHECK
(
m_ByteStreamEventAccess
.retrieve() );
104
ATH_CHECK
(
m_tool
.retrieve() );
105
ATH_CHECK
(
m_evtStore
.retrieve() );
106
107
StatusCode
sc
=
m_robDataProvider
.retrieve();
108
if
(
sc
.isFailure())
109
{
110
ATH_MSG_WARNING
(
"ZDC: Failed to retrieve service "
<<
m_robDataProvider
);
111
}
112
113
return
StatusCode::SUCCESS;
114
}
115
//==================================================================================================
116
117
118
//==================================================================================================
119
StatusCode
ZdcByteStreamCnv::createObjConst
(IOpaqueAddress* pAddr, DataObject*& pObj)
const
120
{
122
ByteStreamAddress
* pBS_Addr{};
123
ATH_CHECK
( (pBS_Addr =
dynamic_cast<
ByteStreamAddress
*
>
(pAddr)) !=
nullptr
);
124
125
const
EventContext& ctx = pBS_Addr->
getEventContext
();
126
const
std::string nm = *(pBS_Addr->par());
127
128
ATH_MSG_DEBUG
(
"ZDC: Creating Objects "
<< nm );
129
130
// Get SourceIDs; This is NOT related to the ZDC Identifiers
131
//const std::vector<uint32_t>& vID(m_tool->sourceIDs()); // old style
132
const
std::vector<uint32_t>& vID(
m_tool
->ppmSourceIDs(
"temp"
));
// new style
133
134
// get ROB fragments
135
IROBDataProviderSvc::VROBFRAG
robFrags;
136
m_robDataProvider
->getROBData(ctx, vID, robFrags);
137
138
// size check
139
ATH_MSG_DEBUG
(
"ZDC: Number of ROB fragments is "
<< robFrags.size() );
140
141
//ZdcDigitsCollection* const ttCollection = new ZdcDigitsCollection;
142
auto
TTCollection = std::make_unique<xAOD::TriggerTowerContainer>();
// new style
143
auto
aux = std::make_unique<xAOD::TriggerTowerAuxContainer>();
144
TTCollection->setStore(aux.get());
145
146
if
(robFrags.empty())
147
{
148
pObj =
SG::asStorable
(std::move(TTCollection));
149
ATH_CHECK
(
m_evtStore
->record (std::move(aux), nm +
"Aux."
) );
150
return
StatusCode::SUCCESS;
151
}
152
153
154
ATH_CHECK
(
m_tool
->convert(robFrags, TTCollection.get()) );
// new style
155
156
pObj =
SG::asStorable
(std::move(TTCollection));
// new style
157
ATH_CHECK
(
m_evtStore
->record (std::move(aux), nm +
"Aux."
) );
158
159
return
StatusCode::SUCCESS;
160
}
161
//==================================================================================================
162
163
164
//==================================================================================================
166
167
/*
168
StatusCode ZdcByteStreamCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAddr)
169
{
170
RawEventWrite* re = m_ByteStreamEventAccess->getRawEvent();
171
172
ZdcDigitsCollection* ttCollection = 0;
173
if (!SG::fromStorable(pObj, ttCollection))
174
{
175
REPORT_ERROR (StatusCode::FAILURE) << "ZDC: Cannot cast to ZdcDigitsCollection";
176
return StatusCode::FAILURE;
177
}
178
179
const std::string nm = pObj->registry()->name();
180
ByteStreamAddress* addr = new ByteStreamAddress(classID(), nm, "");
181
pAddr = addr;
182
183
// Convert to ByteStream
184
return m_tool->convert(ttCollection, re);
185
}
186
*/
187
188
//==================================================================================================
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x,...)
Definition
AthMsgStreamMacros.h:46
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.
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
TriggerTower.h
IByteStreamEventAccess.h
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
StoreGateSvc.h
TrigT1CaloDefs.h
TriggerTowerAuxContainer.h
TriggerTowerContainer.h
ZdcByteStreamCnv.h
ZdcByteStreamReadV1V2Tool.h
ZdcByteStreamTool.h
ZdcDigitsCollection.h
ZdcDigits.h
AthConstConverter::AthConstConverter
AthConstConverter(long storage_type, const CLID &class_type, ISvcLocator *svc, const std::string &name)
Definition
AthConstConverter.h:35
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
IROBDataProviderSvc::VROBFRAG
std::vector< const ROBF * > VROBFRAG
Definition
IROBDataProviderSvc.h:25
ZdcByteStreamCnv::classID
static CLID classID()
Definition
ZdcByteStreamCnv.cxx:76
ZdcByteStreamCnv::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Service for READING bytestream.
Definition
ZdcByteStreamCnv.h:76
ZdcByteStreamCnv::m_evtStore
ServiceHandle< StoreGateSvc > m_evtStore
Definition
ZdcByteStreamCnv.h:81
ZdcByteStreamCnv::initialize
virtual StatusCode initialize() override
Definition
ZdcByteStreamCnv.cxx:91
ZdcByteStreamCnv::createObjConst
virtual StatusCode createObjConst(IOpaqueAddress *pAddr, DataObject *&pObj) const override
Create the transient representation of an object.
Definition
ZdcByteStreamCnv.cxx:119
ZdcByteStreamCnv::storageType
static long storageType()
Definition
ZdcByteStreamCnv.cxx:83
ZdcByteStreamCnv::ZdcByteStreamCnv
ZdcByteStreamCnv(ISvcLocator *svcloc)
ZdcByteStreamCnv.cxx.
Definition
ZdcByteStreamCnv.cxx:55
ZdcByteStreamCnv::m_name
std::string m_name
Converter name.
Definition
ZdcByteStreamCnv.h:69
ZdcByteStreamCnv::m_tool
ToolHandle< ZdcByteStreamReadV1V2Tool > m_tool
Tool that does the actual work.
Definition
ZdcByteStreamCnv.h:73
ZdcByteStreamCnv::m_ByteStreamEventAccess
ServiceHandle< IByteStreamEventAccess > m_ByteStreamEventAccess
Service for WRITING bytestream.
Definition
ZdcByteStreamCnv.h:79
ZdcByteStreamCnv::~ZdcByteStreamCnv
virtual ~ZdcByteStreamCnv()
Definition
ZdcByteStreamCnv.cxx:69
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