ATLAS Offline Software
Loading...
Searching...
No Matches
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
7
11
12TrigBSExtraction::TrigBSExtraction(const std::string& name, ISvcLocator* pSvcLocator)
13 : AthAlgorithm(name, pSvcLocator)
14{
15}
16
17
19
20 ATH_CHECK( m_navTool.retrieve() );
21
22 // Initialize handle keys
25
26 if ( m_dataScoutingKeysIn.size() != m_dataScoutingKeysOut.size() ) {
27 ATH_MSG_ERROR("Size of DSResultKeysIn/Out does not match: " << m_dataScoutingKeysIn <<
28 " vs " << m_dataScoutingKeysOut );
29 return StatusCode::FAILURE;
30 }
31 ATH_CHECK( m_dataScoutingKeysIn.initialize() );
32 ATH_CHECK( m_dataScoutingKeysOut.initialize() );
33
34 // Initialize the TrigSerializeConcHelper here so that all the additional streamerinfos are read in.
35 // In case of DataScouting this may give problems if the DS ROBs contain containers which
36 // were not compiled with navigation (the container type information is then not known
37 // for a given CLID).
38 ToolHandle<ITrigSerializeConvHelper> trigCnvHelper("TrigSerializeConvHelper",this);
39 ATH_CHECK( trigCnvHelper.retrieve() );
40
41 return StatusCode::SUCCESS;
42}
43
44
45StatusCode TrigBSExtraction::execute(const EventContext& ctx) {
46
47 if ( !m_hltResultKeyIn.empty() ) {
49 ATH_MSG_WARNING( "failed unpacking features from BS to SG for: " << m_hltResultKeyIn );
50 }
51
52 for (size_t i = 0; i<m_dataScoutingKeysIn.size(); i++ ) {
54 ATH_MSG_WARNING( "failed unpacking features from BS to SG for: " << m_dataScoutingKeysIn[i] );
55 }
56 m_navTool->reset();
57
58 return StatusCode::SUCCESS;
59}
60
61
62StatusCode TrigBSExtraction::repackFeaturesToSG (const EventContext& ctx,
63 HLT::Navigation& navTool,
66
67 ATH_MSG_DEBUG( "Trying to deserialize content of " << key );
68 auto cresult = SG::makeHandle(key, ctx);
69
70 if ( !cresult.get() ) {
71 ATH_MSG_WARNING( "No HLTResult found with key " << key );
72 return StatusCode::SUCCESS;
73 }
74
75 ATH_MSG_DEBUG("HLTResult is level=" << cresult->getHLTLevel() );
76
77 const std::vector<uint32_t>& navData = cresult->getNavigationResult();
78 if ( !navData.empty() ) {
79 ATH_MSG_DEBUG( "Navigation payload obtained from " << key << " has size " << navData.size() );
80 navTool.deserialize( navData );
81 } else {
82 ATH_MSG_WARNING( "Navigation payload obtained from " << key << " has size 0" );
83 }
84
85 navTool.prepare();
86
87 // Create a copy of HLTResult and pack navigation back into it
88 auto result = std::make_unique<HLT::HLTResult>(*cresult);
89
90 result->getNavigationResult().clear();
91 bool status = navTool.serialize(result->getNavigationResult(), result->getNavigationResultCuts());
92 ATH_MSG_DEBUG( "New serialized navigation for " << keyOut << " has size " << result->getNavigationResult().size() );
93
94 ATH_CHECK( SG::makeHandle(keyOut, ctx).record(std::move(result)) );
95
96 return StatusCode(status);
97}
98
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
virtual bool serialize(std::vector< uint32_t > &output) const
method serizlizes the navigation structure The structure is serrizlized in following order ....
virtual void prepare()
prepapres the navigation for next event
bool deserialize(const std::vector< uint32_t > &input)
The Navigation class, organizes TriggerElements into the tree structure.
Definition Navigation.h:100
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
SG::ReadHandleKey< HLT::HLTResult > m_hltResultKeyIn
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
StatusCode repackFeaturesToSG(const EventContext &ctx, HLT::Navigation &navTool, const SG::ReadHandleKey< HLT::HLTResult > &key, SG::WriteHandleKey< HLT::HLTResult > &keyOut)
method which does loop over objects
SG::WriteHandleKey< HLT::HLTResult > m_hltResultKeyOut
TrigBSExtraction(const std::string &name, ISvcLocator *pSvcLocator)
SG::WriteHandleKeyArray< HLT::HLTResult > m_dataScoutingKeysOut
virtual StatusCode initialize() override
SG::ReadHandleKeyArray< HLT::HLTResult > m_dataScoutingKeysIn
ToolHandle< HLT::Navigation > m_navTool
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())