From b589a8836ef6f5259ed93d1518074062ff83d7ce Mon Sep 17 00:00:00 2001
From: scott snyder <sss@karma>
Date: Sun, 11 Apr 2021 21:13:01 -0400
Subject: [PATCH] TrigBjetMonitoring: Fix cppcheck warnings.

Fix cppcheck warnings.
---
 .../TrigBjetMonitoring/src/HLTBjetMonTool.cxx          | 10 ++++------
 .../src/TrigBjetMonitorAlgorithm.cxx                   |  6 +++---
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.cxx b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.cxx
index bc1347b50f85..204efd65f2d9 100755
--- a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.cxx
+++ b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.cxx
@@ -256,10 +256,8 @@ StatusCode HLTBjetMonTool::book(){
       // Check if folder assignment is made for all chains - if not stop the program
       // Regroup chain names with identical histograms
 
-      std::map<std::string,std::string>::iterator it = m_Chain2Dir.begin();
-      while (it != m_Chain2Dir.end()) {
-	ATH_MSG_DEBUG(it->first << " :: " << it->second );
-	it++;
+      for (const std::pair<const std::string, std::string>& p : m_Chain2Dir) {
+	ATH_MSG_DEBUG(p.first << " :: " << p.second );
       }
       std::map<std::string,std::string>::iterator p;
       for (const auto & chainName:m_TriggerChainBjet){     // Shaun Roe 21/9/16
@@ -1087,7 +1085,7 @@ StatusCode HLTBjetMonTool::book(){
 
 	    // Fetch and plot PV
 	    std::string vtxname = m_onlineVertexContainerKey.key();
-	    if ( vtxname.find("HLT_")==0 ) vtxname.erase(0,4);
+	    if ( vtxname.compare(0, 4, "HLT_")==0 ) vtxname.erase(0,4);
 	    auto vertexLinkInfo = TrigCompositeUtils::findLink<xAOD::VertexContainer>(jetLinkInfo.source, vtxname ); // CV 200120 & MS 290620
 	    ATH_CHECK( vertexLinkInfo.isValid() ) ; // TM 200120
 	    const xAOD::Vertex* vtx = *(vertexLinkInfo.link);
@@ -1097,7 +1095,7 @@ StatusCode HLTBjetMonTool::book(){
 	    // Fetch and plot BTagging information
 
 	    std::string btagname = m_onlineBTaggingContainerKey.key();
-	    if ( btagname.find("HLT_")==0 ) btagname.erase(0,4);
+	    if ( btagname.compare(0, 4, "HLT_")==0 ) btagname.erase(0,4);
 	    auto btaggingLinkInfo = TrigCompositeUtils::findLink<xAOD::BTaggingContainer>(jetLinkInfo.source, btagname );
 	    ATH_CHECK( btaggingLinkInfo.isValid() ) ;
 	    const xAOD::BTagging* btag = *(btaggingLinkInfo.link);
diff --git a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.cxx b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.cxx
index d3c42a06c638..0ac4425385e8 100644
--- a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.cxx
+++ b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "TrigBjetMonitorAlgorithm.h"
@@ -212,7 +212,7 @@ StatusCode TrigBjetMonitorAlgorithm::fillHistograms( const EventContext& ctx ) c
 	    // Fetch and plot PV
 	    
 	    std::string vtxname = m_onlineVertexContainerKey.key();
-	    if ( vtxname.find("HLT_")==0 ) vtxname.erase(0,4);
+	    if ( vtxname.compare(0, 4, "HLT_")==0 ) vtxname.erase(0,4);
 	    auto vertexLinkInfo = TrigCompositeUtils::findLink<xAOD::VertexContainer>(jetLinkInfo.source, vtxname ); // CV 200120 & MS 290620
 	    ATH_CHECK( vertexLinkInfo.isValid() ) ; // TM 200120
 	    const xAOD::Vertex* vtx = *(vertexLinkInfo.link);
@@ -238,7 +238,7 @@ StatusCode TrigBjetMonitorAlgorithm::fillHistograms( const EventContext& ctx ) c
 	    // Fetch and plot BTagging information
 	    
 	    std::string btagname = m_onlineBTaggingContainerKey.key();
-	    if ( btagname.find("HLT_")==0 ) btagname.erase(0,4);
+	    if ( btagname.compare(0, 4, "HLT_")==0 ) btagname.erase(0,4);
 	    auto btaggingLinkInfo = TrigCompositeUtils::findLink<xAOD::BTaggingContainer>(jetLinkInfo.source, btagname );
 	    ATH_CHECK( btaggingLinkInfo.isValid() ) ;
 	    const xAOD::BTagging* btag = *(btaggingLinkInfo.link);
-- 
GitLab