ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloByteStream
src
xaod
CpmTowerByteStreamAuxCnv.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
// Includes
7
// ============================================================================
8
// STD
9
// ============================================================================
10
#include <vector>
11
#include <cstdint>
12
#include <memory>
13
#include <algorithm>
14
// ============================================================================
15
// Athena
16
// ============================================================================
17
#include "
ByteStreamCnvSvcBase/ByteStreamAddress.h
"
18
#include "
ByteStreamCnvSvcBase/IROBDataProviderSvc.h
"
19
20
#include "
ByteStreamData/RawEvent.h
"
21
#include "
ByteStreamData/ROBData.h
"
22
23
#include "
AthenaKernel/errorcheck.h
"
24
#include "GaudiKernel/DataObject.h"
25
#include "GaudiKernel/IOpaqueAddress.h"
26
#include "GaudiKernel/IRegistry.h"
27
#include "GaudiKernel/ISvcLocator.h"
28
#include "GaudiKernel/StatusCode.h"
29
30
#include "
AthenaKernel/ClassID_traits.h
"
31
#include "
AthenaKernel/StorableConversions.h
"
32
#include "
StoreGate/StoreGateSvc.h
"
33
34
// ============================================================================
35
// TrigT1
36
// ============================================================================
37
#include "
TrigT1CaloEvent/CMXCPHits.h
"
38
#include "
TrigT1CaloEvent/CMXCPTob.h
"
39
#include "
TrigT1CaloEvent/CPMTower.h
"
40
// ============================================================================
41
// xAOD
42
// ============================================================================
43
#include "
xAODTrigL1Calo/CPMTower.h
"
44
#include "
xAODTrigL1Calo/CPMTowerContainer.h
"
45
#include "
xAODTrigL1Calo/CPMTowerAuxContainer.h
"
46
// ============================================================================
47
// Local
48
// ============================================================================
49
#include "
CpmTowerByteStreamAuxCnv.h
"
50
#include "
../CpByteStreamV2Tool.h
"
51
#include "
../ToString.h
"
52
// ============================================================================
53
54
namespace
LVL1BS
{
55
CpmTowerByteStreamAuxCnv::CpmTowerByteStreamAuxCnv
(ISvcLocator* svcloc) :
56
Converter
(
storageType
(),
classID
(), svcloc),
57
AthMessaging
(svcloc != 0 ? msgSvc() : 0,
"CpmTowerByteStreamAuxCnv"
),
58
m_name
(
"CpmTowerByteStreamAuxCnv"
),
59
m_cpmReadTool
(
"LVL1BS::CpByteStreamV2Tool/CpByteStreamV2Tool"
)
60
{
61
}
62
63
CLID
CpmTowerByteStreamAuxCnv::classID
() {
64
return
ClassID_traits<xAOD::CPMTowerAuxContainer>::ID
();
65
}
66
67
long
CpmTowerByteStreamAuxCnv::storageType
()
68
{
69
return
ByteStreamAddress::storageType
();
70
}
71
72
// Init method gets all necessary services etc.
73
74
StatusCode
CpmTowerByteStreamAuxCnv::initialize
() {
75
ATH_MSG_DEBUG
(
"Initializing "
<<
m_name
);
76
77
CHECK
(Converter::initialize());
78
CHECK
(
m_cpmReadTool
.retrieve());
79
80
return
StatusCode::SUCCESS;
81
}
82
83
// createObj should create the RDO from bytestream.
84
StatusCode
CpmTowerByteStreamAuxCnv::createObj
(IOpaqueAddress* pAddr,
85
DataObject*& pObj) {
86
ATH_MSG_DEBUG
(
"createObj() called"
);
87
// -------------------------------------------------------------------------
88
ByteStreamAddress
*pBS_Addr =
dynamic_cast<
ByteStreamAddress
*
>
(pAddr);
89
if
(not pBS_Addr)
return
StatusCode::FAILURE;
90
// -------------------------------------------------------------------------
91
const
EventContext& ctx = pBS_Addr->
getEventContext
();
92
const
std::string nm = *(pBS_Addr->par());
93
ATH_MSG_DEBUG
(
"Creating Objects "
<< nm);
94
95
auto
aux =
new
xAOD::CPMTowerAuxContainer
;
96
xAOD::CPMTowerContainer
cpmCollection;
97
cpmCollection.setStore(aux);
98
// -------------------------------------------------------------------------
99
DataVector<LVL1::CPMTower>
cpmTowerVector;
100
StatusCode
sc
=
m_cpmReadTool
->convert(ctx, nm, &cpmTowerVector);
101
if
(
sc
.isFailure()) {
102
ATH_MSG_ERROR
(
"Failed to create objects"
);
103
delete
aux;
104
return
sc
;
105
}
106
107
for
(
auto
ct : cpmTowerVector) {
108
xAOD::CPMTower
* item =
new
xAOD::CPMTower
();
109
cpmCollection.
push_back
(item);
110
std::vector<uint8_t> emEnergyVec(ct->emEnergyVec().begin(), ct->emEnergyVec().end());
111
std::vector<uint8_t> hadEnergyVec(ct->hadEnergyVec().begin(), ct->hadEnergyVec().end());
112
std::vector<uint32_t> emErrorVec(ct->emErrorVec().begin(), ct->emErrorVec().end());
113
std::vector<uint32_t> hadErrorVec(ct->hadErrorVec().begin(), ct->hadErrorVec().end());
114
115
item->
initialize
(ct->eta(), ct->phi(),
116
emEnergyVec,
117
hadEnergyVec,
118
emErrorVec,
119
hadErrorVec,
120
uint8_t(ct->peak()));
121
}
122
123
// -------------------------------------------------------------------------
124
//ATH_MSG_VERBOSE(ToString(cpmCollection));
125
ATH_MSG_DEBUG
(
"Number of readed CPM towers: "
<< aux->size());
126
// -------------------------------------------------------------------------
127
pObj =
SG::asStorable
(aux);
128
return
StatusCode::SUCCESS;
129
}
130
131
// createRep should create the bytestream from RDOs.
132
StatusCode
CpmTowerByteStreamAuxCnv::createRep
(DataObject*
/*pObj*/
,
133
IOpaqueAddress*&
/*pAddr*/
) {
134
return
StatusCode::FAILURE;
135
}
136
137
}
// end namespace
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ByteStreamAddress.h
CPMTowerAuxContainer.h
CPMTowerContainer.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.
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
CpByteStreamV2Tool.h
CpmTowerByteStreamAuxCnv.h
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
CPMTower.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
ToString.h
CMXCPHits.h
CMXCPTob.h
CPMTower.h
AthMessaging::AthMessaging
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
Definition
AthMessaging.cxx:13
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
Converter::Converter
Converter()
Definition
Converter.h:29
DataVector
Derived DataVector<T>.
Definition
DataVector.h:795
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
LVL1BS::CpmTowerByteStreamAuxCnv::classID
static CLID classID()
Definition
CpmTowerByteStreamAuxCnv.cxx:63
LVL1BS::CpmTowerByteStreamAuxCnv::m_cpmReadTool
ToolHandle< CpByteStreamV2Tool > m_cpmReadTool
Do the main job - retrieve xAOD TriggerTowers from robs.
Definition
CpmTowerByteStreamAuxCnv.h:59
LVL1BS::CpmTowerByteStreamAuxCnv::CpmTowerByteStreamAuxCnv
CpmTowerByteStreamAuxCnv(ISvcLocator *svcloc)
Definition
CpmTowerByteStreamAuxCnv.cxx:55
LVL1BS::CpmTowerByteStreamAuxCnv::createRep
virtual StatusCode createRep(DataObject *pObj, IOpaqueAddress *&pAddr)
Create ByteStream from TriggerTowers.
Definition
CpmTowerByteStreamAuxCnv.cxx:132
LVL1BS::CpmTowerByteStreamAuxCnv::storageType
static long storageType()
Definition
CpmTowerByteStreamAuxCnv.cxx:67
LVL1BS::CpmTowerByteStreamAuxCnv::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddr, DataObject *&pObj)
Create TriggerTowers from ByteStream.
Definition
CpmTowerByteStreamAuxCnv.cxx:84
LVL1BS::CpmTowerByteStreamAuxCnv::initialize
virtual StatusCode initialize()
Definition
CpmTowerByteStreamAuxCnv.cxx:74
LVL1BS::CpmTowerByteStreamAuxCnv::m_name
std::string m_name
Converter name.
Definition
CpmTowerByteStreamAuxCnv.h:56
xAOD::CPMTower_v2::initialize
virtual void initialize(const float eta, const float phi)
initialize
Definition
CPMTower_v2.cxx:24
LVL1BS
Definition
ZdcModifySlices.h:10
SG::asStorable
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
Definition
DataObjectSharedPtr.h:31
xAOD::CPMTowerContainer
CPMTowerContainer_v2 CPMTowerContainer
Define the latest version of the CPMHits container.
Definition
CPMTowerContainer.h:15
xAOD::CPMTowerAuxContainer
CPMTowerAuxContainer_v2 CPMTowerAuxContainer
Define the latest version of the CPMHits auxiliary container.
Definition
CPMTowerAuxContainer.h:14
xAOD::CPMTower
CPMTower_v2 CPMTower
Define the latest version of the CPMTower class.
Definition
Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/CPMTower.h:16
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