ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCnv
MuonCSC_CnvTools
src
CSC_RawDataProviderTool.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
#include "
CSC_RawDataProviderTool.h
"
6
7
#include "
ByteStreamCnvSvcBase/ByteStreamAddress.h
"
8
#include "
ByteStreamCnvSvcBase/ByteStreamCnvSvcBase.h
"
9
#include "
ByteStreamCnvSvcBase/IROBDataProviderSvc.h
"
10
#include "
ByteStreamData/ROBData.h
"
11
#include "
ByteStreamData/RawEvent.h
"
12
#include "
MuonIdHelpers/CscIdHelper.h
"
13
#include "
MuonReadoutGeometry/MuonDetectorManager.h
"
14
#include "
StoreGate/ReadHandle.h
"
15
#include "
StoreGate/WriteHandle.h
"
16
17
using
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment
;
18
19
namespace
Muon
{
20
21
//================ Destructor =================================================
22
23
CSC_RawDataProviderTool::~CSC_RawDataProviderTool
() =
default
;
24
25
//================ Initialisation =================================================
26
27
StatusCode
CSC_RawDataProviderTool::initialize
() {
28
ATH_CHECK
(
m_cabling
.retrieve());
29
ATH_CHECK
(
m_robDataProvider
.retrieve());
30
ATH_MSG_INFO
(
"Retrieved service "
<<
m_robDataProvider
);
31
32
ATH_CHECK
(
m_idHelperSvc
.retrieve());
33
m_hid2re
.set(
m_cabling
.get(), &
m_idHelperSvc
->cscIdHelper());
34
35
// Retrieve decoder
36
ATH_CHECK
(
m_decoder
.retrieve());
37
ATH_MSG_INFO
(
"Retrieved tool "
<<
m_decoder
);
38
39
ATH_CHECK
(
m_containerKey
.initialize());
40
ATH_CHECK
(
m_eventInfoKey
.initialize());
41
42
// Initialise the container cache if available
43
ATH_CHECK
(
m_rdoContainerCacheKey
.initialize(!
m_rdoContainerCacheKey
.key().empty()));
44
45
ATH_MSG_INFO
(
"initialize() successful in "
<< name());
46
return
StatusCode::SUCCESS;
47
}
48
49
//============================================================================================
50
51
StatusCode
CSC_RawDataProviderTool::convertIntoContainer
(
52
const
ROBFragmentList& vecRobs,
const
EventContext& ctx)
const
{
53
std::set<uint32_t> robIdSet;
54
55
SG::WriteHandle
rdoContainerHandle{
m_containerKey
, ctx};
56
57
// Split the methods to have one where we use the cache and one where we just setup the container
58
const
bool
externalCacheRDO = !
m_rdoContainerCacheKey
.key().empty();
59
if
(!externalCacheRDO) {
60
ATH_CHECK
(rdoContainerHandle.
record
(std::make_unique<CscRawDataContainer>(
m_idHelperSvc
->cscIdHelper().module_hash_max())));
61
ATH_MSG_DEBUG
(
"Created CSCRawDataContainer"
);
62
}
else
{
63
SG::UpdateHandle
update{
m_rdoContainerCacheKey
, ctx};
64
ATH_CHECK
(update.isValid());
65
ATH_CHECK
(rdoContainerHandle.
record
(std::make_unique<CscRawDataContainer>(update.ptr())));
66
ATH_MSG_DEBUG
(
"Created container using cache for "
<<
m_rdoContainerCacheKey
.key());
67
}
68
69
CscRawDataContainer
* container = rdoContainerHandle.
ptr
();
70
71
if
(!container) {
72
ATH_MSG_ERROR
(
"CSC RDO container pointer is null, cannot decode data"
);
73
return
StatusCode::FAILURE;
74
}
75
const
xAOD::EventInfo
* eventInfo{
nullptr
};
76
ATH_CHECK
(
SG::get
(eventInfo,
m_eventInfoKey
, ctx));
77
78
ATH_MSG_DEBUG
(
"Before processing numColls="
<< container->numberOfCollections());
79
80
ATH_MSG_DEBUG
(
"vector of ROB ID to decode: size = "
<< vecRobs.size());
81
82
for
(
const
ROBFragment
* frag : vecRobs) {
83
uint32_t robid = frag->rod_source_id();
84
85
// check if this ROBFragment was already decoded (EF case in ROIs
86
if
(!robIdSet.insert(robid).second) {
87
ATH_MSG_DEBUG
(
" ROB Fragment with ID "
<< std::hex << robid << std::dec <<
" already decoded, skip"
);
88
}
else
{
89
m_decoder
->fillCollection(*eventInfo, *frag, *container);
90
}
91
}
92
93
ATH_MSG_DEBUG
(
"After processing numColls="
<< container->numberOfCollections());
94
95
return
StatusCode::SUCCESS;
96
}
97
98
//============================================================================================
99
// New EventContext-based convert methods
100
101
StatusCode
CSC_RawDataProviderTool::convert
(
const
std::vector<IdentifierHash>& rdoIdhVect,
102
const
EventContext& ctx)
const
{
103
ROBFragmentList vecOfRobf;
104
std::vector<uint32_t> robIds;
105
106
for
(
unsigned
int
i = 0; i < rdoIdhVect.size(); ++i) {
107
uint32_t rob_id = 0xffff;
108
m_cabling
->hash2RobFull(rdoIdhVect[i], rob_id);
109
robIds.push_back(rob_id);
110
}
111
m_robDataProvider
->getROBData(ctx, robIds, vecOfRobf);
112
ATH_MSG_VERBOSE
(
"Number of ROB fragments "
<< vecOfRobf.size());
113
114
// This would be passed to the function which does not use the IdentifierHash further
115
return
convertIntoContainer
(vecOfRobf, ctx);
116
}
117
118
StatusCode
CSC_RawDataProviderTool::convert
(
const
EventContext& ctx)
const
{
119
return
convert
(
m_hid2re
.allRobIds(), ctx);
120
}
121
122
StatusCode
CSC_RawDataProviderTool::convert
(
const
std::vector<uint32_t>& robIds,
123
const
EventContext& ctx)
const
{
124
ROBFragmentList vecOfRobf;
125
126
ATH_MSG_VERBOSE
(
"Number of ROB ids "
<< robIds.size());
127
// ask ROBDataProviderSvc for the vector of ROBFragment for all CSC ROBIDs
128
m_robDataProvider
->getROBData(ctx, robIds, vecOfRobf);
129
ATH_MSG_VERBOSE
(
"Number of ROB fragments "
<< vecOfRobf.size());
130
131
return
convertIntoContainer
(vecOfRobf, ctx);
132
133
}
134
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
ByteStreamAddress.h
ByteStreamCnvSvcBase.h
CSC_RawDataProviderTool.h
CscIdHelper.h
IROBDataProviderSvc.h
MuonDetectorManager.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
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
CscRawDataContainer
This container provides access to collections of CSC RDOs and a mechanism for recording them.
Definition
CscRawDataContainer.h:23
Muon::CSC_RawDataProviderTool::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition
CSC_RawDataProviderTool.h:53
Muon::CSC_RawDataProviderTool::m_hid2re
CSC_Hid2RESrcID m_hid2re
Definition
CSC_RawDataProviderTool.h:54
Muon::CSC_RawDataProviderTool::m_cabling
ServiceHandle< CSCcablingSvc > m_cabling
Definition
CSC_RawDataProviderTool.h:57
Muon::CSC_RawDataProviderTool::m_decoder
ToolHandle< ICSC_ROD_Decoder > m_decoder
member variables for algorithm properties:
Definition
CSC_RawDataProviderTool.h:47
Muon::CSC_RawDataProviderTool::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Definition
CSC_RawDataProviderTool.h:56
Muon::CSC_RawDataProviderTool::convert
virtual StatusCode convert(const EventContext &ctx) const override
Definition
CSC_RawDataProviderTool.cxx:118
Muon::CSC_RawDataProviderTool::~CSC_RawDataProviderTool
virtual ~CSC_RawDataProviderTool()
default destructor
Muon::CSC_RawDataProviderTool::convertIntoContainer
StatusCode convertIntoContainer(const ROBFragmentList &vecRobs, const EventContext &ctx) const
function to decode the passed ROB fragments into the passed container
Definition
CSC_RawDataProviderTool.cxx:51
Muon::CSC_RawDataProviderTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition
CSC_RawDataProviderTool.h:49
Muon::CSC_RawDataProviderTool::m_containerKey
SG::WriteHandleKey< CscRawDataContainer > m_containerKey
Definition
CSC_RawDataProviderTool.h:51
Muon::CSC_RawDataProviderTool::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition
CSC_RawDataProviderTool.cxx:27
Muon::CSC_RawDataProviderTool::m_rdoContainerCacheKey
SG::UpdateHandleKey< CscRawDataCollection_Cache > m_rdoContainerCacheKey
CSC container cache key.
Definition
CSC_RawDataProviderTool.h:60
SG::UpdateHandle
Definition
UpdateHandle.h:91
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition
TrackSystemController.h:46
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment
eformat::ROBFragment< PointerType > ROBFragment
Definition
RawEvent.h:27
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition
ReadCondHandle.h:282
xAOD::EventInfo
EventInfo_v1 EventInfo
Definition of the latest event info version.
Definition
IEventInfoCnvTool.h:16
Generated on
for ATLAS Offline Software by
1.17.0