From fe31724ccb6f3b90b6bfa27d0c99720c969b3316 Mon Sep 17 00:00:00 2001
From: John Chapman <jchapman@cern.ch>
Date: Fri, 1 Mar 2024 11:58:01 +0100
Subject: [PATCH] Fix HepMcParticleLink_test compilation with HepMC2
 (ATLASSIM-7101)

---
 Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
index 521d4b38a09d..a8d149bbb9a2 100644
--- a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
+++ b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
@@ -894,7 +894,11 @@ namespace MCTesting {
     ASSERT_TRUE( testLink1d < testLink2d );
 
     // Make links to another GenParticle from the first GenEvent
+#ifdef HEPMC3
     HepMC::ConstGenParticlePtr particle3 = ge1.particles().at(3);
+ #else
+    HepMC::ConstGenParticlePtr particle3 = HepMC::barcode_to_particle(&ge1, 4);
+#endif
     // HepMcParticleLink built using a GenParticle pointer and the
     // position of the GenEvent.
     HepMcParticleLink testLink3a(particle3,dummyIndex1,
-- 
GitLab