ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigEvent
TrigBSExtraction
src
TrigBSExtraction.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
StoreGate/ReadHandle.h
"
6
#include "
StoreGate/WriteHandle.h
"
7
8
#include "
TrigBSExtraction/TrigBSExtraction.h
"
9
#include "
TrigSteeringEvent/HLTResult.h
"
10
#include "
TrigSerializeCnvSvc/TrigSerializeConvHelper.h
"
11
12
TrigBSExtraction::TrigBSExtraction
(
const
std::string& name, ISvcLocator* pSvcLocator)
13
:
AthAlgorithm
(name, pSvcLocator)
14
{
15
}
16
17
18
StatusCode
TrigBSExtraction::initialize
() {
19
20
// L2 navigation tool is optional
21
if
( !
m_l2ResultKeyIn
.empty() )
ATH_CHECK
(
m_navToolL2
.retrieve() );
22
else
m_navToolL2
.disable();
23
24
ATH_CHECK
(
m_navTool
.retrieve() );
25
26
// Initialize handle keys
27
ATH_CHECK
(
m_l2ResultKeyIn
.initialize(
SG::AllowEmpty
) );
28
ATH_CHECK
(
m_l2ResultKeyOut
.initialize(
SG::AllowEmpty
) );
29
30
ATH_CHECK
(
m_hltResultKeyIn
.initialize(
SG::AllowEmpty
) );
31
ATH_CHECK
(
m_hltResultKeyOut
.initialize(
SG::AllowEmpty
) );
32
33
if
(
m_dataScoutingKeysIn
.size() !=
m_dataScoutingKeysOut
.size() ) {
34
ATH_MSG_ERROR
(
"Size of DSResultKeysIn/Out does not match: "
<<
m_dataScoutingKeysIn
<<
35
" vs "
<<
m_dataScoutingKeysOut
);
36
return
StatusCode::FAILURE;
37
}
38
ATH_CHECK
(
m_dataScoutingKeysIn
.initialize() );
39
ATH_CHECK
(
m_dataScoutingKeysOut
.initialize() );
40
41
// Initialize the TrigSerializeConcHelper here so that all the additional streamerinfos are read in.
42
// In case of DataScouting this may give problems if the DS ROBs contain containers which
43
// were not compiled with navigation (the container type information is then not known
44
// for a given CLID).
45
ToolHandle<ITrigSerializeConvHelper> trigCnvHelper(
"TrigSerializeConvHelper"
,
this
);
46
ATH_CHECK
( trigCnvHelper.retrieve() );
47
48
return
StatusCode::SUCCESS;
49
}
50
51
52
StatusCode
TrigBSExtraction::execute
(
const
EventContext& ctx) {
53
54
const
bool
isRun1 =
m_navToolL2
.isEnabled();
55
if
( isRun1 ) {
56
ATH_MSG_ERROR
(
"Unpacking of Run-1 bytestream is no longer supported"
);
57
return
StatusCode::FAILURE;
58
}
59
60
if
( !
m_hltResultKeyIn
.empty() ) {
61
// unpack, merge with L2 result and do xAOD conversion
62
// xAOD conversion is only done for HLTResult_EF in Run-1
63
if
(
repackFeaturesToSG
(ctx, *
m_navTool
,
m_hltResultKeyIn
,
m_hltResultKeyOut
, isRun1).isFailure() )
64
ATH_MSG_WARNING
(
"failed unpacking features from BS to SG for: "
<<
m_hltResultKeyIn
);
65
}
66
67
for
(
size_t
i = 0; i<
m_dataScoutingKeysIn
.size(); i++ ) {
68
if
(
repackFeaturesToSG
(ctx, *
m_navTool
,
m_dataScoutingKeysIn
[i],
m_dataScoutingKeysOut
[i],
false
).isFailure() )
69
ATH_MSG_WARNING
(
"failed unpacking features from BS to SG for: "
<<
m_dataScoutingKeysIn
[i] );
70
}
71
m_navTool
->reset();
72
73
return
StatusCode::SUCCESS;
74
}
75
76
77
StatusCode
TrigBSExtraction::repackFeaturesToSG
(
const
EventContext& ctx,
78
HLT::Navigation
& navTool,
79
const
SG::ReadHandleKey<HLT::HLTResult>
& key,
80
SG::WriteHandleKey<HLT::HLTResult>
& keyOut,
81
bool
equalize) {
82
83
ATH_MSG_DEBUG
(
"Trying to deserialize content of "
<< key );
84
auto
cresult =
SG::makeHandle
(key, ctx);
85
86
if
( !cresult.get() ) {
87
ATH_MSG_WARNING
(
"No HLTResult found with key "
<< key );
88
return
StatusCode::SUCCESS;
89
}
90
91
ATH_MSG_DEBUG
(
"HLTResult is level="
<< cresult->getHLTLevel() );
92
93
const
std::vector<uint32_t>& navData = cresult->getNavigationResult();
94
if
( !navData.empty() ) {
95
ATH_MSG_DEBUG
(
"Navigation payload obtained from "
<< key <<
" has size "
<< navData.size() );
96
navTool.
deserialize
( navData );
97
}
else
{
98
ATH_MSG_WARNING
(
"Navigation payload obtained from "
<< key <<
" has size 0"
);
99
}
100
101
if
( equalize &&
m_navToolL2
.isEnabled() ) {
102
ATH_MSG_DEBUG
(
"Merging L2 and EF navigation structures for "
<< key );
103
navTool.
merge
(*
m_navToolL2
);
104
}
105
106
navTool.
prepare
();
107
108
// Create a copy of HLTResult and pack navigation back into it
109
auto
result = std::make_unique<HLT::HLTResult>(*cresult);
110
111
result->getNavigationResult().clear();
112
bool
status = navTool.
serialize
(result->getNavigationResult(), result->getNavigationResultCuts());
113
ATH_MSG_DEBUG
(
"New serialized navigation for "
<< keyOut <<
" has size "
<< result->getNavigationResult().size() );
114
115
ATH_CHECK
(
SG::makeHandle
(keyOut, ctx).record(std::move(result)) );
116
117
return
StatusCode(status);
118
}
119
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
HLTResult.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
TrigBSExtraction.h
TrigSerializeConvHelper.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
HLT::NavigationCore::serialize
virtual bool serialize(std::vector< uint32_t > &output) const
method serizlizes the navigation structure The structure is serrizlized in following order ....
Definition
NavigationCore.cxx:81
HLT::NavigationCore::merge
bool merge(const NavigationCore &l2)
attemtps to merge two trees
Definition
NavigationCore.cxx:235
HLT::NavigationCore::prepare
virtual void prepare()
prepapres the navigation for next event
Definition
NavigationCore.cxx:335
HLT::NavigationCore::deserialize
bool deserialize(const std::vector< uint32_t > &input)
Definition
NavigationCore.cxx:151
HLT::Navigation
The Navigation class, organizes TriggerElements into the tree structure.
Definition
Navigation.h:100
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition
StoreGate/StoreGate/ReadHandleKey.h:40
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition
StoreGate/StoreGate/WriteHandleKey.h:40
TrigBSExtraction::m_hltResultKeyIn
SG::ReadHandleKey< HLT::HLTResult > m_hltResultKeyIn
Definition
TrigBSExtraction.h:56
TrigBSExtraction::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
TrigBSExtraction.cxx:52
TrigBSExtraction::m_hltResultKeyOut
SG::WriteHandleKey< HLT::HLTResult > m_hltResultKeyOut
Definition
TrigBSExtraction.h:58
TrigBSExtraction::m_navToolL2
ToolHandle< HLT::Navigation > m_navToolL2
Definition
TrigBSExtraction.h:46
TrigBSExtraction::TrigBSExtraction
TrigBSExtraction(const std::string &name, ISvcLocator *pSvcLocator)
Definition
TrigBSExtraction.cxx:12
TrigBSExtraction::repackFeaturesToSG
StatusCode repackFeaturesToSG(const EventContext &ctx, HLT::Navigation &navTool, const SG::ReadHandleKey< HLT::HLTResult > &key, SG::WriteHandleKey< HLT::HLTResult > &keyOut, bool equalize)
method which does loop over objects
Definition
TrigBSExtraction.cxx:77
TrigBSExtraction::m_dataScoutingKeysOut
SG::WriteHandleKeyArray< HLT::HLTResult > m_dataScoutingKeysOut
Definition
TrigBSExtraction.h:63
TrigBSExtraction::m_l2ResultKeyIn
SG::ReadHandleKey< HLT::HLTResult > m_l2ResultKeyIn
Definition
TrigBSExtraction.h:51
TrigBSExtraction::initialize
virtual StatusCode initialize() override
Definition
TrigBSExtraction.cxx:18
TrigBSExtraction::m_dataScoutingKeysIn
SG::ReadHandleKeyArray< HLT::HLTResult > m_dataScoutingKeysIn
Definition
TrigBSExtraction.h:61
TrigBSExtraction::m_l2ResultKeyOut
SG::WriteHandleKey< HLT::HLTResult > m_l2ResultKeyOut
Definition
TrigBSExtraction.h:53
TrigBSExtraction::m_navTool
ToolHandle< HLT::Navigation > m_navTool
Definition
TrigBSExtraction.h:48
SG::AllowEmpty
@ AllowEmpty
Definition
StoreGate/StoreGate/VarHandleKey.h:27
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
Generated on
for ATLAS Offline Software by
1.17.0