ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigSteer
TrigHLTResultByteStream
src
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
6
#include "
HLTResultByteStreamTool.h
"
7
#include "
HLTSrcIdMap.h
"
8
#include "eformat/SourceIdentifier.h"
9
#include "
ByteStreamCnvSvcBase/IROBDataProviderSvc.h
"
10
#include <iostream>
11
#include <stdlib.h>
12
13
HLT::HLTResultByteStreamTool::HLTResultByteStreamTool
(
const
std::string&
type
,
14
const
std::string& name,
15
const
IInterface* parent )
16
:
AthAlgTool
(
type
,name,parent)
17
{
18
declareInterface<HLT::HLTResultByteStreamTool>(
this
);
19
}
20
21
26
StatusCode
HLT::HLTResultByteStreamTool::convert
(
HLTResult
* result,
RawEventWrite
*
re
,
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
58
StatusCode
HLT::HLTResultByteStreamTool::convert
(
IROBDataProviderSvc
& dataProvider,
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
70
IROBDataProviderSvc::VROBFRAG
robFrags;
71
dataProvider.
getROBData
(Gaudi::Hive::currentContext(), {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
77
OFFLINE_FRAGMENTS_NAMESPACE::PointerType
rodData =
nullptr
;
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
}
re
const std::regex re(r_e)
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
HLTResultByteStreamTool.h
HLTSrcIdMap.h
IROBDataProviderSvc.h
RawEventWrite
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::FullEventFragment RawEventWrite
data type for writing raw event
Definition
RawEvent.h:39
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
HLT::HLTResultByteStreamTool::HLTResultByteStreamTool
HLTResultByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
std Gaudi tool constructor
Definition
HLTResultByteStreamTool.cxx:13
HLT::HLTResultByteStreamTool::m_robIDMap
Gaudi::Property< std::map< std::string, uint32_t > > m_robIDMap
Definition
HLTResultByteStreamTool.h:65
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
HLT::HLTResultByteStreamTool::m_fea
FullEventAssembler< HLTSrcIdMap > m_fea
Definition
HLTResultByteStreamTool.h:72
HLT::HLTResult
HLT::HLTResult is sumarising result of trigger decision evaluation (online/offline) It contains basic...
Definition
HLTResult.h:49
IROBDataProviderSvc
Interface class for managing ROB for both online and offline.
Definition
IROBDataProviderSvc.h:23
IROBDataProviderSvc::ROBF
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment ROBF
Definition
IROBDataProviderSvc.h:26
IROBDataProviderSvc::getROBData
virtual void getROBData(const EventContext &context, const std::vector< uint32_t > &robIds, VROBFRAG &robFragments, const std::string_view callerName="UNKNOWN")=0
Retrieve ROBFragments for given ROB ids from cache.
IROBDataProviderSvc::VROBFRAG
std::vector< const ROBF * > VROBFRAG
Definition
IROBDataProviderSvc.h:27
OFFLINE_FRAGMENTS_NAMESPACE::PointerType
const DataType * PointerType
Definition
RawEvent.h:25
type
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0