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