diff --git a/Calorimeter/CaloUtils/CaloUtils/CaloCollectionHelper.h b/Calorimeter/CaloUtils/CaloUtils/CaloCollectionHelper.h index 59a2cf37e52b69c73cdc3b440e584ad0626e645d..df1d87188501f0a5fb89fd03d707c1e42d94744e 100644 --- a/Calorimeter/CaloUtils/CaloUtils/CaloCollectionHelper.h +++ b/Calorimeter/CaloUtils/CaloUtils/CaloCollectionHelper.h @@ -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 */ #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() ) diff --git a/Calorimeter/CaloUtils/src/CaloTopoTowerBuilderTool.cxx b/Calorimeter/CaloUtils/src/CaloTopoTowerBuilderTool.cxx index eb7645757f6603dead9f386579c384288bebc01b..a190d2c7dd9c345c8c48cdb28944abb2e69f0948 100644 --- a/Calorimeter/CaloUtils/src/CaloTopoTowerBuilderTool.cxx +++ b/Calorimeter/CaloUtils/src/CaloTopoTowerBuilderTool.cxx @@ -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 } }