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