ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::PadTrig_RawDataProviderTool Class Reference

#include <PadTrig_RawDataProviderTool.h>

Inheritance diagram for Muon::PadTrig_RawDataProviderTool:
Collaboration diagram for Muon::PadTrig_RawDataProviderTool:

Public Member Functions

virtual ~PadTrig_RawDataProviderTool ()=default
StatusCode initialize () override
StatusCode convert (const EventContext &ctx) const override
StatusCode convert (const std::vector< IdentifierHash > &chamberHashes, const EventContext &ctx) const override
StatusCode convert (const std::vector< uint32_t > &robIDS, const EventContext &ctx) const override

Private Attributes

ServiceHandle< Muon::IMuonIdHelperSvcm_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
ToolHandle< IPadTrig_ROD_Decoderm_decoder {this, "Decoder", "Muon::PadTrig_ROD_Decoder/PadTrig_ROD_Decoder"}
ServiceHandle< IROBDataProviderSvcm_robDataProvider {this, "RobProviderSvc", "ROBDataProviderSvc"}
 Rob Data Provider handle.
SG::WriteHandleKey< NSW_PadTriggerDataContainerm_rdoContainerKey {this, "RdoLocation", "NSW_PadTrigger_RDO", "Name of of the RDO container to write to"}
unsigned int m_maxhashtoUse {0}

Detailed Description

Definition at line 20 of file PadTrig_RawDataProviderTool.h.

Constructor & Destructor Documentation

◆ ~PadTrig_RawDataProviderTool()

virtual Muon::PadTrig_RawDataProviderTool::~PadTrig_RawDataProviderTool ( )
virtualdefault

Member Function Documentation

◆ convert() [1/3]

StatusCode Muon::PadTrig_RawDataProviderTool::convert ( const EventContext & ctx) const
override

Definition at line 18 of file PadTrig_RawDataProviderTool.cxx.

18 {
19 // Get all ROBs!
20 ROBFragmentList 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");
35 SG::WriteHandle<NSW_PadTriggerDataContainer> rdoContainerHandle{m_rdoContainerKey, ctx};
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}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
ToolHandle< IPadTrig_ROD_Decoder > m_decoder
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.
setWord1 uint16_t

◆ convert() [2/3]

StatusCode Muon::PadTrig_RawDataProviderTool::convert ( const std::vector< IdentifierHash > & chamberHashes,
const EventContext & ctx ) const
override

Definition at line 59 of file PadTrig_RawDataProviderTool.cxx.

60 {
61 ATH_MSG_ERROR(__PRETTY_FUNCTION__<<" not implemented");
62 return StatusCode::FAILURE;
63 }

◆ convert() [3/3]

StatusCode Muon::PadTrig_RawDataProviderTool::convert ( const std::vector< uint32_t > & robIDS,
const EventContext & ctx ) const
override

Definition at line 64 of file PadTrig_RawDataProviderTool.cxx.

65 {
66 ATH_MSG_ERROR(__PRETTY_FUNCTION__<<" not implemented");
67 return StatusCode::FAILURE;
68 }

◆ initialize()

StatusCode Muon::PadTrig_RawDataProviderTool::initialize ( )
override

Definition at line 6 of file PadTrig_RawDataProviderTool.cxx.

6 {
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}
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc

Member Data Documentation

◆ m_decoder

ToolHandle<IPadTrig_ROD_Decoder> Muon::PadTrig_RawDataProviderTool::m_decoder {this, "Decoder", "Muon::PadTrig_ROD_Decoder/PadTrig_ROD_Decoder"}
private

Definition at line 40 of file PadTrig_RawDataProviderTool.h.

40{this, "Decoder", "Muon::PadTrig_ROD_Decoder/PadTrig_ROD_Decoder"};

◆ m_idHelperSvc

ServiceHandle<Muon::IMuonIdHelperSvc> Muon::PadTrig_RawDataProviderTool::m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}
private

Definition at line 39 of file PadTrig_RawDataProviderTool.h.

39{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};

◆ m_maxhashtoUse

unsigned int Muon::PadTrig_RawDataProviderTool::m_maxhashtoUse {0}
private

Definition at line 45 of file PadTrig_RawDataProviderTool.h.

45{0};

◆ m_rdoContainerKey

SG::WriteHandleKey<NSW_PadTriggerDataContainer> Muon::PadTrig_RawDataProviderTool::m_rdoContainerKey {this, "RdoLocation", "NSW_PadTrigger_RDO", "Name of of the RDO container to write to"}
private

Definition at line 43 of file PadTrig_RawDataProviderTool.h.

43{this, "RdoLocation", "NSW_PadTrigger_RDO", "Name of of the RDO container to write to"};

◆ m_robDataProvider

ServiceHandle<IROBDataProviderSvc> Muon::PadTrig_RawDataProviderTool::m_robDataProvider {this, "RobProviderSvc", "ROBDataProviderSvc"}
private

Rob Data Provider handle.

Definition at line 42 of file PadTrig_RawDataProviderTool.h.

42{this, "RobProviderSvc", "ROBDataProviderSvc"};

The documentation for this class was generated from the following files: