ATLAS Offline Software
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 // =============================================================================
11 : AthReentrantAlgorithm(name, svcLoc),
12  m_robDataProviderSvc("ROBDataProviderSvc", name) {}
13 
14 // =============================================================================
15 // Implementation of AthReentrantAlgorithm::initialize
16 // =============================================================================
18  ATH_MSG_DEBUG("Initialising " << name());
20  ATH_CHECK(m_robDataProviderSvc.retrieve());
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 // =============================================================================
43 StatusCode 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 }
RawEvent
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition: RawEvent.h:37
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
HLTResultMTByteStreamDecoderAlg::finalize
virtual StatusCode finalize() override
Definition: HLTResultMTByteStreamDecoderAlg.cxx:34
HLTResultMTByteStreamDecoderAlg::m_hltResultWHKey
SG::WriteHandleKey< HLT::HLTResultMT > m_hltResultWHKey
StoreGate key for the output HLTResultMT.
Definition: HLTResultMTByteStreamDecoderAlg.h:38
HLTResultMTByteStreamDecoderAlg::m_moduleIdsToDecode
Gaudi::Property< std::vector< uint16_t > > m_moduleIdsToDecode
Module IDs to decode.
Definition: HLTResultMTByteStreamDecoderAlg.h:33
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
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
HLTResultMTByteStreamDecoderAlg::m_decoderTool
ToolHandle< HLTResultMTByteStreamDecoderTool > m_decoderTool
Tool performing the decoding work.
Definition: HLTResultMTByteStreamDecoderAlg.h:43
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IROBDataProviderSvc::VROBFRAG
std::vector< const ROBF * > VROBFRAG
Definition: IROBDataProviderSvc.h:27
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
HLTResultMTByteStreamDecoderAlg::HLTResultMTByteStreamDecoderAlg
HLTResultMTByteStreamDecoderAlg(const std::string &name, ISvcLocator *svcLoc)
Standard constructor.
Definition: HLTResultMTByteStreamDecoderAlg.cxx:10
HLTResultMTByteStreamDecoderAlg::m_robIdsToDecode
std::vector< uint32_t > m_robIdsToDecode
Full ROB IDs constructed from the ModuleIdsToDecode property.
Definition: HLTResultMTByteStreamDecoderAlg.h:50
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
HLTResultMTByteStreamDecoderAlg::m_robDataProviderSvc
ServiceHandle< IROBDataProviderSvc > m_robDataProviderSvc
ROBDataProvider service handle.
Definition: HLTResultMTByteStreamDecoderAlg.h:46
HLTResultMTByteStreamDecoderAlg.h
re
const boost::regex re(r_e)
HLTResultMTByteStreamDecoderAlg::initialize
virtual StatusCode initialize() override
Definition: HLTResultMTByteStreamDecoderAlg.cxx:17
HLTResultMTByteStreamDecoderAlg::execute
virtual StatusCode execute(const EventContext &eventContext) const override
Definition: HLTResultMTByteStreamDecoderAlg.cxx:43