ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCnv
MuonSTGC_CnvTools
src
PadTrig_RawDataProviderTool.cxx
Go to the documentation of this file.
1
#include "
PadTrig_RawDataProviderTool.h
"
2
3
namespace
Muon
{
4
5
//=====================================================================
6
StatusCode
PadTrig_RawDataProviderTool::initialize
() {
7
ATH_CHECK
(
m_decoder
.retrieve());
8
ATH_CHECK
(
m_idHelperSvc
.retrieve());
9
ATH_CHECK
(
m_robDataProvider
.retrieve());
10
ATH_CHECK
(
m_rdoContainerKey
.initialize());
11
m_maxhashtoUse
=
m_idHelperSvc
->stgcIdHelper().module_hash_max();
12
13
return
StatusCode::SUCCESS;
14
}
15
16
//=====================================================================
17
// Convert all Pad Trigger ROBFragments within the given EventContext
18
StatusCode
PadTrig_RawDataProviderTool::convert
(
const
EventContext& ctx)
const
{
19
// Get all ROBs!
20
ROBFragmentList fragments;
21
std::vector<uint32_t> robIDs;
22
23
// Generate all possible ROB IDs, aka Source Identifiers
24
// Valid values are: 0x00{6d,6e}002[0..f]
25
for
(uint32_t detectorID : {eformat::MUON_STGC_ENDCAP_A_SIDE, eformat::MUON_STGC_ENDCAP_C_SIDE}) {
// 0x6D, 0x6E
26
for
(uint8_t sector{}; sector < 16; sector++) {
27
uint16_t moduleID = (0x2 << 4) | sector;
28
eformat::helper::SourceIdentifier sourceID{
static_cast<
eformat::SubDetector
>
(detectorID), moduleID};
29
robIDs.push_back(sourceID.simple_code());
30
}
31
}
32
33
m_robDataProvider
->getROBData(ctx, robIDs, fragments);
34
ATH_MSG_DEBUG
(__PRETTY_FUNCTION__ <<
": Got "
<< fragments.size() <<
" fragments"
);
35
SG::WriteHandle<NSW_PadTriggerDataContainer>
rdoContainerHandle{
m_rdoContainerKey
, ctx};
36
NSW_PadTriggerDataContainer
* pContainer{
nullptr
};
37
38
// Retrieve container, if it exists in the event store; otherwise, create one
39
if
(rdoContainerHandle.
isPresent
()) {
40
ATH_CHECK
(evtStore()->retrieve(pContainer,
m_rdoContainerKey
.key()));
41
}
else
{
42
ATH_CHECK
(rdoContainerHandle.
record
(std::make_unique<NSW_PadTriggerDataContainer>(
m_maxhashtoUse
)));
43
pContainer = rdoContainerHandle.
ptr
();
44
}
45
46
if
(!pContainer) {
47
ATH_MSG_ERROR
(
"Could not retrieve nor create Pad Trigger RDO container!"
);
48
return
StatusCode::FAILURE;
49
}
50
51
for
(
const
auto
*
const
fragment : fragments) {
52
// TODO should an error here be a hard failure?
53
ATH_CHECK
(
m_decoder
->fillCollection(*fragment, *pContainer));
54
}
55
return
StatusCode::SUCCESS;
56
}
57
58
59
StatusCode
PadTrig_RawDataProviderTool::convert
(
const
std::vector<IdentifierHash>&,
60
const
EventContext&)
const
{
61
ATH_MSG_ERROR
(__PRETTY_FUNCTION__<<
" not implemented"
);
62
return
StatusCode::FAILURE;
63
}
64
StatusCode
PadTrig_RawDataProviderTool::convert
(
const
std::vector<uint32_t>&,
65
const
EventContext& )
const
{
66
ATH_MSG_ERROR
(__PRETTY_FUNCTION__<<
" not implemented"
);
67
return
StatusCode::FAILURE;
68
}
69
70
}
// namespace Muon
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_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
PadTrig_RawDataProviderTool.h
Muon::NSW_PadTriggerDataContainer
Definition
NSW_PadTriggerDataContainer.h:15
Muon::PadTrig_RawDataProviderTool::m_maxhashtoUse
unsigned int m_maxhashtoUse
Definition
PadTrig_RawDataProviderTool.h:45
Muon::PadTrig_RawDataProviderTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition
PadTrig_RawDataProviderTool.h:39
Muon::PadTrig_RawDataProviderTool::m_decoder
ToolHandle< IPadTrig_ROD_Decoder > m_decoder
Definition
PadTrig_RawDataProviderTool.h:40
Muon::PadTrig_RawDataProviderTool::convert
StatusCode convert(const EventContext &ctx) const override
Definition
PadTrig_RawDataProviderTool.cxx:18
Muon::PadTrig_RawDataProviderTool::initialize
StatusCode initialize() override
Definition
PadTrig_RawDataProviderTool.cxx:6
Muon::PadTrig_RawDataProviderTool::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Rob Data Provider handle.
Definition
PadTrig_RawDataProviderTool.h:42
Muon::PadTrig_RawDataProviderTool::m_rdoContainerKey
SG::WriteHandleKey< NSW_PadTriggerDataContainer > m_rdoContainerKey
Definition
PadTrig_RawDataProviderTool.h:43
SG::VarHandleBase::isPresent
bool isPresent() const
Is the referenced object present in SG?
Definition
StoreGate/src/VarHandleBase.cxx:400
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
Generated on
for ATLAS Offline Software by
1.17.0