From 1d50acd36aeddae76f71e9f3cd5e15a5310636d2 Mon Sep 17 00:00:00 2001
From: Adam Edward Barton <adam.edward.barton@cern.ch>
Date: Wed, 17 Jun 2020 16:23:16 +0100
Subject: [PATCH] Adjust IDC iterators in SiSpacePointsSeedTool_xk
 TRT_TrackSegmentsTool_xk

---
 .../src/SiSpacePointsSeedMaker_ATLxk.cxx          | 14 ++++++--------
 .../src/SiSpacePointsSeedMaker_BeamGas.cxx        | 15 ++++++---------
 .../src/SiSpacePointsSeedMaker_Cosmic.cxx         | 15 ++++++---------
 .../src/SiSpacePointsSeedMaker_HeavyIon.cxx       | 14 ++++++--------
 .../src/SiSpacePointsSeedMaker_ITK.cxx            | 14 ++++++--------
 .../src/SiSpacePointsSeedMaker_LowMomentum.cxx    | 12 ++++++------
 .../src/SiSpacePointsSeedMaker_Trigger.cxx        | 14 ++++++--------
 .../src/TRT_TrackSegmentsMaker_ATLxk.cxx          |  8 ++++----
 8 files changed, 46 insertions(+), 60 deletions(-)

diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx
index 70aea30a74f1..ddec45bac496 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx
@@ -338,14 +338,13 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::newRegion
 
     SG::ReadHandle<SpacePointContainer> spacepointsPixel{m_spacepointsPixel, ctx};
     if ( spacepointsPixel.isValid() ) {
-      SpacePointContainer::const_iterator spce = spacepointsPixel->end();
 
       // Loop through all trigger collections
       //
       for (const IdentifierHash& l: vPixel) {
-        SpacePointContainer::const_iterator w = spacepointsPixel->indexFind(l);
-        if (w==spce) continue;
-        for (const Trk::SpacePoint* sp: **w) {
+        auto w = spacepointsPixel->indexFindPtr(l);
+        if (w==nullptr) continue;
+        for (const Trk::SpacePoint* sp: *w) {
           float r = sp->r();
           if (r > m_r_rmax) continue;
           InDet::SiSpacePointForSeed* sps = newSpacePoint(data, sp);
@@ -366,14 +365,13 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::newRegion
 
     SG::ReadHandle<SpacePointContainer> spacepointsSCT{m_spacepointsSCT, ctx};
     if (spacepointsSCT.isValid()) {
-      SpacePointContainer::const_iterator spce = spacepointsSCT->end();
 
       // Loop through all trigger collections
       //
       for (const IdentifierHash& l: vSCT) {
-        SpacePointContainer::const_iterator w = spacepointsSCT->indexFind(l);
-        if (w==spce) continue;
-        for (const Trk::SpacePoint* sp: **w) {
+        auto w = spacepointsSCT->indexFindPtr(l);
+        if (w==nullptr) continue;
+        for (const Trk::SpacePoint* sp: *w) {
           float r = sp->r();
           if (r > m_r_rmax) continue;
           InDet::SiSpacePointForSeed* sps = newSpacePoint(data, sp);
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_BeamGas.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_BeamGas.cxx
index abd0d2c58d5d..2c7400366b86 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_BeamGas.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_BeamGas.cxx
@@ -253,14 +253,13 @@ void InDet::SiSpacePointsSeedMaker_BeamGas::newRegion
 
     SG::ReadHandle<SpacePointContainer> spacepointsPixel{m_spacepointsPixel, ctx};
     if (spacepointsPixel.isValid()) {
-      SpacePointContainer::const_iterator spce = spacepointsPixel->end();
 
       // Loop through all trigger collections
       //
       for (const IdentifierHash& l: vPixel) {
-	SpacePointContainer::const_iterator w = spacepointsPixel->indexFind(l);
-	if (w==spce) continue;
-        for (const Trk::SpacePoint* sp: **w) {
+	auto w = spacepointsPixel->indexFindPtr(l);
+	if (w==nullptr) continue;
+        for (const Trk::SpacePoint* sp: *w) {
 	  float r = sp->r();
           if (r<0. || r>=m_r_rmax) continue;
 	  if (prd_to_track_map_cptr && isUsed(sp, *prd_to_track_map_cptr)) continue;
@@ -281,14 +280,12 @@ void InDet::SiSpacePointsSeedMaker_BeamGas::newRegion
 
     SG::ReadHandle<SpacePointContainer> spacepointsSCT{m_spacepointsSCT, ctx};
     if (spacepointsSCT.isValid()) {
-      SpacePointContainer::const_iterator spce = spacepointsSCT->end();
-
       // Loop through all trigger collections
       //
       for (const IdentifierHash& l: vPixel) {
-	SpacePointContainer::const_iterator w = spacepointsSCT->indexFind(l);
-	if (w==spce) continue;
-        for (const Trk::SpacePoint* sp: **w) {
+	auto w = spacepointsSCT->indexFindPtr(l);
+	if (w==nullptr) continue;
+        for (const Trk::SpacePoint* sp: *w) {
 	  float r = sp->r();
           if (r<0. || r>=m_r_rmax) continue;
 	  if (prd_to_track_map_cptr && isUsed(sp,*prd_to_track_map_cptr)) continue;
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Cosmic.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Cosmic.cxx
index e0572aad3cf5..bbfc2e54f252 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Cosmic.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Cosmic.cxx
@@ -207,14 +207,12 @@ void InDet::SiSpacePointsSeedMaker_Cosmic::newRegion
 
     SG::ReadHandle<SpacePointContainer> spacepointsPixel{m_spacepointsPixel, ctx};
     if (spacepointsPixel.isValid()) {
-      SpacePointContainer::const_iterator spce = spacepointsPixel->end();
-
       // Loop through all trigger collections
       //
       for (const IdentifierHash& l: vPixel) {
-	SpacePointContainer::const_iterator w = spacepointsPixel->indexFind(l);
-	if (w==spce) continue;
-        for (const Trk::SpacePoint* sp: **w) {
+	auto w = spacepointsPixel->indexFindPtr(l);
+	if (w==nullptr) continue;
+        for (const Trk::SpacePoint* sp: *w) {
 	  float r = sp->r();
           if (r<0. || r>=m_r_rmax) continue;
 	  if (prd_to_track_map_cptr && isUsed(sp,*prd_to_track_map_cptr)) continue;
@@ -236,14 +234,13 @@ void InDet::SiSpacePointsSeedMaker_Cosmic::newRegion
 
     SG::ReadHandle<SpacePointContainer> spacepointsSCT{m_spacepointsSCT, ctx};
     if (spacepointsSCT.isValid()) {
-      SpacePointContainer::const_iterator spce = spacepointsSCT->end();
 
       // Loop through all trigger collections
       //
       for (const IdentifierHash& l: vSCT) {
-	SpacePointContainer::const_iterator w = spacepointsSCT->indexFind(l);
-	if (w==spce) continue;
-        for (const Trk::SpacePoint* sp: **w) {
+	auto w = spacepointsSCT->indexFindPtr(l);
+	if (w==nullptr) continue;
+        for (const Trk::SpacePoint* sp: *w) {
 	  float r = sp->r();
           if (r<0. || r>=m_r_rmax) continue;
 	  if (prd_to_track_map_cptr && isUsed(sp,*prd_to_track_map_cptr)) continue;
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_HeavyIon.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_HeavyIon.cxx
index 02777545edfc..423b40ddfde6 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_HeavyIon.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_HeavyIon.cxx
@@ -208,14 +208,13 @@ void InDet::SiSpacePointsSeedMaker_HeavyIon::newRegion
 
     SG::ReadHandle<SpacePointContainer> spacepointsPixel{m_spacepointsPixel, ctx};
     if (spacepointsPixel.isValid()) {
-      SpacePointContainer::const_iterator spce = spacepointsPixel->end();
 
       // Loop through all trigger collections
       //
       for (const IdentifierHash& l: vPixel) {
-	SpacePointContainer::const_iterator w = spacepointsPixel->indexFind(l);
-	if (w==spce) continue;
-        for (const Trk::SpacePoint* sp: **w) {
+	auto w = spacepointsPixel->indexFindPtr(l);
+	if (w==nullptr) continue;
+        for (const Trk::SpacePoint* sp: *w) {
 	  float r = sp->r();
           if (r<0. || r>=m_r_rmax) continue;
 	  InDet::SiSpacePointForSeed* sps = newSpacePoint(data, sp);
@@ -236,14 +235,13 @@ void InDet::SiSpacePointsSeedMaker_HeavyIon::newRegion
 
     SG::ReadHandle<SpacePointContainer> spacepointsSCT{m_spacepointsSCT, ctx};
     if (spacepointsSCT.isValid()) {
-      SpacePointContainer::const_iterator spce = spacepointsSCT->end();
 
       // Loop through all trigger collections
       //
       for (const IdentifierHash& l: vSCT) {
-	SpacePointContainer::const_iterator w = spacepointsSCT->indexFind(l);
-	if (w==spce) continue;
-        for (const Trk::SpacePoint* sp: **w) {
+	auto w = spacepointsSCT->indexFindPtr(l);
+	if (w==nullptr) continue;
+        for (const Trk::SpacePoint* sp: *w) {
 	  float r = sp->r();
           if (r<0. || r>=m_r_rmax) continue;
 	  InDet::SiSpacePointForSeed* sps = newSpacePoint(data, sp);
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ITK.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ITK.cxx
index eff676328de3..acc9bb73cea6 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ITK.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ITK.cxx
@@ -302,14 +302,13 @@ void InDet::SiSpacePointsSeedMaker_ITK::newRegion
 
     SG::ReadHandle<SpacePointContainer> spacepointsPixel{m_spacepointsPixel, ctx};
     if (spacepointsPixel.isValid()) {
-      SpacePointContainer::const_iterator spce = spacepointsPixel->end();
 
       // Loop through all trigger collections
       //
       for (const IdentifierHash& l: vPixel) {
-	SpacePointContainer::const_iterator w = spacepointsPixel->indexFind(l);
-	if (w==spce) continue;
-        for (const Trk::SpacePoint* sp: **w) {
+	auto w = spacepointsPixel->indexFindPtr(l);
+	if (w==nullptr) continue;
+        for (const Trk::SpacePoint* sp: *w) {
 	  float r = sp->r();
           if (r > m_r_rmax || r < m_r_rmin) continue;
 	  InDet::SiSpacePointForSeedITK* sps = newSpacePoint(data, sp);
@@ -330,14 +329,13 @@ void InDet::SiSpacePointsSeedMaker_ITK::newRegion
 
     SG::ReadHandle<SpacePointContainer> spacepointsSCT{m_spacepointsSCT, ctx};
     if (spacepointsSCT.isValid()) {
-      SpacePointContainer::const_iterator spce = spacepointsSCT->end();
 
       // Loop through all trigger collections
       //
       for (const IdentifierHash& l: vSCT) {
-	SpacePointContainer::const_iterator w = spacepointsSCT->indexFind(l);
-	if (w==spce) continue;
-        for (const Trk::SpacePoint* sp: **w) {
+	auto w = spacepointsSCT->indexFindPtr(l);
+	if (w==nullptr) continue;
+        for (const Trk::SpacePoint* sp: *w) {
 	  float r = sp->r();
           if (r > m_r_rmax || r < m_r_rmin) continue;
 	  InDet::SiSpacePointForSeedITK* sps = newSpacePoint(data, sp);
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_LowMomentum.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_LowMomentum.cxx
index 942b6e1bb578..d85bfc747981 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_LowMomentum.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_LowMomentum.cxx
@@ -199,9 +199,9 @@ void InDet::SiSpacePointsSeedMaker_LowMomentum::newRegion
       // Loop through all trigger collections
       //
       for (const IdentifierHash& l: vPixel) {
-        SpacePointContainer::const_iterator w = spacepointsPixel->indexFind(l);
-        if (w==spce) continue;
-        for (const Trk::SpacePoint* sp: **w) {
+        auto w = spacepointsPixel->indexFindPtr(l);
+        if (w==nullptr) continue;
+        for (const Trk::SpacePoint* sp: *w) {
           float r = sp->r();
           if (r<0. || r>=m_r_rmax) continue;
           if (prd_to_track_map_cptr && isUsed(sp,*prd_to_track_map_cptr)) continue;
@@ -231,9 +231,9 @@ void InDet::SiSpacePointsSeedMaker_LowMomentum::newRegion
       // Loop through all trigger collections
       //
       for (const IdentifierHash& l: vSCT) {
-        SpacePointContainer::const_iterator w = spacepointsSCT->indexFind(l);
-        if (w==spce) continue;
-        for (const Trk::SpacePoint* sp: **w) {
+        auto w = spacepointsSCT->indexFindPtr(l);
+        if (w==nullptr) continue;
+        for (const Trk::SpacePoint* sp: *w) {
           float r = sp->r();
           if (r<0. || r>=m_r_rmax) continue;
           if (prd_to_track_map_cptr && isUsed(sp,*prd_to_track_map_cptr)) continue;
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx
index 35bf26575177..61db8694e7a5 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx
@@ -237,14 +237,13 @@ void InDet::SiSpacePointsSeedMaker_Trigger::newRegion
 
     SG::ReadHandle<SpacePointContainer> spacepointsPixel{m_spacepointsPixel, ctx};
     if (spacepointsPixel.isValid()) {
-      SpacePointContainer::const_iterator spce = spacepointsPixel->end();
 
       // Loop through all trigger collections
       //
       for (const IdentifierHash& l: vPixel) {
-        SpacePointContainer::const_iterator  w =  spacepointsPixel->indexFind(l);
-        if (w==spce) continue;
-        for (const Trk::SpacePoint* sp: **w) {
+        auto w =  spacepointsPixel->indexFindPtr(l);
+        if (w==nullptr) continue;
+        for (const Trk::SpacePoint* sp: *w) {
           float r = sp->r();
           if (r<0. || r>=m_r_rmax) continue;
           InDet::SiSpacePointForSeed* sps = newSpacePoint(data, sp);
@@ -265,14 +264,13 @@ void InDet::SiSpacePointsSeedMaker_Trigger::newRegion
 
     SG::ReadHandle<SpacePointContainer> spacepointsSCT{m_spacepointsSCT, ctx};
     if (spacepointsSCT.isValid()) {
-      SpacePointContainer::const_iterator spce = spacepointsSCT->end();
 
       // Loop through all trigger collections
       //
       for (const IdentifierHash& l: vSCT) {
-        SpacePointContainer::const_iterator w = spacepointsSCT->indexFind(l);
-        if (w==spce) continue;
-        for (const Trk::SpacePoint* sp: **w) {
+        auto w = spacepointsSCT->indexFindPtr(l);
+        if (w==nullptr) continue;
+        for (const Trk::SpacePoint* sp: *w) {
           float r = sp->r();
           if (r<0. || r>=m_r_rmax) continue;
           InDet::SiSpacePointForSeed* sps = newSpacePoint(data, sp);
diff --git a/InnerDetector/InDetRecTools/TRT_TrackSegmentsTool_xk/src/TRT_TrackSegmentsMaker_ATLxk.cxx b/InnerDetector/InDetRecTools/TRT_TrackSegmentsTool_xk/src/TRT_TrackSegmentsMaker_ATLxk.cxx
index 22fa30885a8d..1559bbc9f071 100755
--- a/InnerDetector/InDetRecTools/TRT_TrackSegmentsTool_xk/src/TRT_TrackSegmentsMaker_ATLxk.cxx
+++ b/InnerDetector/InDetRecTools/TRT_TrackSegmentsTool_xk/src/TRT_TrackSegmentsMaker_ATLxk.cxx
@@ -273,11 +273,11 @@ InDet::TRT_TrackSegmentsMaker_ATLxk::newRegion
   int n = 0;
   for(; d!=de; ++d) {
 
-    InDet::TRT_DriftCircleContainer::const_iterator w = trtcontainer->indexFind((*d));
+    auto w = trtcontainer->indexFindPtr((*d));
 
-    if(w!=we) {
+    if(w!=nullptr) {
 
-      Identifier ID = (*w)->identify();
+      Identifier ID = w->identify();
       int be = m_trtid->barrel_ec     (ID);
       int lw = m_trtid->layer_or_wheel(ID);
       int sl = m_trtid->straw_layer   (ID);
@@ -289,7 +289,7 @@ InDet::TRT_TrackSegmentsMaker_ATLxk::newRegion
       unsigned int ad  = 1000*b+l;
 
       InDet::TRT_DriftCircleCollection::const_iterator 
-	c  = (*w)->begin(), ce = (*w)->end();
+	c  = w->begin(), ce = w->end();
 
       for(; c!=ce; ++c) {
 
-- 
GitLab