Skip to content
Snippets Groups Projects
Commit c7a9bf01 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'cppcheck.CaloUtils-20210605' into 'master'

CaloUtils: Fix cppcheck warnings.

See merge request atlas/athena!44159
parents 4b367f9f 4e11bade
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef CALOUTILS_CALOCOLLECTIONHELPER_H
......@@ -52,7 +52,7 @@ struct CaloCollectionHelper
typedef typename COLL::base_value_type object_t;
typename CONT::const_iterator fObj = theStorable->begin();
typename CONT::const_iterator lObj = theStorable->end();
for ( ; fObj != lObj; fObj++ )
for ( ; fObj != lObj; ++fObj )
{ theAltStorable->push_back((object_t*)(*fObj)); }
// problem
if ( theAltStorable->size() != theStorable->size() )
......
......@@ -137,7 +137,7 @@ StatusCode CaloTopoTowerBuilderTool::execute(const EventContext& ctx,
clusterContainer = pNav->getContainer(pNav->begin());
ATH_MSG_DEBUG("Successfully picked up CaloClusterContainer ");
}
else fClusMap++;
else ++fClusMap;
}
// Make sure the cluster container is not NULL
......@@ -166,20 +166,17 @@ StatusCode CaloTopoTowerBuilderTool::execute(const EventContext& ctx,
// (*cellInTowerIter) is the ITERATOR over CELLS for this TOWER
ATH_MSG_DEBUG("Beginning loop over tower grid");
CaloTowerContainer::const_iterator towerIter(towerContainer->begin());
CaloTowerContainer::const_iterator lastTower(towerContainer->end());
for ( ; towerIter != lastTower; towerIter++ )
for (const CaloTower* tower : *towerContainer)
{
const CaloTower* tower = (*towerIter);
int towerIndex = towerContainer->getTowerIndex(tower);
CaloTower* newTower = theTowers->getTower(towerIndex);
///+++ loop cells in old tower
ATH_MSG_VERBOSE("In loop over tower grid: tower eta-phi" << tower->eta() << " " << tower->phi());
CaloTower::cell_iterator cellInTowerIter((*towerIter)->cell_begin());
CaloTower::cell_iterator lastCellInTower((*towerIter)->cell_end());
CaloTower::cell_iterator cellInTowerIter(tower->cell_begin());
CaloTower::cell_iterator lastCellInTower(tower->cell_end());
/// Various counters for keeping track of energy added to this tower
double energyTower = 0.0;
......@@ -343,17 +340,14 @@ CaloTopoTowerBuilderTool::CreateCaloCell2ClusterMap(const CaloClusterContainer*
ATH_MSG_DEBUG("CaloCluster container contains " << clusColl->size() << " clusters");
// loop over cluster collection and add each cluster to the map for
// each member cell
CaloClusterContainer::const_iterator clusIter = clusColl->begin();
CaloClusterContainer::const_iterator clusIterEnd = clusColl->end();
unsigned int iClus=0;
for( ;clusIter!=clusIterEnd;clusIter++,iClus++) {
for (const CaloCluster* clust : *clusColl) {
// loop over its cell members
if (((*clusIter)->getNumberOfCells()) == 0 ) {
if ((clust->getNumberOfCells()) == 0 ) {
ATH_MSG_DEBUG(" no cells for this cluster... No reverse navigation possible...");
}
else {
CaloCluster::cell_iterator cellIter = (*clusIter)->cell_begin();
CaloCluster::cell_iterator cellIterEnd = (*clusIter)->cell_end();
CaloCluster::cell_iterator cellIter = clust->cell_begin();
CaloCluster::cell_iterator cellIterEnd = clust->cell_end();
for( ;cellIter!=cellIterEnd;cellIter++) {
// look up the IdentifierHash for the current cell
if (*cellIter) {
......@@ -367,7 +361,7 @@ CaloTopoTowerBuilderTool::CreateCaloCell2ClusterMap(const CaloClusterContainer*
(*cell2ClusterMap)[myHashId] = theNav;
}
// add the current cluster to the list of clusters for this cell
theNav->putElement(clusColl,*clusIter);
theNav->putElement(clusColl,clust);
// add the energy*weight for this cell to the weightedESum
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment