diff --git a/Trigger/TrigAnalysis/TrigDecisionTool/Root/CacheGlobalMemory.cxx b/Trigger/TrigAnalysis/TrigDecisionTool/Root/CacheGlobalMemory.cxx index 12d1f83744682cc6b2af7d56c1eed586699db119..9725b0beeab133dbd6d0229325f9b8101dc76d2a 100644 --- a/Trigger/TrigAnalysis/TrigDecisionTool/Root/CacheGlobalMemory.cxx +++ b/Trigger/TrigAnalysis/TrigDecisionTool/Root/CacheGlobalMemory.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************** @@ -86,10 +86,11 @@ const Trig::ChainGroup* Trig::CacheGlobalMemory::createChainGroup(const std::vec // create a proper key std::vector< std::string > key=Trig::keyWrap(triggerNames); - if (m_chainGroups.find(key)==m_chainGroups.end()) { - m_chainGroups[key]=new ChainGroup( key, *this ); - updateChainGroup(m_chainGroups[key]); - m_chainGroupsRef[key]=m_chainGroups[key]; + auto res = m_chainGroups.try_emplace (key, nullptr); + if (res.second) { + res.first->second = new ChainGroup( key, *this ); + updateChainGroup(res.first->second); + m_chainGroupsRef[key] = res.first->second; } // this overwrites the pointer in the map each time in case the alias needs defining if (alias!="") { @@ -205,7 +206,7 @@ void Trig::CacheGlobalMemory::update(const TrigConf::HLTChainList* confChains, } // std::map<std::string, std::vector<std::string> >::iterator mstIt; - for (mstIt=m_streams.begin(); mstIt != m_streams.end(); mstIt++) { + for (mstIt=m_streams.begin(); mstIt != m_streams.end(); ++mstIt) { const std::string alias("STREAM_"+mstIt->first); std::vector< std::string > key_alias=Trig::keyWrap(Trig::convertStringToVector(alias)); ChGrIt preIt = m_chainGroupsRef.find(key_alias); @@ -220,7 +221,7 @@ void Trig::CacheGlobalMemory::update(const TrigConf::HLTChainList* confChains, } } - for (mstIt=m_groups.begin(); mstIt != m_groups.end(); mstIt++) { + for (mstIt=m_groups.begin(); mstIt != m_groups.end(); ++mstIt) { const std::string alias("GROUP_"+mstIt->first); std::vector< std::string > key_alias=Trig::keyWrap(Trig::convertStringToVector(alias)); ChGrIt preIt = m_chainGroupsRef.find(key_alias); diff --git a/Trigger/TrigAnalysis/TrigDecisionTool/Root/ChainGroup.cxx b/Trigger/TrigAnalysis/TrigDecisionTool/Root/ChainGroup.cxx index fadc62c56ff29b57c59659ab192cab9fdf9c2964..5ebf66333df47af96fd8dc381a701a8c1c5feb31 100644 --- a/Trigger/TrigAnalysis/TrigDecisionTool/Root/ChainGroup.cxx +++ b/Trigger/TrigAnalysis/TrigDecisionTool/Root/ChainGroup.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************** @@ -222,7 +222,7 @@ bool Trig::ChainGroup::isPassed(unsigned int condition) const std::vector<std::string> triggers = getListOfTriggers(); const std::vector<std::string>& express_names = expressStream->linkColNames(); std::vector<std::string>::const_iterator p1, p2; - for (p1=triggers.begin(); p1!=triggers.end(); p1++) { + for (p1=triggers.begin(); p1!=triggers.end(); ++p1) { for (p2=express_names.begin(); p2!=express_names.end(); ++p2) { if ( (*p1) == (*p2) ) { //essentially implements a OR across all triggers in the CG (as is done upstream) @@ -642,7 +642,7 @@ Trig::ChainGroup::update(const TrigConf::HLTChainList* confChains, if (!(confChains && confItems) ) return; for(std::vector< std::string >::const_iterator it = m_patterns.begin(); - it != m_patterns.end(); it++) { + it != m_patterns.end(); ++it) { // find chains matching pattern boost::regex compiled(*it); boost::cmatch what; diff --git a/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/ChainGroup.h b/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/ChainGroup.h index 3eb835c032574e4026c75478a7bbb1cbe04f3611..e0d518468eb19b2721dab8baea749238300ab19d 100644 --- a/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/ChainGroup.h +++ b/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/ChainGroup.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGGER_DECISION_TOOL_CHAIN_GROUP_H @@ -128,9 +128,9 @@ namespace Trig { template<class CONTAINER> std::vector< TrigCompositeUtils::LinkInfo<CONTAINER> > features(EventPtr_t eventStore, unsigned int condition = TrigDefs::Physics, - const std::string container = "", + const std::string& container = "", const unsigned int featureCollectionMode = TrigDefs::oneFeaturePerLeg, - const std::string featureName = "feature") const; + const std::string& featureName = "feature") const; // const std::vector< std::string >& patterns() const {return m_patterns;} diff --git a/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/ChainGroup.icc b/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/ChainGroup.icc index 55c63dd2345e2c4f11d12606eaa1ac1f67f0f7a4..b707eb4989cbe99b4958f1313ffb5b614a108868 100644 --- a/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/ChainGroup.icc +++ b/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/ChainGroup.icc @@ -1,7 +1,7 @@ template<class CONTAINER> std::vector< TrigCompositeUtils::LinkInfo<CONTAINER> > Trig::ChainGroup::features(EventPtr_t eventStore, - unsigned int condition, const std::string container, - const unsigned int featureCollectionMode, const std::string featureName) const { + unsigned int condition, const std::string& container, + const unsigned int featureCollectionMode, const std::string& featureName) const { bool errState = false; diff --git a/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/DecisionAccess.h b/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/DecisionAccess.h index 22bb65723c3f0d1453778e44617f8b28116c141d..edfd8d0342cbb66dd5380502788b7da08847a7c1 100644 --- a/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/DecisionAccess.h +++ b/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/DecisionAccess.h @@ -1,7 +1,7 @@ // -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGGER_DECISION_TOOL_DecisionAccess_H @@ -117,9 +117,9 @@ namespace Trig { template<class CONTAINER> std::vector< TrigCompositeUtils::LinkInfo<CONTAINER> > features(const Trig::ChainGroup* group, const unsigned int condition = TrigDefs::Physics, - const std::string container = "", + const std::string& container = "", const unsigned int featureCollectionMode = TrigDefs::oneFeaturePerLeg, - const std::string featureName = "feature") const; + const std::string& featureName = "feature") const; /** * @brief Runs 3+. Returns features related to given chain @@ -133,9 +133,9 @@ namespace Trig { template<class CONTAINER> std::vector< TrigCompositeUtils::LinkInfo<CONTAINER> > features(const std::string& chainName = "HLT_.*", const unsigned int condition = TrigDefs::Physics, - const std::string container = "", + const std::string& container = "", const unsigned int featureCollectionMode = TrigDefs::oneFeaturePerLeg, - const std::string featureName = "feature") const; + const std::string& featureName = "feature") const; /** * @brief gives back feature matching (by seeding relation) diff --git a/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/DecisionAccess.icc b/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/DecisionAccess.icc index f19fc60cb2dfcd9f527443358641d934a1436ce8..13b59e5bd8235f79d4e283842d3c371db63ce102 100644 --- a/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/DecisionAccess.icc +++ b/Trigger/TrigAnalysis/TrigDecisionTool/TrigDecisionTool/DecisionAccess.icc @@ -46,9 +46,9 @@ const std::vector<Trig::Feature<T> > Trig::DecisionAccess::ancestors(const HLT:: template<class CONTAINER> std::vector< TrigCompositeUtils::LinkInfo<CONTAINER> > Trig::DecisionAccess::features(const Trig::ChainGroup* group, const unsigned int condition, - const std::string container, + const std::string& container, const unsigned int featureCollectionMode, - const std::string featureName) const { + const std::string& featureName) const { // const TrigCompositeUtils::DecisionContainer* terminusNode = SG::get(m_HLTSummaryKeyIn/*, context*/); return group->features<CONTAINER>(cgm()->store(), condition, container, featureCollectionMode, featureName); } @@ -56,9 +56,9 @@ std::vector< TrigCompositeUtils::LinkInfo<CONTAINER> > Trig::DecisionAccess::fea template<class CONTAINER> std::vector< TrigCompositeUtils::LinkInfo<CONTAINER> > Trig::DecisionAccess::features(const std::string& chainName, const unsigned int condition, - const std::string container, + const std::string& container, const unsigned int featureCollectionMode, - const std::string featureName) const { + const std::string& featureName) const { const Trig::ChainGroup *g = cgm()->createChainGroup(Trig::convertStringToVector(chainName)); return features<CONTAINER>(g, condition, container, featureCollectionMode, featureName); }