ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCnv
MuonMDT_CnvTools
src
MDT_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 "
MDT_RawDataProviderTool.h
"
6
7
#include "
ByteStreamCnvSvcBase/IROBDataProviderSvc.h
"
8
#include "
MuonRDO/MdtCsmContainer.h
"
9
#include "
MuonReadoutGeometry/MuonDetectorManager.h
"
10
11
12
StatusCode
Muon::MDT_RawDataProviderTool::initialize
() {
13
ATH_MSG_VERBOSE
(
"Starting init"
);
14
15
ATH_MSG_VERBOSE
(
"Getting m_robDataProvider"
);
16
17
// Get ROBDataProviderSvc
18
ATH_CHECK
(
m_robDataProvider
.retrieve());
19
ATH_CHECK
(
m_idHelperSvc
.retrieve());
20
21
ATH_MSG_VERBOSE
(
"Getting m_decoder"
);
22
23
// Retrieve decoder
24
ATH_CHECK
(
m_decoder
.retrieve());
25
m_maxhashtoUse
=
m_idHelperSvc
->mdtIdHelper().stationNameIndex(
"BME"
) != -1 ?
m_idHelperSvc
->mdtIdHelper().detectorElement_hash_max()
26
:
m_idHelperSvc
->mdtIdHelper().module_hash_max();
27
28
ATH_CHECK
(
m_rdoContainerKey
.initialize());
29
ATH_CHECK
(
m_readKey
.initialize());
30
ATH_CHECK
(
m_rdoContainerCacheKey
.initialize(!
m_rdoContainerCacheKey
.key().empty()));
31
32
ATH_MSG_DEBUG
(
"initialize() successful in "
<< name());
33
return
StatusCode::SUCCESS;
34
}
35
36
StatusCode
Muon::MDT_RawDataProviderTool::convertIntoContainer
(
const
ROBFragmentList & vecRobs,
37
const
EventContext& ctx)
const
{
38
39
ATH_MSG_VERBOSE
(
"convert(): "
<< vecRobs.size() <<
" ROBFragments."
);
40
41
SG::WriteHandle
rdoContainerHandle(
m_rdoContainerKey
, ctx);
42
43
MdtCsmContainer
* rdoContainer =
nullptr
;
44
45
// here we have two paths. The first one we do not use an external cache, so just create
46
// the MDT CSM container and record it. For the second path, we create the container
47
// by passing in the container cache key so that the container is linked with the event
48
// wide cache.
49
const
bool
externalCacheRDO = !
m_rdoContainerCacheKey
.key().empty();
50
if
(!externalCacheRDO) {
51
// without the cache we just record the container
52
ATH_CHECK
(rdoContainerHandle.
record
(std::make_unique<MdtCsmContainer>(
m_maxhashtoUse
)));
53
ATH_MSG_DEBUG
(
"Created container"
);
54
rdoContainer = rdoContainerHandle.
ptr
();
55
}
else
{
56
// use the cache to get the container
57
SG::UpdateHandle
update(
m_rdoContainerCacheKey
, ctx);
58
ATH_CHECK
(update.isValid());
59
ATH_CHECK
(rdoContainerHandle.
record
(std::make_unique<MdtCsmContainer>(update.ptr())));
60
ATH_MSG_DEBUG
(
"Created container using cache for "
<<
m_rdoContainerCacheKey
.key());
61
rdoContainer = rdoContainerHandle.
ptr
();
62
}
63
64
// this should never happen, but since we dereference the pointer we should check it first
65
if
(!rdoContainer) {
66
ATH_MSG_ERROR
(
"MdtCsmContainer is null, cannot convert MDT raw data"
);
67
return
StatusCode::FAILURE;
68
}
69
70
71
ATH_MSG_VERBOSE
(
"convert(): "
<< vecRobs.size() <<
" ROBFragments."
);
72
73
for
(
const
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment
* frag : vecRobs) {
74
// convert only if data payload is delivered
75
if
(frag->rod_ndata() != 0) {
76
m_decoder
->fillCollections(*frag, *rdoContainer).ignore();
77
}
else
{
78
ATH_MSG_DEBUG
(
" ROB "
<< MSG::hex << frag->source_id() <<
" is delivered with an empty payload"
);
79
// store the error condition into the StatusCode and continue
80
}
81
}
82
// in presence of errors return FAILURE
83
ATH_MSG_DEBUG
(
"After processing numColls="
<< rdoContainer->
numberOfCollections
());
84
return
StatusCode::SUCCESS;
85
}
86
87
StatusCode
Muon::MDT_RawDataProviderTool::convert
(
88
const
EventContext& ctx)
const
// call decoding function using list of all detector ROBId's
89
{
90
91
const
MuonMDT_CablingMap
* readCdo{};
92
ATH_CHECK
(
SG::get
(readCdo,
m_readKey
, ctx));
93
return
convert
(readCdo->
getAllROBId
(), ctx);
94
}
95
96
StatusCode
Muon::MDT_RawDataProviderTool::convert
(
const
std::vector<IdentifierHash>& HashVec,
const
EventContext& ctx)
const
{
97
const
MuonMDT_CablingMap
* readCdo{};
98
ATH_CHECK
(
SG::get
(readCdo,
m_readKey
, ctx));
99
return
convert
(readCdo->
getROBId
(HashVec, msgStream()), ctx);
100
}
101
102
StatusCode
Muon::MDT_RawDataProviderTool::convert
(
const
std::vector<uint32_t>& robIds,
103
const
EventContext& ctx)
const
{
104
ROBFragmentList vecOfRobf;
105
m_robDataProvider
->getROBData(ctx, robIds, vecOfRobf);
106
return
convertIntoContainer
(vecOfRobf, ctx);
// using the old one
107
}
108
109
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_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
IROBDataProviderSvc.h
MDT_RawDataProviderTool.h
MdtCsmContainer.h
MuonDetectorManager.h
IdentifiableContainerMT::numberOfCollections
virtual size_t numberOfCollections() const override final
return number of collections
Definition
IdentifiableContainerMT.h:216
MdtCsmContainer
This container provides acces to the MDT RDOs.
Definition
MdtCsmContainer.h:22
MuonMDT_CablingMap
Definition
MuonMDT_CablingMap.h:28
MuonMDT_CablingMap::getAllROBId
const ListOfROB & getAllROBId() const
return the ROD id of a given chamber
Definition
MuonMDT_CablingMap.cxx:531
MuonMDT_CablingMap::getROBId
uint32_t getROBId(const IdentifierHash &stationCode, MsgStream &log) const
return the ROD id of a given chamber, given the hash id
Definition
MuonMDT_CablingMap.cxx:467
Muon::MDT_RawDataProviderTool::m_decoder
ToolHandle< MdtROD_Decoder > m_decoder
Definition
MDT_RawDataProviderTool.h:53
Muon::MDT_RawDataProviderTool::m_maxhashtoUse
unsigned int m_maxhashtoUse
Definition
MDT_RawDataProviderTool.h:59
Muon::MDT_RawDataProviderTool::initialize
virtual StatusCode initialize() override
standard Athena-Algorithm method
Definition
MDT_RawDataProviderTool.cxx:12
Muon::MDT_RawDataProviderTool::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Definition
MDT_RawDataProviderTool.h:62
Muon::MDT_RawDataProviderTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition
MDT_RawDataProviderTool.h:57
Muon::MDT_RawDataProviderTool::convertIntoContainer
virtual StatusCode convertIntoContainer(const ROBFragmentList &vecRobs, const EventContext &ctx) const
Convert method.
Definition
MDT_RawDataProviderTool.cxx:36
Muon::MDT_RawDataProviderTool::convert
virtual StatusCode convert(const EventContext &ctx) const override
IMuonRawDataProviderTool interface - EventContext-based methods.
Definition
MDT_RawDataProviderTool.cxx:87
Muon::MDT_RawDataProviderTool::m_rdoContainerKey
SG::WriteHandleKey< MdtCsmContainer > m_rdoContainerKey
Definition
MDT_RawDataProviderTool.h:54
Muon::MDT_RawDataProviderTool::m_rdoContainerCacheKey
SG::UpdateHandleKey< MdtCsm_Cache > m_rdoContainerCacheKey
This is the key for the cache for the CSM containers, can be empty.
Definition
MDT_RawDataProviderTool.h:66
Muon::MDT_RawDataProviderTool::m_readKey
SG::ReadCondHandleKey< MuonMDT_CablingMap > m_readKey
Definition
MDT_RawDataProviderTool.h:64
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.
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
Generated on
for ATLAS Offline Software by
1.17.0