ATLAS Offline Software
HLTResultByteStreamTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
7 #include "HLTSrcIdMap.h"
8 #include "eformat/SourceIdentifier.h"
10 #include <iostream>
11 #include <stdlib.h>
12 
14  const std::string& name,
15  const IInterface* parent )
17 {
18  declareInterface<HLT::HLTResultByteStreamTool>( this );
19 }
20 
21 
27  std::string objName)
28 {
29  // find the ROB ID for the given HLTResult name
30  const auto itr = m_robIDMap.find(objName);
31  if ( itr==m_robIDMap.end() ) {
32  ATH_MSG_ERROR("No ROB ID configured for " << objName);
33  return StatusCode::FAILURE;
34  }
35  eformat::helper::SourceIdentifier rob(itr->second);
36 
37  // configure the EventAssembler and serialize into bytestream
38  m_fea.clear();
39  m_fea.idMap().setDetId(rob.subdetector_id());
40 
41  std::vector<uint32_t>* rod = m_fea.getRodData( rob.code() );
42  if (!rod) return StatusCode::FAILURE;
43 
44  result->serialize( *rod );
45  m_fea.fill(re, msg());
46 
47  ATH_MSG_DEBUG("Serialized HLT Result " << objName << " (" << rod->size()
48  << " words) to location " << rob.human());
49 
50  return StatusCode::SUCCESS;
51 }
52 
53 
59  HLT::HLTResult*& result, std::string objName)
60 {
61  // find the ROB ID for the given HLTResult name
62  const auto itr = m_robIDMap.find(objName);
63  if ( itr==m_robIDMap.end() ) {
64  ATH_MSG_ERROR("No ROB ID configured for " << objName);
65  return StatusCode::FAILURE;
66  }
67  eformat::helper::SourceIdentifier rob(itr->second);
68 
69  // request the ROB and deserialize into HLTResult
71  dataProvider.getROBData({rob.code()}, robFrags);
72 
73  // unsigned int vector where to store HLT payload
74  std::vector<uint32_t> hltContent;
75  for (const IROBDataProviderSvc::ROBF* rob : robFrags ) {
76 
78  rob->rod_data(rodData);
79 
80  const uint32_t nData = rob->rod_ndata();
81  hltContent.reserve(nData);
82  for (size_t i = 0; i < nData; i++) hltContent.push_back(rodData[i]);
83  }
84 
85  result->deserialize(hltContent);
86  ATH_MSG_DEBUG("Deserialized HLT Result " << objName << " (" << hltContent.size() << " words)");
87 
88  return StatusCode::SUCCESS;
89 }
RawEventWrite
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::FullEventFragment RawEventWrite
data type for writing raw event
Definition: RawEvent.h:39
HLTResultByteStreamTool.h
get_generator_info.result
result
Definition: get_generator_info.py:21
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
IROBDataProviderSvc
Interface class for managing ROB for both online and offline.
Definition: IROBDataProviderSvc.h:25
OFFLINE_FRAGMENTS_NAMESPACE::PointerType
const DataType * PointerType
Definition: RawEvent.h:25
HLT::HLTResultByteStreamTool::convert
StatusCode convert(IROBDataProviderSvc &dataProvider, HLTResult *&result, std::string objName)
convert ROBData to HLTResult this function should be called from createObj
Definition: HLTResultByteStreamTool.cxx:58
IROBDataProviderSvc::getROBData
virtual void getROBData(const std::vector< uint32_t > &robIds, VROBFRAG &robFragments, const std::string_view callerName="UNKNOWN")=0
Retrieve ROBFragments for given ROB ids from cache.
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
eformat::ROBFragment
Definition: L1CaloBsDecoderUtil.h:12
lumiFormat.i
int i
Definition: lumiFormat.py:92
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
test_pyathena.parent
parent
Definition: test_pyathena.py:15
IROBDataProviderSvc::VROBFRAG
std::vector< const ROBF * > VROBFRAG
Definition: IROBDataProviderSvc.h:29
HLT::HLTResult
HLT::HLTResult is sumarising result of trigger decision evaluation (online/offline) It contains basic...
Definition: HLTResult.h:57
RunTileMonitoring.rod
rod
Definition: RunTileMonitoring.py:134
HLTSrcIdMap.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
HLT::HLTResultByteStreamTool::HLTResultByteStreamTool
HLTResultByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
std Gaudi tool constructor
Definition: HLTResultByteStreamTool.cxx:13
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
re
const boost::regex re(r_e)
AthAlgTool
Definition: AthAlgTool.h:26
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
IROBDataProviderSvc.h