Skip to content
Snippets Groups Projects

Fix thinning of HLTResult (ATR-18627)

Merged Frank Winklmeier requested to merge fwinkl/athena:hltresult_thinning into master
All threads resolved!
2 files
+ 26
38
Compare changes
  • Side-by-side
  • Inline
Files
2
/*
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
*/
#include "TrigSteeringEvent/HLTResult.h"
#include "TrigSteeringEvent/HLTResult.h"
@@ -37,12 +37,6 @@ StatusCode TrigNavigationThinningTool::finalize() {
@@ -37,12 +37,6 @@ StatusCode TrigNavigationThinningTool::finalize() {
}
}
template<class ResultType>
ResultType* TrigNavigationThinningTool::createAndRecordResult(const std::string&) const { return nullptr; }
template<>
template<>
xAOD::TrigNavigation* TrigNavigationThinningTool::createAndRecordResult(const std::string& key) const {
xAOD::TrigNavigation* TrigNavigationThinningTool::createAndRecordResult(const std::string& key) const {
auto nav = new xAOD::TrigNavigation();
auto nav = new xAOD::TrigNavigation();
@@ -63,37 +57,35 @@ xAOD::TrigNavigation* TrigNavigationThinningTool::createAndRecordResult(const st
@@ -63,37 +57,35 @@ xAOD::TrigNavigation* TrigNavigationThinningTool::createAndRecordResult(const st
}
}
 
StatusCode TrigNavigationThinningTool::doThinning() const {
 
ATH_MSG_DEBUG( "TrigNavigationThinningTool::doThinning()" );
template<class ResultType>
// Check if there is a (const) HLTResult
ResultType* TrigNavigationThinningTool::retrieveResult(const std::string& key) const {
HLT::HLTResult *hltresult = nullptr;
if ( key.empty() ) {
if ( not m_HLTResultKey.empty() and evtStore()->contains<HLT::HLTResult>(m_HLTResultKey) ) {
// ATH_MSG_DEBUG( "Key for type " << ClassID_traits<ResultType>::typeName() <<" is empty, dooing nothing");
const HLT::HLTResult* cres = nullptr;
return nullptr;
if ( evtStore()->retrieve( cres, m_HLTResultKey).isFailure() or cres==nullptr ) {
 
ATH_MSG_WARNING( "Unable to load HLT::HLTResult using key " << m_HLTResultKey );
 
}
 
else {
 
hltresult = const_cast<HLT::HLTResult*>(cres);
 
}
}
}
if ( not evtStore()->contains<ResultType>( key ) ) {
// Check if there is a xAOD::TrigNavigation, or create it
ATH_MSG_DEBUG( "Absent " << ClassID_traits<ResultType>::typeName() << " of key " << key << " creating new and registering it");
xAOD::TrigNavigation *xaodresult = nullptr;
return createAndRecordResult<ResultType>(key);
if ( not m_xAODNavigationKey.empty() ) {
 
if ( not evtStore()->contains<xAOD::TrigNavigation>(m_xAODNavigationKey) ) {
 
ATH_MSG_DEBUG( "Absent xAOD::TrigNavigation of key " << m_xAODNavigationKey << ". Creating new one and registering it");
 
xaodresult = createAndRecordResult<xAOD::TrigNavigation>(m_xAODNavigationKey);
 
}
 
if ( evtStore()->retrieve( xaodresult, m_xAODNavigationKey).isFailure() or xaodresult==nullptr ) {
 
ATH_MSG_WARNING( "Unable to load xAOD::TrigNavigation using key " << m_xAODNavigationKey );
 
}
}
}
ResultType *result = nullptr;
if ( evtStore()->retrieve( result, key ).isFailure() || result == nullptr ) {
ATH_MSG_WARNING( "Unable to load " << ClassID_traits<ResultType>::typeName() << " using key " << key );
return nullptr;
}
return result;
}
StatusCode TrigNavigationThinningTool::doThinning() const {
ATH_MSG_DEBUG( "TrigNavigationThinningTool::doThinning()" );
// check if the result is there (do nothing if is not)
HLT::HLTResult *hltresult = retrieveResult<HLT::HLTResult>(m_HLTResultKey);
xAOD::TrigNavigation *xaodresult = retrieveResult<xAOD::TrigNavigation>(m_xAODNavigationKey);
if ( hltresult == nullptr and xaodresult == nullptr ) {
if ( hltresult == nullptr and xaodresult == nullptr ) {
ATH_MSG_DEBUG( "Neither xAOD, not HLT navigations are present or required, dooing nothing");
ATH_MSG_DEBUG( "Neither xAOD, not HLT navigations are present or required, doing nothing");
return StatusCode::SUCCESS;
return StatusCode::SUCCESS;
}
}
@@ -110,7 +102,7 @@ StatusCode TrigNavigationThinningTool::doThinning() const {
@@ -110,7 +102,7 @@ StatusCode TrigNavigationThinningTool::doThinning() const {
xaodresult->setSerialized(slimmedPayload);
xaodresult->setSerialized(slimmedPayload);
}
}
} else {
} else {
ATH_MSG_DEBUG( "Scheduling trigger navigation slimming while writting output file" );
ATH_MSG_DEBUG( "Scheduling trigger navigation slimming while writing output file" );
if ( hltresult ) {
if ( hltresult ) {
SlimmingHandler<HLT::HLTResult> *hdlr
SlimmingHandler<HLT::HLTResult> *hdlr
= new SlimmingHandler<HLT::HLTResult>(hltresult, this, m_slimmingTool.operator->());
= new SlimmingHandler<HLT::HLTResult>(hltresult, this, m_slimmingTool.operator->());
Loading