ATLAS Offline Software
Loading...
Searching...
No Matches
CscRawDataProvider.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
11
12Muon::CscRawDataProvider::CscRawDataProvider(const std::string& name, ISvcLocator* pSvcLocator) :
13 AthReentrantAlgorithm(name, pSvcLocator) {}
14
15// --------------------------------------------------------------------
16// Initialize
18 ATH_MSG_VERBOSE(" in initialize()");
20
21 ATH_CHECK(m_roiCollectionKey.initialize(m_seededDecoding)); // pass the seeded decoding flag - this marks the RoI collection flag as
22 // not used for the case when we decode the full detector
23
24 // Get CscRawDataProviderTool
25 ATH_CHECK(m_rawDataTool.retrieve());
26
27 // We only need the region selector in RoI seeded mode
28 ATH_CHECK(m_regsel_csc.retrieve(EnableTool{m_seededDecoding}));
29 ATH_CHECK(m_detMgrKey.initialize(m_seededDecoding)); // !!! REMOVEME: when MuonDetectorManager in cond store
30
31 return StatusCode::SUCCESS;
32}
33
34// --------------------------------------------------------------------
35// Execute
36
37StatusCode Muon::CscRawDataProvider::execute(const EventContext& ctx) const {
38 ATH_MSG_VERBOSE("CscRawDataProvider::execute");
39
40 if (m_seededDecoding) {
42 if (!readDetMgrHandle.isValid()) {
43 ATH_MSG_WARNING("Cannot retrieve DetMgr Handle " << m_detMgrKey.key());
44 return StatusCode::FAILURE;
45 }
46
47 // read in the RoIs to process
49 if (!muonRoI.isValid()) {
50 ATH_MSG_WARNING("Cannot retrieve muonRoI " << m_roiCollectionKey.key());
51 return StatusCode::SUCCESS;
52 }
53
54 // loop on RoIs
55 std::vector<IdentifierHash> csc_hash_ids;
56 for (auto roi : *muonRoI) {
57 ATH_MSG_DEBUG("Get has IDs for RoI " << *roi);
58 // get list of hash IDs from region selection
59 m_regsel_csc->lookup(ctx)->HashIDList(*roi, csc_hash_ids);
60
61 // decode the ROBs
62 if (m_rawDataTool->convert(csc_hash_ids, ctx).isFailure()) { ATH_MSG_ERROR("RoI seeded BS conversion into RDOs failed"); }
63 // clear vector of hash IDs ready for next RoI
64 csc_hash_ids.clear();
65 }
66 } else {
67 // ask CscRawDataProviderTool to decode entire event and to fill the IDC
68 if (m_rawDataTool->convert(ctx).isFailure()) ATH_MSG_ERROR("BS conversion into RDOs failed");
69 }
70
71 return StatusCode::SUCCESS;
72}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(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.
Gaudi::Property< bool > m_seededDecoding
Property to decide whether or not to do RoI based decoding.
SG::ReadHandleKey< TrigRoiDescriptorCollection > m_roiCollectionKey
ReadHandle for the input RoIs.
virtual StatusCode execute(const EventContext &ctx) const
Execute.
ToolHandle< IRegSelTool > m_regsel_csc
Handle for region selector service.
virtual StatusCode initialize()
Initialize.
CscRawDataProvider(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > m_detMgrKey
ToolHandle< Muon::IMuonRawDataProviderTool > m_rawDataTool
virtual bool isValid() override final
Can the handle be successfully dereferenced?