From adecd71a5e68e83d8d25c45cb65ee967af0b6206 Mon Sep 17 00:00:00 2001 From: scott snyder <sss@karma> Date: Thu, 25 Mar 2021 12:24:29 -0400 Subject: [PATCH] CaloSysD3PDMaker: Fix cppcheck warnings. Don't use post-increment with user iterators. --- .../CaloSysD3PDMaker/src/LArNoisyROFillerTool.cxx | 7 ++++--- .../D3PDMaker/CaloSysD3PDMaker/src/SCFillerTool.cxx | 12 +++--------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/PhysicsAnalysis/D3PDMaker/CaloSysD3PDMaker/src/LArNoisyROFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/CaloSysD3PDMaker/src/LArNoisyROFillerTool.cxx index d900ba8957e..af0fc1dc059 100644 --- a/PhysicsAnalysis/D3PDMaker/CaloSysD3PDMaker/src/LArNoisyROFillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/CaloSysD3PDMaker/src/LArNoisyROFillerTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ @@ -44,8 +44,9 @@ StatusCode LArNoisyROFillerTool::fill (const LArNoisyROSummary& c) if (m_SaveFEBIDs) { m_NoisyFEBIDs->clear(); - for ( std::vector<HWIdentifier>::const_iterator it = noisyfebs.begin(); - it != noisyfebs.end(); it++ ) m_NoisyFEBIDs->push_back(it->get_identifier32().get_compact()); + for (HWIdentifier hwid : noisyfebs) { + m_NoisyFEBIDs->push_back(hwid.get_identifier32().get_compact()); + } } diff --git a/PhysicsAnalysis/D3PDMaker/CaloSysD3PDMaker/src/SCFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/CaloSysD3PDMaker/src/SCFillerTool.cxx index 8725863dda5..8364ec0495f 100644 --- a/PhysicsAnalysis/D3PDMaker/CaloSysD3PDMaker/src/SCFillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/CaloSysD3PDMaker/src/SCFillerTool.cxx @@ -1,12 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ -// $Id$ -/** - */ - - #include "AthenaKernel/errorcheck.h" #include <sstream> @@ -278,7 +273,6 @@ void SCFillerTool::dumpHashTables( const CaloCellContainer& p ) { int key = scID; std::vector<const CaloCell*> v = (*it).second; int nl = v.size(); - std::vector<const CaloCell*>::iterator vit; int pn = ((key >> 28) & 0x1) ? 1: -1; int calo = ((key >> 24) & 0xf)*pn; int region = (key>>20) & 0xf; @@ -289,8 +283,8 @@ void SCFillerTool::dumpHashTables( const CaloCellContainer& p ) { std::cout << "SCFillerTool::dumpHashTables() ===> scID = " << scID << " calo,pn,region,lay,ieta,jphi: " << calo << ", " << pn << ", " << region << ", " << lay << ", " << ieta << ", " << jphi << std::endl; std::cout << "SCFillerTool::dumpHashTables() ===> scID = " << scID << " No. of cells: " << nl << std::endl; std::cout << "SCFillerTool::dumpHashTables() ===> " ; - for( vit=v.begin(); vit!= v.end(); vit++) { - std::cout << *vit << ", " ; + for (const CaloCell* cell : v) { + std::cout << cell << ", " ; } std::cout << "" << std::endl; } -- GitLab