diff --git a/Trigger/TrigAnalysis/TrigDecisionTool/Root/ExpertMethods.cxx b/Trigger/TrigAnalysis/TrigDecisionTool/Root/ExpertMethods.cxx index 20b6e5d0fcdf7ee659d4bc10850c925c7aecfcd5..6d9332781d2632f3c84a6607cd03b1cf1464d689 100644 --- a/Trigger/TrigAnalysis/TrigDecisionTool/Root/ExpertMethods.cxx +++ b/Trigger/TrigAnalysis/TrigDecisionTool/Root/ExpertMethods.cxx @@ -143,13 +143,12 @@ bool Trig::ExpertMethods::isHLTTruncated() const { } #if !defined(XAOD_STANDALONE) && !defined(XAOD_ANALYSIS) - const HLT::HLTResult* res(nullptr); - auto navigation = getNavigation(); - if(!navigation || navigation->getAccessProxy()->retrieve(res, "HLTResult_HLT").isFailure()) { + SG::ReadHandle<HLT::HLTResult> hltResult("HLTResult_HLT"); + if(!hltResult.isValid()) { ATH_MSG_WARNING("TDT has not ben able to get HLTResult_HLT"); return false; } - return res->isHLTResultTruncated(); + return hltResult->isHLTResultTruncated(); #else ATH_MSG_ERROR("isHLTTruncated only supported with a xAOD::TrigDecision ReadHandle (Runs 2,3) or in full Athena (Run 2)"); return false; diff --git a/Trigger/TrigEvent/TrigNavStructure/Root/TrigNavStructure.cxx b/Trigger/TrigEvent/TrigNavStructure/Root/TrigNavStructure.cxx index ea4ff80dd4a0ddac136342dfd1880e6d8579f52b..495741d2ec9826380b926bb056a9b0e4259d96ff 100644 --- a/Trigger/TrigEvent/TrigNavStructure/Root/TrigNavStructure.cxx +++ b/Trigger/TrigEvent/TrigNavStructure/Root/TrigNavStructure.cxx @@ -42,12 +42,14 @@ TrigNavStructure::~TrigNavStructure() { * *****************************************************************************/ TriggerElement* TrigNavStructure::getInitialNode() { + std::lock_guard<std::recursive_mutex> lock(m_rmutex); if ( m_factory.empty() ) m_factory.produce(0); return m_factory.listOfProduced().front(); } const TriggerElement* TrigNavStructure::getInitialNode() const { + std::lock_guard<std::recursive_mutex> lock(m_rmutex); if ( not m_factory.empty() ) return m_factory.listOfProduced().front(); return 0; @@ -55,6 +57,7 @@ const TriggerElement* TrigNavStructure::getInitialNode() const { TriggerElement* TrigNavStructure::addRoINode( TriggerElement* initial ) { + std::lock_guard<std::recursive_mutex> lock(m_rmutex); if ( isInitialNode(initial) ) { TriggerElement* te = m_factory.produce(0); @@ -79,6 +82,8 @@ TriggerElement* TrigNavStructure::addNode( TriggerElement* seednode, unsigned in } TriggerElement* TrigNavStructure::addNode( std::vector<TriggerElement* >& seeds, unsigned int id, bool ghost, bool nofwd ) { + std::lock_guard<std::recursive_mutex> lock(m_rmutex); + TriggerElement* te = m_factory.produce(id, ghost, nofwd); @@ -204,6 +209,7 @@ void TrigNavStructure::printASCIIArt (std::string& str, const TriggerElement* te } bool TrigNavStructure::serializeTEs( std::vector<uint32_t>& output ) const { + std::lock_guard<std::recursive_mutex> lock(m_rmutex); ::HLTNavDetails::FillSize fs(output); const std::vector<TriggerElement*>& fullList = m_factory.listOfProduced(); @@ -248,6 +254,7 @@ bool TrigNavStructure::serializeTEs( std::vector<uint32_t>& output ) const { *****************************************************************************/ bool TrigNavStructure::deserializeTEs(std::vector<uint32_t>::const_iterator& start, unsigned int totalSize) { + std::lock_guard<std::recursive_mutex> lock(m_rmutex); m_factory.reset(); std::vector<uint32_t>::const_iterator& inputIt = start; @@ -327,6 +334,7 @@ void TrigNavStructure::getAllRoIThresholdTEs( std::vector< TriggerElement* >& ou void TrigNavStructure::getAllOfType ( const te_id_type id, std::vector< TriggerElement* >& output, const bool activeOnly) const { + std::lock_guard<std::recursive_mutex> lock(m_rmutex); if ( not m_factory.listOfProduced(id).empty() ) { std::back_insert_iterator<std::vector<TriggerElement*> > outputIt( output ); @@ -341,6 +349,7 @@ void TrigNavStructure::getAllOfType ( const te_id_type id, } void TrigNavStructure::getAll ( std::vector< TriggerElement* >& output, const bool activeOnly) const { + std::lock_guard<std::recursive_mutex> lock(m_rmutex); if ( not m_factory.listOfProduced().empty() ) { std::back_insert_iterator<std::vector<TriggerElement*> > outputIt( output ); if (activeOnly) @@ -351,6 +360,7 @@ void TrigNavStructure::getAll ( std::vector< TriggerElement* >& output, const bo } unsigned int TrigNavStructure::countAllOfType( const te_id_type id, const bool activeOnly ) const { + std::lock_guard<std::recursive_mutex> lock(m_rmutex); if ( activeOnly ) return m_factory.listOfProduced(id).size() - count_if(m_factory.listOfProduced(id).begin(), m_factory.listOfProduced(id).end(), isNotActive); @@ -515,6 +525,7 @@ bool TrigNavStructure::isCompatibleTree( const TriggerElement* te1, const Trigge bool TrigNavStructure::propagateDeactivation(const TrigNavStructure* nav) { + std::lock_guard<std::recursive_mutex> lock(m_rmutex); // basic checks first if ( nav->m_factory.listOfProduced().size() > m_factory.listOfProduced().size() ) return false; @@ -710,16 +721,20 @@ unsigned int TrigNavStructure::copyAllFeatures( const TriggerElement* sourceTE, * *****************************************************************************/ void TrigNavStructure::reset() { + std::lock_guard<std::recursive_mutex> lock(m_rmutex); + // std::cerr << "resetting" << std::endl; m_factory.reset(); m_holderstorage.reset(); } sub_index_type TrigNavStructure::subType(class_id_type clid, const index_or_label_type& sti_or_label) const { + std::lock_guard<std::recursive_mutex> lock(m_rmutex); return m_holderstorage.getSubTypeIndex(clid,sti_or_label); } std::string TrigNavStructure::label(class_id_type clid, const index_or_label_type& sti_or_label) const { + std::lock_guard<std::recursive_mutex> lock(m_rmutex); return m_holderstorage.getLabel(clid,sti_or_label); } diff --git a/Trigger/TrigEvent/TrigNavStructure/TrigNavStructure/TrigNavStructure.h b/Trigger/TrigEvent/TrigNavStructure/TrigNavStructure/TrigNavStructure.h index 8a508f5582afe389c4a4d3e9d0cda59a5cdca68d..c7ad70ee03730f7980f03b751aa6322946f2c09d 100644 --- a/Trigger/TrigEvent/TrigNavStructure/TrigNavStructure/TrigNavStructure.h +++ b/Trigger/TrigEvent/TrigNavStructure/TrigNavStructure/TrigNavStructure.h @@ -9,6 +9,7 @@ #define TRIGNAVSTRUCTURE_TRIGNAVSTRUCTURE_H #include <vector> +#include <mutex> #include "CxxUtils/checker_macros.h" #include "TrigNavStructure/TriggerElement.h" @@ -372,6 +373,8 @@ namespace HLT { static const TriggerElement* m_unspecifiedTE ATLAS_THREAD_SAFE; static std::string m_unspecifiedLabel ATLAS_THREAD_SAFE; + mutable std::recursive_mutex m_rmutex; + }; } // end of HLT namespace