diff --git a/Generators/GeneratorObjects/GeneratorObjects/HepMcParticleLink.h b/Generators/GeneratorObjects/GeneratorObjects/HepMcParticleLink.h
index b6fb73787bbcfc34b7c6285060fa51937bb23a33..938ec08cebc2fb7e882445448c917854cecbd8a0 100644
--- a/Generators/GeneratorObjects/GeneratorObjects/HepMcParticleLink.h
+++ b/Generators/GeneratorObjects/GeneratorObjects/HepMcParticleLink.h
@@ -22,6 +22,7 @@
 #include <iostream>
 #include <limits>  /* numeric_limits */
 #include <string>
+#include <vector>
 
 #include "AtlasHepMC/GenEvent_fwd.h"
 #include "AtlasHepMC/GenParticle_fwd.h"
@@ -523,6 +524,34 @@ public:
   index_type eventIndex() const;
 
 
+  /**
+   * @brief Return the event number of the GenEvent at the specified
+   *        position in the McEventCollection.
+   * @param position in the McEventCollection
+   * @param evColl McEventCollection type
+   * @param sg Target event store.
+   * Returns -999 when position is larger than the McEventCollection size
+   */
+  static int getEventNumberAtPosition (index_type position, EBC_EVCOLL evColl, const IProxyDict* sg);
+
+
+  /**
+   * @brief Return a vector of the positions in the McEventCollection of the
+   *        GenEvent(s) with a given event number.
+   * @param index the event number of the required GenEvent
+   * @param evColl McEventCollection type
+   * @param sg Target event store.
+   * Returns a vector containing only ExtendedBarCode::UNDEFINED FIXME when no event with the appropriate event_number was found.
+   * (Multiple entries in the vector is technically a bug, but can't be fixed until the HepMC3 migration.)
+   */
+  static std::vector<index_type> getEventPositionInCollection (index_type index, EBC_EVCOLL evColl, const IProxyDict* sg);
+
+  /**
+   * @brief Return the position in the McEventCollection of the
+   *        GenEvent pointed to by this HepMcParticleLink
+   * @param sg Target event store.
+   * FIXME - need to be able to flag when no event with the appropriate event_number was found.
+   */
   index_type getEventPositionInCollection (const IProxyDict* sg) const;
 
 
@@ -564,6 +593,16 @@ public:
   friend MsgStream& operator << (MsgStream&, const HepMcParticleLink&);
 
 
+  /**
+   * @brief Look up the event collection we're targeting.
+   * @param sg Target event store.
+   * @param evColl McEventCollection type
+   * May return nullptr if the collection is not found.
+   */
+  static const McEventCollection*
+  retrieveMcEventCollection (EBC_EVCOLL evColl, const IProxyDict* sg);
+
+
   /**
    * @brief Look up the event collection we're targeting.
    * @param sg Target event store.
@@ -575,10 +614,11 @@ public:
 
   /**
    * @brief Find the proxy for the target event collection.
+   * @param evColl McEventCollection type
    * @param sg Target event store.
    * May return nullptr if the collection is not found.
    */
-  SG::DataProxy* find_proxy (const IProxyDict* sg) const;
+  static SG::DataProxy* find_proxy (EBC_EVCOLL evColl, const IProxyDict* sg);
 
 
   /**
diff --git a/Generators/GeneratorObjects/share/HepMcParticleLink_test.ref b/Generators/GeneratorObjects/share/HepMcParticleLink_test.ref
index b7430df5df9969fb9ce9e54b348f54acc0787a7e..a0a4df283c29f9d5a647fcba5b5771845b825f7d 100644
--- a/Generators/GeneratorObjects/share/HepMcParticleLink_test.ref
+++ b/Generators/GeneratorObjects/share/HepMcParticleLink_test.ref
@@ -1,4 +1,4 @@
-[==========] Running 4 tests from 1 test case.
+[==========] Running 9 tests from 1 test case.
 [----------] Global test environment set-up.
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
@@ -10,7 +10,7 @@ EventLoopMgr      WARNING Unable to locate service "EventSelector"
 EventLoopMgr      WARNING No events will be processed from external input.
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr Ready
-[----------] 4 tests from HepMcParticleLink_test
+[----------] 9 tests from HepMcParticleLink_test
 [ RUN      ] HepMcParticleLink_test.old_test
 *** HepMcParticleLink_test starts ***
 ClassIDSvc           INFO  getRegistryEntries: read 817 CLIDRegistry entries for module ALL
@@ -21,12 +21,25 @@ HepMcParticleLink    INFO find_proxy: Using TruthEvent as McEventCollection key
 [ RUN      ] HepMcParticleLink_test.broken_event_link
 ClassIDSvc           INFO  getRegistryEntries: read 1070 CLIDRegistry entries for module ALL
 [       OK ] HepMcParticleLink_test.broken_event_link (1 ms)
-[ RUN      ] HepMcParticleLink_test.truth_event_link
-[       OK ] HepMcParticleLink_test.truth_event_link (0 ms)
+[ RUN      ] HepMcParticleLink_test.truth_event_link_first_event
+[       OK ] HepMcParticleLink_test.truth_event_link_first_event (0 ms)
+[ RUN      ] HepMcParticleLink_test.truth_event_link_second_event
+[       OK ] HepMcParticleLink_test.truth_event_link_second_event (0 ms)
+[ RUN      ] HepMcParticleLink_test.truth_event_link_third_event
+[       OK ] HepMcParticleLink_test.truth_event_link_third_event (0 ms)
+[ RUN      ] HepMcParticleLink_test.truth_event_link_fourth_event
+[       OK ] HepMcParticleLink_test.truth_event_link_fourth_event (0 ms)
+[ RUN      ] HepMcParticleLink_test.truth_event_link_delta_rays
+[       OK ] HepMcParticleLink_test.truth_event_link_delta_rays (0 ms)
+[ RUN      ] HepMcParticleLink_test.truth_event_link_cut_events
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+[       OK ] HepMcParticleLink_test.truth_event_link_cut_events (0 ms)
 [ RUN      ] HepMcParticleLink_test.max_event_number
 [       OK ] HepMcParticleLink_test.max_event_number (0 ms)
-[----------] 4 tests from HepMcParticleLink_test (54 ms total)
+[----------] 9 tests from HepMcParticleLink_test (54 ms total)
 
 [----------] Global test environment tear-down
-[==========] 4 tests from 1 test case ran. (176 ms total)
-[  PASSED  ] 4 tests.
+[==========] 9 tests from 1 test case ran. (176 ms total)
+[  PASSED  ] 9 tests.
diff --git a/Generators/GeneratorObjects/src/HepMcParticleLink.cxx b/Generators/GeneratorObjects/src/HepMcParticleLink.cxx
index 5a6aa6abfb9a73a464aee9d64a38362bb4355b54..7bdf4195f06f27c822c83ee611329809e8a6aa62 100644
--- a/Generators/GeneratorObjects/src/HepMcParticleLink.cxx
+++ b/Generators/GeneratorObjects/src/HepMcParticleLink.cxx
@@ -170,7 +170,7 @@ const HepMC::GenParticle* HepMcParticleLink::cptr() const
   const IProxyDict* sg = nullptr;
   const HepMC::GenParticle* p = m_ptrs.get (sg);
   if (!p) {
-    if (0 == barcode() || 0x7fffffff == barcode()) {
+    if (0 == barcode()) {
 #if 0
       MsgStream log (Athena::getMessageSvc(), "HepMcParticleLink");
       log << MSG::DEBUG
@@ -179,6 +179,9 @@ const HepMC::GenParticle* HepMcParticleLink::cptr() const
 #endif
       return nullptr;
     }
+    if (!sg) {
+      sg = SG::CurrentEventStore::store();
+    }
     if (const McEventCollection* pEvtColl = retrieveMcEventCollection(sg)) {
       const HepMC::GenEvent *pEvt = nullptr;
       index_type index, position;
@@ -204,15 +207,23 @@ const HepMC::GenParticle* HepMcParticleLink::cptr() const
 
       if (0 != pEvt) {
         p = pEvt->barcode_to_particle(barcode());
-        m_ptrs.set (sg, p);
+        if (p) {
+          m_ptrs.set (sg, p);
+        }
         if (position != ExtendedBarCode::UNDEFINED) {
           m_extBarcode.makeIndex (pEvt->event_number(), position);
         }
       } else {
         MsgStream log (Athena::getMessageSvc(), "HepMcParticleLink");
-        log << MSG::WARNING
-            << "cptr: Mc Truth not stored for event " << eventIndex()
+        if (position != ExtendedBarCode::UNDEFINED) {
+          log << MSG::WARNING
+            << "cptr: Mc Truth not stored for event at " << position
+            << endmsg;
+        } else {
+          log << MSG::WARNING
+            << "cptr: Mc Truth not stored for event with event number " << index
             << endmsg;
+        }
       }
     } else {
       MsgStream log (Athena::getMessageSvc(), "HepMcParticleLink");
@@ -232,16 +243,45 @@ HepMcParticleLink::index_type HepMcParticleLink::eventIndex() const
   index_type index, position;
   m_extBarcode.eventIndex (index, position);
   if (index == ExtendedBarCode::UNDEFINED) {
-    // Don't trip the assertion for a null link.
-    if (barcode() == 0 || barcode() == 0x7fffffff) return 0;
-    cptr();
-    m_extBarcode.eventIndex (index, position);
-    assert (index != ExtendedBarCode::UNDEFINED);
+    const HepMC::GenEvent* pEvt{};
+    const IProxyDict* sg{};
+    const HepMC::GenParticle* p = m_ptrs.get (sg);
+    if (const McEventCollection* coll = retrieveMcEventCollection (getEventCollection(),sg)) {
+      if (position < coll->size()) {
+        pEvt = coll->at (position);
+      }
+      if (pEvt) {
+        const int event_number = pEvt->event_number();
+        p = pEvt->barcode_to_particle(barcode());
+        if (p) {
+          m_ptrs.set (sg, p);
+        }
+        if(event_number>-1) {
+          index = static_cast<index_type>(event_number);
+          m_extBarcode.makeIndex (index, HepMcParticleLink::IS_INDEX);
+          return index;
+        }
+      }
+    }
+  }
+  // Don't trip the assertion for a null link.
+  if (barcode() == 0 ) {  // || barcode() == 0x7fffffff)
+    if (index != ExtendedBarCode::UNDEFINED) {
+      return index;
+    }
+    return 0;
   }
+  cptr();
+  m_extBarcode.eventIndex (index, position);
+  assert (index != ExtendedBarCode::UNDEFINED);
   return index;
 }
 
 
+/**
+ * @brief Return the position in the McEventCollection of the
+ *        (first) GenEvent with a given event number
+ */
 HepMcParticleLink::index_type
 HepMcParticleLink::getEventPositionInCollection (const IProxyDict* sg) const
 {
@@ -254,20 +294,56 @@ HepMcParticleLink::getEventPositionInCollection (const IProxyDict* sg) const
     return 0;
   }
 
+  EBC_EVCOLL evColl = getEventCollection();
+  std::vector<index_type> positions = getEventPositionInCollection(index, evColl, sg);
+  return positions[0];
+}
+
+
+/**
+ * @brief Return the position in the McEventCollection of the
+ *        (first) GenEvent with a given event number
+ */
+std::vector<HepMcParticleLink::index_type>
+HepMcParticleLink::getEventPositionInCollection (index_type index, EBC_EVCOLL evColl, const IProxyDict* sg)
+{
+  std::vector<index_type> positions; positions.reserve(1);
   const int intIndex = static_cast<int>(index);
-  const McEventCollection* coll = retrieveMcEventCollection (sg);
-  size_t sz = coll->size();
-  for (size_t i = 0; i < sz; i++) {
-    if ((*coll)[i]->event_number() == intIndex) {
-      return i;
+  if (const McEventCollection* coll = retrieveMcEventCollection (evColl,sg)) {
+    size_t sz = coll->size();
+    for (size_t i = 0; i < sz; i++) {
+      if ((*coll)[i]->event_number() == intIndex) {
+        positions.push_back(i);
+      }
     }
   }
+  if (positions.empty() ) {
+    positions.push_back(ExtendedBarCode::UNDEFINED);
+  }
+  return positions;
+}
+
 
-  return ExtendedBarCode::UNDEFINED;
+/**
+ * @brief Return the event number of the GenEvent at the specified
+ *        position in the McEventCollection.
+ */
+int HepMcParticleLink::getEventNumberAtPosition (index_type position, EBC_EVCOLL evColl, const IProxyDict* sg)
+{
+  if (const McEventCollection* coll = retrieveMcEventCollection (evColl,sg)) {
+    if (position < coll->size()) {
+      return coll->at (position)->event_number();
+    }
+  }
+#if 0
+  MsgStream log (Athena::getMessageSvc(), "HepMcParticleLink");
+  log << MSG::WARNING << "getEventNumberAtPosition: position = " << position << ", McEventCollection size = "<< coll->size() << endmsg;
+#endif
+  return -999;
 }
 
 
-/** 
+/**
  * @brief Return the corresponding enum from a McEventCollection name.
  */
 EBC_EVCOLL HepMcParticleLink::find_enumFromKey (const std::string& evCollName)
@@ -297,14 +373,15 @@ void HepMcParticleLink::setExtendedBarCode (const ExtendedBarCode& extBarcode)
 
 /**
  * @brief Look up the event collection we're targeting.
+ * @param evColl McEventCollection type
  * @param sg Target event store.
  * May return nullptr if the collection is not found.
  */
 const McEventCollection*
-HepMcParticleLink::retrieveMcEventCollection (const IProxyDict* sg) const
+HepMcParticleLink::retrieveMcEventCollection (EBC_EVCOLL evColl, const IProxyDict* sg)
 {
   const McEventCollection* pEvtColl = nullptr;
-  SG::DataProxy* proxy = find_proxy (sg);
+  SG::DataProxy* proxy = find_proxy (evColl, sg);
   if (proxy) {
     pEvtColl = SG::DataProxy_cast<McEventCollection> (proxy);
     if (!pEvtColl) {
@@ -315,16 +392,27 @@ HepMcParticleLink::retrieveMcEventCollection (const IProxyDict* sg) const
   return pEvtColl;
 }
 
+/**
+ * @brief Look up the event collection we're targeting.
+ * @param sg Target event store.
+ * May return nullptr if the collection is not found.
+ */
+const McEventCollection*
+HepMcParticleLink::retrieveMcEventCollection (const IProxyDict* sg) const
+{
+  EBC_EVCOLL evColl = getEventCollection();
+  return retrieveMcEventCollection(evColl, sg);
+}
+
 
 /**
  * @brief Find the proxy for the target event collection.
  * @param sg Target event store.
  * May return nullptr if the collection is not found.
  */
-SG::DataProxy* HepMcParticleLink::find_proxy (const IProxyDict* sg) const
+SG::DataProxy* HepMcParticleLink::find_proxy (EBC_EVCOLL evColl, const IProxyDict* sg)
 {
   const CLID clid = ClassID_traits<McEventCollection>::ID();
-  EBC_EVCOLL evColl = getEventCollection();
   assert (evColl < EBC_NCOLLKINDS);
   unsigned int hint_orig = s_hints[evColl];
   if (hint_orig >= NKEYS) hint_orig = 0;
diff --git a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
index 3f33ea31b82122dac032e20f15374fa916bf3ca7..1bc22655368edd4f3d61c304858eee927b8ec5fc 100644
--- a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
+++ b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
@@ -10,6 +10,7 @@
 #undef NDEBUG
 
 #include <iostream>
+#include <limits>
 #include <list>
 // Framework
 #include "TestTools/initGaudi.h"
@@ -50,6 +51,9 @@ namespace MCTesting {
     }
 
     virtual void TearDown() override {
+      StoreGateSvc* pStore(nullptr);
+      ASSERT_TRUE(MCTesting::g_svcLoc->service("StoreGateSvc", pStore).isSuccess());
+      pStore->clearStore(true).ignore(); // forceRemove=true to remove all proxies
     }
   };
 
@@ -178,6 +182,55 @@ namespace MCTesting {
     return inParticle4;
   }
 
+  HepMC::GenParticle* populateFilteredGenEvent(HepMC::GenEvent & ge)
+  {
+    //.......Create new particle (geantino) to link  hits from pileup
+    HepMC::GenParticle* genPart=new HepMC::GenParticle();
+    genPart->set_pdg_id(999); //Geantino
+    genPart->set_status(1); //!< set decay status
+    genPart->suggest_barcode( std::numeric_limits<int32_t>::max() );
+
+    HepMC::GenVertex* genVertex=new HepMC::GenVertex();
+    genVertex->add_particle_out(genPart);
+
+    //to set geantino vertex as a truth primary vertex
+    HepMC::GenVertex* hScatVx = ge.barcode_to_vertex(-3);
+    if(hScatVx!=nullptr) {
+      HepMC::FourVector pmvxpos=hScatVx->position();
+      genVertex->set_position(pmvxpos);
+      //to set geantino kinematic phi=eta=0, E=p=E_hard_scat
+      HepMC::GenVertex::particles_in_const_iterator itrp =hScatVx->particles_in_const_begin();
+      if (hScatVx->particles_in_size()==2){
+        HepMC::FourVector mom1=(*itrp)->momentum();
+        HepMC::FourVector mom2=(*(++itrp))->momentum();
+        HepMC::FourVector vxmom;
+        vxmom.setPx(mom1.e()+mom2.e());
+        vxmom.setPy(0.);
+        vxmom.setPz(0.);
+        vxmom.setE(mom1.e()+mom2.e());
+
+        genPart->set_momentum(vxmom);
+      }
+    }
+
+    if(!ge.vertices_empty()){
+      std::vector<HepMC::GenVertex *> vtxvec;
+      HepMC::GenEvent::vertex_iterator itvtx = ge.vertices_begin();
+      for (;itvtx != ge.vertices_end(); ++itvtx ) {
+        ge.remove_vertex(*itvtx);
+        vtxvec.push_back((*itvtx));
+        //fix me: delete vertex pointer causes crash
+        //delete (*itvtx);
+      }
+      for(unsigned int i=0;i<vtxvec.size();i++)  delete vtxvec[i];
+    }
+
+    //.....add new vertex with geantino
+    ge.add_vertex(genVertex);
+
+    return genPart;
+  }
+
   TEST_F(HepMcParticleLink_test, old_test) {
     std::cout << "*** HepMcParticleLink_test starts ***" <<std::endl;
 
@@ -203,7 +256,7 @@ namespace MCTesting {
     HepMcParticleLink gammaLink12(pGamma->barcode(), 1);
 
     std::cout << "Testing HepMcParticleLink streamer "
-         << gammaLink1 << " --- " << gammaLink11 <<std::endl;
+              << gammaLink1 << " --- " << gammaLink11 <<std::endl;
 
 
 #ifdef GENP_DEBUG
@@ -222,9 +275,6 @@ namespace MCTesting {
     ASSERT_EQ(*gammaLink1, *gammaLink11);
     ASSERT_NE( gammaLink1, gammaLink11 ); //FIXME weird! Can't check ptr...
     ASSERT_LT( gammaLink1, gammaLink11 );  //FIXME weird! Can't check ptr...
-    StoreGateSvc* pStore(nullptr);
-    ASSERT_TRUE(MCTesting::g_svcLoc->service("StoreGateSvc", pStore).isSuccess());
-    pStore->clearStore(true).ignore(); // forceRemove=true to remove all proxies
     std::cout << "*** HepMcParticleLink_test OK ***" <<std::endl;
   }
 
@@ -245,12 +295,9 @@ namespace MCTesting {
     // the GenEvent in the McEventCollection should still work.
     HepMcParticleLink testLink1b(particle1->barcode(),0);
     ASSERT_TRUE( testLink1b.isValid() );
-    StoreGateSvc* pStore(nullptr);
-    ASSERT_TRUE(MCTesting::g_svcLoc->service("StoreGateSvc", pStore).isSuccess());
-    pStore->clearStore(true).ignore(); // forceRemove=true to remove all proxies
   }
 
-  TEST_F(HepMcParticleLink_test, truth_event_link) {
+  TEST_F(HepMcParticleLink_test, truth_event_link_first_event) {
     // create dummy input McEventCollection with a name that
     // HepMcParticleLink knows about
     SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"};
@@ -268,25 +315,28 @@ namespace MCTesting {
     const int process_id2(20);
     const int event_number2(25);
     inputTestDataHandle->push_back(new HepMC::GenEvent(process_id2, event_number2));
-    const HepMcParticleLink::index_type dummyIndex2(1);
-    const HepMcParticleLink::index_type refEvtNum2 = static_cast<HepMcParticleLink::index_type>(event_number2);
     HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1));
-    const HepMC::GenParticle* particle2 = populateGenEvent2(ge2);
+    (void)populateGenEvent2(ge2);
     // Add a third dummy GenEvent (identical to the first)
     const int process_id3(20);
     const int event_number3(17);
     inputTestDataHandle->push_back(new HepMC::GenEvent(process_id3, event_number3));
-    const HepMcParticleLink::index_type dummyIndex3(2);
-    const HepMcParticleLink::index_type refEvtNum3 = static_cast<HepMcParticleLink::index_type>(event_number3);
     HepMC::GenEvent& ge3 = *(inputTestDataHandle->at(2));
-    const HepMC::GenParticle* particle3 = populateGenEvent(ge3);
+    (void)populateGenEvent(ge3);
+
+    const int event_number4(89);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(ge1));
+    HepMC::GenEvent& ge4 = *(inputTestDataHandle->at(3));
+    ge4.set_event_number(event_number4);
+    (void)populateFilteredGenEvent(ge4);
 
-    //Testing links to the first dummy GenEvent
     const IProxyDict* sg = SG::CurrentEventStore::store();
 
+    //Testing links to the first dummy GenEvent
+
     // HepMcParticleLink built using a GenParticle pointer and the
     // position of the GenEvent.
-    HepMcParticleLink testLink1a(particle1,0, EBC_MAINEVCOLL,
+    HepMcParticleLink testLink1a(particle1,dummyIndex1, EBC_MAINEVCOLL,
                                  HepMcParticleLink::IS_POSITION);
     ASSERT_TRUE( testLink1a.isValid() );
     ASSERT_EQ( particle1->barcode(), testLink1a.barcode());
@@ -295,7 +345,7 @@ namespace MCTesting {
     ASSERT_EQ(particle1,testLink1a.cptr());
     // A HepMcParticleLink built using the barcode and the position of
     // the GenEvent.
-    HepMcParticleLink testLink1b(particle1->barcode(),0, EBC_MAINEVCOLL,
+    HepMcParticleLink testLink1b(particle1->barcode(),dummyIndex1, EBC_MAINEVCOLL,
                                  HepMcParticleLink::IS_POSITION);
     ASSERT_TRUE( testLink1b.isValid() );
     ASSERT_EQ( particle1->barcode(), testLink1b.barcode());
@@ -320,12 +370,48 @@ namespace MCTesting {
     ASSERT_EQ( refEvtNum1, testLink1d.eventIndex());
     ASSERT_EQ( dummyIndex1, testLink1d.getEventPositionInCollection(sg));
     ASSERT_EQ(particle1,testLink1d.cptr());
+  }
+
+  TEST_F(HepMcParticleLink_test, truth_event_link_second_event) {
+    // create dummy input McEventCollection with a name that
+    // HepMcParticleLink knows about
+    SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"};
+    inputTestDataHandle = std::make_unique<McEventCollection>();
+
+    // Add a dummy GenEvent
+    const int process_id1(20);
+    const int event_number1(17);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1));
+    HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0));
+    (void)populateGenEvent(ge1);
+    // Add a second dummy GenEvent
+    const int process_id2(20);
+    const int event_number2(25);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(process_id2, event_number2));
+    const HepMcParticleLink::index_type dummyIndex2(1);
+    const HepMcParticleLink::index_type refEvtNum2 = static_cast<HepMcParticleLink::index_type>(event_number2);
+    HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1));
+    const HepMC::GenParticle* particle2 = populateGenEvent2(ge2);
+    // Add a third dummy GenEvent (identical to the first)
+    const int process_id3(20);
+    const int event_number3(17);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(process_id3, event_number3));
+    HepMC::GenEvent& ge3 = *(inputTestDataHandle->at(2));
+    (void)populateGenEvent(ge3);
+
+    const int event_number4(89);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(ge1));
+    HepMC::GenEvent& ge4 = *(inputTestDataHandle->at(3));
+    ge4.set_event_number(event_number4);
+    (void)populateFilteredGenEvent(ge4);
+
+    const IProxyDict* sg = SG::CurrentEventStore::store();
 
     //Testing links to the second dummy GenEvent
 
     // HepMcParticleLink built using a GenParticle pointer and the
     // position of the GenEvent.
-    HepMcParticleLink testLink2a(particle2,1, EBC_MAINEVCOLL,
+    HepMcParticleLink testLink2a(particle2, dummyIndex2, EBC_MAINEVCOLL,
                                  HepMcParticleLink::IS_POSITION);
     ASSERT_TRUE( testLink2a.isValid() );
     ASSERT_EQ( particle2->barcode(), testLink2a.barcode());
@@ -334,7 +420,7 @@ namespace MCTesting {
     ASSERT_EQ(particle2,testLink2a.cptr());
     // A HepMcParticleLink built using the barcode and the position of
     // the GenEvent.
-    HepMcParticleLink testLink2b(particle2->barcode(),1, EBC_MAINEVCOLL,
+    HepMcParticleLink testLink2b(particle2->barcode(), dummyIndex2, EBC_MAINEVCOLL,
                                  HepMcParticleLink::IS_POSITION);
     ASSERT_TRUE( testLink2b.isValid() );
     ASSERT_EQ( particle2->barcode(), testLink2b.barcode());
@@ -359,12 +445,47 @@ namespace MCTesting {
     ASSERT_EQ( refEvtNum2, testLink2d.eventIndex());
     ASSERT_EQ( dummyIndex2, testLink2d.getEventPositionInCollection(sg));
     ASSERT_EQ(particle2,testLink2d.cptr());
+  }
+
+  TEST_F(HepMcParticleLink_test, truth_event_link_third_event) {
+    // create dummy input McEventCollection with a name that
+    // HepMcParticleLink knows about
+    SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"};
+    inputTestDataHandle = std::make_unique<McEventCollection>();
+
+    // Add a dummy GenEvent
+    const int process_id1(20);
+    const int event_number1(17);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1));
+    HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0));
+    const HepMC::GenParticle* particle1 = populateGenEvent(ge1);
+    // Add a second dummy GenEvent
+    const int process_id2(20);
+    const int event_number2(25);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(process_id2, event_number2));
+    HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1));
+    (void)populateGenEvent2(ge2);
+    // Add a third dummy GenEvent (identical to the first)
+    const int process_id3(20);
+    const int event_number3(17);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(process_id3, event_number3));
+    const HepMcParticleLink::index_type dummyIndex3(2);
+    const HepMcParticleLink::index_type refEvtNum3 = static_cast<HepMcParticleLink::index_type>(event_number3);
+    HepMC::GenEvent& ge3 = *(inputTestDataHandle->at(2));
+    const HepMC::GenParticle* particle3 = populateGenEvent(ge3);
+
+    const int event_number4(89);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(ge1));
+    HepMC::GenEvent& ge4 = *(inputTestDataHandle->at(3));
+    ge4.set_event_number(event_number4);
+    (void)populateFilteredGenEvent(ge4);
+
 
     //Testing links to the third dummy GenEvent
 
     // HepMcParticleLink built using a GenParticle pointer and the
     // position of the GenEvent.
-    HepMcParticleLink testLink3a(particle3,2, EBC_MAINEVCOLL,
+    HepMcParticleLink testLink3a(particle3, dummyIndex3, EBC_MAINEVCOLL,
                                  HepMcParticleLink::IS_POSITION);
     ASSERT_TRUE( testLink3a.isValid() );
     ASSERT_EQ( particle3->barcode(), testLink3a.barcode());
@@ -372,7 +493,7 @@ namespace MCTesting {
     ASSERT_EQ(particle3,testLink3a.cptr());
     // A HepMcParticleLink built using the barcode and the position of
     // the GenEvent.
-    HepMcParticleLink testLink3b(particle3->barcode(),2, EBC_MAINEVCOLL,
+    HepMcParticleLink testLink3b(particle3->barcode(), dummyIndex3, EBC_MAINEVCOLL,
                                  HepMcParticleLink::IS_POSITION);
     ASSERT_TRUE( testLink3b.isValid() );
     ASSERT_EQ( particle3->barcode(), testLink3b.barcode());
@@ -395,10 +516,227 @@ namespace MCTesting {
     ASSERT_EQ( refEvtNum3, testLink3d.eventIndex());
     ASSERT_NE(particle3,testLink3d.cptr());
     ASSERT_EQ(particle1,testLink3d.cptr()); //POINTS AT THE IDENTICAL PARTICLE IN FIRST GenEvent!!
+  }
+
+  TEST_F(HepMcParticleLink_test, truth_event_link_fourth_event) {
+    // create dummy input McEventCollection with a name that
+    // HepMcParticleLink knows about
+    SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"};
+    inputTestDataHandle = std::make_unique<McEventCollection>();
+
+    // Add a dummy GenEvent
+    const int process_id1(20);
+    const int event_number1(17);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1));
+    HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0));
+    (void)populateGenEvent(ge1);
+    // Add a second dummy GenEvent
+    const int process_id2(20);
+    const int event_number2(25);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(process_id2, event_number2));
+    HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1));
+    (void)populateGenEvent2(ge2);
+    // Add a third dummy GenEvent (identical to the first)
+    const int process_id3(20);
+    const int event_number3(17);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(process_id3, event_number3));
+    HepMC::GenEvent& ge3 = *(inputTestDataHandle->at(2));
+    (void)populateGenEvent(ge3);
+
+    const int event_number4(89);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(ge1));
+    const HepMcParticleLink::index_type dummyIndex4(3);
+    const HepMcParticleLink::index_type refEvtNum4 = static_cast<HepMcParticleLink::index_type>(event_number4);
+    HepMC::GenEvent& ge4 = *(inputTestDataHandle->at(3));
+    ge4.set_event_number(event_number4);
+    const HepMC::GenParticle* particle4 = populateFilteredGenEvent(ge4);
+
+    const IProxyDict* sg = SG::CurrentEventStore::store();
+
+    // Testing links to the fourth GenEvent - filtered pile-up truth
 
-    StoreGateSvc* pStore(nullptr);
-    ASSERT_TRUE(MCTesting::g_svcLoc->service("StoreGateSvc", pStore).isSuccess());
-    pStore->clearStore(true).ignore(); // forceRemove=true to remove all proxies
+    // HepMcParticleLink built using a GenParticle pointer and the
+    // event_number of the GenEvent.
+    HepMcParticleLink testLink4a(particle4,event_number4);
+    ASSERT_TRUE( testLink4a.isValid() );
+    ASSERT_EQ( particle4->barcode(), testLink4a.barcode());
+    ASSERT_EQ( refEvtNum4, testLink4a.eventIndex());
+    ASSERT_EQ( dummyIndex4, testLink4a.getEventPositionInCollection(sg));
+    ASSERT_EQ( particle4, testLink4a.cptr());
+    // A HepMcParticleLink built using the barcode and the event_number of
+    // the GenEvent.
+    HepMcParticleLink testLink4b(particle4->barcode(),event_number4);
+    ASSERT_TRUE( testLink4b.isValid() );
+    ASSERT_EQ( particle4->barcode(), testLink4b.barcode());
+    ASSERT_EQ( refEvtNum4, testLink4b.eventIndex());
+    ASSERT_EQ( dummyIndex4, testLink4a.getEventPositionInCollection(sg));
+    ASSERT_EQ( particle4, testLink4b.cptr());
+    // HepMcParticleLink built using a GenParticle pointer and the
+    // position of the GenEvent.
+    HepMcParticleLink testLink4c(particle4, dummyIndex4, EBC_MAINEVCOLL,
+                                 HepMcParticleLink::IS_POSITION);
+    ASSERT_TRUE( testLink4c.isValid() );
+    ASSERT_EQ( particle4->barcode(), testLink4c.barcode());
+    ASSERT_EQ( refEvtNum4, testLink4c.eventIndex());
+    ASSERT_EQ( dummyIndex4, testLink4c.getEventPositionInCollection(sg));
+    ASSERT_EQ( particle4, testLink4c.cptr());
+
+    // A HepMcParticleLink built using the barcode and the position of
+    // the GenEvent.
+    HepMcParticleLink testLink4d(particle4->barcode(), dummyIndex4, EBC_MAINEVCOLL,
+                                 HepMcParticleLink::IS_POSITION);
+    ASSERT_TRUE( testLink4d.isValid() );
+    ASSERT_EQ( particle4->barcode(), testLink4d.barcode());
+    ASSERT_EQ( refEvtNum4, testLink4d.eventIndex());
+    ASSERT_EQ( dummyIndex4, testLink4d.getEventPositionInCollection(sg));
+    ASSERT_EQ( particle4, testLink4d.cptr());
+  }
+
+  TEST_F(HepMcParticleLink_test, truth_event_link_delta_rays) {
+    // create dummy input McEventCollection with a name that
+    // HepMcParticleLink knows about
+    SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"};
+    inputTestDataHandle = std::make_unique<McEventCollection>();
+
+    // Add a dummy GenEvent
+    const int process_id1(20);
+    const int event_number1(17);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1));
+    const HepMcParticleLink::index_type dummyIndex1(0);
+    const HepMcParticleLink::index_type refEvtNum1 = static_cast<HepMcParticleLink::index_type>(event_number1);
+    HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0));
+    (void)populateGenEvent(ge1);
+    // Add a second dummy GenEvent
+    const int process_id2(20);
+    const int event_number2(25);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(process_id2, event_number2));
+    const HepMcParticleLink::index_type dummyIndex2(1);
+    const HepMcParticleLink::index_type refEvtNum2 = static_cast<HepMcParticleLink::index_type>(event_number2);
+    HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1));
+    (void)populateGenEvent2(ge2);
+    // Add a third dummy GenEvent (identical to the first)
+    const int process_id3(20);
+    const int event_number3(17);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(process_id3, event_number3));
+    HepMC::GenEvent& ge3 = *(inputTestDataHandle->at(2));
+    (void)populateGenEvent(ge3);
+
+    const int event_number4(89);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(ge1));
+    HepMC::GenEvent& ge4 = *(inputTestDataHandle->at(3));
+    ge4.set_event_number(event_number4);
+    (void)populateFilteredGenEvent(ge4);
+
+    const IProxyDict* sg = SG::CurrentEventStore::store();
+
+    // Testing Links to delta-rays (barcode=0) - not recorded in McEventCollection
+    const int deltaRayBarcode(0);
+    HepMC::GenParticle *deltaRayPtr{};
+
+    // HepMcParticleLink built using a delta-ray barcode and the event_number of
+    // the GenEvent.
+    HepMcParticleLink testLink5a(deltaRayBarcode, refEvtNum1);
+    ASSERT_EQ( refEvtNum1, testLink5a.eventIndex());
+    ASSERT_FALSE( testLink5a.isValid() );
+    ASSERT_EQ( deltaRayBarcode, testLink5a.barcode());
+    ASSERT_EQ( dummyIndex1, testLink5a.getEventPositionInCollection(sg));
+    ASSERT_EQ( deltaRayPtr, testLink5a.cptr());
+
+    // HepMcParticleLink built using a delta-ray barcode and the event_number of
+    // the GenEvent. GenEvent not recorded
+    const int event_number5(460);
+    const HepMcParticleLink::index_type refEvtNum5 = static_cast<HepMcParticleLink::index_type>(event_number5);
+    HepMcParticleLink testLink5b(deltaRayBarcode, refEvtNum5);
+    ASSERT_FALSE( testLink5b.isValid() );
+    ASSERT_EQ( deltaRayBarcode, testLink5b.barcode());
+    ASSERT_EQ( refEvtNum5, testLink5b.eventIndex());
+    ASSERT_EQ( HepMcParticleLink:: ExtendedBarCode::UNDEFINED, testLink5b.getEventPositionInCollection(sg));
+    ASSERT_EQ( deltaRayPtr, testLink5b.cptr());
+
+    // HepMcParticleLink built using a delta-ray barcode and the
+    // position of the GenEvent.
+    HepMcParticleLink testLink5c(deltaRayBarcode, dummyIndex1, EBC_MAINEVCOLL,
+                                 HepMcParticleLink::IS_POSITION);
+    ASSERT_FALSE( testLink5c.isValid() );
+    ASSERT_EQ( deltaRayBarcode, testLink5c.barcode());
+    ASSERT_EQ( refEvtNum1, testLink5c.eventIndex());
+    ASSERT_EQ( dummyIndex1, testLink5c.getEventPositionInCollection(sg));
+    ASSERT_EQ( deltaRayPtr, testLink5c.cptr());
+
+    // HepMcParticleLink built using a delta-ray barcode and the
+    // position of the GenEvent.
+    HepMcParticleLink testLink5d(deltaRayBarcode, dummyIndex2, EBC_MAINEVCOLL,
+                                 HepMcParticleLink::IS_POSITION);
+    ASSERT_FALSE( testLink5d.isValid() );
+    ASSERT_EQ( deltaRayBarcode, testLink5d.barcode());
+    ASSERT_EQ( refEvtNum2, testLink5d.eventIndex());
+    ASSERT_EQ( dummyIndex2, testLink5d.getEventPositionInCollection(sg));
+    ASSERT_EQ( deltaRayPtr, testLink5d.cptr());
+  }
+
+  TEST_F(HepMcParticleLink_test, truth_event_link_cut_events) {
+    // create dummy input McEventCollection with a name that
+    // HepMcParticleLink knows about
+    SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"};
+    inputTestDataHandle = std::make_unique<McEventCollection>();
+
+    // Add a dummy GenEvent
+    const int process_id1(20);
+    const int event_number1(17);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1));
+    const HepMcParticleLink::index_type dummyIndex1(0);
+    const HepMcParticleLink::index_type refEvtNum1 = static_cast<HepMcParticleLink::index_type>(event_number1);
+    HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0));
+    (void)populateGenEvent(ge1);
+    // Add a second dummy GenEvent
+    const int process_id2(20);
+    const int event_number2(25);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(process_id2, event_number2));
+    HepMC::GenEvent& ge2 = *(inputTestDataHandle->at(1));
+    (void)populateGenEvent2(ge2);
+    // Add a third dummy GenEvent (identical to the first)
+    const int process_id3(20);
+    const int event_number3(17);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(process_id3, event_number3));
+    HepMC::GenEvent& ge3 = *(inputTestDataHandle->at(2));
+    (void)populateGenEvent(ge3);
+
+    const int event_number4(89);
+    inputTestDataHandle->push_back(new HepMC::GenEvent(ge1));
+    HepMC::GenEvent& ge4 = *(inputTestDataHandle->at(3));
+    ge4.set_event_number(event_number4);
+    (void)populateFilteredGenEvent(ge4);
+
+    //Testing links to the first dummy GenEvent
+    const IProxyDict* sg = SG::CurrentEventStore::store();
+
+    // Links to GenParticles which were not copied to the current McEventCollection
+
+    // Info about a GenParticle/GenEvent which is not part of the
+    // McEventCollection. For example if pile-up truth was not
+    // recorded.
+    const int event_number5(460);
+    const HepMcParticleLink::index_type refEvtNum5 = static_cast<HepMcParticleLink::index_type>(event_number5);
+    const int cutBarcode(210001);
+    const HepMC::GenParticle* cutParticlePtr{};
+
+    // Link to a GenParticle which was not recorded to the
+    // McEventCollection, even though other parts of the same GenEvent
+    // were recorded.
+    HepMcParticleLink testLink6a(cutBarcode, refEvtNum1);
+    ASSERT_FALSE( testLink6a.isValid() );
+    ASSERT_EQ( cutBarcode, testLink6a.barcode());
+    ASSERT_EQ( refEvtNum1, testLink6a.eventIndex());
+    ASSERT_EQ( dummyIndex1, testLink6a.getEventPositionInCollection(sg));
+    ASSERT_EQ( cutParticlePtr, testLink6a.cptr());
+
+    // Link to a GenEvent which was not recorded to the McEventCollection
+    HepMcParticleLink testLink6b(cutBarcode, refEvtNum5);
+    ASSERT_FALSE( testLink6b.isValid() );
+    ASSERT_EQ( cutBarcode, testLink6b.barcode());
+    ASSERT_EQ( refEvtNum5, testLink6b.eventIndex());
+    ASSERT_EQ( HepMcParticleLink:: ExtendedBarCode::UNDEFINED, testLink6b.getEventPositionInCollection(sg));
+    ASSERT_EQ( cutParticlePtr, testLink6b.cptr());
   }
 
   TEST_F(HepMcParticleLink_test, max_event_number) {
@@ -438,7 +776,7 @@ namespace MCTesting {
 
     // HepMcParticleLink built using a GenParticle pointer and the
     // position of the GenEvent.
-    HepMcParticleLink testLink1a(particle1,0, EBC_MAINEVCOLL,
+    HepMcParticleLink testLink1a(particle1, dummyIndex1, EBC_MAINEVCOLL,
                                  HepMcParticleLink::IS_POSITION);
     ASSERT_TRUE( testLink1a.isValid() );
     ASSERT_EQ( particle1->barcode(), testLink1a.barcode());
@@ -447,7 +785,7 @@ namespace MCTesting {
     ASSERT_EQ(particle1,testLink1a.cptr());
     // A HepMcParticleLink built using the barcode and the position of
     // the GenEvent.
-    HepMcParticleLink testLink1b(particle1->barcode(),0, EBC_MAINEVCOLL,
+    HepMcParticleLink testLink1b(particle1->barcode(), dummyIndex1, EBC_MAINEVCOLL,
                                  HepMcParticleLink::IS_POSITION);
     ASSERT_TRUE( testLink1b.isValid() );
     ASSERT_EQ( particle1->barcode(), testLink1b.barcode());
@@ -477,7 +815,7 @@ namespace MCTesting {
 
     // HepMcParticleLink built using a GenParticle pointer and the
     // position of the GenEvent.
-    HepMcParticleLink testLink2a(particle2,1, EBC_MAINEVCOLL,
+    HepMcParticleLink testLink2a(particle2, dummyIndex2, EBC_MAINEVCOLL,
                                  HepMcParticleLink::IS_POSITION);
     ASSERT_TRUE( testLink2a.isValid() );
     ASSERT_EQ( particle2->barcode(), testLink2a.barcode());
@@ -486,7 +824,7 @@ namespace MCTesting {
     ASSERT_EQ(particle2,testLink2a.cptr());
     // A HepMcParticleLink built using the barcode and the position of
     // the GenEvent.
-    HepMcParticleLink testLink2b(particle2->barcode(),1, EBC_MAINEVCOLL,
+    HepMcParticleLink testLink2b(particle2->barcode(), dummyIndex2, EBC_MAINEVCOLL,
                                  HepMcParticleLink::IS_POSITION);
     ASSERT_TRUE( testLink2b.isValid() );
     ASSERT_EQ( particle2->barcode(), testLink2b.barcode());
@@ -511,10 +849,6 @@ namespace MCTesting {
     ASSERT_EQ( refEvtNum2, testLink2d.eventIndex());
     ASSERT_EQ( dummyIndex2, testLink2d.getEventPositionInCollection(sg));
     ASSERT_EQ(particle2,testLink2d.cptr());
-
-    StoreGateSvc* pStore(nullptr);
-    ASSERT_TRUE(MCTesting::g_svcLoc->service("StoreGateSvc", pStore).isSuccess());
-    pStore->clearStore(true).ignore(); // forceRemove=true to remove all proxies
   }
 
 } // <-- namespace MCTesting
diff --git a/Generators/GeneratorObjectsTPCnv/share/HepMcParticleLinkCnv_p1_test.ref b/Generators/GeneratorObjectsTPCnv/share/HepMcParticleLinkCnv_p1_test.ref
index 075f1607b3a428f1d10a95404d8e0b80d6d77043..740fe2f0e3e80570c973f485f93e7c7106ce5181 100644
--- a/Generators/GeneratorObjectsTPCnv/share/HepMcParticleLinkCnv_p1_test.ref
+++ b/Generators/GeneratorObjectsTPCnv/share/HepMcParticleLinkCnv_p1_test.ref
@@ -12,3 +12,12 @@ ApplicationMgr Ready
 test1
 ClassIDSvc           INFO  getRegistryEntries: read 1853 CLIDRegistry entries for module ALL
 HepMcParticleLink    INFO find_proxy: Using TruthEvent as McEventCollection key for this job 
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
diff --git a/Generators/GeneratorObjectsTPCnv/share/HepMcParticleLinkCnv_p2_test.ref b/Generators/GeneratorObjectsTPCnv/share/HepMcParticleLinkCnv_p2_test.ref
index ad71efce4f8586494b63dcf78e897b1ef39ae84f..624d028db9a5bc83a408dac84101d2381197c7e4 100644
--- a/Generators/GeneratorObjectsTPCnv/share/HepMcParticleLinkCnv_p2_test.ref
+++ b/Generators/GeneratorObjectsTPCnv/share/HepMcParticleLinkCnv_p2_test.ref
@@ -12,3 +12,12 @@ ApplicationMgr Ready
 test1
 ClassIDSvc           INFO  getRegistryEntries: read 1853 CLIDRegistry entries for module ALL
 HepMcParticleLink    INFO find_proxy: Using TruthEvent as McEventCollection key for this job 
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
+HepMcParticleLink WARNING cptr: Mc Truth not stored for event with event number 460
diff --git a/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p1.cxx b/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p1.cxx
index a1b0d96df2aef5a70769780df608d0d84733490e..06809d4a80289174a0cf6b1a94e53e48783a2688 100755
--- a/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p1.cxx
+++ b/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p1.cxx
@@ -6,6 +6,8 @@
 
 // Framework includes
 #include "GaudiKernel/MsgStream.h"
+#include "GaudiKernel/ThreadLocalContext.h"
+#include "AthenaKernel/ExtendedEventContext.h"
 
 // GeneratorObjectsAthenaPool includes
 #include "GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p1.h"
@@ -54,8 +56,14 @@ void HepMcParticleLinkCnv_p1::transToPers( const HepMcParticleLink* transObj,
   // NB This method assumes that there all GenEvents are stored in a
   // single McEventCollection, as running with split
   // McEventCollections is not supported in 21.0.
+  const EventContext& ctx = Gaudi::Hive::currentContext();
+  const IProxyDict* proxy = Atlas::getExtendedEventContext(ctx).proxy();
   unsigned short index{0};
-  if (transObj->getEventPositionInCollection(SG::CurrentEventStore::store())!=0) {
+  const HepMcParticleLink::index_type position =
+    HepMcParticleLink::getEventPositionInCollection(transObj->eventIndex(),
+                                                    transObj->getEventCollection(),
+                                                    proxy).at(0);
+  if (position!=0) {
     index = transObj->eventIndex();
     if(transObj->eventIndex()!=static_cast<HepMcParticleLink::index_type>(index)) {
       msg << MSG::WARNING << "Attempting to persistify an eventIndex larger than max unsigned short!" << endmsg;
diff --git a/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p2.cxx b/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p2.cxx
index ea0693b4d5eaf5202228ae1e290f234da2d20fe9..d448d8cca25e65c1ab378bd32c247b658633cd76 100755
--- a/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p2.cxx
+++ b/Generators/GeneratorObjectsTPCnv/src/HepMcParticleLinkCnv_p2.cxx
@@ -6,6 +6,8 @@
 
 // Framework includes
 #include "GaudiKernel/MsgStream.h"
+#include "GaudiKernel/ThreadLocalContext.h"
+#include "AthenaKernel/ExtendedEventContext.h"
 
 // GeneratorObjectsAthenaPool includes
 #include "GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p2.h"
@@ -48,8 +50,14 @@ void HepMcParticleLinkCnv_p2::transToPers( const HepMcParticleLink* transObj,
   // m_mcEvtIndex of zero as a special case, in which m_mcEvtIndex
   // should be interpreted as the position in the McEventCollection
   // rather than the value of GenEvent::event_number().
+  const EventContext& ctx = Gaudi::Hive::currentContext();
+  const IProxyDict* proxy = Atlas::getExtendedEventContext(ctx).proxy();
   unsigned short index{0};
-  if (transObj->getEventPositionInCollection(SG::CurrentEventStore::store())!=0) {
+  const HepMcParticleLink::index_type position =
+    HepMcParticleLink::getEventPositionInCollection(transObj->eventIndex(),
+                                                    transObj->getEventCollection(),
+                                                    proxy).at(0);
+  if (position!=0) {
     index = transObj->eventIndex();
     if(transObj->eventIndex()!=static_cast<HepMcParticleLink::index_type>(index)) {
       msg << MSG::WARNING << "Attempting to persistify an eventIndex larger than max unsigned short!" << endmsg;
diff --git a/Generators/GeneratorObjectsTPCnv/src/initMcEventCollection.cxx b/Generators/GeneratorObjectsTPCnv/src/initMcEventCollection.cxx
index 4714e3d384374dc98b338b4cf4ada1e3ecf3c648..cbea6c770cee14d04a6998f5f45ee9e7876ffe4c 100644
--- a/Generators/GeneratorObjectsTPCnv/src/initMcEventCollection.cxx
+++ b/Generators/GeneratorObjectsTPCnv/src/initMcEventCollection.cxx
@@ -29,6 +29,12 @@ namespace Athena_test {
     // HepMcParticleLink knows about
     SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"};
     inputTestDataHandle = std::make_unique<McEventCollection>();
+
+    // create a dummy EventContext
+    EventContext ctx;
+    ctx.setExtension( Atlas::ExtendedEventContext( SG::CurrentEventStore::store() ) );
+    Gaudi::Hive::setCurrentContext( ctx );
+
     // Add a dummy GenEvent
     const int process_id1(20);
     const int event_number1(17);
diff --git a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx
index 937f83451d94de4223aad4ec2d2fb5421cba0122..cba5f66338a69b3d66e46093e1ca857758b10de5 100644
--- a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx
+++ b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx
@@ -59,12 +59,65 @@ void populateGenEvent(HepMC::GenEvent & ge, int pdgid1, int pdgid2, std::vector<
   ge.set_beam_particles(inParticle1,inParticle2);
 }
 
+void populateFilteredGenEvent(HepMC::GenEvent & ge, std::vector<HepMC::GenParticle*>& genPartList)
+{
+  //.......Create new particle (geantino) to link  hits from pileup
+  HepMC::GenParticle* genPart=new HepMC::GenParticle();
+  genPart->set_pdg_id(999); //Geantino
+  genPart->set_status(1); //!< set decay status
+  genPart->suggest_barcode( std::numeric_limits<int32_t>::max() );
+
+  HepMC::GenVertex* genVertex=new HepMC::GenVertex();
+  genVertex->add_particle_out(genPart);
+  genPartList.push_back(genPart);
+
+  //to set geantino vertex as a truth primary vertex
+  HepMC::GenVertex* hScatVx = ge.barcode_to_vertex(-3);
+  if(hScatVx!=nullptr) {
+    HepMC::FourVector pmvxpos=hScatVx->position();
+    genVertex->set_position(pmvxpos);
+    //to set geantino kinematic phi=eta=0, E=p=E_hard_scat
+    HepMC::GenVertex::particles_in_const_iterator itrp =hScatVx->particles_in_const_begin();
+    if (hScatVx->particles_in_size()==2){
+      HepMC::FourVector mom1=(*itrp)->momentum();
+      HepMC::FourVector mom2=(*(++itrp))->momentum();
+      HepMC::FourVector vxmom;
+      vxmom.setPx(mom1.e()+mom2.e());
+      vxmom.setPy(0.);
+      vxmom.setPz(0.);
+      vxmom.setE(mom1.e()+mom2.e());
+
+      genPart->set_momentum(vxmom);
+    }
+  }
+
+  if(!ge.vertices_empty()){
+    std::vector<HepMC::GenVertex *> vtxvec;
+    HepMC::GenEvent::vertex_iterator itvtx = ge.vertices_begin();
+    for (;itvtx != ge.vertices_end(); ++itvtx ) {
+      ge.remove_vertex(*itvtx);
+      vtxvec.push_back((*itvtx));
+      //fix me: delete vertex pointer causes crash
+      //delete (*itvtx);
+    }
+    for(unsigned int i=0;i<vtxvec.size();i++)  delete vtxvec[i];
+  }
+
+  //.....add new vertex with geantino
+  ge.add_vertex(genVertex);
+}
+
 void createMcEventCollectionInStoreGate(std::vector<HepMC::GenParticle*>& genPartList)
 {
   // create dummy input McEventCollection with a name that
   // HepMcParticleLink knows about
   SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"};
   inputTestDataHandle = std::make_unique<McEventCollection>();
+
+  EventContext ctx;
+  ctx.setExtension( Atlas::ExtendedEventContext( SG::CurrentEventStore::store() ) );
+  Gaudi::Hive::setCurrentContext( ctx );
+
   // Add a dummy GenEvent
   const int process_id1(20);
   const int event_number1(2147483647);
@@ -78,6 +131,7 @@ void createMcEventCollectionInStoreGate(std::vector<HepMC::GenParticle*>& genPar
   // HepMcParticleLink_p2. A workaround is used to suppport larger
   // values for the first event in the McEventCollection.
   const int event_number3(64);
+  const int event_number4(89);
   inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1));
   HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0));
   populateGenEvent(ge1,-11,11,genPartList);
@@ -90,6 +144,10 @@ void createMcEventCollectionInStoreGate(std::vector<HepMC::GenParticle*>& genPar
   HepMC::GenEvent& ge3 = *(inputTestDataHandle->at(2));
   populateGenEvent(ge3,-11,11,genPartList);
   populateGenEvent(ge3,22,22,genPartList);
+  inputTestDataHandle->push_back(new HepMC::GenEvent(ge1));
+  HepMC::GenEvent& ge4 = *(inputTestDataHandle->at(3));
+  ge4.set_event_number(event_number4);
+  populateFilteredGenEvent(ge4,genPartList);
   return;
 }
 
@@ -110,18 +168,45 @@ void test1()
   std::cout << "test1\n";
   std::vector<HepMC::GenParticle*> genPartList;
   createMcEventCollectionInStoreGate(genPartList);
-  assert ( genPartList.size() == 12 );
+  assert ( genPartList.size() == 13 );
+  // HepMcParticleLinks pointing at GenParticles in the first GenEvent in the McEventCollection
+  // By event_number
   const HepMC::GenParticle * particle1 = genPartList.at(0);
-  HepMcParticleLink trans1(particle1->barcode(),particle1->parent_event()->event_number());
-  testit (trans1);
-  HepMcParticleLink trans2(particle1->barcode(),0,EBC_MAINEVCOLL,HepMcParticleLink::IS_POSITION);
-  testit (trans2);
+  HepMcParticleLink trans1a(particle1->barcode(),particle1->parent_event()->event_number());
+  testit (trans1a);
+  // By position
+  HepMcParticleLink trans1b(particle1->barcode(),0,EBC_MAINEVCOLL,HepMcParticleLink::IS_POSITION);
+  testit (trans1b);
+  // HepMcParticleLinks pointing at GenParticles in other GenEvents in the McEventCollection
   const HepMC::GenParticle * particle2 = genPartList.at(7);
-  HepMcParticleLink trans3(particle2->barcode(),particle2->parent_event()->event_number());
-  testit (trans3);
+  HepMcParticleLink trans2(particle2->barcode(),particle2->parent_event()->event_number());
+  testit (trans2);
   const HepMC::GenParticle * particle3 = genPartList.at(8);
-  HepMcParticleLink trans4(particle3->barcode(),particle3->parent_event()->event_number());
+  HepMcParticleLink trans3(particle3->barcode(),particle3->parent_event()->event_number());
+  testit (trans3);
+  // HepMcParticleLinks pointing at filtered pileup truth
+  const HepMC::GenParticle * particle4 = genPartList.at(12);
+  HepMcParticleLink trans4(particle4->barcode(),particle4->parent_event()->event_number());
   testit (trans4);
+  // HepMcParticleLinks pointing at delta-ray (barcode=0 - not recorded in McEventCollection) using event_number
+  int deltaRayBarcode(0);
+  HepMcParticleLink trans5a(deltaRayBarcode,particle1->parent_event()->event_number());
+  testit (trans5a);
+  // HepMcParticleLinks pointing at delta-ray (barcode=0 - not recorded in McEventCollection) using position
+  HepMcParticleLink trans5b(deltaRayBarcode,0,EBC_MAINEVCOLL,HepMcParticleLink::IS_POSITION);
+  testit (trans5b);
+  // Link to a GenParticle which was not recorded to the
+  // McEventCollection, even though other parts of the same GenEvent
+  // were recorded.
+  const HepMcParticleLink::index_type refEvtNum1 = static_cast<HepMcParticleLink::index_type>(particle1->parent_event()->event_number());
+  const int cutBarcode(210001);
+  HepMcParticleLink trans6a(cutBarcode, refEvtNum1);
+  testit (trans6a);
+  // Link to a GenEvent which was not recorded to the McEventCollection
+  const int event_number5(460);
+  const HepMcParticleLink::index_type refEvtNum5 = static_cast<HepMcParticleLink::index_type>(event_number5);
+  HepMcParticleLink trans6b(cutBarcode, refEvtNum5);
+  testit (trans6b);
 }
 
 
diff --git a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx
index b18f98f5770d1728e4a2551c55df274d94fdb627..2fa9d29de83e01978b22e6de6fab755737a83e59 100644
--- a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx
+++ b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx
@@ -59,12 +59,65 @@ void populateGenEvent(HepMC::GenEvent & ge, int pdgid1, int pdgid2, std::vector<
   ge.set_beam_particles(inParticle1,inParticle2);
 }
 
+void populateFilteredGenEvent(HepMC::GenEvent & ge, std::vector<HepMC::GenParticle*>& genPartList)
+{
+  //.......Create new particle (geantino) to link  hits from pileup
+  HepMC::GenParticle* genPart=new HepMC::GenParticle();
+  genPart->set_pdg_id(999); //Geantino
+  genPart->set_status(1); //!< set decay status
+  genPart->suggest_barcode( std::numeric_limits<int32_t>::max() );
+
+  HepMC::GenVertex* genVertex=new HepMC::GenVertex();
+  genVertex->add_particle_out(genPart);
+  genPartList.push_back(genPart);
+
+  //to set geantino vertex as a truth primary vertex
+  HepMC::GenVertex* hScatVx = ge.barcode_to_vertex(-3);
+  if(hScatVx!=nullptr) {
+    HepMC::FourVector pmvxpos=hScatVx->position();
+    genVertex->set_position(pmvxpos);
+    //to set geantino kinematic phi=eta=0, E=p=E_hard_scat
+    HepMC::GenVertex::particles_in_const_iterator itrp =hScatVx->particles_in_const_begin();
+    if (hScatVx->particles_in_size()==2){
+      HepMC::FourVector mom1=(*itrp)->momentum();
+      HepMC::FourVector mom2=(*(++itrp))->momentum();
+      HepMC::FourVector vxmom;
+      vxmom.setPx(mom1.e()+mom2.e());
+      vxmom.setPy(0.);
+      vxmom.setPz(0.);
+      vxmom.setE(mom1.e()+mom2.e());
+
+      genPart->set_momentum(vxmom);
+    }
+  }
+
+  if(!ge.vertices_empty()){
+    std::vector<HepMC::GenVertex *> vtxvec;
+    HepMC::GenEvent::vertex_iterator itvtx = ge.vertices_begin();
+    for (;itvtx != ge.vertices_end(); ++itvtx ) {
+      ge.remove_vertex(*itvtx);
+      vtxvec.push_back((*itvtx));
+      //fix me: delete vertex pointer causes crash
+      //delete (*itvtx);
+    }
+    for(unsigned int i=0;i<vtxvec.size();i++)  delete vtxvec[i];
+  }
+
+  //.....add new vertex with geantino
+  ge.add_vertex(genVertex);
+}
+
 void createMcEventCollectionInStoreGate(std::vector<HepMC::GenParticle*>& genPartList)
 {
   // create dummy input McEventCollection with a name that
   // HepMcParticleLink knows about
   SG::WriteHandle<McEventCollection> inputTestDataHandle{"TruthEvent"};
   inputTestDataHandle = std::make_unique<McEventCollection>();
+  // create a dummy EventContext
+  EventContext ctx;
+  ctx.setExtension( Atlas::ExtendedEventContext( SG::CurrentEventStore::store() ) );
+  Gaudi::Hive::setCurrentContext( ctx );
+
   // Add a dummy GenEvent
   const int process_id1(20);
   const int event_number1(2147483647);
@@ -78,6 +131,7 @@ void createMcEventCollectionInStoreGate(std::vector<HepMC::GenParticle*>& genPar
   // HepMcParticleLink_p2. A workaround is used to suppport larger
   // values for the first event in the McEventCollection.
   const int event_number3(64);
+  const int event_number4(89);
   inputTestDataHandle->push_back(new HepMC::GenEvent(process_id1, event_number1));
   HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0));
   populateGenEvent(ge1,-11,11,genPartList);
@@ -90,6 +144,10 @@ void createMcEventCollectionInStoreGate(std::vector<HepMC::GenParticle*>& genPar
   HepMC::GenEvent& ge3 = *(inputTestDataHandle->at(2));
   populateGenEvent(ge3,-11,11,genPartList);
   populateGenEvent(ge3,22,22,genPartList);
+  inputTestDataHandle->push_back(new HepMC::GenEvent(ge1));
+  HepMC::GenEvent& ge4 = *(inputTestDataHandle->at(3));
+  ge4.set_event_number(event_number4);
+  populateFilteredGenEvent(ge4,genPartList);
   return;
 }
 
@@ -110,18 +168,45 @@ void test1()
   std::cout << "test1\n";
   std::vector<HepMC::GenParticle*> genPartList;
   createMcEventCollectionInStoreGate(genPartList);
-  assert ( genPartList.size() == 12 );
+  assert ( genPartList.size() == 13 );
+  // HepMcParticleLinks pointing at GenParticles in the first GenEvent in the McEventCollection
+  // By event_number
   const HepMC::GenParticle * particle1 = genPartList.at(0);
-  HepMcParticleLink trans1(particle1->barcode(),particle1->parent_event()->event_number());
-  testit (trans1);
-  HepMcParticleLink trans2(particle1->barcode(),0,EBC_MAINEVCOLL,HepMcParticleLink::IS_POSITION);
-  testit (trans2);
+  HepMcParticleLink trans1a(particle1->barcode(),particle1->parent_event()->event_number());
+  testit (trans1a);
+  // By position
+  HepMcParticleLink trans1b(particle1->barcode(),0,EBC_MAINEVCOLL,HepMcParticleLink::IS_POSITION);
+  testit (trans1b);
+  // HepMcParticleLinks pointing at GenParticles in other GenEvents in the McEventCollection
   const HepMC::GenParticle * particle2 = genPartList.at(7);
-  HepMcParticleLink trans3(particle2->barcode(),particle2->parent_event()->event_number());
-  testit (trans3);
+  HepMcParticleLink trans2(particle2->barcode(),particle2->parent_event()->event_number());
+  testit (trans2);
   const HepMC::GenParticle * particle3 = genPartList.at(8);
-  HepMcParticleLink trans4(particle3->barcode(),particle3->parent_event()->event_number());
+  HepMcParticleLink trans3(particle3->barcode(),particle3->parent_event()->event_number());
+  testit (trans3);
+  // HepMcParticleLinks pointing at filtered pileup truth
+  const HepMC::GenParticle * particle4 = genPartList.at(12);
+  HepMcParticleLink trans4(particle4->barcode(),particle4->parent_event()->event_number());
   testit (trans4);
+  // HepMcParticleLinks pointing at delta-ray (barcode=0 - not recorded in McEventCollection) using event number
+  int deltaRayBarcode(0);
+  HepMcParticleLink trans5a(deltaRayBarcode,particle1->parent_event()->event_number());
+  testit (trans5a);
+  // HepMcParticleLinks pointing at delta-ray (barcode=0 - not recorded in McEventCollection) using hard-scatter event position
+  HepMcParticleLink trans5b(deltaRayBarcode,0,EBC_MAINEVCOLL,HepMcParticleLink::IS_POSITION);
+  testit (trans5b);
+  // Link to a GenParticle which was not recorded to the
+  // McEventCollection, even though other parts of the same GenEvent
+  // were recorded.
+  const HepMcParticleLink::index_type refEvtNum1 = static_cast<HepMcParticleLink::index_type>(particle1->parent_event()->event_number());
+  const int cutBarcode(210001);
+  HepMcParticleLink trans6a(cutBarcode, refEvtNum1);
+  testit (trans6a);
+  // Link to a GenEvent which was not recorded to the McEventCollection
+  const int event_number5(460);
+  const HepMcParticleLink::index_type refEvtNum5 = static_cast<HepMcParticleLink::index_type>(event_number5);
+  HepMcParticleLink trans6b(cutBarcode, refEvtNum5);
+  testit (trans6b);
 }
 
 
diff --git a/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/CMakeLists.txt b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/CMakeLists.txt
index dec3c29aa55351e6c61daabb732fd7e949d59d24..4e25e8e705e88b8698a604f5a33f752b0d874d64 100644
--- a/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/CMakeLists.txt
+++ b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/CMakeLists.txt
@@ -19,7 +19,7 @@ find_package( AthenaPoolUtilitiesTest )
 
 if( ATHENAPOOLUTILITIESTEST_FOUND )
   set( INDETSIMEVENTATHENAPOOL_REFERENCE_TAG
-       InDetSimEventAthenaPoolReference-02-00-00 )
+       InDetSimEventAthenaPoolReference-02-01-00 )
   run_tpcnv_legacy_test( InDetSimEventTPCnv_HITS   HITS.04919495._000416
                    REFERENCE_TAG ${INDETSIMEVENTATHENAPOOL_REFERENCE_TAG} )
 else()
diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/CMakeLists.txt b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/CMakeLists.txt
index 2fd4f5c476e202374a504b60103e28f731bea51b..5c31dc0a6617240870c805a4ed42293c4b150b01 100644
--- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/CMakeLists.txt
+++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/CMakeLists.txt
@@ -13,6 +13,7 @@ atlas_depends_on_subdirs( PUBLIC
                           InnerDetector/InDetSimEvent
                           PRIVATE
                           AtlasTest/TestTools
+                          Control/AthenaKernel
                           Control/StoreGate
                           DetectorDescription/Identifier )
 
@@ -27,7 +28,7 @@ atlas_add_library( InDetSimEventTPCnv
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES GaudiKernel GeneratorObjectsTPCnv InDetSimEvent AthenaPoolCnvSvcLib StoreGateLib SGtests
-                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} TestTools Identifier )
+                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} TestTools Identifier AthenaKernel )
 
 atlas_add_dictionary( InDetSimEventTPCnvDict
                       InDetSimEventTPCnv/InDetSimEventTPCnvDict.h
diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p2.cxx b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p2.cxx
index 428a76f6d624024e893dd9cf7cac83aaf5642cda..72eba048dcbf37a57f7eadf749513c8e5a97daed 100644
--- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p2.cxx
+++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p2.cxx
@@ -258,7 +258,8 @@ void SiHitCollectionCnv_p2::persToTrans(const SiHitCollection_p2* persCont, SiHi
   unsigned int endHit = 0;
   unsigned int endBC = 0;
   unsigned int endId = 0;
-
+  // Assume that all Hits should be linked to the hard-scatter GenEvent
+  const int event_number = HepMcParticleLink::getEventNumberAtPosition (0, EBC_MAINEVCOLL, SG::CurrentEventStore::store());
   for (unsigned int i = 0; i < persCont->m_nHits.size(); i++) {
 
     if (persCont->m_nHits[i]) {
@@ -298,7 +299,7 @@ void SiHitCollectionCnv_p2::persToTrans(const SiHitCollection_p2* persCont, SiHi
 
         HepGeom::Point3D<double> endThis( endLast + r );
 
-        HepMcParticleLink partLink; partLink.setExtendedBarCode( HepMcParticleLink::ExtendedBarCode( persCont->m_barcode[idxBC], 0, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION) );
+        HepMcParticleLink partLink( persCont->m_barcode[idxBC], event_number);
         transCont->Emplace( endLast, endThis, eneLoss, meanTime, partLink, persCont->m_id[idxId]);
 
         endLast = endThis;
diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p3.cxx b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p3.cxx
index 07f4b1c0992ab006f3d53d2720eaa051463ea9b5..e329c1c4adbfe0c8c7c92aa2b594f4d99b3d19c6 100644
--- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p3.cxx
+++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/SiHitCollectionCnv_p3.cxx
@@ -14,7 +14,10 @@
 #include "CLHEP/Geometry/Point3D.h"
 // Gaudi
 #include "GaudiKernel/MsgStream.h"
+#include "GaudiKernel/ThreadLocalContext.h"
+
 // Athena
+#include "AthenaKernel/ExtendedEventContext.h"
 #include "StoreGate/StoreGateSvc.h"
 
 //  * * *  stolen from eflowRec  * * *  //
@@ -77,6 +80,8 @@ void SiHitCollectionCnv_p3::transToPers(const SiHitCollection* transCont, SiHitC
   static const double dRcut = 1.0e-7;
   static const double dTcut = 1.0;
 
+  const EventContext& ctx = Gaudi::Hive::currentContext();
+  const IProxyDict* proxy = Atlas::getExtendedEventContext(ctx).proxy();
   const HepMcParticleLink * lastLink=nullptr;
   int lastId = -1;
   double stringFirstTheta = 0.0;
@@ -103,7 +108,11 @@ void SiHitCollectionCnv_p3::transToPers(const SiHitCollection* transCont, SiHitC
       lastLink = &(siHit->particleLink());
       persCont->m_barcode.push_back(lastLink->barcode());
       unsigned short index{0};
-      if (lastLink->getEventPositionInCollection(SG::CurrentEventStore::store())!=0) {
+      const HepMcParticleLink::index_type position =
+        HepMcParticleLink::getEventPositionInCollection(lastLink->eventIndex(),
+                                                        lastLink->getEventCollection(),
+                                                        proxy).at(0);
+      if (position!=0) {
         index = lastLink->eventIndex();
         if(lastLink->eventIndex()!=static_cast<HepMcParticleLink::index_type>(index)) {
           log << MSG::WARNING << "Attempting to persistify an eventIndex larger than max unsigned short!" << endmsg;
diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p3.cxx b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p3.cxx
index d4ade6a9d18ae4cc94cd931bd7a763ddfa1fa4b7..c1bda96002c0f83286aba7485cdd7ed0258954a5 100644
--- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p3.cxx
+++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p3.cxx
@@ -294,6 +294,9 @@ void TRT_HitCollectionCnv_p3::persToTrans(const TRT_HitCollection_p3* persCont,
   unsigned int meanTimeofCount=0, startRCount=0, endRCount=0, hitEneCount=0;
   unsigned int idxBC=0, idxId=0, endHit=0, endBC=0, endId=0;
 
+  // Assume that all Hits should be linked to the hard-scatter GenEvent
+  const int event_number = HepMcParticleLink::getEventNumberAtPosition (0, EBC_MAINEVCOLL, SG::CurrentEventStore::store());
+
   //
   // loop over strings - index [i]
   //
@@ -478,8 +481,7 @@ void TRT_HitCollectionCnv_p3::persToTrans(const TRT_HitCollection_p3* persCont,
         // - For charged particles kinEne is *zero*!
         //
 
-        HepMcParticleLink partLink(persCont->m_barcode[idxBC]);
-        partLink.setExtendedBarCode(HepMcParticleLink::ExtendedBarCode(persCont->m_barcode[idxBC], 0, EBC_MAINEVCOLL, HepMcParticleLink::IS_POSITION));;
+        HepMcParticleLink partLink(persCont->m_barcode[idxBC], event_number);
         transCont->Emplace( strawId, partLink, persCont->m_id[idxId],
                             kinEne, hitEne, startX, startY, startZ,
                             endX, endY, endZ, meanTime );
diff --git a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p4.cxx b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p4.cxx
index 4fb8405218da3e3f6af9266202ce809274d0977d..a4986a1e28335c36a3e44a64851fbd414773ce0c 100644
--- a/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p4.cxx
+++ b/InnerDetector/InDetEventCnv/InDetSimEventTPCnv/src/InDetHits/TRT_HitCollectionCnv_p4.cxx
@@ -15,8 +15,10 @@
 
 // Gaudi
 #include "GaudiKernel/MsgStream.h"
+#include "GaudiKernel/ThreadLocalContext.h"
 
 // Athena
+#include "AthenaKernel/ExtendedEventContext.h"
 #include "StoreGate/StoreGateSvc.h"
 
 // Transient(Geant) to Persistent(Disk)
@@ -50,6 +52,8 @@ void TRT_HitCollectionCnv_p4::transToPers(const TRTUncompressedHitCollection* tr
 
   //    if (log.level() <= MSG::DEBUG) log << MSG::DEBUG << "In TRT_HitCollectionCnv_p4::transToPers()" << endmsg;
 
+  const EventContext& ctx = Gaudi::Hive::currentContext();
+  const IProxyDict* proxy = Atlas::getExtendedEventContext(ctx).proxy();
   const HepMcParticleLink * lastLink=NULL;
   int lastId = -1;
   double lastT = 0.0*CLHEP::ns;
@@ -68,7 +72,11 @@ void TRT_HitCollectionCnv_p4::transToPers(const TRTUncompressedHitCollection* tr
       lastLink = &(trtHit->particleLink());
       persCont->m_barcode.push_back(lastLink->barcode());
       unsigned short index{0};
-      if (lastLink->getEventPositionInCollection(SG::CurrentEventStore::store())!=0) {
+      const HepMcParticleLink::index_type position =
+        HepMcParticleLink::getEventPositionInCollection(lastLink->eventIndex(),
+                                                        lastLink->getEventCollection(),
+                                                        proxy).at(0);
+      if (position!=0) {
         index = lastLink->eventIndex();
         if(lastLink->eventIndex()!=static_cast<HepMcParticleLink::index_type>(index)) {
           log << MSG::WARNING << "Attempting to persistify an eventIndex larger than max unsigned short!" << endmsg;
diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/CMakeLists.txt
index cd0e03a55a7b06935b0c4199d6c4b586e3fa63ce..d8673e394020b71f830455754ce40c23c7c13bf4 100644
--- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/CMakeLists.txt
+++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/CMakeLists.txt
@@ -73,7 +73,7 @@ find_package( AthenaPoolUtilitiesTest )
 
 if( ATHENAPOOLUTILITIESTEST_FOUND )
   set( MUONEVENTATHENAPOOL_REFERENCE_TAG
-       MuonEventAthenaPoolReference-03-00-00 )
+       MuonEventAthenaPoolReference-03-01-00 )
   run_tpcnv_legacy_test( MuonEventTPCnv_17.0.0   ESD-17.0.0
                    REFERENCE_TAG ${MUONEVENTATHENAPOOL_REFERENCE_TAG} )
   run_tpcnv_legacy_test( MuonEventTPCnv_20.1.7.2 ESD-20.1.7.2
diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/CMakeLists.txt
index 594101166b74610572aeb7d2a8cef9705a906d80..99ed098203dc6f70e18cf574f027e55516d31d8b 100644
--- a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/CMakeLists.txt
+++ b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/CMakeLists.txt
@@ -22,7 +22,7 @@ find_package( AthenaPoolUtilitiesTest )
 
 if( ATHENAPOOLUTILITIESTEST_FOUND )
   set( MUONSIMEVENTATHENAPOOL_REFERENCE_TAG
-       MuonSimEventAthenaPoolReference-02-00-00 )
+       MuonSimEventAthenaPoolReference-02-01-00 )
   run_tpcnv_legacy_test( MuonSimEventTPCnv_HITS   HITS.04919495._000416
                    REFERENCE_TAG ${MUONSIMEVENTATHENAPOOL_REFERENCE_TAG} )
 else()