ATLAS Offline Software
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 
7 namespace Muon {
8 
9 //=====================================================================
10 NSWTP_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 
41 StatusCode NSWTP_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 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 //=====================================================================
55 StatusCode 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
76 StatusCode 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 
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
NSWTP_RawDataProviderToolMT.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Muon::NSWTP_RawDataProviderToolMT::initialize
StatusCode initialize() override
Definition: NSWTP_RawDataProviderToolMT.cxx:17
Muon::NSWTP_RawDataProviderToolMT::m_decoder
ToolHandle< INSWTP_ROD_Decoder > m_decoder
Definition: NSWTP_RawDataProviderToolMT.h:41
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
NSWTPRDOAuxContainer.h
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Muon::NSWTP_RawDataProviderToolMT::convert
StatusCode convert() const override
the new ones
Definition: NSWTP_RawDataProviderToolMT.cxx:29
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
Muon::NSWTP_RawDataProviderToolMT::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Definition: NSWTP_RawDataProviderToolMT.h:42
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Muon::NSWTP_RawDataProviderToolMT::m_rdoContainerKey
SG::WriteHandleKey< xAOD::NSWTPRDOContainer > m_rdoContainerKey
Definition: NSWTP_RawDataProviderToolMT.h:43
Muon::NSWTP_RawDataProviderToolMT::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: NSWTP_RawDataProviderToolMT.h:40
Muon::NSWTP_RawDataProviderToolMT::NSWTP_RawDataProviderToolMT
NSWTP_RawDataProviderToolMT(const std::string &type, const std::string &name, const IInterface *parent)
Definition: NSWTP_RawDataProviderToolMT.cxx:10
Muon::IMuonRawDataProviderTool::ROBFragmentList
std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > ROBFragmentList
Decoding method.
Definition: IMuonRawDataProviderTool.h:27
AthAlgTool
Definition: AthAlgTool.h:26