ATLAS Offline Software
Loading...
Searching...
No Matches
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 )
16 : AthAlgTool(type,name,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(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
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}
const boost::regex re(r_e)
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::FullEventFragment RawEventWrite
data type for writing raw event
Definition RawEvent.h:39
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
HLTResultByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
std Gaudi tool constructor
Gaudi::Property< std::map< std::string, uint32_t > > m_robIDMap
StatusCode convert(IROBDataProviderSvc &dataProvider, HLTResult *&result, std::string objName)
convert ROBData to HLTResult this function should be called from createObj
FullEventAssembler< HLTSrcIdMap > m_fea
HLT::HLTResult is sumarising result of trigger decision evaluation (online/offline) It contains basic...
Definition HLTResult.h:51
Interface class for managing ROB for both online and offline.
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment ROBF
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.
std::vector< const ROBF * > VROBFRAG
const DataType * PointerType
Definition RawEvent.h:25
MsgStream & msg
Definition testRead.cxx:32