ATLAS Offline Software
Loading...
Searching...
No Matches
NSWTP_RawDataProviderToolMT.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
6
7namespace Muon {
8
9//=====================================================================
10NSWTP_RawDataProviderToolMT::NSWTP_RawDataProviderToolMT(const std::string& type, const std::string& name, const IInterface* parent)
11: AthAlgTool(type, name, parent), m_robDataProvider("ROBDataProviderSvc", name)
12{
13 declareInterface<IMuonRawDataProviderTool>(this);
14}
15
16//=====================================================================
18{
19 ATH_CHECK(m_decoder.retrieve());
20 ATH_CHECK(m_idHelperSvc.retrieve());
21 ATH_CHECK(m_robDataProvider.retrieve());
22 ATH_CHECK(m_rdoContainerKey.initialize());
23
24 return StatusCode::SUCCESS;
25}
26
27
28//=====================================================================
30{
31 ATH_MSG_ERROR(__PRETTY_FUNCTION__ << " not yet implemented!");
32 return StatusCode::FAILURE;
33}
34
36{
37 ATH_MSG_ERROR(__PRETTY_FUNCTION__ << " not implemented!");
38 return StatusCode::FAILURE;
39}
40
41StatusCode NSWTP_RawDataProviderToolMT::convert(const std::vector<IdentifierHash>&) const
42{
43 ATH_MSG_ERROR(__PRETTY_FUNCTION__ << " not yet implemented!");
44 return StatusCode::FAILURE;
45}
46
47StatusCode NSWTP_RawDataProviderToolMT::convert(const ROBFragmentList&, const std::vector<IdentifierHash>&) const
48{
49 ATH_MSG_ERROR(__PRETTY_FUNCTION__ << " not implemented!");
50 return StatusCode::FAILURE;
51}
52
53
54//=====================================================================
55StatusCode NSWTP_RawDataProviderToolMT::convert(const ROBFragmentList& fragments, const EventContext& ctx) const
56{
57 ATH_MSG_DEBUG(__PRETTY_FUNCTION__ << ": Got " << fragments.size() << " fragments");
59 xAOD::NSWTPRDOContainer* pContainer{nullptr};
60
61 // Retrieve container, if it exists in the event store; otherwise, create one
62
63 ATH_CHECK(rdoContainerHandle.record(std::make_unique<xAOD::NSWTPRDOContainer>(), std::make_unique<xAOD::NSWTPRDOAuxContainer>()));
64 pContainer = rdoContainerHandle.ptr();
65 for (const auto *const fragment : fragments) {
66 // TODO should an error here be a hard failure?
67 ATH_CHECK(m_decoder->fillCollection(*fragment, *pContainer));
68 }
69
70 return StatusCode::SUCCESS;
71}
72
73
74//=====================================================================
75// Convert all Pad Trigger ROBFragments within the given EventContext
76StatusCode NSWTP_RawDataProviderToolMT::convert(const EventContext& ctx) const
77{
78 // Get all ROBs!
79 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> fragments;
80 std::vector<uint32_t> robIDs;
81
82 // Generate all possible ROB IDs, aka Source Identifiers
83 // Valid values are: 0x00{6d,6e}002[0..f]
84 for (uint32_t detectorID : {eformat::MUON_STGC_ENDCAP_A_SIDE, eformat::MUON_STGC_ENDCAP_C_SIDE}) { // 0x6D, 0x6E
85 for (uint8_t sector{}; sector < 16; sector++) {
86 uint16_t moduleID = (0x1 << 4) | sector;
87 eformat::helper::SourceIdentifier sourceID{static_cast<eformat::SubDetector>(detectorID), moduleID};
88 robIDs.push_back(sourceID.simple_code());
89 }
90 }
91
92 m_robDataProvider->getROBData(ctx, robIDs, fragments);
93 return convert(fragments, ctx);
94}
95
96} // namespace Muon
97
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > ROBFragmentList
Decoding method.
SG::WriteHandleKey< xAOD::NSWTPRDOContainer > m_rdoContainerKey
StatusCode convert() const override
the new ones
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
NSWTP_RawDataProviderToolMT(const std::string &type, const std::string &name, const IInterface *parent)
ToolHandle< INSWTP_ROD_Decoder > m_decoder
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
NSWTPRDOContainer_v1 NSWTPRDOContainer
Define the version of the NRPC RDO container.