ATLAS Offline Software
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 
9 #include "MuonRDO/TgcRdoIdHash.h"
10 #include "eformat/SourceIdentifier.h"
11 
12 using eformat::helper::SourceIdentifier;
13 
14 Muon::TgcRawDataProvider::TgcRawDataProvider(const std::string& name, ISvcLocator* pSvcLocator) :
15  AthReentrantAlgorithm(name, pSvcLocator) {}
16 
18  ATH_MSG_INFO("TgcRawDataProvider::initialize");
19  ATH_MSG_INFO(m_seededDecoding);
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 
42 StatusCode 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
47  SG::ReadHandle<TrigRoiDescriptorCollection> muonRoI(m_roiCollectionKey, ctx);
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 }
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
Muon::TgcRawDataProvider::TgcRawDataProvider
TgcRawDataProvider(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: TgcRawDataProvider.cxx:14
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TgcRawDataProvider.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Muon::TgcRawDataProvider::execute
virtual StatusCode execute(const EventContext &ctx) const
Execute.
Definition: TgcRawDataProvider.cxx:42
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
TgcRdoIdHash.h
Muon::TgcRawDataProvider::initialize
virtual StatusCode initialize()
Initialize.
Definition: TgcRawDataProvider.cxx:17