ATLAS Offline Software
Loading...
Searching...
No Matches
PadTrig_RawDataProviderToolMT.cxx
Go to the documentation of this file.
2
3namespace Muon {
4
5//=====================================================================
6PadTrig_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{
15 ATH_CHECK(AthAlgTool::initialize());
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
40StatusCode PadTrig_RawDataProviderToolMT::convert(const std::vector<IdentifierHash>&) const
41{
42 ATH_MSG_ERROR(__PRETTY_FUNCTION__ << " not yet implemented!");
43 return StatusCode::FAILURE;
44}
45
46StatusCode 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//=====================================================================
54StatusCode 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
84StatusCode 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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
ServiceHandle< StoreGateSvc > & evtStore()
std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > ROBFragmentList
Decoding method.
StatusCode convert() const override
the new ones
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
ToolHandle< IPadTrig_ROD_Decoder > m_decoder
PadTrig_RawDataProviderToolMT(const std::string &type, const std::string &name, const IInterface *parent)
SG::WriteHandleKey< NSW_PadTriggerDataContainer > m_rdoContainerKey
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
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.