From 80aa9d49951aa82aa53256a949d57e96f30aad4d Mon Sep 17 00:00:00 2001
From: Andrii Verbytskyi <andrii.verbytskyi@cern.ch>
Date: Thu, 26 Nov 2020 12:04:03 +0000
Subject: [PATCH] Hepmc3 nightly fixes 25112020 part 3

---
 .../test/LUCID_SimHitCnv_p1_test.cxx             |  8 ++++----
 .../test/LUCID_SimHitCnv_p2_test.cxx             |  6 +++---
 .../test/InDetSimDataCollectionCnv_common_test.h |  6 +++---
 .../InDetOverlay/test/TRTOverlay_test.cxx        | 16 ++++++++--------
 .../src/FakeMissingETTool.cxx                    |  2 +-
 .../src/SplitElectronContainer.cxx               |  2 +-
 .../TrackParticleTruthCollectionCnv_p1_test.cxx  |  8 ++++----
 .../TrackParticleTruthCollectionCnv_p2_test.cxx  |  6 +++---
 .../test/PRD_MultiTruthCollectionCnv_p2_test.cxx |  6 +++---
 .../test/PRD_MultiTruthCollectionCnv_p3_test.cxx |  6 +++---
 .../test/TrackTruthCollectionCnv_p1_test.cxx     |  6 +++---
 .../test/TrackTruthCollectionCnv_p2_test.cxx     |  6 +++---
 .../test/TruthTrajectoryCnv_p1_test.cxx          |  6 +++---
 .../test/TruthTrajectoryCnv_p2_test.cxx          |  6 +++---
 .../test/TrigInDetTrackTruthCnv_p1_test.cxx      |  8 ++++----
 .../test/TrigInDetTrackTruthMapCnv_p1_test.cxx   |  8 ++++----
 16 files changed, 53 insertions(+), 53 deletions(-)

diff --git a/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p1_test.cxx b/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p1_test.cxx
index 255dd8b5091..b261ac28c54 100644
--- a/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p1_test.cxx
+++ b/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p1_test.cxx
@@ -69,16 +69,16 @@ void testit (const LUCID_SimHit& trans1)
 }
 
 
-void test1(std::vector<HepMC::GenParticle*>& genPartVector)
+void test1(std::vector<HepMC::GenParticlePtr>& genPartVector)
 {
   std::cout << "test1\n";
-  const HepMC::GenParticle *particle = genPartVector.at(0);
+  auto particle = genPartVector.at(0);
   // Create HepMcParticleLink outside of leak check.
   HepMcParticleLink dummyHMPL(HepMC::barcode(particle),particle->parent_event()->event_number());
   assert(dummyHMPL.cptr()==particle);
   Athena_test::Leakcheck check;
 
-  const HepMC::GenParticle *pGenParticle = genPartVector.at(0);
+  auto pGenParticle = genPartVector.at(0);
   HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number());
   LUCID_SimHit trans1 (1, pGenParticle->pdg_id(), trkLink, 4,
                        5.5, 6.5, 7.5,
@@ -92,7 +92,7 @@ void test1(std::vector<HepMC::GenParticle*>& genPartVector)
 int main()
 {
   ISvcLocator* pSvcLoc = nullptr;
-  std::vector<HepMC::GenParticle*> genPartVector;
+  std::vector<HepMC::GenParticlePtr> genPartVector;
   if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) {
     std::cerr << "This test can not be run" << std::endl;
     return 0;
diff --git a/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p2_test.cxx b/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p2_test.cxx
index c08d89c4296..c50beacf6b7 100644
--- a/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p2_test.cxx
+++ b/ForwardDetectors/LUCID/LUCID_Cnv/LUCID_EventTPCnv/test/LUCID_SimHitCnv_p2_test.cxx
@@ -68,10 +68,10 @@ void testit (const LUCID_SimHit& trans1)
 }
 
 
-void test1(std::vector<HepMC::GenParticle*>& genPartVector)
+void test1(std::vector<HepMC::GenParticlePtr>& genPartVector)
 {
   std::cout << "test1\n";
-  const HepMC::GenParticle *particle = genPartVector.at(0);
+  auto particle = genPartVector.at(0);
   // Create HepMcParticleLink outside of leak check.
   HepMcParticleLink dummyHMPL(HepMC::barcode(particle),particle->parent_event()->event_number());
   assert(dummyHMPL.cptr()==particle);
@@ -90,7 +90,7 @@ void test1(std::vector<HepMC::GenParticle*>& genPartVector)
 int main()
 {
   ISvcLocator* pSvcLoc = nullptr;
-  std::vector<HepMC::GenParticle*> genPartVector;
+  std::vector<HepMC::GenParticlePtr> genPartVector;
   if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) {
     std::cerr << "This test can not be run" << std::endl;
     return 0;
diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_common_test.h b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_common_test.h
index d98f0df7e71..a5173802781 100644
--- a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_common_test.h
+++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_common_test.h
@@ -89,10 +89,10 @@ void testit(const InDetSimDataCollection& trans1)
 // TCnv: InDetSimDataCollectionCnv_pX
 // T: InDetSimDataCollection_pX
 template<typename TCnv, typename T>
-void test1(std::vector<HepMC::GenParticle*>& genPartVector)
+void test1(std::vector<HepMC::GenParticlePtr>& genPartVector)
 {
   std::cout << "test1\n";
-  const HepMC::GenParticle *particle = genPartVector.at(0);
+  auto particle = genPartVector.at(0);
   // Create HepMcParticleLink outside of leak check.
   HepMcParticleLink dummyHMPL(HepMC::barcode(particle), particle->parent_event()->event_number());
   assert(dummyHMPL.cptr()==particle);
@@ -145,7 +145,7 @@ int commonMain()
   // Make PixelID for InDetSimDataCollectionCnv_pX (TCnv)
   makePixelID(pSvcLoc);
 
-  std::vector<HepMC::GenParticle*> genPartVector;
+  std::vector<HepMC::GenParticlePtr> genPartVector;
   // Fill genPartVector
   // false is to skip Athena_test::initGaudi in Athena_test::initMcEventCollection.
   if (!Athena_test::initMcEventCollection(pSvcLoc, genPartVector, false)) {
diff --git a/InnerDetector/InDetRawAlgs/InDetOverlay/test/TRTOverlay_test.cxx b/InnerDetector/InDetRawAlgs/InDetOverlay/test/TRTOverlay_test.cxx
index 92828b29600..f7cce7f0dd1 100644
--- a/InnerDetector/InDetRawAlgs/InDetOverlay/test/TRTOverlay_test.cxx
+++ b/InnerDetector/InDetRawAlgs/InDetOverlay/test/TRTOverlay_test.cxx
@@ -623,11 +623,11 @@ namespace OverlayTesting {
     ASSERT_TRUE(inputBkgDataHandle->addCollection(bkgCollection.get(),sigElementHash).isSuccess());
     bkgCollection.release(); // Now owned by inputBkgDataHandle
 
-    std::vector<HepMC::GenParticle*> genPartList;
+    std::vector<HepMC::GenParticlePtr> genPartList;
     initMcEventCollection(genPartList);
     SG::WriteHandle<InDetSimDataCollection> inputSigSDODataHandle{"StoreGateSvc+TRT_SDO_Map_SIG"};
     inputSigSDODataHandle = std::make_unique<InDetSimDataCollection>();
-    const HepMC::GenParticle* pGenParticle = genPartList.at(0);
+    auto pGenParticle = genPartList.at(0);
     HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number());
     InDetSimData::Deposit deposit( trkLink, 0.0 );
     std::vector<InDetSimData::Deposit> depositVector(1);
@@ -709,11 +709,11 @@ namespace OverlayTesting {
     const double outputTOT = TRT_LoLumRawData::timeOverThreshold(outWord);
     const unsigned int outputDriftTimeBin = TRT_LoLumRawData::driftTimeBin(outWord);
 
-    std::vector<HepMC::GenParticle*> genPartList;
+    std::vector<HepMC::GenParticlePtr> genPartList;
     initMcEventCollection(genPartList);
     SG::WriteHandle<InDetSimDataCollection> inputSigSDODataHandle{"StoreGateSvc+TRT_SDO_Map_SIG"};
     inputSigSDODataHandle = std::make_unique<InDetSimDataCollection>();
-    const HepMC::GenParticle* pGenParticle = genPartList.at(0);
+    auto pGenParticle = genPartList.at(0);
     HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number());
     InDetSimData::Deposit deposit( trkLink, 0.0 );
     std::vector<InDetSimData::Deposit> depositVector(1);
@@ -804,11 +804,11 @@ namespace OverlayTesting {
     const double outputTOT = TRT_LoLumRawData::timeOverThreshold(outWord);
     const unsigned int outputDriftTimeBin = TRT_LoLumRawData::driftTimeBin(outWord);
 
-    std::vector<HepMC::GenParticle*> genPartList;
+    std::vector<HepMC::GenParticlePtr> genPartList;
     initMcEventCollection(genPartList);
     SG::WriteHandle<InDetSimDataCollection> inputSigSDODataHandle{"StoreGateSvc+TRT_SDO_Map_SIG"};
     inputSigSDODataHandle = std::make_unique<InDetSimDataCollection>();
-    const HepMC::GenParticle* pGenParticle = genPartList.at(0);
+    auto pGenParticle = genPartList.at(0);
     HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number());
     ASSERT_EQ(trkLink.cptr()->pdg_id(), -11); // Sanity check to confirm that we are linking to a positron as expected
     InDetSimData::Deposit deposit( trkLink, 0.0 );
@@ -896,11 +896,11 @@ namespace OverlayTesting {
     ASSERT_TRUE(inputBkgDataHandle->addCollection(bkgCollection.get(),sigElementHash).isSuccess());
     bkgCollection.release(); // Now owned by inputBkgDataHandle
 
-    std::vector<HepMC::GenParticle*> genPartList;
+    std::vector<HepMC::GenParticlePtr> genPartList;
     initMcEventCollection(genPartList);
     SG::WriteHandle<InDetSimDataCollection> inputSigSDODataHandle{"StoreGateSvc+TRT_SDO_Map_SIG"};
     inputSigSDODataHandle = std::make_unique<InDetSimDataCollection>();
-    const HepMC::GenParticle* pGenParticle = genPartList.at(0);
+    auto pGenParticle = genPartList.at(0);
     HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number());
     ASSERT_EQ(trkLink.cptr()->pdg_id(), -11); // Sanity check to confirm that we are linking to a positron as expected
     InDetSimData::Deposit deposit( trkLink, 0.0 );
diff --git a/Reconstruction/MissingETPerformance/src/FakeMissingETTool.cxx b/Reconstruction/MissingETPerformance/src/FakeMissingETTool.cxx
index 2a6002fee7c..48ea69c163f 100755
--- a/Reconstruction/MissingETPerformance/src/FakeMissingETTool.cxx
+++ b/Reconstruction/MissingETPerformance/src/FakeMissingETTool.cxx
@@ -745,7 +745,7 @@ StatusCode FakeMissingETTool::fakeMissingET(MissingETData *data, MissingETMuonDa
       bool fakeevent = false;
 
       //Loop over truth muons
-      for (std::vector<const HepMC::GenParticle*>::const_iterator it = truth_muons.begin(); it != truth_muons.end(); ++it ) {
+      for (auto it = truth_muons.begin(); it != truth_muons.end(); ++it ) {
 
 	if ((*it)->momentum().perp() > 10.0*GeV) {
 	  //try to find a matching reco muon
diff --git a/Reconstruction/MissingETPerformance/src/SplitElectronContainer.cxx b/Reconstruction/MissingETPerformance/src/SplitElectronContainer.cxx
index b6e54c8b0a6..cf76352883e 100644
--- a/Reconstruction/MissingETPerformance/src/SplitElectronContainer.cxx
+++ b/Reconstruction/MissingETPerformance/src/SplitElectronContainer.cxx
@@ -328,7 +328,7 @@ bool SplitElectronContainer::MatchTruthElectron(const Analysis::Electron* recoEl
       // look for mother
       if( (*pItr)->nParents() >=1 ){
 	
-	const HepMC::GenParticle* mother = (*pItr)->genMother(0);
+	auto mother = (*pItr)->genMother(0);
 	
 	if( mother->pdg_id() == 23){
 	  
diff --git a/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p1_test.cxx b/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p1_test.cxx
index 9e3a2eb2842..2f348f9b821 100644
--- a/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p1_test.cxx
+++ b/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p1_test.cxx
@@ -64,10 +64,10 @@ void testit (const TrackParticleTruthCollection& trans1)
 }
 
 
-void test1(std::vector<HepMC::GenParticle*> genPartVector)
+void test1(std::vector<HepMC::GenParticlePtr> genPartVector)
 {
   std::cout << "test1\n";
-  const HepMC::GenParticle *particle = genPartVector.at(0);
+  auto particle = genPartVector.at(0);
   // Create HepMcParticleLink outside of leak check.
   HepMcParticleLink dummyHMPL(HepMC::barcode(particle));
   assert(dummyHMPL.cptr()==particle);
@@ -77,7 +77,7 @@ void test1(std::vector<HepMC::GenParticle*> genPartVector)
 
   TrackParticleTruthCollection trans1 (DataLink<Rec::TrackParticleContainer>("tpc"));
   for (int i=0; i<10; i++) {
-    const HepMC::GenParticle* pGenParticle = genPartVector.at(i);
+    auto pGenParticle = genPartVector.at(i);
     HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number());
     Rec::TrackParticleTruthKey key (ElementLink<Rec::TrackParticleContainer> ("tpc", i));
     TrackParticleTruth val (trkLink, (float)i/10);
@@ -91,7 +91,7 @@ void test1(std::vector<HepMC::GenParticle*> genPartVector)
 int main()
 {
   ISvcLocator* pSvcLoc = nullptr;
-  std::vector<HepMC::GenParticle*> genPartVector;
+  std::vector<HepMC::GenParticlePtr> genPartVector;
   if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) {
     std::cerr << "This test can not be run" << std::endl;
     return 0;
diff --git a/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p2_test.cxx b/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p2_test.cxx
index 491b0d01d1d..362d914fe85 100644
--- a/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p2_test.cxx
+++ b/Reconstruction/TrackParticleTruthTPCnv/test/TrackParticleTruthCollectionCnv_p2_test.cxx
@@ -63,13 +63,13 @@ void testit (const TrackParticleTruthCollection& trans1)
 }
 
 
-void test1(std::vector<HepMC::GenParticle*> genPartVector)
+void test1(std::vector<HepMC::GenParticlePtr> genPartVector)
 {
   std::cout << "test1\n";
 
   TrackParticleTruthCollection trans1 (DataLink<Rec::TrackParticleContainer>("tpc"));
   for (int i=0; i<10; i++) {
-    const HepMC::GenParticle* pGenParticle = genPartVector.at(i);
+    auto pGenParticle = genPartVector.at(i);
     HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number());
     Rec::TrackParticleTruthKey key (ElementLink<Rec::TrackParticleContainer> ("tpc", i));
     TrackParticleTruth val (trkLink, (float)i/10);
@@ -83,7 +83,7 @@ void test1(std::vector<HepMC::GenParticle*> genPartVector)
 int main()
 {
   ISvcLocator* pSvcLoc = nullptr;
-  std::vector<HepMC::GenParticle*> genPartVector;
+  std::vector<HepMC::GenParticlePtr> genPartVector;
   if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) {
     std::cerr << "This test can not be run" << std::endl;
     return 0;
diff --git a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/PRD_MultiTruthCollectionCnv_p2_test.cxx b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/PRD_MultiTruthCollectionCnv_p2_test.cxx
index 473529490db..5dae2cff6e0 100644
--- a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/PRD_MultiTruthCollectionCnv_p2_test.cxx
+++ b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/PRD_MultiTruthCollectionCnv_p2_test.cxx
@@ -62,13 +62,13 @@ void testit (const PRD_MultiTruthCollection& trans1)
 }
 
 
-void test1(std::vector<HepMC::GenParticle*> genPartVector)
+void test1(std::vector<HepMC::GenParticlePtr> genPartVector)
 {
   std::cout << "test1\n";
 
   PRD_MultiTruthCollection trans1;
   for (int i=0; i<10; i++) {
-    const HepMC::GenParticle* pGenParticle = genPartVector.at(i);
+    auto pGenParticle = genPartVector.at(i);
     HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number());
     const Identifier chanId(i+100);
     trans1.insert(trans1.end(), std::make_pair(chanId, trkLink) );
@@ -81,7 +81,7 @@ void test1(std::vector<HepMC::GenParticle*> genPartVector)
 int main()
 {
   ISvcLocator* pSvcLoc = nullptr;
-  std::vector<HepMC::GenParticle*> genPartVector;
+  std::vector<HepMC::GenParticlePtr> genPartVector;
   if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) {
     std::cerr << "This test can not be run" << std::endl;
     return 0;
diff --git a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/PRD_MultiTruthCollectionCnv_p3_test.cxx b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/PRD_MultiTruthCollectionCnv_p3_test.cxx
index cb045cd1532..60dc1379d51 100644
--- a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/PRD_MultiTruthCollectionCnv_p3_test.cxx
+++ b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/PRD_MultiTruthCollectionCnv_p3_test.cxx
@@ -62,13 +62,13 @@ void testit (const PRD_MultiTruthCollection& trans1)
 }
 
 
-void test1(std::vector<HepMC::GenParticle*> genPartVector)
+void test1(std::vector<HepMC::GenParticlePtr> genPartVector)
 {
   std::cout << "test1\n";
 
   PRD_MultiTruthCollection trans1;
   for (int i=0; i<10; i++) {
-    const HepMC::GenParticle* pGenParticle = genPartVector.at(i);
+    auto pGenParticle = genPartVector.at(i);
     HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number());
     const Identifier chanId(i+100);
     trans1.insert(trans1.end(), std::make_pair(chanId, trkLink) );
@@ -81,7 +81,7 @@ void test1(std::vector<HepMC::GenParticle*> genPartVector)
 int main()
 {
   ISvcLocator* pSvcLoc = nullptr;
-  std::vector<HepMC::GenParticle*> genPartVector;
+  std::vector<HepMC::GenParticlePtr> genPartVector;
   if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) {
     std::cerr << "This test can not be run" << std::endl;
     return 0;
diff --git a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TrackTruthCollectionCnv_p1_test.cxx b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TrackTruthCollectionCnv_p1_test.cxx
index 897c86486e2..4c479bc8f8b 100644
--- a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TrackTruthCollectionCnv_p1_test.cxx
+++ b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TrackTruthCollectionCnv_p1_test.cxx
@@ -63,13 +63,13 @@ void testit (const TrackTruthCollection& trans1)
 }
 
 
-void test1(std::vector<HepMC::GenParticle*> genPartVector)
+void test1(std::vector<HepMC::GenParticlePtr> genPartVector)
 {
   std::cout << "test1\n";
 
   TrackTruthCollection trans1 (DataLink<TrackCollection>("tpc"));
   for (int i=0; i<10; i++) {
-    const HepMC::GenParticle* pGenParticle = genPartVector.at(i);
+    auto pGenParticle = genPartVector.at(i);
     HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number());
     Trk::TrackTruthKey key (ElementLink<TrackCollection> ("tpc", i));
     TrackTruth val (trkLink, (float)i/10);
@@ -83,7 +83,7 @@ void test1(std::vector<HepMC::GenParticle*> genPartVector)
 int main()
 {
   ISvcLocator* pSvcLoc = nullptr;
-  std::vector<HepMC::GenParticle*> genPartVector;
+  std::vector<HepMC::GenParticlePtr> genPartVector;
   if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) {
     std::cerr << "This test can not be run" << std::endl;
     return 0;
diff --git a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TrackTruthCollectionCnv_p2_test.cxx b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TrackTruthCollectionCnv_p2_test.cxx
index 2f724430165..bcd51354a68 100644
--- a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TrackTruthCollectionCnv_p2_test.cxx
+++ b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TrackTruthCollectionCnv_p2_test.cxx
@@ -63,13 +63,13 @@ void testit (const TrackTruthCollection& trans1)
 }
 
 
-void test1(std::vector<HepMC::GenParticle*> genPartVector)
+void test1(std::vector<HepMC::GenParticlePtr> genPartVector)
 {
   std::cout << "test1\n";
 
   TrackTruthCollection trans1 (DataLink<TrackCollection>("tpc"));
   for (int i=0; i<10; i++) {
-    const HepMC::GenParticle* pGenParticle = genPartVector.at(i);
+    auto pGenParticle = genPartVector.at(i);
     HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number());
     Trk::TrackTruthKey key (ElementLink<TrackCollection> ("tpc", i));
     TrackTruth val (trkLink, (float)i/10);
@@ -83,7 +83,7 @@ void test1(std::vector<HepMC::GenParticle*> genPartVector)
 int main()
 {
   ISvcLocator* pSvcLoc = nullptr;
-  std::vector<HepMC::GenParticle*> genPartVector;
+  std::vector<HepMC::GenParticlePtr> genPartVector;
   if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) {
     std::cerr << "This test can not be run" << std::endl;
     return 0;
diff --git a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TruthTrajectoryCnv_p1_test.cxx b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TruthTrajectoryCnv_p1_test.cxx
index 853cf92d669..97795b47be1 100644
--- a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TruthTrajectoryCnv_p1_test.cxx
+++ b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TruthTrajectoryCnv_p1_test.cxx
@@ -60,13 +60,13 @@ void testit (const TruthTrajectory& trans1)
 }
 
 
-void test1(std::vector<HepMC::GenParticle*> genPartVector)
+void test1(std::vector<HepMC::GenParticlePtr> genPartVector)
 {
   std::cout << "test1\n";
 
   TruthTrajectory trans1;
   for (int i=0; i<10; i++) {
-    const HepMC::GenParticle* pGenParticle = genPartVector.at(i);
+    auto pGenParticle = genPartVector.at(i);
     HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number());
     trans1.push_back(trkLink);
   }
@@ -78,7 +78,7 @@ void test1(std::vector<HepMC::GenParticle*> genPartVector)
 int main()
 {
   ISvcLocator* pSvcLoc = nullptr;
-  std::vector<HepMC::GenParticle*> genPartVector;
+  std::vector<HepMC::GenParticlePtr> genPartVector;
   if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) {
     std::cerr << "This test can not be run" << std::endl;
     return 0;
diff --git a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TruthTrajectoryCnv_p2_test.cxx b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TruthTrajectoryCnv_p2_test.cxx
index 48dd594c325..1a1afae093b 100644
--- a/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TruthTrajectoryCnv_p2_test.cxx
+++ b/Tracking/TrkEventCnv/TrkTruthTPCnv/test/TruthTrajectoryCnv_p2_test.cxx
@@ -60,13 +60,13 @@ void testit (const TruthTrajectory& trans1)
 }
 
 
-void test1(std::vector<HepMC::GenParticle*> genPartVector)
+void test1(std::vector<HepMC::GenParticlePtr> genPartVector)
 {
   std::cout << "test1\n";
 
   TruthTrajectory trans1;
   for (int i=0; i<10; i++) {
-    const HepMC::GenParticle* pGenParticle = genPartVector.at(i);
+    auto pGenParticle = genPartVector.at(i);
     HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number());
     trans1.push_back(trkLink);
   }
@@ -78,7 +78,7 @@ void test1(std::vector<HepMC::GenParticle*> genPartVector)
 int main()
 {
   ISvcLocator* pSvcLoc = nullptr;
-  std::vector<HepMC::GenParticle*> genPartVector;
+  std::vector<HepMC::GenParticlePtr> genPartVector;
   if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) {
     std::cerr << "This test can not be run" << std::endl;
     return 0;
diff --git a/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthCnv_p1_test.cxx b/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthCnv_p1_test.cxx
index dde73ed0f02..9775277e6ba 100644
--- a/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthCnv_p1_test.cxx
+++ b/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthCnv_p1_test.cxx
@@ -49,7 +49,7 @@ public:
 
   }
 
-  static void set (TrigInDetTrackTruth& p, std::vector<HepMC::GenParticle*>& genPartVector)
+  static void set (TrigInDetTrackTruth& p, std::vector<HepMC::GenParticlePtr>& genPartVector)
   {
     int nstat = 4;
     p.m_nr_common_hits.resize (nstat);
@@ -88,10 +88,10 @@ void testit (const TrigInDetTrackTruth& trans1)
 }
 
 
-void test1(std::vector<HepMC::GenParticle*>& genPartVector)
+void test1(std::vector<HepMC::GenParticlePtr>& genPartVector)
 {
   std::cout << "test1\n";
-  const HepMC::GenParticle *particle = genPartVector.at(0);
+  auto particle = genPartVector.at(0);
   // Create HepMcParticleLink outside of leak check.
   HepMcParticleLink dummyHMPL(HepMC::barcode(particle),particle->parent_event()->event_number());
   assert(dummyHMPL.cptr()==particle);
@@ -107,7 +107,7 @@ void test1(std::vector<HepMC::GenParticle*>& genPartVector)
 int main()
 {
   ISvcLocator* pSvcLoc = nullptr;
-  std::vector<HepMC::GenParticle*> genPartVector;
+  std::vector<HepMC::GenParticlePtr> genPartVector;
   if (!Athena_test::initMcEventCollection(pSvcLoc, genPartVector)) {
     std::cerr << "This test can not be run" << std::endl;
     return 0;
diff --git a/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthMapCnv_p1_test.cxx b/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthMapCnv_p1_test.cxx
index c671675ed0d..e8a93cfa45d 100644
--- a/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthMapCnv_p1_test.cxx
+++ b/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthMapCnv_p1_test.cxx
@@ -51,7 +51,7 @@ public:
 
   }
 
-  static void set (TrigInDetTrackTruth& p, std::vector<HepMC::GenParticle*>& genPartVector, int ndx)
+  static void set (TrigInDetTrackTruth& p, std::vector<HepMC::GenParticlePtr>& genPartVector, int ndx)
   {
     int nstat = 1;
     p.m_nr_common_hits.resize (nstat);
@@ -101,10 +101,10 @@ void testit (const TrigInDetTrackTruthMap& trans1)
 }
 
 
-void test1(std::vector<HepMC::GenParticle*>& genPartVector)
+void test1(std::vector<HepMC::GenParticlePtr>& genPartVector)
 {
   std::cout << "test1\n";
-  const HepMC::GenParticle *particle = genPartVector.at(0);
+  auto particle = genPartVector.at(0);
   // Create HepMcParticleLink outside of leak check.
   HepMcParticleLink dummyHMPL(HepMC::barcode(particle),particle->parent_event()->event_number());
   assert(dummyHMPL.cptr()==particle);
@@ -145,7 +145,7 @@ void test1(std::vector<HepMC::GenParticle*>& genPartVector)
 int main()
 {
   ISvcLocator* pSvcLoc = nullptr;
-  std::vector<HepMC::GenParticle*> genPartVector;
+  std::vector<HepMC::GenParticlePtr> genPartVector;
   if (!Athena_test::initMcEventCollection(pSvcLoc, genPartVector)) {
     std::cerr << "This test can not be run" << std::endl;
     return 0;
-- 
GitLab