From 00882526aaa345f32e87a9434e3cf6ca030fc42d Mon Sep 17 00:00:00 2001 From: Adam Edward Barton <adam.edward.barton@cern.ch> Date: Mon, 29 Jun 2020 14:44:55 +0100 Subject: [PATCH] Adjust IDC random access in various packages --- .../src/InDetEventCnvTool.cxx | 30 +++++-------- .../PixelGangedClusterAmbiguitiesCnv_p1.cxx | 4 +- .../SCT_Monitoring/src/SCTHitEffMonAlg.cxx | 7 ++- .../SCT_Monitoring/src/SCTHitEffMonTool.cxx | 7 ++- .../SCT_Monitoring/src/SCTHitsNoiseMonAlg.cxx | 6 +-- .../src/SCTHitsNoiseMonTool.cxx | 6 +-- .../src/SiTrajectory_xk.cxx | 44 +++++++++---------- .../InDetAssociationTools/InDetPRD_Provider.h | 5 +-- .../src/TRT_SeededSpacePointFinder_ATL.cxx | 21 ++++----- .../src/TRT_TrackExtensionTool_DAF.cxx | 26 +++++------ .../src/TRT_TrackExtensionToolCosmics.cxx | 10 ++--- .../src/TRT_Trajectory_xk.cxx | 14 +++--- .../src/Pixel_TrgClusterization.cxx | 7 +-- .../src/SCT_TrgClusterization.cxx | 7 +-- .../src/TRT_TrgRIO_Maker.cxx | 7 +-- .../src/SCT_TrigSpacePointTool.cxx | 15 ++----- .../src/SiTrigSpacePointFinder.cxx | 24 +++------- .../src/MuonLayerHoughTool.cxx | 20 ++++----- .../src/MuonPatternCalibration.cxx | 16 +++---- 19 files changed, 110 insertions(+), 166 deletions(-) diff --git a/InnerDetector/InDetEventCnv/InDetEventCnvTools/src/InDetEventCnvTool.cxx b/InnerDetector/InDetEventCnv/InDetEventCnvTools/src/InDetEventCnvTool.cxx index 7e8ff0e44ee..8def17fe48d 100755 --- a/InnerDetector/InDetEventCnv/InDetEventCnvTools/src/InDetEventCnvTool.cxx +++ b/InnerDetector/InDetEventCnv/InDetEventCnvTools/src/InDetEventCnvTool.cxx @@ -261,14 +261,12 @@ InDet::InDetEventCnvTool::pixelClusterLink( const Identifier& id, const Identif } else { ATH_MSG_DEBUG("Pixel Cluster Container found" ); } - const PixelClusterContainer* pixClusCont = h_pixClusCont.cptr(); - - PixelClusterContainer::const_iterator it = pixClusCont->indexFind(idHash); + const PixelClusterCollection *ptr = h_pixClusCont->indexFindPtr(idHash); // if we find PRD, then recreate link - if (it!=pixClusCont->end()) { + if (ptr!=nullptr) { //loop though collection to find matching PRD. - PixelClusterCollection::const_iterator collIt = (*it)->begin(); - PixelClusterCollection::const_iterator collItEnd = (*it)->end(); + PixelClusterCollection::const_iterator collIt = ptr->begin(); + PixelClusterCollection::const_iterator collItEnd = ptr->end(); // there MUST be a faster way to do this!! for ( ; collIt!=collItEnd; collIt++){ if ( (*collIt)->identify()==id ) return *collIt; @@ -292,14 +290,12 @@ InDet::InDetEventCnvTool::sctClusterLink( const Identifier& id, const Identifie } else { ATH_MSG_DEBUG("SCT Cluster Container found" ); } - const SCT_ClusterContainer* sctClusCont = h_sctClusCont.cptr(); - - SCT_ClusterContainer::const_iterator it = sctClusCont->indexFind(idHash); + const SCT_ClusterCollection *ptr = h_sctClusCont->indexFindPtr(idHash); // if we find PRD, then recreate link - if (it!=sctClusCont->end()) { + if (ptr!=nullptr) { //loop though collection to find matching PRD. - SCT_ClusterCollection::const_iterator collIt = (*it)->begin(); - SCT_ClusterCollection::const_iterator collItEnd = (*it)->end(); + SCT_ClusterCollection::const_iterator collIt = ptr->begin(); + SCT_ClusterCollection::const_iterator collItEnd = ptr->end(); // there MUST be a faster way to do this!! for ( ; collIt!=collItEnd; collIt++) { if ( (*collIt)->identify()==id ) return *collIt; @@ -323,14 +319,12 @@ InDet::InDetEventCnvTool::trtDriftCircleLink( const Identifier& id, const Ident } else { ATH_MSG_DEBUG("TRT Drift Circles Container found" ); } - const TRT_DriftCircleContainer* trtDriftCircleCont = h_trtDriftCircleCont.cptr(); - - TRT_DriftCircleContainer::const_iterator it = trtDriftCircleCont->indexFind(idHash); + const TRT_DriftCircleCollection *ptr = h_trtDriftCircleCont->indexFindPtr(idHash); // if we find PRD, then recreate link - if (it!=trtDriftCircleCont->end()) { + if (ptr!=nullptr) { //loop though collection to find matching PRD. - TRT_DriftCircleCollection::const_iterator collIt = (*it)->begin(); - TRT_DriftCircleCollection::const_iterator collItEnd = (*it)->end(); + TRT_DriftCircleCollection::const_iterator collIt = ptr->begin(); + TRT_DriftCircleCollection::const_iterator collItEnd = ptr->end(); // there MUST be a faster way to do this!! for ( ; collIt!=collItEnd; collIt++) { if ( (*collIt)->identify()==id ) return *collIt; diff --git a/InnerDetector/InDetEventCnv/InDetEventTPCnv/src/InDetPrepRawData/PixelGangedClusterAmbiguitiesCnv_p1.cxx b/InnerDetector/InDetEventCnv/InDetEventTPCnv/src/InDetPrepRawData/PixelGangedClusterAmbiguitiesCnv_p1.cxx index 4db3f66efd2..0847d2fba0c 100644 --- a/InnerDetector/InDetEventCnv/InDetEventTPCnv/src/InDetPrepRawData/PixelGangedClusterAmbiguitiesCnv_p1.cxx +++ b/InnerDetector/InDetEventCnv/InDetEventTPCnv/src/InDetPrepRawData/PixelGangedClusterAmbiguitiesCnv_p1.cxx @@ -57,11 +57,11 @@ void PixelGangedClusterAmbiguitiesCnv_p1::transToPers ATLAS_NOT_THREAD_SAFE // loop over dhs for ( ; dh!=dhEnd; dh++ ) { - InDet::PixelClusterContainer::const_iterator coll = dh->indexFind(idHash); //matching collection + auto coll = dh->indexFindPtr(idHash); //matching collection // does coll exist? // check prd exists in collection // check idhaspointer value the same. - if ( (coll!=dh->end())&& ((*coll)->size()>index) && (pixelCluster==(**coll)[index]) ){ + if ( (coll!=nullptr)&& (coll->size()>index) && (pixelCluster==(*coll)[index]) ){ // okay, so we found the correct PRD in the container. // Now set the name to the container correctly persObj->m_pixelClusterContainerName = dh.key(); diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonAlg.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonAlg.cxx index ff9b59949bc..3c70c2afc55 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonAlg.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonAlg.cxx @@ -175,10 +175,9 @@ double SCTHitEffMonAlg::getResidual(const Identifier& surfaceID, return trackHitResidual; } IdentifierHash idh{m_sctId->wafer_hash(surfaceID)}; - InDet::SCT_ClusterContainer::const_iterator containerIterator{p_sctclcontainer->indexFind(idh)}; - InDet::SCT_ClusterContainer::const_iterator containerEnd{p_sctclcontainer->end()}; - if (containerIterator != containerEnd) { - for (const InDet::SCT_Cluster* cluster: **containerIterator) { + auto containerIterator{p_sctclcontainer->indexFindPtr(idh)}; + if (containerIterator != nullptr) { + for (const InDet::SCT_Cluster* cluster: *containerIterator) { if ((cluster==nullptr) or (cluster->detectorElement()==nullptr)) { ATH_MSG_WARNING("nullptr to RIO or detElement"); continue; diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonTool.cxx index d8919d158b7..fc7e6763225 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonTool.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitEffMonTool.cxx @@ -978,10 +978,9 @@ SCTHitEffMonTool::getResidual(const Identifier& surfaceID, const Trk::TrackParam return trackHitResidual; } IdentifierHash idh{m_sctId->wafer_hash(surfaceID)}; - InDet::SCT_ClusterContainer::const_iterator containerIterator{p_sctclcontainer->indexFind(idh)}; - InDet::SCT_ClusterContainer::const_iterator containerEnd{p_sctclcontainer->end()}; - if (containerIterator != containerEnd) { - for (const InDet::SCT_Cluster* cluster: **containerIterator) { + const InDet::SCT_ClusterCollection *containerIterator{p_sctclcontainer->indexFindPtr(idh)}; + if (containerIterator != nullptr) { + for (const InDet::SCT_Cluster* cluster: *containerIterator) { if ((cluster==nullptr) or (cluster->detectorElement()==nullptr)) { ATH_MSG_WARNING("nullptr to RIO or detElement"); continue; diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonAlg.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonAlg.cxx index 36ddd73858c..2882091e789 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonAlg.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonAlg.cxx @@ -208,9 +208,9 @@ StatusCode SCTHitsNoiseMonAlg::generalHistsandNoise(const std::array<std::unorde // Define a set of spIDs std::unordered_set<Identifier> mySetOfSPIds; for (int side{0}; side<N_SIDES; side++) { - SpacePointContainer::const_iterator spContainerIterator{spacePointContainer->indexFind(side==0 ? theModuleHash0 : theModuleHash1)}; - if (spContainerIterator==spacePointContainer->end()) continue; - for (const Trk::SpacePoint* sp: **spContainerIterator) { + auto spContainerIterator{spacePointContainer->indexFindPtr(side==0 ? theModuleHash0 : theModuleHash1)}; + if (spContainerIterator==nullptr) continue; + for (const Trk::SpacePoint* sp: *spContainerIterator) { const std::vector<Identifier>& rdoList{(thisSide==side ? sp->clusterList().first : sp->clusterList().second)->rdoList()}; mySetOfSPIds.insert(rdoList.begin(), rdoList.end()); } diff --git a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx index ad5a0914e96..d6c3a56db3c 100644 --- a/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx +++ b/InnerDetector/InDetMonitoring/SCT_Monitoring/src/SCTHitsNoiseMonTool.cxx @@ -396,9 +396,9 @@ SCTHitsNoiseMonTool::generalHistsandNoise(const EventContext& ctx) { // Define a set of spIDs std::unordered_set<Identifier> mySetOfSPIds; for (int side{0}; side<N_SIDES; side++) { - SpacePointContainer::const_iterator spContainerIterator{spacePointContainer->indexFind(side==0 ? theModuleHash0 : theModuleHash1)}; - if (spContainerIterator==spacePointContainer->end()) continue; - for (const Trk::SpacePoint* sp: **spContainerIterator) { + auto spContainer{spacePointContainer->indexFindPtr(side==0 ? theModuleHash0 : theModuleHash1)}; + if (spContainer==nullptr) continue; + for (const Trk::SpacePoint* sp: *spContainer) { const std::vector<Identifier>& rdoList{(side==thisSide ? sp->clusterList().first->rdoList() : sp->clusterList().second->rdoList())}; mySetOfSPIds.insert(rdoList.begin(), rdoList.end()); } diff --git a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiTrajectory_xk.cxx b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiTrajectory_xk.cxx index 44d7008419e..5169446082b 100644 --- a/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiTrajectory_xk.cxx +++ b/InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData/src/SiTrajectory_xk.cxx @@ -522,11 +522,11 @@ bool InDet::SiTrajectory_xk::initialize if (de->isPixel()) { if (PIX) { InDet::PixelClusterCollection::const_iterator sib, sie; - InDet::PixelClusterContainer::const_iterator w = (*PIXc).indexFind(id); + const InDet::PixelClusterCollection *w = (*PIXc).indexFindPtr(id); - if (w!=(*PIXc).end() && (*w)->begin()!=(*w)->end()) { + if (w!=nullptr && w->begin()!=w->end()) { - sib = (*w)->begin(); sie = (*w)->end(); + sib = w->begin(); sie = w->end(); for (c=lSiCluster.begin(); c!=lSiCluster.end(); ++c) { if ((*c)->detectorElement()==de) { @@ -551,11 +551,11 @@ bool InDet::SiTrajectory_xk::initialize } } else if (SCT) { InDet::SCT_ClusterCollection::const_iterator sib, sie; - InDet::SCT_ClusterContainer::const_iterator w = (*SCTc).indexFind(id); + const InDet::SCT_ClusterCollection *w = (*SCTc).indexFindPtr(id); - if (w!=(*SCTc).end() && (*w)->begin()!=(*w)->end()) { + if (w!=nullptr && w->begin()!=w->end()) { - sib = (*w)->begin(); sie = (*w)->end(); + sib = w->begin(); sie = w->end(); for (c=lSiCluster.begin(); c!=lSiCluster.end(); ++c) { if ((*c)->detectorElement()==de) { @@ -695,22 +695,22 @@ bool InDet::SiTrajectory_xk::trackParametersToClusters if (!sct) { InDet::PixelClusterCollection::const_iterator sib, sie; - InDet::PixelClusterContainer::const_iterator w = (*PIXc).indexFind(id); + const InDet::PixelClusterCollection *w = (*PIXc).indexFindPtr(id); - if (w!=(*PIXc).end() && (*w)->begin()!=(*w)->end()) { - sib = (*w)->begin(); - sie = (*w)->end (); + if (w!=nullptr && w->begin()!=w->end()) { + sib = w->begin(); + sie = w->end (); } else { continue; } if (!m_elements[0].ForwardPropagationForClusterSeach(m_nElements,Tp,(*r),sib,sie)) return false; } else { InDet::SCT_ClusterCollection::const_iterator sib, sie; - InDet::SCT_ClusterContainer::const_iterator w = (*SCTc).indexFind(id); + const InDet::SCT_ClusterCollection *w = (*SCTc).indexFindPtr(id); - if (w!=(*SCTc).end() && (*w)->begin()!=(*w)->end()) { - sib = (*w)->begin(); - sie = (*w)->end (); + if (w!=nullptr && w->begin()!=w->end()) { + sib = w->begin(); + sie = w->end (); } else { continue; } @@ -798,19 +798,19 @@ bool InDet::SiTrajectory_xk::globalPositionsToClusters bool sct = d->isSCT(); if (!sct) { - InDet::PixelClusterContainer::const_iterator w = (*PIXc).indexFind(id); - if (w!=(*PIXc).end() && (*w)->begin()!=(*w)->end()) { - pib = (*w)->begin(); - pie = (*w)->end (); + const InDet::PixelClusterCollection *w = (*PIXc).indexFindPtr(id); + if (w!=nullptr && w->begin()!=w->end()) { + pib = w->begin(); + pie = w->end (); } else { continue; } } else { zcut = 1.; - InDet::SCT_ClusterContainer::const_iterator w = (*SCTc).indexFind(id); - if (w!=(*SCTc).end() && (*w)->begin()!=(*w)->end()) { - sib = (*w)->begin(); - sie = (*w)->end (); + const InDet::SCT_ClusterCollection *w = (*SCTc).indexFindPtr(id); + if (w!=nullptr && w->begin()!=w->end()) { + sib = w->begin(); + sie = w->end (); } else { continue; } diff --git a/InnerDetector/InDetRecTools/InDetAssociationTools/InDetAssociationTools/InDetPRD_Provider.h b/InnerDetector/InDetRecTools/InDetAssociationTools/InDetAssociationTools/InDetPRD_Provider.h index 736cb72bc16..350a4e3eb7f 100644 --- a/InnerDetector/InDetRecTools/InDetAssociationTools/InDetAssociationTools/InDetPRD_Provider.h +++ b/InnerDetector/InDetRecTools/InDetAssociationTools/InDetAssociationTools/InDetPRD_Provider.h @@ -65,12 +65,11 @@ namespace InDet { const Identifier& ideh, const IdentifierHash& ideHash ) const { // find the collection - typename Trk::PrepRawDataContainer< Trk::PrepRawDataCollection< PrdT > >::const_iterator prdCollIter = cont.indexFind(ideHash); - if ( prdCollIter == cont.end() ){ + const Trk::PrepRawDataCollection< PrdT >* prdCollection = cont.indexFindPtr(ideHash); + if ( prdCollection == nullptr ){ ATH_MSG_VERBOSE("PRD Collection to IdentifierHash could not be found. Return 0."); return 0; } - const Trk::PrepRawDataCollection< PrdT >* prdCollection = (*prdCollIter); // search for the PRD in the collection --- do a loop, can be done better with std::find probably const PrdT* prd = 0; // iterate through the collections diff --git a/InnerDetector/InDetRecTools/TRT_SeededSpacePointFinderTool/src/TRT_SeededSpacePointFinder_ATL.cxx b/InnerDetector/InDetRecTools/TRT_SeededSpacePointFinderTool/src/TRT_SeededSpacePointFinder_ATL.cxx index 25b527c91cc..e03f8b73126 100755 --- a/InnerDetector/InDetRecTools/TRT_SeededSpacePointFinderTool/src/TRT_SeededSpacePointFinder_ATL.cxx +++ b/InnerDetector/InDetRecTools/TRT_SeededSpacePointFinderTool/src/TRT_SeededSpacePointFinder_ATL.cxx @@ -258,20 +258,16 @@ std::unique_ptr<InDet::ITRT_SeededSpacePointFinder::IEventData> InDet::TRT_Seede // SG::ReadHandle<SpacePointContainer> spacepointsPix(m_spacepointsPixname); if (spacepointsPix.isValid()) { - SpacePointContainer::const_iterator spce = spacepointsPix->end (); - std::vector<IdentifierHash>::const_iterator l = vPixel.begin(), le = vPixel.end(); // Loop through all trigger collections // for(; l!=le; ++l) { - SpacePointContainer::const_iterator w = spacepointsPix->indexFind((*l)); - if(w==spce) continue; - - - SpacePointCollection::const_iterator sp = (*w)->begin(); - SpacePointCollection::const_iterator spe = (*w)->end (); + const SpacePointCollection *w = spacepointsPix->indexFindPtr(*l); + if(w==nullptr) continue; + SpacePointCollection::const_iterator sp = w->begin(); + SpacePointCollection::const_iterator spe = w->end (); for(; sp != spe; ++sp) { double r = (*sp)->r(); if(r<0. || r>=m_r_rmax) continue; @@ -309,11 +305,10 @@ std::unique_ptr<InDet::ITRT_SeededSpacePointFinder::IEventData> InDet::TRT_Seede double r_rmin = (!m_loadFull) ? m_r2min : m_r_rmin; for(; l!=le; ++l) { - SpacePointContainer::const_iterator w = spacepointsSCT->indexFind((*l)); - if(w==spce) continue; - - SpacePointCollection::const_iterator sp = (*w)->begin(); - SpacePointCollection::const_iterator spe = (*w)->end (); + const SpacePointCollection *w = spacepointsSCT->indexFindPtr(*l); + if(w==nullptr) continue; + SpacePointCollection::const_iterator sp = w->begin(); + SpacePointCollection::const_iterator spe = w->end (); for(; sp != spe; ++sp) { if(prd_to_track_map.cptr()){ diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_DAF/src/TRT_TrackExtensionTool_DAF.cxx b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_DAF/src/TRT_TrackExtensionTool_DAF.cxx index f4333c6a26e..e20184407d0 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_DAF/src/TRT_TrackExtensionTool_DAF.cxx +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_DAF/src/TRT_TrackExtensionTool_DAF.cxx @@ -393,9 +393,6 @@ StatusCode InDet::TRT_TrackExtensionTool_DAF::elementWiseExtension(int beginInde const double squaredMaxBarrelRIOdistance = m_jo_roadwidth * m_jo_roadwidth; const double squaredMaxEndcapRIOdistance = m_jo_roadwidth * m_jo_roadwidth; - // ----------------------- - // get all the RIOs on the detElements - InDet::TRT_DriftCircleContainer::const_iterator containerIterator; double lastEndCapZ = -10000.; // create a new list of RIOs @@ -445,17 +442,17 @@ StatusCode InDet::TRT_TrackExtensionTool_DAF::elementWiseExtension(int beginInde // get the id of the detElement IdentifierHash detElementID = event_data.m_detectorElements[index]->identifyHash(); // get the driftCircleCollection belonging to this id - containerIterator = event_data.m_trtcontainer->indexFind(detElementID); + auto container = event_data.m_trtcontainer->indexFindPtr(detElementID); - if(containerIterator==event_data.m_trtcontainer->end()) { + if(container==nullptr) { ATH_MSG_DEBUG("for the current detectorElement no DriftCircleContainer seems to exist"); continue; } - ATH_MSG_DEBUG( "There are " << (*containerIterator)->size() << " entries in the TRT_DriftCircleCollection" ); + ATH_MSG_DEBUG( "There are " << container->size() << " entries in the TRT_DriftCircleCollection" ); // loop over RIOs in the collection - InDet::TRT_DriftCircleCollection::const_iterator driftCircleIterator = (*containerIterator)->begin(); - for (; driftCircleIterator != (*containerIterator)->end(); driftCircleIterator++) { + InDet::TRT_DriftCircleCollection::const_iterator driftCircleIterator = container->begin(); + for (; driftCircleIterator != container->end(); driftCircleIterator++) { // get the straw center of the RIO Amg::Vector3D strawGlobPos( event_data.m_detectorElements[index]->center( (*driftCircleIterator)->identify() ) ); ATH_MSG_DEBUG("straw center at: ("<< strawGlobPos.x() <<", "<< strawGlobPos.y() << ")" ); @@ -580,25 +577,22 @@ InDet::TRT_TrackExtensionTool_DAF::groupedBarrelExtension(int beginIndex, ATH_MSG_DEBUG("looping over detElements to get the DriftCircles" ); int createdGroupCounter=0; - // ----------------------- - // get all the RIOs on the detElements - InDet::TRT_DriftCircleContainer::const_iterator containerIterator; // loop over detElements for(int index = beginIndex+1; index <= endIndex; ++index) { ATH_MSG_VERBOSE("trying to get detElement for index "<< index ); // get the id of the detElement IdentifierHash detElementID = event_data.m_detectorElements[index]->identifyHash(); // get the driftCircleCollection belonging to this id - containerIterator = event_data.m_trtcontainer->indexFind(detElementID); + auto container = event_data.m_trtcontainer->indexFindPtr(detElementID); // loop over RIOs in the collection - if(containerIterator==event_data.m_trtcontainer->end()) { + if(container==nullptr) { ATH_MSG_DEBUG("for the current detectorElement no DriftCircleContainer seems to exist"); continue; } - ATH_MSG_DEBUG( "There are " << (*containerIterator)->size() << " entries in the TRT_DriftCircleCollection" ); + ATH_MSG_DEBUG( "There are " << container->size() << " entries in the TRT_DriftCircleCollection" ); - InDet::TRT_DriftCircleCollection::const_iterator driftCircleIterator = (*containerIterator)->begin(); - for (; driftCircleIterator != (*containerIterator)->end(); driftCircleIterator++) { + InDet::TRT_DriftCircleCollection::const_iterator driftCircleIterator = container->begin(); + for (; driftCircleIterator != container->end(); driftCircleIterator++) { // get the straw center of the RIO Amg::Vector3D strawGlobPos( event_data.m_detectorElements[index]->center( (*driftCircleIterator)->identify() ) ); strawGlobPos[Amg::z]=0.; diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx index d747cd18aca..be35916d7c5 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx @@ -319,18 +319,18 @@ void InDet::TRT_TrackExtensionToolCosmics::analyze_tpars(const std::vector<const //check if this PRD exists // get the driftCircleCollection belonging to this id - InDet::TRT_DriftCircleContainer::const_iterator containerIterator = event_data.m_trtcontainer->indexFind(detElements[i+1]); + const InDet::TRT_DriftCircleCollection *container = event_data.m_trtcontainer->indexFindPtr(detElements[i+1]); - if(containerIterator==event_data.m_trtcontainer->end()) { + if(container==nullptr) { msg(MSG::DEBUG)<<"for the current detectorElement no DriftCircleContainer seems to exist: "<<m_trtid->show_to_string(m_trtid->layer_id(detElements[i+1]))<<endmsg; continue; } - msg(MSG::DEBUG)<< "There are " << (*containerIterator)->size() << " entries in the TRT_DriftCircleCollection "<<m_trtid->show_to_string(m_trtid->layer_id(detElements[i+1])) <<endmsg; + msg(MSG::DEBUG)<< "There are " << container->size() << " entries in the TRT_DriftCircleCollection "<<m_trtid->show_to_string(m_trtid->layer_id(detElements[i+1])) <<endmsg; //take the closest one in case it satisfies some default cuts - InDet::TRT_DriftCircleCollection::const_iterator driftCircleIterator = (*containerIterator)->begin(); - for (; driftCircleIterator != (*containerIterator)->end(); driftCircleIterator++) { + InDet::TRT_DriftCircleCollection::const_iterator driftCircleIterator = container->begin(); + for (; driftCircleIterator != container->end(); driftCircleIterator++) { //get the associated surface of the driftcircle const Trk::Surface &dc_surface=(*driftCircleIterator)->detectorElement()->surface((*driftCircleIterator)->identify()); diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_Trajectory_xk.cxx b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_Trajectory_xk.cxx index 97829312920..f1239997a4a 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_Trajectory_xk.cxx +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_Trajectory_xk.cxx @@ -65,7 +65,6 @@ void InDet::TRT_Trajectory_xk::initiateForPrecisionSeed m_xi2 = 0.; m_parameters = Tp; - InDet::TRT_DriftCircleContainer::const_iterator w; InDet::TRT_DriftCircleCollection::const_iterator ti,te; std::vector<const InDetDD::TRT_BaseElement*>::iterator d=De.begin(),de=De.end(); @@ -90,10 +89,10 @@ void InDet::TRT_Trajectory_xk::initiateForPrecisionSeed for(i=Gp.begin(); i!=ie; ++i) { - IdentifierHash id = (*d)->identifyHash(); w=(*TRTc).indexFind(id); + IdentifierHash id = (*d)->identifyHash(); auto w=(*TRTc).indexFindPtr(id); bool q; - if(w!=(*TRTc).end() && (*w)->begin()!=(*w)->end()) { - ti = (*w)->begin(); te = (*w)->end (); + if(w!=nullptr && w->begin()!=w->end()) { + ti = w->begin(); te = w->end (); q = m_elements[m_nElements].initiateForPrecisionSeed(true,(*d),ti,te,(*i),A,m_roadwidth2); if(q && m_elements[m_nElements].isCluster()) ++m_naElements; @@ -148,7 +147,6 @@ void InDet::TRT_Trajectory_xk::initiateForTRTSeed m_xi2 = 0.; m_parameters = Tp; - InDet::TRT_DriftCircleContainer::const_iterator w; InDet::TRT_DriftCircleCollection::const_iterator ti,te; std::vector<const InDetDD::TRT_BaseElement*>::iterator d=De.begin(),de=De.end(); @@ -173,11 +171,11 @@ void InDet::TRT_Trajectory_xk::initiateForTRTSeed for(i=Gp.begin(); i!=ie; ++i) { - IdentifierHash id = (*d)->identifyHash(); w=(*TRTc).indexFind(id); + IdentifierHash id = (*d)->identifyHash(); auto w=(*TRTc).indexFindPtr(id); bool q; - if(w!=(*TRTc).end() && (*w)->begin()!=(*w)->end()) { + if(w!=nullptr && w->begin()!=w->end()) { - ti = (*w)->begin(); te = (*w)->end (); + ti = w->begin(); te = w->end (); q = m_elements[m_lastRoad].initiateForTRTSeed(1,(*d),ti,te,(*i),A,m_roadwidth2); if(m_elements [m_lastRoad].isCluster()) ++m_naElements; diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/Pixel_TrgClusterization.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/Pixel_TrgClusterization.cxx index 97014327e8b..329eba3de6a 100755 --- a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/Pixel_TrgClusterization.cxx +++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/Pixel_TrgClusterization.cxx @@ -446,12 +446,7 @@ namespace InDet{ return HLT::ErrorCode(HLT::Action::ABORT_CHAIN, HLT::Reason::TIMEOUT); } - PixelRDO_Container::const_iterator - RDO_collection_iter = p_pixelRDOContainer->indexFind(m_listOfPixIds[i]); - - if (RDO_collection_iter == p_pixelRDOContainer->end()) continue; - - const InDetRawDataCollection<PixelRDORawData>* RDO_Collection (*RDO_collection_iter); + const InDetRawDataCollection<PixelRDORawData>* RDO_Collection (p_pixelRDOContainer->indexFindPtr(m_listOfPixIds[i])); if (!RDO_Collection) continue; diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/SCT_TrgClusterization.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/SCT_TrgClusterization.cxx index afd0994945e..2a7d5c87263 100755 --- a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/SCT_TrgClusterization.cxx +++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/SCT_TrgClusterization.cxx @@ -402,18 +402,13 @@ namespace InDet{ for (unsigned int i=0; i<m_listOfSctIds.size(); i++) { - SCT_RDO_Container::const_iterator - RDO_collection_iter = p_sctRDOContainer->indexFind(m_listOfSctIds[i]); - - if (RDO_collection_iter == p_sctRDOContainer->end()) continue; - if (m_doTimeOutChecks && Athena::Timeout::instance().reached() ) { ATH_MSG_WARNING( "Timeout reached. Aborting sequence." ); return HLT::ErrorCode(HLT::Action::ABORT_CHAIN, HLT::Reason::TIMEOUT); } - const InDetRawDataCollection<SCT_RDORawData>* RDO_Collection (*RDO_collection_iter); + const InDetRawDataCollection<SCT_RDORawData>* RDO_Collection (p_sctRDOContainer->indexFindPtr(m_listOfSctIds[i])); if (!RDO_Collection) continue; diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/TRT_TrgRIO_Maker.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/TRT_TrgRIO_Maker.cxx index 1ff1ff46511..6b41fc716d9 100755 --- a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/TRT_TrgRIO_Maker.cxx +++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/TRT_TrgRIO_Maker.cxx @@ -370,12 +370,7 @@ namespace InDet{ return HLT::ErrorCode(HLT::Action::ABORT_CHAIN, HLT::Reason::TIMEOUT); } - TRT_RDO_Container::const_iterator - RDO_collection_iter = p_trtRDOContainer->indexFind(m_listOfTrtIds[i]); - - if (RDO_collection_iter == p_trtRDOContainer->end()) continue; - - const InDetRawDataCollection<TRT_RDORawData>* RDO_Collection(*RDO_collection_iter); + const InDetRawDataCollection<TRT_RDORawData>* RDO_Collection( p_trtRDOContainer->indexFindPtr(m_listOfTrtIds[i])); if (!RDO_Collection) continue; diff --git a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.cxx b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.cxx index f2687450494..708a1c26d58 100755 --- a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.cxx +++ b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.cxx @@ -233,13 +233,9 @@ checkForSCT_Points(const SCT_ClusterCollection* clusters1, // Get the cluster collections for these two detectors. // Require that (xPhi2 - xPhi1) lie in the range specified. // Used for opposite and eta modules - - SCT_ClusterContainer::const_iterator - it(m_Sct_clcontainer->indexFind(id2)); - if (it==m_Sct_clcontainer->end()) return; - const SCT_ClusterCollection * clusters2 = *it; - + const SCT_ClusterCollection * clusters2 = m_Sct_clcontainer->indexFindPtr(id2); + if (clusters2==nullptr) return; Amg::Vector3D beampos; if (!m_overrideBS){ SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle(m_beamSpotKey); @@ -286,11 +282,8 @@ void SCT_TrigSpacePointTool:: beampos = ovtx; } - SCT_ClusterContainer::const_iterator - it(m_Sct_clcontainer->indexFind(id2)); - if (it==m_Sct_clcontainer->end()) return; - - const SCT_ClusterCollection * clusters2 (&(**it)); + const SCT_ClusterCollection * clusters2 = m_Sct_clcontainer->indexFindPtr(id2); + if (clusters2==nullptr) return; m_SiSpacePointMakerTool-> fillSCT_SpacePointPhiOverlapCollection(clusters1, clusters2, min1, max1, diff --git a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SiTrigSpacePointFinder.cxx b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SiTrigSpacePointFinder.cxx index 55d26a22b99..b3c30d1609c 100755 --- a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SiTrigSpacePointFinder.cxx +++ b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SiTrigSpacePointFinder.cxx @@ -455,19 +455,14 @@ namespace InDet{ if(doTiming()) m_timerFindSi->resume(); // Iterate through the hash id list. Retrieve the cluster collections // and form space points - for( std::vector<IdentifierHash>::iterator itIDs = m_listOfSctIds.begin(); + for( std::vector<IdentifierHash>::const_iterator itIDs = m_listOfSctIds.begin(); itIDs != m_listOfSctIds.end(); itIDs++){ // Retrieve the clusterCollection: - SCT_ClusterContainer::const_iterator - itSCT_Clusters(m_sctClusterContainer->indexFind((*itIDs))); - - if( itSCT_Clusters == m_sctClusterContainer->end()) continue; - - const SCT_ClusterCollection * SCTClusterCollection = &(**itSCT_Clusters); + const SCT_ClusterCollection * SCTClusterCollection = m_sctClusterContainer->indexFindPtr(*itIDs); - if( SCTClusterCollection->begin() == SCTClusterCollection->end()) + if(SCTClusterCollection==nullptr || SCTClusterCollection->begin() == SCTClusterCollection->end()) continue; m_nReceivedClustersSCT += SCTClusterCollection->size(); @@ -638,19 +633,12 @@ namespace InDet{ if(doTiming()) m_timerFindPx->resume(); - for(std::vector<IdentifierHash>::iterator itIDs = m_listOfPixIds.begin(); + for(std::vector<IdentifierHash>::const_iterator itIDs = m_listOfPixIds.begin(); itIDs != m_listOfPixIds.end(); itIDs++){ - // Retrieve the clusterCollection: - PixelClusterContainer::const_iterator - itPixClusters(m_pixelClusterContainer->indexFind(*itIDs)); - - if( itPixClusters == m_pixelClusterContainer->end()) continue; - - const PixelClusterCollection * pixelClusterCollection = - &(**itPixClusters); + const PixelClusterCollection * pixelClusterCollection = m_pixelClusterContainer->indexFindPtr(*itIDs); - if( pixelClusterCollection->begin() == pixelClusterCollection->end()) + if(pixelClusterCollection==nullptr || pixelClusterCollection->begin() == pixelClusterCollection->end()) continue; m_nReceivedClustersPix += pixelClusterCollection->size(); diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx index 9f17409e5b8..58ff0c5fdd5 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx @@ -1707,24 +1707,24 @@ namespace Muon { for( ;iit!=iit_end;++iit ){ // !?! else if made by Felix if( mdtCont && mdtCont->size()>0 && tech == MuonStationIndex::MDT ) { - MdtPrepDataContainer::const_iterator pos = mdtCont->indexFind(*iit); - if( pos != mdtCont->end() ) fill(truthHits,**pos,houghData.hitVec[layerHash]); + auto pos = mdtCont->indexFindPtr(*iit); + if( pos != nullptr ) fill(truthHits,*pos,houghData.hitVec[layerHash]); } else if( rpcCont && rpcCont->size()>0 && tech == MuonStationIndex::RPC ) { - RpcPrepDataContainer::const_iterator pos = rpcCont->indexFind(*iit); - if( pos != rpcCont->end() ) fill(truthHits,**pos,houghData.hitVec[layerHash],houghData.phiHitVec[regionLayer.first]); + auto pos = rpcCont->indexFindPtr(*iit); + if( pos != nullptr ) fill(truthHits,*pos,houghData.hitVec[layerHash],houghData.phiHitVec[regionLayer.first]); } else if( tgcCont && tgcCont->size()>0 && tech == MuonStationIndex::TGC ) { - TgcPrepDataContainer::const_iterator pos = tgcCont->indexFind(*iit); - if( pos != tgcCont->end() ) fill(truthHits, tgcClusteringObjs, **pos,houghData.hitVec[layerHash],houghData.phiHitVec[regionLayer.first],collectionsPerSector.sector); + auto pos = tgcCont->indexFindPtr(*iit); + if( pos != nullptr ) fill(truthHits, tgcClusteringObjs, *pos,houghData.hitVec[layerHash],houghData.phiHitVec[regionLayer.first],collectionsPerSector.sector); } else if( stgcCont && stgcCont->size()>0 && tech == MuonStationIndex::STGC ) { - sTgcPrepDataContainer::const_iterator pos = stgcCont->indexFind(*iit); - if( pos != stgcCont->end() ) fill(truthHits,**pos,houghData.hitVec[layerHash],houghData.phiHitVec[regionLayer.first],collectionsPerSector.sector); + auto pos = stgcCont->indexFindPtr(*iit); + if( pos != nullptr ) fill(truthHits,*pos,houghData.hitVec[layerHash],houghData.phiHitVec[regionLayer.first],collectionsPerSector.sector); } else if( mmCont && mmCont->size()>0 && tech == MuonStationIndex::MM ) { - MMPrepDataContainer::const_iterator pos = mmCont->indexFind(*iit); - if( pos != mmCont->end() ) fill(truthHits,**pos,houghData.hitVec[layerHash]); + auto pos = mmCont->indexFindPtr(*iit); + if( pos != nullptr ) fill(truthHits,*pos,houghData.hitVec[layerHash]); } } } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternCalibration.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternCalibration.cxx index da0ea5a6456..8b45ee0b201 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternCalibration.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternCalibration.cxx @@ -200,11 +200,11 @@ namespace Muon { if( (hits.neta > 0 && hits.nphi == 0) || (hits.nphi > 0 && hits.neta == 0) ){ if( m_idHelperSvc->isRpc(id) && m_rpcPrdContainer ){ - RpcPrepDataContainer::const_iterator pos = m_rpcPrdContainer->indexFind(chit->first); - if( pos == m_rpcPrdContainer->end() ) ATH_MSG_DEBUG("RpcPrepDataCollection not found in container!!"); + auto pos = m_rpcPrdContainer->indexFindPtr(chit->first); + if( pos == nullptr ) ATH_MSG_DEBUG("RpcPrepDataCollection not found in container!!"); else{ - RpcPrepDataCollection::const_iterator rpcit = (*pos)->begin(); - RpcPrepDataCollection::const_iterator rpcit_end = (*pos)->end(); + RpcPrepDataCollection::const_iterator rpcit = pos->begin(); + RpcPrepDataCollection::const_iterator rpcit_end = pos->end(); for( ;rpcit!=rpcit_end;++rpcit ){ if( clusterIds.count( (*rpcit)->identify() ) ) continue; const MuonCluster* clus = dynamic_cast<const MuonCluster*>(*rpcit); @@ -213,11 +213,11 @@ namespace Muon { } } }else if( m_idHelperSvc->isTgc(id) && m_tgcPrdContainer ){ - TgcPrepDataContainer::const_iterator pos = m_tgcPrdContainer->indexFind(chit->first); - if( pos == m_tgcPrdContainer->end() ) ATH_MSG_DEBUG("TgcPrepDataCollection not found in container!!"); + auto pos = m_tgcPrdContainer->indexFindPtr(chit->first); + if( pos == nullptr ) ATH_MSG_DEBUG("TgcPrepDataCollection not found in container!!"); else{ - TgcPrepDataCollection::const_iterator tgcit = (*pos)->begin(); - TgcPrepDataCollection::const_iterator tgcit_end = (*pos)->end(); + TgcPrepDataCollection::const_iterator tgcit = pos->begin(); + TgcPrepDataCollection::const_iterator tgcit_end = pos->end(); for( ;tgcit!=tgcit_end;++tgcit ){ if( clusterIds.count( (*tgcit)->identify() ) ) continue; const MuonCluster* clus = dynamic_cast<const MuonCluster*>(*tgcit); -- GitLab