ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloByteStream
src
CpReadByteStreamV1V2Cnv.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/CPMTower.h
"
28
29
#include "
CpReadByteStreamV1V2Cnv.h
"
30
#include "
CpByteStreamV1Tool.h
"
31
#include "
CpByteStreamV2Tool.h
"
32
33
namespace
LVL1BS
{
34
35
CpReadByteStreamV1V2Cnv::CpReadByteStreamV1V2Cnv
( ISvcLocator* svcloc )
36
:
AthConstConverter
(
storageType
(),
classID
(), svcloc,
"CpReadByteStreamV1V2Cnv"
),
37
m_tool1
(
"LVL1BS::CpByteStreamV1Tool/CpByteStreamV1Tool"
),
38
m_tool2
(
"LVL1BS::CpByteStreamV2Tool/CpByteStreamV2Tool"
),
39
m_robDataProvider
(
"ROBDataProviderSvc"
,
name
())
40
{
41
}
42
43
CpReadByteStreamV1V2Cnv::~CpReadByteStreamV1V2Cnv
()
44
{
45
}
46
47
// CLID
48
49
CLID
CpReadByteStreamV1V2Cnv::classID
()
50
{
51
return
ClassID_traits<DataVector<LVL1::CPMTower>
>::ID();
52
}
53
54
long
CpReadByteStreamV1V2Cnv::storageType
()
55
{
56
return
ByteStreamAddress::storageType
();
57
}
58
59
// Init method gets all necessary services etc.
60
61
62
StatusCode
CpReadByteStreamV1V2Cnv::initialize
()
63
{
64
ATH_CHECK
( Converter::initialize() );
65
ATH_CHECK
(
m_tool1
.retrieve() );
66
ATH_CHECK
(
m_tool2
.retrieve() );
67
ATH_CHECK
(
m_robDataProvider
.retrieve() );
68
69
return
StatusCode::SUCCESS;
70
}
71
72
// createObj should create the RDO from bytestream.
73
74
StatusCode
CpReadByteStreamV1V2Cnv::createObjConst
( IOpaqueAddress* pAddr,
75
DataObject*& pObj )
const
76
{
77
ByteStreamAddress
* pBS_Addr{};
78
ATH_CHECK
( (pBS_Addr =
dynamic_cast<
ByteStreamAddress
*
>
(pAddr)) !=
nullptr
);
79
80
const
EventContext& ctx = pBS_Addr->
getEventContext
();
81
const
std::string nm = *( pBS_Addr->par() );
82
83
ATH_MSG_DEBUG
(
" Creating Objects "
<< nm );
84
85
// get SourceIDs
86
const
std::vector<uint32_t>& vID1(
m_tool1
->sourceIDs());
87
const
std::vector<uint32_t>& vID2(
m_tool2
->sourceIDs());
88
89
// get ROB fragments
90
IROBDataProviderSvc::VROBFRAG
robFrags1;
91
m_robDataProvider
->getROBData(ctx, vID1, robFrags1 );
92
IROBDataProviderSvc::VROBFRAG
robFrags2;
93
m_robDataProvider
->getROBData(ctx, vID2, robFrags2 );
94
95
// size check
96
auto
towerCollection = std::make_unique<DataVector<LVL1::CPMTower> >();
97
ATH_MSG_DEBUG
(
" Number of ROB fragments is "
<< robFrags1.size()
98
<<
", "
<< robFrags2.size() );
99
100
if
(robFrags1.size() == 0 && robFrags2.size() == 0) {
101
pObj =
SG::asStorable
(std::move(towerCollection)) ;
102
return
StatusCode::SUCCESS;
103
}
104
105
// Pre-LS1 data
106
if
(robFrags1.size() > 0) {
107
ATH_CHECK
(
m_tool1
->convert(nm, robFrags1, towerCollection.get()) );
108
}
109
// Post-LS1 data
110
if
(robFrags2.size() > 0) {
111
ATH_CHECK
(
m_tool2
->convert(nm, robFrags2, towerCollection.get()) );
112
}
113
114
pObj =
SG::asStorable
(std::move(towerCollection));
115
116
return
StatusCode::SUCCESS;
117
}
118
119
}
// end namespace
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: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.
CpByteStreamV1Tool.h
CpByteStreamV2Tool.h
CpReadByteStreamV1V2Cnv.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
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
CPMTower.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
IROBDataProviderSvc::VROBFRAG
std::vector< const ROBF * > VROBFRAG
Definition
IROBDataProviderSvc.h:27
LVL1BS::CpReadByteStreamV1V2Cnv::m_tool1
ToolHandle< LVL1BS::CpByteStreamV1Tool > m_tool1
Tool that does the actual work pre-LS1.
Definition
CpReadByteStreamV1V2Cnv.h:54
LVL1BS::CpReadByteStreamV1V2Cnv::createObjConst
virtual StatusCode createObjConst(IOpaqueAddress *pAddr, DataObject *&pObj) const override
Create CPM Towers from ByteStream.
Definition
CpReadByteStreamV1V2Cnv.cxx:74
LVL1BS::CpReadByteStreamV1V2Cnv::initialize
virtual StatusCode initialize() override
Definition
CpReadByteStreamV1V2Cnv.cxx:62
LVL1BS::CpReadByteStreamV1V2Cnv::storageType
static long storageType()
Definition
CpReadByteStreamV1V2Cnv.cxx:54
LVL1BS::CpReadByteStreamV1V2Cnv::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Service for reading bytestream.
Definition
CpReadByteStreamV1V2Cnv.h:59
LVL1BS::CpReadByteStreamV1V2Cnv::CpReadByteStreamV1V2Cnv
CpReadByteStreamV1V2Cnv(ISvcLocator *svcloc)
Definition
CpReadByteStreamV1V2Cnv.cxx:35
LVL1BS::CpReadByteStreamV1V2Cnv::m_tool2
ToolHandle< LVL1BS::CpByteStreamV2Tool > m_tool2
Tool that does the actual work post-LS1.
Definition
CpReadByteStreamV1V2Cnv.h:56
LVL1BS::CpReadByteStreamV1V2Cnv::classID
static CLID classID()
Definition
CpReadByteStreamV1V2Cnv.cxx:49
LVL1BS::CpReadByteStreamV1V2Cnv::~CpReadByteStreamV1V2Cnv
virtual ~CpReadByteStreamV1V2Cnv()
Definition
CpReadByteStreamV1V2Cnv.cxx:43
LVL1BS
Definition
ZdcModifySlices.h:10
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