ATLAS Offline Software
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 
7 namespace 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(robIDs, fragments);
93  return convert(fragments, ctx);
94  }
95 
96 }
NSWMMTPRDOAuxContainer.h
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
Muon::NSWMMTP_RawDataProviderToolMT::m_rdoContainerKey
SG::WriteHandleKey< xAOD::NSWMMTPRDOContainer > m_rdoContainerKey
Definition: NSWMMTP_RawDataProviderToolMT.h:43
NSWMMTP_RawDataProviderToolMT.h
Muon::NSWMMTP_RawDataProviderToolMT::initialize
StatusCode initialize() override
Definition: NSWMMTP_RawDataProviderToolMT.cxx:17
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
Muon::NSWMMTP_RawDataProviderToolMT::convert
StatusCode convert() const override
the new ones
Definition: NSWMMTP_RawDataProviderToolMT.cxx:29
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
Muon::NSWMMTP_RawDataProviderToolMT::NSWMMTP_RawDataProviderToolMT
NSWMMTP_RawDataProviderToolMT(const std::string &type, const std::string &name, const IInterface *parent)
Definition: NSWMMTP_RawDataProviderToolMT.cxx:10
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
Muon::NSWMMTP_RawDataProviderToolMT::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: NSWMMTP_RawDataProviderToolMT.h:40
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Muon::IMuonRawDataProviderTool::ROBFragmentList
std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > ROBFragmentList
Decoding method.
Definition: IMuonRawDataProviderTool.h:27
AthAlgTool
Definition: AthAlgTool.h:26
Muon::NSWMMTP_RawDataProviderToolMT::m_decoder
ToolHandle< INSWMMTP_ROD_Decoder > m_decoder
Definition: NSWMMTP_RawDataProviderToolMT.h:41
Muon::NSWMMTP_RawDataProviderToolMT::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Definition: NSWMMTP_RawDataProviderToolMT.h:42