ATLAS Offline Software
Loading...
Searching...
No Matches
MdtRawDataProvider.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <algorithm>
8
9Muon::MdtRawDataProvider::MdtRawDataProvider(const std::string& name, ISvcLocator* pSvcLocator) :
10 AthReentrantAlgorithm(name, pSvcLocator) {}
11
13 ATH_MSG_INFO("MdtRawDataProvider::initialize");
15
16 ATH_CHECK(m_rawDataTool.retrieve());
17
18 ATH_CHECK(m_roiCollectionKey.initialize(m_seededDecoding)); // pass the seeded decoding flag - this marks the RoI collection flag as
19 // not used for the case when we decode the full detector
20
21 if (m_seededDecoding) {
22 // We only need the region selector in RoI seeded mode
23 if (m_regsel_mdt.retrieve().isFailure()) {
24 ATH_MSG_FATAL("Unable to retrieve RegionSelector Tool");
25 return StatusCode::FAILURE;
26 }
27 } // seededDecoding
28 else
29 m_regsel_mdt.disable();
30
31 return StatusCode::SUCCESS;
32}
33
34// --------------------------------------------------------------------
35// Execute
36
37StatusCode Muon::MdtRawDataProvider::execute(const EventContext& ctx) const {
38 ATH_MSG_VERBOSE("MdtRawDataProvider::execute");
39
40 if (m_seededDecoding) {
41 // read in the RoIs to process
43 if (!muonRoI.isValid()) {
44 ATH_MSG_WARNING("Cannot retrieve muonRoI " << m_roiCollectionKey.key());
45 return StatusCode::FAILURE;
46 }
47
48 // loop on RoIs
49 std::vector<uint32_t> robs;
50 for (auto roi : *muonRoI) {
51 ATH_MSG_DEBUG("Get ROBs for RoI " << *roi);
52 // get list of ROBs from region selector
53 m_regsel_mdt->lookup(ctx)->ROBIDList(*roi, robs);
54
55 // decode the ROBs
56 if (m_rawDataTool->convert(robs, ctx).isFailure()) { ATH_MSG_ERROR("RoI seeded BS conversion into RDOs failed"); }
57 // clear vector of ROB IDs ready for next RoI
58 robs.clear();
59 }
60 } else {
61 // ask MdtRawDataProviderTool to decode the event and to fill the IDC
62 if (m_rawDataTool->convert(ctx).isFailure()) ATH_MSG_ERROR("BS conversion into RDOs failed");
63 }
64
65 return StatusCode::SUCCESS;
66}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
An algorithm that can be simultaneously executed in multiple threads.
ToolHandle< IRegSelTool > m_regsel_mdt
Handle for region selector service.
SG::ReadHandleKey< TrigRoiDescriptorCollection > m_roiCollectionKey
ReadHandle for the input RoIs.
ToolHandle< Muon::IMuonRawDataProviderTool > m_rawDataTool
Tool handle for raw data provider tool.
virtual StatusCode initialize()
Initialize.
Gaudi::Property< bool > m_seededDecoding
Property to decide whether or not to do RoI based decoding.
virtual StatusCode execute(const EventContext &ctx) const
Execute.
MdtRawDataProvider(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
virtual bool isValid() override final
Can the handle be successfully dereferenced?