ATLAS Offline Software
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 
12 Muon::CscRawDataProvider::CscRawDataProvider(const std::string& name, ISvcLocator* pSvcLocator) :
13  AthReentrantAlgorithm(name, pSvcLocator) {}
14 
15 // --------------------------------------------------------------------
16 // Initialize
18  ATH_MSG_VERBOSE(" in initialize()");
19  ATH_MSG_VERBOSE(m_seededDecoding);
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 
37 StatusCode Muon::CscRawDataProvider::execute(const EventContext& ctx) const {
38  ATH_MSG_VERBOSE("CscRawDataProvider::execute");
39 
40  if (m_seededDecoding) {
41  SG::ReadCondHandle<MuonGM::MuonDetectorManager> readDetMgrHandle(m_detMgrKey, ctx);
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
48  SG::ReadHandle<TrigRoiDescriptorCollection> muonRoI(m_roiCollectionKey, ctx);
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->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 }
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
SG::ReadCondHandle::isValid
bool isValid()
Definition: ReadCondHandle.h:206
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
CscRawDataProvider.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
Muon::CscRawDataProvider::CscRawDataProvider
CscRawDataProvider(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: CscRawDataProvider.cxx:12
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
Muon::CscRawDataProvider::execute
virtual StatusCode execute(const EventContext &ctx) const
Execute.
Definition: CscRawDataProvider.cxx:37
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
IROBDataProviderSvc.h
Muon::CscRawDataProvider::initialize
virtual StatusCode initialize()
Initialize.
Definition: CscRawDataProvider.cxx:17
CSCcablingSvc.h