ATLAS Offline Software
Loading...
Searching...
No Matches
NSWTP_RawDataProviderTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
6
7namespace Muon {
8
9//=====================================================================
11{
12 ATH_CHECK(m_decoder.retrieve());
13 ATH_CHECK(m_idHelperSvc.retrieve());
14 ATH_CHECK(m_robDataProvider.retrieve());
15 ATH_CHECK(m_rdoContainerKey.initialize());
16
17 return StatusCode::SUCCESS;
18}
19
20
21//=====================================================================
22// Convert all Pad Trigger ROBFragments within the given EventContext
23StatusCode NSWTP_RawDataProviderTool::convert(const EventContext& ctx) const {
24 // Get all ROBs!
25 ROBFragmentList fragments;
26 std::vector<uint32_t> robIDs;
27
28 // Generate all possible ROB IDs, aka Source Identifiers
29 // Valid values are: 0x00{6d,6e}002[0..f]
30 for (uint32_t detectorID : {eformat::MUON_STGC_ENDCAP_A_SIDE, eformat::MUON_STGC_ENDCAP_C_SIDE}) { // 0x6D, 0x6E
31 for (uint8_t sector{}; sector < 16; sector++) {
32 uint16_t moduleID = (0x1 << 4) | sector;
33 eformat::helper::SourceIdentifier sourceID{static_cast<eformat::SubDetector>(detectorID), moduleID};
34 robIDs.push_back(sourceID.simple_code());
35 }
36 }
37
38 m_robDataProvider->getROBData(ctx, robIDs, fragments);
39 ATH_MSG_DEBUG(__PRETTY_FUNCTION__ << ": Got " << fragments.size() << " fragments");
41 xAOD::NSWTPRDOContainer* pContainer{nullptr};
42
43 // Retrieve container, if it exists in the event store; otherwise, create one
44
45 ATH_CHECK(rdoContainerHandle.record(std::make_unique<xAOD::NSWTPRDOContainer>(), std::make_unique<xAOD::NSWTPRDOAuxContainer>()));
46 pContainer = rdoContainerHandle.ptr();
47 for (const auto *const fragment : fragments) {
48 // TODO should an error here be a hard failure?
49 ATH_CHECK(m_decoder->fillCollection(*fragment, *pContainer));
50 }
51 return StatusCode::SUCCESS;
52}
53
54
55StatusCode NSWTP_RawDataProviderTool::convert(const std::vector<IdentifierHash>& ,
56 const EventContext&) const {
57 ATH_MSG_ERROR(__PRETTY_FUNCTION__<<" not implemented");
58 return StatusCode::FAILURE;
59}
60StatusCode NSWTP_RawDataProviderTool::convert(const std::vector<uint32_t>& ,
61 const EventContext& ) const {
62 ATH_MSG_ERROR(__PRETTY_FUNCTION__<<" not implemented");
63 return StatusCode::FAILURE;
64}
65
66
67} // namespace Muon
68
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
ToolHandle< INSWTP_ROD_Decoder > m_decoder
StatusCode convert(const std::vector< IdentifierHash > &chamberHashes, const EventContext &ctx) const override
SG::WriteHandleKey< xAOD::NSWTPRDOContainer > m_rdoContainerKey
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.