ATLAS Offline Software
Loading...
Searching...
No Matches
NSWMMTP_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 //=====================================================================
10 NSWMMTP_RawDataProviderToolMT::NSWMMTP_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
41 StatusCode NSWMMTP_RawDataProviderToolMT::convert(const std::vector<IdentifierHash>&) const
42 {
43 ATH_MSG_ERROR(__PRETTY_FUNCTION__ << " not yet implemented!");
44 return StatusCode::FAILURE;
45 }
46
47 StatusCode NSWMMTP_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 //=====================================================================
55 StatusCode NSWMMTP_RawDataProviderToolMT::convert(const ROBFragmentList& fragments, const EventContext& ctx) const
56 {
57 ATH_MSG_DEBUG(__PRETTY_FUNCTION__ << ": Got " << fragments.size() << " fragments");
59 xAOD::NSWMMTPRDOContainer* 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::NSWMMTPRDOContainer>(), std::make_unique<xAOD::NSWMMTPRDOAuxContainer>()));
64 pContainer = rdoContainerHandle.ptr();
65 for (const auto *const fragment : fragments) {
66 // NSW Common Decoder has already a try/catch inside and it's reporting errors/exceptions: wanna handle them here too?
67 ATH_CHECK(m_decoder->fillCollection(*fragment, *pContainer));
68 }
69
70 return StatusCode::SUCCESS;
71 }
72
73
74 //=====================================================================
75 StatusCode NSWMMTP_RawDataProviderToolMT::convert(const EventContext& ctx) const
76 {
77 // Get all ROBs!
78 std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> fragments;
79 std::vector<uint32_t> robIDs;
80
81 // Generate all possible ROB IDs, aka Source Identifiers
82 // Valid values are: 0x00{6b,6c}001[0..f]
83 robIDs.reserve(32);
84 for (uint32_t detectorID : {eformat::MUON_MMEGA_ENDCAP_A_SIDE, eformat::MUON_MMEGA_ENDCAP_C_SIDE}) { // 0x6B, 0x6C
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}
#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.
NSWMMTP_RawDataProviderToolMT(const std::string &type, const std::string &name, const IInterface *parent)
StatusCode convert() const override
the new ones
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
ToolHandle< INSWMMTP_ROD_Decoder > m_decoder
SG::WriteHandleKey< xAOD::NSWMMTPRDOContainer > m_rdoContainerKey
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.
NSWMMTPRDOContainer_v1 NSWMMTPRDOContainer
Define the version of the NSW MM RDO container.