ATLAS Offline Software
Loading...
Searching...
No Matches
HLTResultMTByteStreamDecoderAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7// =============================================================================
8// Standard constructor
9// =============================================================================
10HLTResultMTByteStreamDecoderAlg::HLTResultMTByteStreamDecoderAlg(const std::string& name, ISvcLocator* svcLoc)
11: AthReentrantAlgorithm(name, svcLoc),
12 m_robDataProviderSvc("ROBDataProviderSvc", name) {}
13
14// =============================================================================
15// Implementation of AthReentrantAlgorithm::initialize
16// =============================================================================
18 ATH_MSG_DEBUG("Initialising " << name());
19 ATH_CHECK(m_hltResultWHKey.initialize());
21
22 // Convert module IDs to HLT result ROB IDs
23 for (const uint16_t moduleId : m_moduleIdsToDecode) {
24 eformat::helper::SourceIdentifier sid(eformat::TDAQ_HLT, moduleId);
25 m_robIdsToDecode.push_back(sid.code());
26 }
27
28 return StatusCode::SUCCESS;
29}
30
31// =============================================================================
32// Implementation of AthReentrantAlgorithm::finalize
33// =============================================================================
35 ATH_MSG_DEBUG("Finalising " << name());
37 return StatusCode::SUCCESS;
38}
39
40// =============================================================================
41// Implementation of AthReentrantAlgorithm::execute
42// =============================================================================
43StatusCode HLTResultMTByteStreamDecoderAlg::execute(const EventContext& eventContext) const {
44 ATH_MSG_DEBUG("Executing " << name());
45
46 // Create and record the HLTResultMT object
47 auto hltResult = SG::makeHandle(m_hltResultWHKey,eventContext);
48 ATH_CHECK( hltResult.record(std::make_unique<HLT::HLTResultMT>()) );
49 ATH_MSG_DEBUG("Recorded HLTResultMT with key " << m_hltResultWHKey.key());
50
51 // Retrieve the RawEvent pointer
52 const RawEvent* re = m_robDataProviderSvc->getEvent(eventContext); // Owned by ROBDataProvider or InputSvc
53 if (!re) {
54 ATH_MSG_ERROR("Failed to retrieve the RawEvent pointer from ROBDataProvider");
55 return StatusCode::FAILURE;
56 }
57
58 // Retrieve the HLT result payload
59 IROBDataProviderSvc::VROBFRAG vrobf; // vector of ROBFragments to be filled
60 m_robDataProviderSvc->getROBData(eventContext, m_robIdsToDecode, vrobf, name());
61 if (vrobf.empty()) {
62 ATH_MSG_ERROR("Failed to retrieve HLT ROBFragments from ROBDataProvider");
63 return StatusCode::FAILURE;
64 }
65
66 // Get the format version
67 hltResult->setVersion(m_decoderTool->getHltRodMinorVersion(vrobf));
68
69 // Fill the result object from ByteStream event header
70 ATH_CHECK(m_decoderTool->decodeHeader(re, *hltResult));
71
72 // Read the HLT result payload
73 ATH_CHECK(m_decoderTool->decodePayload(vrobf, *hltResult));
74
75 // Print the result
76 ATH_MSG_DEBUG(*hltResult);
77
78 return StatusCode::SUCCESS;
79}
const boost::regex re(r_e)
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition RawEvent.h:37
An algorithm that can be simultaneously executed in multiple threads.
ToolHandle< HLTResultMTByteStreamDecoderTool > m_decoderTool
Tool performing the decoding work.
Gaudi::Property< std::vector< uint16_t > > m_moduleIdsToDecode
Module IDs to decode.
HLTResultMTByteStreamDecoderAlg(const std::string &name, ISvcLocator *svcLoc)
Standard constructor.
ServiceHandle< IROBDataProviderSvc > m_robDataProviderSvc
ROBDataProvider service handle.
virtual StatusCode execute(const EventContext &eventContext) const override
std::vector< uint32_t > m_robIdsToDecode
Full ROB IDs constructed from the ModuleIdsToDecode property.
SG::WriteHandleKey< HLT::HLTResultMT > m_hltResultWHKey
StoreGate key for the output HLTResultMT.
std::vector< const ROBF * > VROBFRAG
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())