ATLAS Offline Software
PadTrig_RawDataProviderToolMT.cxx
Go to the documentation of this file.
2 
3 namespace Muon {
4 
5 //=====================================================================
6 PadTrig_RawDataProviderToolMT::PadTrig_RawDataProviderToolMT(const std::string& type, const std::string& name, const IInterface* parent)
7 : AthAlgTool(type, name, parent), m_robDataProvider("ROBDataProviderSvc", name)
8 {
9  declareInterface<IMuonRawDataProviderTool>(this);
10 }
11 
12 //=====================================================================
14 {
16  ATH_CHECK(m_decoder.retrieve());
17  ATH_CHECK(m_idHelperSvc.retrieve());
18  ATH_CHECK(m_robDataProvider.retrieve());
19  ATH_CHECK(m_rdoContainerKey.initialize());
20 
21  m_maxhashtoUse = m_idHelperSvc->stgcIdHelper().module_hash_max();
22 
23  return StatusCode::SUCCESS;
24 }
25 
26 
27 //=====================================================================
29 {
30  ATH_MSG_ERROR(__PRETTY_FUNCTION__ << " not yet implemented!");
31  return StatusCode::FAILURE;
32 }
33 
35 {
36  ATH_MSG_ERROR(__PRETTY_FUNCTION__ << " not implemented!");
37  return StatusCode::FAILURE;
38 }
39 
40 StatusCode PadTrig_RawDataProviderToolMT::convert(const std::vector<IdentifierHash>&) const
41 {
42  ATH_MSG_ERROR(__PRETTY_FUNCTION__ << " not yet implemented!");
43  return StatusCode::FAILURE;
44 }
45 
46 StatusCode PadTrig_RawDataProviderToolMT::convert(const ROBFragmentList&, const std::vector<IdentifierHash>&) const
47 {
48  ATH_MSG_ERROR(__PRETTY_FUNCTION__ << " not implemented!");
49  return StatusCode::FAILURE;
50 }
51 
52 
53 //=====================================================================
54 StatusCode PadTrig_RawDataProviderToolMT::convert(const ROBFragmentList& fragments, const EventContext& ctx) const
55 {
56  ATH_MSG_DEBUG(__PRETTY_FUNCTION__ << ": Got " << fragments.size() << " fragments");
58  NSW_PadTriggerDataContainer* pContainer{nullptr};
59 
60  // Retrieve container, if it exists in the event store; otherwise, create one
61  if (rdoContainerHandle.isPresent()) {
62  ATH_CHECK(evtStore()->retrieve(pContainer, m_rdoContainerKey.key()));
63  } else {
64  ATH_CHECK(rdoContainerHandle.record(std::make_unique<NSW_PadTriggerDataContainer>(m_maxhashtoUse)));
65  pContainer = rdoContainerHandle.ptr();
66  }
67 
68  if (!pContainer) {
69  ATH_MSG_ERROR("Could not retrieve nor create Pad Trigger RDO container!");
70  return StatusCode::FAILURE;
71  }
72 
73  for (const auto *const fragment : fragments) {
74  // TODO should an error here be a hard failure?
75  ATH_CHECK(m_decoder->fillCollection(*fragment, *pContainer));
76  }
77 
78  return StatusCode::SUCCESS;
79 }
80 
81 
82 //=====================================================================
83 // Convert all Pad Trigger ROBFragments within the given EventContext
84 StatusCode PadTrig_RawDataProviderToolMT::convert(const EventContext& ctx) const
85 {
86  // Get all ROBs!
87  std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> fragments;
88  std::vector<uint32_t> robIDs;
89 
90  // Generate all possible ROB IDs, aka Source Identifiers
91  // Valid values are: 0x00{6d,6e}002[0..f]
92  for (uint32_t detectorID : {eformat::MUON_STGC_ENDCAP_A_SIDE, eformat::MUON_STGC_ENDCAP_C_SIDE}) { // 0x6D, 0x6E
93  for (uint8_t sector{}; sector < 16; sector++) {
94  uint16_t moduleID = (0x2 << 4) | sector;
95  eformat::helper::SourceIdentifier sourceID{static_cast<eformat::SubDetector>(detectorID), moduleID};
96  robIDs.push_back(sourceID.simple_code());
97  }
98  }
99 
100  m_robDataProvider->getROBData(ctx, robIDs, fragments);
101  return convert(fragments, ctx);
102 }
103 
104 } // namespace Muon
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
Muon::PadTrig_RawDataProviderToolMT::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Definition: PadTrig_RawDataProviderToolMT.h:39
Muon::PadTrig_RawDataProviderToolMT::m_rdoContainerKey
SG::WriteHandleKey< NSW_PadTriggerDataContainer > m_rdoContainerKey
Definition: PadTrig_RawDataProviderToolMT.h:40
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
initialize
void initialize()
Definition: run_EoverP.cxx:894
Muon::NSW_PadTriggerDataContainer
Definition: NSW_PadTriggerDataContainer.h:15
Muon::PadTrig_RawDataProviderToolMT::initialize
StatusCode initialize() override
Definition: PadTrig_RawDataProviderToolMT.cxx:13
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
Muon::PadTrig_RawDataProviderToolMT::PadTrig_RawDataProviderToolMT
PadTrig_RawDataProviderToolMT(const std::string &type, const std::string &name, const IInterface *parent)
Definition: PadTrig_RawDataProviderToolMT.cxx:6
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::PadTrig_RawDataProviderToolMT::convert
StatusCode convert() const override
the new ones
Definition: PadTrig_RawDataProviderToolMT.cxx:28
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Muon::PadTrig_RawDataProviderToolMT::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: PadTrig_RawDataProviderToolMT.h:37
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Muon::PadTrig_RawDataProviderToolMT::m_maxhashtoUse
unsigned int m_maxhashtoUse
Definition: PadTrig_RawDataProviderToolMT.h:42
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Muon::PadTrig_RawDataProviderToolMT::m_decoder
ToolHandle< IPadTrig_ROD_Decoder > m_decoder
Definition: PadTrig_RawDataProviderToolMT.h:38
PadTrig_RawDataProviderToolMT.h
Muon::IMuonRawDataProviderTool::ROBFragmentList
std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > ROBFragmentList
Decoding method.
Definition: IMuonRawDataProviderTool.h:27
AthAlgTool
Definition: AthAlgTool.h:26