From f120944f6fb5a9c97a88250b11612c5aa74d2586 Mon Sep 17 00:00:00 2001
From: Andrii Verbytskyi <andrii.verbytskyi@cern.ch>
Date: Fri, 17 Apr 2020 10:05:58 +0000
Subject: [PATCH] Migration of the remaining Generator packages to AtlasHepMC

---
 .../xAOD/xAODTruthCnv/src/HepMCTruthReader.h  |  8 ++----
 Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.h | 10 +++----
 Generators/AtlasHepMC/AtlasHepMC/Flow.h       |  3 +-
 .../AtlasHepMC/AtlasHepMC/GenParticle_fwd.h   |  1 -
 .../AtlasHepMC/AtlasHepMC/GenVertex_fwd.h     |  1 -
 .../AtlasHepMC/AtlasHepMC/IteratorRange.h     |  7 +++++
 Generators/AtlasHepMC/CMakeLists.txt          |  4 +--
 Generators/Epos_i/CMakeLists.txt              | 10 +++----
 Generators/Epos_i/src/Epos.cxx                |  4 +--
 .../TruthHelper/CMakeLists.txt                |  1 -
 Generators/GenInterfaces/CMakeLists.txt       |  5 ++--
 .../GenInterfaces/GenInterfaces/IHforTool.h   |  3 +-
 Generators/GeneratorObjects/CMakeLists.txt    | 15 +++++-----
 .../GeneratorObjects/CachedParticlePtr.h      |  4 +--
 .../GeneratorObjects/HepMcParticleLink.h      |  7 ++---
 .../GeneratorObjects/McEventCollection.h      | 10 +++----
 .../src/HepMcParticleLink.cxx                 |  4 +--
 .../test/CachedParticlePtr_test.cxx           |  2 +-
 .../test/HepMcParticleLink_test.cxx           |  2 +-
 .../GeneratorObjectsTPCnv/CMakeLists.txt      | 28 +++++++++----------
 .../GeneratorObjectsTPCnv/GenEventCnv_p1.h    |  6 ++--
 .../McEventCollectionCnv_p1.h                 |  6 ++--
 .../McEventCollectionCnv_p2.h                 |  6 ++--
 .../McEventCollectionCnv_p3.h                 |  6 ++--
 .../McEventCollectionCnv_p4.h                 |  6 ++--
 .../McEventCollectionCnv_p5.h                 |  6 ++--
 .../initMcEventCollection.h                   |  6 ++--
 .../GeneratorObjectsTPCnv/src/HepMcDataPool.h |  6 ++--
 .../src/initMcEventCollection.cxx             |  6 ++--
 .../test/HepMcParticleLinkCnv_p1_test.cxx     |  2 +-
 .../test/HepMcParticleLinkCnv_p2_test.cxx     |  2 +-
 .../test/McEventCollectionCnv_p4_test.cxx     |  2 +-
 .../test/McEventCollectionCnv_p5_test.cxx     |  2 +-
 Generators/GenzModuleEvent/CMakeLists.txt     |  9 +++---
 .../GenzModuleEvent/KineHepMcmap.h            |  4 +--
 .../HepMCAnalysis_i/LeptonJetAnalysis.h       |  4 +--
 .../HepMCAnalysis_i/ParticleContentAnalysis.h |  7 ++---
 .../HepMCAnalysis_i/PdfAnalysis.h             |  6 ++--
 .../HepMCAnalysis_i/UserAnalysis.h            |  4 +--
 Generators/QGSJet_i/CMakeLists.txt            |  9 +++---
 Generators/QGSJet_i/src/QGSJet.cxx            |  4 +--
 Generators/Sherpa_i/Sherpa_i/Sherpa_i.h       |  4 +--
 Generators/TruthIO/CMakeLists.txt             |  5 ++--
 .../TruthIO/TruthIO/HepMCReadFromFile.h       |  2 +-
 .../TruthIO/TruthIO/ReadHepEvtFromAscii.h     |  2 +-
 Generators/TruthIO/TruthIO/WriteHepMC.h       |  2 +-
 Generators/TruthIO/src/HepMCReadFromFile.cxx  |  6 ++--
 Generators/TruthIO/src/PrintMC.cxx            |  2 +-
 .../TruthIO/src/ReadHepEvtFromAscii.cxx       |  6 ++--
 .../McParticleEvent/CMakeLists.txt            |  9 +++---
 .../McParticleEvent/TruthEtIsolations.h       |  2 --
 .../McParticleEvent/TruthParticle.h           |  5 ++--
 .../McParticleEvent/TruthParticleBase.h       |  2 +-
 .../McParticleEvent/TruthParticleMomentum.h   |  2 +-
 .../McParticleEvent/src/TruthEtIsolations.cxx |  6 ++--
 .../McParticleEvent/src/TruthParticle.cxx     |  6 ++--
 Reconstruction/MissingETEvent/CMakeLists.txt  |  7 ++---
 .../MissingETEvent/MissingEtTruth.h           |  4 +--
 58 files changed, 146 insertions(+), 164 deletions(-)
 create mode 100644 Generators/AtlasHepMC/AtlasHepMC/IteratorRange.h

diff --git a/Event/xAOD/xAODTruthCnv/src/HepMCTruthReader.h b/Event/xAOD/xAODTruthCnv/src/HepMCTruthReader.h
index 71bf61b5a3f..71e19e440fe 100644
--- a/Event/xAOD/xAODTruthCnv/src/HepMCTruthReader.h
+++ b/Event/xAOD/xAODTruthCnv/src/HepMCTruthReader.h
@@ -7,11 +7,9 @@
 
 #include "AthenaBaseComps/AthAlgorithm.h"
 
-namespace HepMC {
-  class GenEvent;
-  class GenVertex;
-  class GenParticle;
-}
+#include "AtlasHepMC/GenEvent_fwd.h"
+#include "AtlasHepMC/GenVertex_fwd.h"
+#include "AtlasHepMC/GenParticle_fwd.h"
 
 
 /// @short Algorithm demonstrating reading of HepMC truth, and printing to screen
diff --git a/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.h b/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.h
index 52f60dc6ba8..aad1b77c482 100644
--- a/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.h
+++ b/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.h
@@ -15,7 +15,7 @@
 #pragma clang diagnostic ignored "-Wkeyword-macro"
 #endif
 #define private public
-#   include "HepMC/WeightContainer.h"
+#include "AtlasHepMC/WeightContainer.h"
 #undef private
 #ifdef __clang__
 #pragma clang diagnostic pop
@@ -38,10 +38,10 @@
 
 #include <unordered_set>
 
-namespace HepMC {
-  class GenVertex;
-  class GenParticle;
-}
+
+#include "AtlasHepMC/GenVertex_fwd.h"
+#include "AtlasHepMC/GenParticle_fwd.h"
+
 
 namespace xAODMaker {
 
diff --git a/Generators/AtlasHepMC/AtlasHepMC/Flow.h b/Generators/AtlasHepMC/AtlasHepMC/Flow.h
index eb686562d48..9991ae6192d 100644
--- a/Generators/AtlasHepMC/AtlasHepMC/Flow.h
+++ b/Generators/AtlasHepMC/AtlasHepMC/Flow.h
@@ -6,6 +6,7 @@
 #include "HepMC/Flow.h"
 namespace HepMC
 {
-template <class T> int flow(T a,int i=0){return a->flow(i);}
+template <class T> int flow(T a,int i){return a->flow(i);}
+template <class T> Flow flow(T a){return a->flow();}
 }
 #endif
diff --git a/Generators/AtlasHepMC/AtlasHepMC/GenParticle_fwd.h b/Generators/AtlasHepMC/AtlasHepMC/GenParticle_fwd.h
index 1dcb9679681..15f0ac57861 100644
--- a/Generators/AtlasHepMC/AtlasHepMC/GenParticle_fwd.h
+++ b/Generators/AtlasHepMC/AtlasHepMC/GenParticle_fwd.h
@@ -6,6 +6,5 @@
 namespace HepMC {
 class GenParticle;
 typedef GenParticle* GenParticlePtr;
-typedef (GenParticle* const) ConstGenParticlePtr;
 }
 #endif
diff --git a/Generators/AtlasHepMC/AtlasHepMC/GenVertex_fwd.h b/Generators/AtlasHepMC/AtlasHepMC/GenVertex_fwd.h
index 93fa2244ed9..2c98b4f9daf 100644
--- a/Generators/AtlasHepMC/AtlasHepMC/GenVertex_fwd.h
+++ b/Generators/AtlasHepMC/AtlasHepMC/GenVertex_fwd.h
@@ -6,6 +6,5 @@
 namespace HepMC {
 class GenVertex;
 typedef HepMC::GenVertex* GenVertexPtr;
-typedef (HepMC::GenVertex* const)  ConstGenVertexPtr;
 }
 #endif
diff --git a/Generators/AtlasHepMC/AtlasHepMC/IteratorRange.h b/Generators/AtlasHepMC/AtlasHepMC/IteratorRange.h
new file mode 100644
index 00000000000..3936956cb0f
--- /dev/null
+++ b/Generators/AtlasHepMC/AtlasHepMC/IteratorRange.h
@@ -0,0 +1,7 @@
+/* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+   Author: Andrii Verbytskyi andrii.verbytskyi@mpp.mpg.de
+   */
+#ifndef ATLASHEPMC_ITERATORRANGE_H
+#define ATLASHEPMC_ITERATORRANGE_H
+#include "HepMC/IteratorRange.h"
+#endif
diff --git a/Generators/AtlasHepMC/CMakeLists.txt b/Generators/AtlasHepMC/CMakeLists.txt
index a269ede5797..a4e5b03554e 100644
--- a/Generators/AtlasHepMC/CMakeLists.txt
+++ b/Generators/AtlasHepMC/CMakeLists.txt
@@ -11,11 +11,11 @@ atlas_add_library( AtlasHepMCLib
    INTERFACE
    PUBLIC_HEADERS AtlasHepMC
    INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS}
-   LINK_LIBRARIES ${HepMC_HepMC_LIBRARY} )
+   LINK_LIBRARIES ${_HEPMC_HepMC_library} )
 
 atlas_add_library( AtlasHepMCfioLib
    AtlasHepMC/*.h
    INTERFACE
    PUBLIC_HEADERS AtlasHepMC
    INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS}
-   LINK_LIBRARIES ${HepMC_HepMCfio_LIBRARY} )
+   LINK_LIBRARIES ${_HEPMC_HepMCfio_library} )
diff --git a/Generators/Epos_i/CMakeLists.txt b/Generators/Epos_i/CMakeLists.txt
index bb317817567..922105d3eda 100644
--- a/Generators/Epos_i/CMakeLists.txt
+++ b/Generators/Epos_i/CMakeLists.txt
@@ -8,6 +8,7 @@ atlas_subdir( Epos_i )
 # Declare the package's dependencies:
 atlas_depends_on_subdirs( PUBLIC
                           Generators/GeneratorModules
+                          Generators/AtlasHepMC
                           PRIVATE
                           Control/AthenaKernel
                           GaudiKernel
@@ -16,7 +17,6 @@ atlas_depends_on_subdirs( PUBLIC
 # External dependencies:
 find_package( CLHEP )
 find_package( Crmc COMPONENTS Epos )
-find_package( HepMC COMPONENTS HepMC HepMCfio )
 
 # Remove the --as-needed linker flags:
 atlas_disable_as_needed()
@@ -29,15 +29,15 @@ atlas_add_library( Epos_iLib
                    src/Rangen.F
                    PUBLIC_HEADERS Epos_i
                    INCLUDE_DIRS ${CRMC_INCLUDE_DIRS}
-                   PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
+                   PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${CRMC_LIBRARIES} GeneratorModulesLib
-                   PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaKernel GaudiKernel TruthUtils )
+                   PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib AtlasHepMCfioLib AthenaKernel GaudiKernel TruthUtils )
 
 atlas_add_component( Epos_i
                      src/components/*.cxx
-                     INCLUDE_DIRS ${CRMC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${CRMC_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GeneratorModulesLib AthenaKernel GaudiKernel TruthUtils Epos_iLib )
+                     INCLUDE_DIRS ${CRMC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} 
+                     LINK_LIBRARIES ${CRMC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AtlasHepMCfioLib GeneratorModulesLib AthenaKernel GaudiKernel TruthUtils Epos_iLib )
 
 # Install files from the package:
 atlas_install_joboptions( share/*.py )
diff --git a/Generators/Epos_i/src/Epos.cxx b/Generators/Epos_i/src/Epos.cxx
index 383829dabe7..c1a635e247b 100644
--- a/Generators/Epos_i/src/Epos.cxx
+++ b/Generators/Epos_i/src/Epos.cxx
@@ -19,8 +19,8 @@
 #include "CLHEP/Random/RandFlat.h"
 #include "AthenaKernel/IAtRndmGenSvc.h"
 
-#include "HepMC/HEPEVT_Wrapper.h"
-#include "HepMC/IO_HEPEVT.h"
+#include "AtlasHepMC/HEPEVT_Wrapper.h"
+#include "AtlasHepMC/IO_HEPEVT.h"
 
 
 #include "Epos_i/Epos.h"
diff --git a/Generators/GenAnalysisTools/TruthHelper/CMakeLists.txt b/Generators/GenAnalysisTools/TruthHelper/CMakeLists.txt
index 8edd6ffd076..572d21a4044 100644
--- a/Generators/GenAnalysisTools/TruthHelper/CMakeLists.txt
+++ b/Generators/GenAnalysisTools/TruthHelper/CMakeLists.txt
@@ -23,7 +23,6 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
 atlas_add_library( TruthHelper
                    src/*.cxx
                    PUBLIC_HEADERS TruthHelper
-                   INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS}
                    PRIVATE_INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
                    LINK_LIBRARIES AtlasHepMCLib GaudiKernel GeneratorObjects StoreGateLib SGtests
                    PRIVATE_LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} AthenaKernel TruthUtils )
diff --git a/Generators/GenInterfaces/CMakeLists.txt b/Generators/GenInterfaces/CMakeLists.txt
index ea23276ef70..793dd383df4 100644
--- a/Generators/GenInterfaces/CMakeLists.txt
+++ b/Generators/GenInterfaces/CMakeLists.txt
@@ -14,11 +14,10 @@ atlas_add_library( GenInterfacesLib
    GenInterfaces/*.h
    INTERFACE
    PUBLIC_HEADERS GenInterfaces
-   LINK_LIBRARIES ${HEPMC_LIBRARIES} GaudiKernel )
+   LINK_LIBRARIES AtlasHepMCLib GaudiKernel )
 
 atlas_add_dictionary( GenInterfacesDict
    GenInterfaces/GenInterfacesDict.h
    GenInterfaces/selection.xml
-   INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS}
-   LINK_LIBRARIES ${HEPMC_LIBRARIES} GenInterfacesLib )
+   LINK_LIBRARIES AtlasHepMCLib GenInterfacesLib )
 
diff --git a/Generators/GenInterfaces/GenInterfaces/IHforTool.h b/Generators/GenInterfaces/GenInterfaces/IHforTool.h
index 68ec146628b..1e8824aa766 100644
--- a/Generators/GenInterfaces/GenInterfaces/IHforTool.h
+++ b/Generators/GenInterfaces/GenInterfaces/IHforTool.h
@@ -8,8 +8,7 @@
 #include "GaudiKernel/IAlgTool.h"
 #include <vector>
 
-// Forward declaration
-namespace HepMC {class FourVector ;}
+#include "AtlasHepMC/SimpleVector.h"
 
 static const InterfaceID IID_IHforTool("IHforTool", 1, 0);
 
diff --git a/Generators/GeneratorObjects/CMakeLists.txt b/Generators/GeneratorObjects/CMakeLists.txt
index 0f9baed5004..af7edc9db03 100644
--- a/Generators/GeneratorObjects/CMakeLists.txt
+++ b/Generators/GeneratorObjects/CMakeLists.txt
@@ -13,6 +13,7 @@ atlas_depends_on_subdirs( PUBLIC
                           Control/AthenaKernel
                           Event/xAOD/xAODTruth
                           GaudiKernel
+                          Generators/AtlasHepMC
                           PRIVATE
                           AtlasTest/TestTools
                           Control/CxxUtils
@@ -21,7 +22,6 @@ atlas_depends_on_subdirs( PUBLIC
 
 # External dependencies:
 find_package( CLHEP )
-find_package( HepMC )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
 find_package( GTest )
 
@@ -31,17 +31,16 @@ atlas_add_library( GeneratorObjects
                    src/McEventCollection.cxx
                    src/HijingEventParams.cxx
                    PUBLIC_HEADERS GeneratorObjects
-                   INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS}
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
-                   LINK_LIBRARIES ${HEPMC_LIBRARIES} AthContainers AthLinks SGTools xAODTruth GaudiKernel RootUtilsPyROOT StoreGateLib SGtests
+                   LINK_LIBRARIES  AtlasHepMCLib AthContainers AthLinks SGTools xAODTruth GaudiKernel RootUtilsPyROOT StoreGateLib SGtests
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} TestTools AthenaKernel RootUtils )
 
 atlas_add_dictionary( GeneratorObjectsDict
                       GeneratorObjects/McEventDict.h
                       GeneratorObjects/selection.xml
-                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthContainers AthLinks SGTools xAODTruth GaudiKernel TestTools AthenaKernel RootUtils RootUtilsPyROOT StoreGateLib SGtests GeneratorObjects )
+                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} 
+                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES}  AtlasHepMCLib AthContainers AthLinks SGTools xAODTruth GaudiKernel TestTools AthenaKernel RootUtils RootUtilsPyROOT StoreGateLib SGtests GeneratorObjects )
 
 # Install a dummy rootmap file to suppress loading the rootmap from hepmc3,
 # which defines dictionary entries for HepMC types that clash with
@@ -53,11 +52,11 @@ atlas_install_generic ( share/libHepMC3rootIO.rootmap
 
 atlas_add_test( HepMcParticleLink_test
                 SOURCES test/HepMcParticleLink_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthContainers CxxUtils AthLinks SGTools xAODTruth GaudiKernel TestTools AthenaKernel RootUtils RootUtilsPyROOT StoreGateLib SGtests GeneratorObjects ${GTEST_LIBRARIES} )
+                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}  ${GTEST_INCLUDE_DIRS}
+                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthContainers CxxUtils AthLinks SGTools xAODTruth GaudiKernel TestTools AthenaKernel RootUtils RootUtilsPyROOT StoreGateLib SGtests GeneratorObjects ${GTEST_LIBRARIES} )
 
 
 atlas_add_test( CachedParticlePtr_test
                 SOURCES test/CachedParticlePtr_test.cxx
-                LINK_LIBRARIES GeneratorObjects )
+                LINK_LIBRARIES GeneratorObjects AtlasHepMCLib)
 
diff --git a/Generators/GeneratorObjects/GeneratorObjects/CachedParticlePtr.h b/Generators/GeneratorObjects/GeneratorObjects/CachedParticlePtr.h
index 06e5390eb32..6b34ff3706d 100644
--- a/Generators/GeneratorObjects/GeneratorObjects/CachedParticlePtr.h
+++ b/Generators/GeneratorObjects/GeneratorObjects/CachedParticlePtr.h
@@ -17,11 +17,9 @@
 #include "SGTools/CurrentEventStore.h"
 #include <atomic>
 #include <cassert>
+#include "AtlasHepMC/GenParticle.h"
 
 
-namespace HepMC {
-  class GenParticle;
-}
 class IProxyDict;
 
 
diff --git a/Generators/GeneratorObjects/GeneratorObjects/HepMcParticleLink.h b/Generators/GeneratorObjects/GeneratorObjects/HepMcParticleLink.h
index 03f23289188..f62074daf4d 100644
--- a/Generators/GeneratorObjects/GeneratorObjects/HepMcParticleLink.h
+++ b/Generators/GeneratorObjects/GeneratorObjects/HepMcParticleLink.h
@@ -23,10 +23,9 @@
 #include <limits>  /* numeric_limits */
 #include <string>
 
-namespace HepMC {
-  class GenParticle;
-  class GenEvent;
-}
+#include "AtlasHepMC/GenEvent_fwd.h"
+#include "AtlasHepMC/GenParticle_fwd.h"
+
 class IProxyDict;
 class McEventCollection;
 
diff --git a/Generators/GeneratorObjects/GeneratorObjects/McEventCollection.h b/Generators/GeneratorObjects/GeneratorObjects/McEventCollection.h
index 9feff45822d..bc193502de5 100644
--- a/Generators/GeneratorObjects/GeneratorObjects/McEventCollection.h
+++ b/Generators/GeneratorObjects/GeneratorObjects/McEventCollection.h
@@ -6,14 +6,12 @@
 #define GENERATOROBJECTSMCEVENTCOLLECTION_H 1
 
 
-
-// #include "GeneratorObjects/McEvent.h"
 #include "AthContainers/DataVector.h"
 #include "AthenaKernel/CLASS_DEF.h"
-#include "HepMC/GenEvent.h"
-#include "HepMC/GenParticle.h"
-#include "HepMC/GenVertex.h"
-#include "HepMC/GenRanges.h"
+#include "AtlasHepMC/GenEvent.h"
+#include "AtlasHepMC/GenParticle.h"
+#include "AtlasHepMC/GenVertex.h"
+#include "AtlasHepMC/GenRanges.h"
 
 #include <iostream>
 /**
diff --git a/Generators/GeneratorObjects/src/HepMcParticleLink.cxx b/Generators/GeneratorObjects/src/HepMcParticleLink.cxx
index f88d7255341..21fd8cdd80b 100644
--- a/Generators/GeneratorObjects/src/HepMcParticleLink.cxx
+++ b/Generators/GeneratorObjects/src/HepMcParticleLink.cxx
@@ -10,8 +10,8 @@
 #include "GeneratorObjects/HepMcParticleLink.h"
 #include "GeneratorObjects/McEventCollection.h"
 #include "StoreGate/StoreGate.h"
-#include "HepMC/GenParticle.h"
-#include "HepMC/GenEvent.h"
+#include "AtlasHepMC/GenParticle.h"
+#include "AtlasHepMC/GenEvent.h"
 #include "AthenaKernel/getMessageSvc.h"
 #include "GaudiKernel/MsgStream.h"
 #include "SGTools/CurrentEventStore.h"
diff --git a/Generators/GeneratorObjects/test/CachedParticlePtr_test.cxx b/Generators/GeneratorObjects/test/CachedParticlePtr_test.cxx
index 360a5e36855..7a930f29d4a 100644
--- a/Generators/GeneratorObjects/test/CachedParticlePtr_test.cxx
+++ b/Generators/GeneratorObjects/test/CachedParticlePtr_test.cxx
@@ -11,7 +11,7 @@
 
 #undef NDEBUG
 #include "GeneratorObjects/CachedParticlePtr.h"
-#include "HepMC/GenParticle.h"
+#include "AtlasHepMC/GenParticle.h"
 #include "SGTools/TestStore.h"
 #include "SGTools/CurrentEventStore.h"
 #include <thread>
diff --git a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
index 305f6767b10..f4b6714a071 100644
--- a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
+++ b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
@@ -18,7 +18,7 @@
 #include "gtest/gtest.h"
 
 // HepMC includes
-#include "HepMC/GenEvent.h"
+#include "AtlasHepMC/GenEvent.h"
 
 // CLHEP includes
 #include "CLHEP/Vector/LorentzVector.h"
diff --git a/Generators/GeneratorObjectsTPCnv/CMakeLists.txt b/Generators/GeneratorObjectsTPCnv/CMakeLists.txt
index ba5903714e3..c3c5b0b14a7 100644
--- a/Generators/GeneratorObjectsTPCnv/CMakeLists.txt
+++ b/Generators/GeneratorObjectsTPCnv/CMakeLists.txt
@@ -14,6 +14,7 @@ atlas_depends_on_subdirs( PUBLIC
                           AtlasTest/TestTools
                           Control/AthAllocators
                           Control/AthenaKernel
+                          Generators/AtlasHepMC
                           Generators/GenInterfaces )
 
 # External dependencies:
@@ -25,42 +26,41 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
 atlas_add_tpcnv_library( GeneratorObjectsTPCnv
                          src/*.cxx
                          PUBLIC_HEADERS GeneratorObjectsTPCnv
-                         INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS}
                          PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                         LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjects AthAllocators AthenaKernel TestTools )
+                         LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaPoolCnvSvcLib GaudiKernel GeneratorObjects AthAllocators AthenaKernel TestTools )
 
 atlas_add_dictionary( GeneratorObjectsTPCnvDict
                       GeneratorObjectsTPCnv/GeneratorObjectsTPCnvDict.h
                       GeneratorObjectsTPCnv/selection.xml
-                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjects AthAllocators AthenaKernel GeneratorObjectsTPCnv TestTools )
+                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} 
+                      LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib AthenaPoolCnvSvcLib GaudiKernel GeneratorObjects AthAllocators AthenaKernel GeneratorObjectsTPCnv TestTools )
 
 atlas_add_dictionary( OLD_GeneratorObjectsTPCnvDict
                       GeneratorObjectsTPCnv/GeneratorObjectsTPCnvDict.h
                       GeneratorObjectsTPCnv/OLD_selection.xml
-                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjects AthAllocators AthenaKernel GeneratorObjectsTPCnv TestTools )
+                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} 
+                      LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib AthenaPoolCnvSvcLib GaudiKernel GeneratorObjects AthAllocators AthenaKernel GeneratorObjectsTPCnv TestTools )
 
 atlas_add_test( McEventCollectionCnv_p4_test
                 SOURCES
                 test/McEventCollectionCnv_p4_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjects TestTools StoreGateLib SGtests GeneratorObjectsTPCnv )
+                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} 
+                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaPoolCnvSvcLib GaudiKernel GeneratorObjects TestTools StoreGateLib SGtests GeneratorObjectsTPCnv )
 
 atlas_add_test( McEventCollectionCnv_p5_test
                 SOURCES
                 test/McEventCollectionCnv_p5_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjects TestTools StoreGateLib SGtests GeneratorObjectsTPCnv )
+                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} 
+                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaPoolCnvSvcLib GaudiKernel GeneratorObjects TestTools StoreGateLib SGtests GeneratorObjectsTPCnv )
 
 atlas_add_test( HepMcParticleLinkCnv_p1_test
                 SOURCES
                 test/HepMcParticleLinkCnv_p1_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjects TestTools StoreGateLib SGtests GeneratorObjectsTPCnv )
+                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} 
+                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaPoolCnvSvcLib GaudiKernel GeneratorObjects TestTools StoreGateLib SGtests GeneratorObjectsTPCnv )
 
 atlas_add_test( HepMcParticleLinkCnv_p2_test
                 SOURCES
                 test/HepMcParticleLinkCnv_p2_test.cxx
-                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
-                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjects TestTools StoreGateLib SGtests GeneratorObjectsTPCnv )
+                INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} 
+                LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaPoolCnvSvcLib GaudiKernel GeneratorObjects TestTools StoreGateLib SGtests GeneratorObjectsTPCnv )
diff --git a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/GenEventCnv_p1.h b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/GenEventCnv_p1.h
index 84ae7420bf5..533727ce1cd 100755
--- a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/GenEventCnv_p1.h
+++ b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/GenEventCnv_p1.h
@@ -24,9 +24,9 @@
 #endif
 #define private public
 #define protected public
-#include "HepMC/GenEvent.h"
-#include "HepMC/GenVertex.h"
-#include "HepMC/GenParticle.h"
+#include "AtlasHepMC/GenEvent.h"
+#include "AtlasHepMC/GenVertex.h"
+#include "AtlasHepMC/GenParticle.h"
 #undef private
 #undef protected
 #ifdef __clang__
diff --git a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p1.h b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p1.h
index 87e5aa412ad..473957d7818 100755
--- a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p1.h
+++ b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p1.h
@@ -20,9 +20,9 @@
 #endif
 #define private public
 #define protected public
-#include "HepMC/GenEvent.h"
-#include "HepMC/GenVertex.h"
-#include "HepMC/GenParticle.h"
+#include "AtlasHepMC/GenEvent.h"
+#include "AtlasHepMC/GenVertex.h"
+#include "AtlasHepMC/GenParticle.h"
 #ifdef __clang__
 #pragma clang diagnostic pop
 #endif
diff --git a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p2.h b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p2.h
index 6cdcd5b5bc4..5ef4935216c 100755
--- a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p2.h
+++ b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p2.h
@@ -21,9 +21,9 @@
 #endif
 #define private public
 #define protected public
-#include "HepMC/GenEvent.h"
-#include "HepMC/GenVertex.h"
-#include "HepMC/GenParticle.h"
+#include "AtlasHepMC/GenEvent.h"
+#include "AtlasHepMC/GenVertex.h"
+#include "AtlasHepMC/GenParticle.h"
 #ifdef __clang__
 #pragma clang diagnostic pop
 #endif
diff --git a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p3.h b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p3.h
index de2c3adb5b0..d286f8a0a02 100755
--- a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p3.h
+++ b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p3.h
@@ -21,9 +21,9 @@
 #endif
 #define private public
 #define protected public
-#include "HepMC/GenEvent.h"
-#include "HepMC/GenVertex.h"
-#include "HepMC/GenParticle.h"
+#include "AtlasHepMC/GenEvent.h"
+#include "AtlasHepMC/GenVertex.h"
+#include "AtlasHepMC/GenParticle.h"
 #undef private
 #undef protected
 #ifdef __clang__
diff --git a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p4.h b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p4.h
index 1de4eb62238..c8f96383057 100755
--- a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p4.h
+++ b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p4.h
@@ -21,9 +21,9 @@
 #endif
 #define private public
 #define protected public
-#include "HepMC/GenEvent.h"
-#include "HepMC/GenVertex.h"
-#include "HepMC/GenParticle.h"
+#include "AtlasHepMC/GenEvent.h"
+#include "AtlasHepMC/GenVertex.h"
+#include "AtlasHepMC/GenParticle.h"
 #undef private
 #undef protected
 #ifdef __clang__
diff --git a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p5.h b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p5.h
index f176d50a336..cad48a5b7c3 100755
--- a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p5.h
+++ b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/McEventCollectionCnv_p5.h
@@ -21,9 +21,9 @@
 #endif
 #define private public
 #define protected public
-#include "HepMC/GenEvent.h"
-#include "HepMC/GenVertex.h"
-#include "HepMC/GenParticle.h"
+#include "AtlasHepMC/GenEvent.h"
+#include "AtlasHepMC/GenVertex.h"
+#include "AtlasHepMC/GenParticle.h"
 #undef private
 #undef protected
 #ifdef __clang__
diff --git a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/initMcEventCollection.h b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/initMcEventCollection.h
index 0a46ab4f962..f74c78bbe9a 100644
--- a/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/initMcEventCollection.h
+++ b/Generators/GeneratorObjectsTPCnv/GeneratorObjectsTPCnv/initMcEventCollection.h
@@ -11,14 +11,12 @@
 
 #include <string>
 #include <vector>
-#include "HepMC/GenParticle.h"
+#include "AtlasHepMC/GenParticle.h"
 
 #undef NDEBUG
 
 class ISvcLocator;
-namespace HepMC {
-  class GenEvent;
-}
+#include "AtlasHepMC/GenEvent_fwd.h"
 
 namespace Athena_test {
   /** @fn bool initGaudi(ISvcLocator*& pSvcLoc, HepMC::GenParticle*& pGenParticle)
diff --git a/Generators/GeneratorObjectsTPCnv/src/HepMcDataPool.h b/Generators/GeneratorObjectsTPCnv/src/HepMcDataPool.h
index 0e4fd635a27..be051d1fbb4 100755
--- a/Generators/GeneratorObjectsTPCnv/src/HepMcDataPool.h
+++ b/Generators/GeneratorObjectsTPCnv/src/HepMcDataPool.h
@@ -18,9 +18,9 @@
 #endif
 #define private public
 #define protected public
-#include "HepMC/GenEvent.h"
-#include "HepMC/GenVertex.h"
-#include "HepMC/GenParticle.h"
+#include "AtlasHepMC/GenEvent.h"
+#include "AtlasHepMC/GenVertex.h"
+#include "AtlasHepMC/GenParticle.h"
 #ifdef __clang__
 #pragma clang diagnostic pop
 #endif
diff --git a/Generators/GeneratorObjectsTPCnv/src/initMcEventCollection.cxx b/Generators/GeneratorObjectsTPCnv/src/initMcEventCollection.cxx
index 50bbb46a448..4714e3d3843 100644
--- a/Generators/GeneratorObjectsTPCnv/src/initMcEventCollection.cxx
+++ b/Generators/GeneratorObjectsTPCnv/src/initMcEventCollection.cxx
@@ -4,9 +4,9 @@
 #include "GeneratorObjectsTPCnv/initMcEventCollection.h"
 
 // HepMC includes
-#include "HepMC/GenEvent.h"
-#include "HepMC/GenParticle.h"
-#include "HepMC/GenVertex.h"
+#include "AtlasHepMC/GenEvent.h"
+#include "AtlasHepMC/GenParticle.h"
+#include "AtlasHepMC/GenVertex.h"
 
 // CLHEP includes
 #include "CLHEP/Vector/LorentzVector.h"
diff --git a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx
index 0e4af50864d..23fcbdabe1b 100644
--- a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx
+++ b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx
@@ -13,7 +13,7 @@
 #include <cassert>
 #include <iostream>
 // HepMC includes
-#include "HepMC/GenEvent.h"
+#include "AtlasHepMC/GenEvent.h"
 
 // CLHEP includes
 #include "CLHEP/Vector/LorentzVector.h"
diff --git a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx
index 5284dfa1a0c..ce94ce084fb 100644
--- a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx
+++ b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx
@@ -8,7 +8,7 @@
 #include <cassert>
 #include <iostream>
 // HepMC includes
-#include "HepMC/GenEvent.h"
+#include "AtlasHepMC/GenEvent.h"
 
 // CLHEP includes
 #include "CLHEP/Vector/LorentzVector.h"
diff --git a/Generators/GeneratorObjectsTPCnv/test/McEventCollectionCnv_p4_test.cxx b/Generators/GeneratorObjectsTPCnv/test/McEventCollectionCnv_p4_test.cxx
index 792e0629fd3..52d941263c7 100644
--- a/Generators/GeneratorObjectsTPCnv/test/McEventCollectionCnv_p4_test.cxx
+++ b/Generators/GeneratorObjectsTPCnv/test/McEventCollectionCnv_p4_test.cxx
@@ -13,7 +13,7 @@
 #include <cassert>
 #include <iostream>
 // HepMC includes
-#include "HepMC/GenEvent.h"
+#include "AtlasHepMC/GenEvent.h"
 
 // CLHEP includes
 #include "CLHEP/Vector/LorentzVector.h"
diff --git a/Generators/GeneratorObjectsTPCnv/test/McEventCollectionCnv_p5_test.cxx b/Generators/GeneratorObjectsTPCnv/test/McEventCollectionCnv_p5_test.cxx
index 831571ff724..b9e78aa81a5 100644
--- a/Generators/GeneratorObjectsTPCnv/test/McEventCollectionCnv_p5_test.cxx
+++ b/Generators/GeneratorObjectsTPCnv/test/McEventCollectionCnv_p5_test.cxx
@@ -13,7 +13,7 @@
 #include <cassert>
 #include <iostream>
 // HepMC includes
-#include "HepMC/GenEvent.h"
+#include "AtlasHepMC/GenEvent.h"
 
 // CLHEP includes
 #include "CLHEP/Vector/LorentzVector.h"
diff --git a/Generators/GenzModuleEvent/CMakeLists.txt b/Generators/GenzModuleEvent/CMakeLists.txt
index 3ca3bd07589..c8063a30fdc 100644
--- a/Generators/GenzModuleEvent/CMakeLists.txt
+++ b/Generators/GenzModuleEvent/CMakeLists.txt
@@ -5,13 +5,14 @@
 # Declare the package name:
 atlas_subdir( GenzModuleEvent )
 
-# External dependencies:
-find_package( HepMC )
+# The dependencies of the package:
+atlas_depends_on_subdirs(
+   PUBLIC
+   Generators/AtlasHepMC)
 
 # Component(s) in the package:
 atlas_add_library( GenzModuleEvent
                    src/*.cxx
                    PUBLIC_HEADERS GenzModuleEvent
-                   INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${HEPMC_LIBRARIES} )
+                   LINK_LIBRARIES AtlasHepMCLib )
 
diff --git a/Generators/GenzModuleEvent/GenzModuleEvent/KineHepMcmap.h b/Generators/GenzModuleEvent/GenzModuleEvent/KineHepMcmap.h
index 5ce4da78d40..8b76dbb6cfb 100644
--- a/Generators/GenzModuleEvent/GenzModuleEvent/KineHepMcmap.h
+++ b/Generators/GenzModuleEvent/GenzModuleEvent/KineHepMcmap.h
@@ -5,8 +5,8 @@
 #ifndef KINEHEPMCMAP_H
 #define KINEHEPMCMAP_H
 
-#include "HepMC/GenEvent.h"
-#include "HepMC/GenParticle.h"
+#include "AtlasHepMC/GenEvent.h"
+#include "AtlasHepMC/GenParticle.h"
 
 class KineHepMcmap
 {
diff --git a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/LeptonJetAnalysis.h b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/LeptonJetAnalysis.h
index b138f1349c5..6c1f44dffac 100644
--- a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/LeptonJetAnalysis.h
+++ b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/LeptonJetAnalysis.h
@@ -8,9 +8,7 @@
 #include "baseAnalysis.h"
 
 // forward declarations
-namespace HepMC {
-  class GenEvent;
-}
+#include "AtlasHepMC/GenEvent_fwd.h"
 class TH1D;
 
 class LeptonJetAnalysis: public baseAnalysis
diff --git a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/ParticleContentAnalysis.h b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/ParticleContentAnalysis.h
index fa5490f7c6d..45cfd6ce142 100644
--- a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/ParticleContentAnalysis.h
+++ b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/ParticleContentAnalysis.h
@@ -8,10 +8,9 @@
 #include "baseAnalysis.h"
 
 // forward declarations
-namespace HepMC {
-  class GenEvent;
-  class GenParticle;
-}
+// forward declarations
+#include "AtlasHepMC/GenEvent_fwd.h"
+#include "AtlasHepMC/GenParticle_fwd.h"
 
 class TH1D;
 
diff --git a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/PdfAnalysis.h b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/PdfAnalysis.h
index ff245a2961f..2cecf588b5a 100644
--- a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/PdfAnalysis.h
+++ b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/PdfAnalysis.h
@@ -8,9 +8,9 @@
 #include "baseAnalysis.h"
 
 // forward declarations
-namespace HepMC {
-  class GenEvent;
-}
+#include "AtlasHepMC/GenEvent_fwd.h"
+#include "AtlasHepMC/PdfInfo.h"
+
 class TH1D;
 
 class PdfAnalysis: public baseAnalysis
diff --git a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/UserAnalysis.h b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/UserAnalysis.h
index 6baf9b56349..a81836c5525 100644
--- a/Generators/HepMCAnalysis_i/HepMCAnalysis_i/UserAnalysis.h
+++ b/Generators/HepMCAnalysis_i/HepMCAnalysis_i/UserAnalysis.h
@@ -8,9 +8,7 @@
 #include "baseAnalysis.h"
 
 // forward declarations
-namespace HepMC {
-  class GenEvent;
-}
+#include "AtlasHepMC/GenEvent_fwd.h"
 class TH1D;
 
 class UserAnalysis: public baseAnalysis
diff --git a/Generators/QGSJet_i/CMakeLists.txt b/Generators/QGSJet_i/CMakeLists.txt
index 5c4bbd5e2f0..74608c333b6 100644
--- a/Generators/QGSJet_i/CMakeLists.txt
+++ b/Generators/QGSJet_i/CMakeLists.txt
@@ -16,7 +16,6 @@ atlas_depends_on_subdirs( PUBLIC
 # External dependencies:
 find_package( CLHEP )
 find_package( Crmc COMPONENTS QgsjetII04 )
-find_package( HepMC COMPONENTS HepMC HepMCfio )
 
 # Remove the --as-needed linker flags:
 atlas_disable_as_needed()
@@ -29,15 +28,15 @@ atlas_add_library( QGSJet_iLib
                    src/Rangen.F
                    PUBLIC_HEADERS QGSJet_i
                    INCLUDE_DIRS ${CRMC_INCLUDE_DIRS}
-                   PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
+                   PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} 
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES ${CRMC_LIBRARIES} GeneratorModulesLib
-                   PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaKernel GaudiKernel TruthUtils )
+                   PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib AtlasHepMCfioLib AthenaKernel GaudiKernel TruthUtils )
 
 atlas_add_component( QGSJet_i
                      src/components/*.cxx
-                     INCLUDE_DIRS ${CRMC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${CRMC_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GeneratorModulesLib AthenaKernel GaudiKernel TruthUtils QGSJet_iLib )
+                     INCLUDE_DIRS ${CRMC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} 
+                     LINK_LIBRARIES ${CRMC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AtlasHepMCfioLib GeneratorModulesLib AthenaKernel GaudiKernel TruthUtils QGSJet_iLib )
 
 # Install files from the package:
 atlas_install_runtime( share/qgsjet_crmc.param )
diff --git a/Generators/QGSJet_i/src/QGSJet.cxx b/Generators/QGSJet_i/src/QGSJet.cxx
index c301f728576..34786c4bde2 100644
--- a/Generators/QGSJet_i/src/QGSJet.cxx
+++ b/Generators/QGSJet_i/src/QGSJet.cxx
@@ -19,8 +19,8 @@
 #include "CLHEP/Random/RandFlat.h"
 #include "AthenaKernel/IAtRndmGenSvc.h"
 
-#include "HepMC/HEPEVT_Wrapper.h"
-#include "HepMC/IO_HEPEVT.h"
+#include "AtlasHepMC/HEPEVT_Wrapper.h"
+#include "AtlasHepMC/IO_HEPEVT.h"
 
 
 #include "QGSJet_i/QGSJet.h"
diff --git a/Generators/Sherpa_i/Sherpa_i/Sherpa_i.h b/Generators/Sherpa_i/Sherpa_i/Sherpa_i.h
index 395903d6ac2..8e1c60deefb 100644
--- a/Generators/Sherpa_i/Sherpa_i/Sherpa_i.h
+++ b/Generators/Sherpa_i/Sherpa_i/Sherpa_i.h
@@ -9,14 +9,12 @@
 #include "GeneratorModules/GenModule.h"
 #include "TruthUtils/GeneratorName.h"
 
+#include "AtlasHepMC/GenEvent.h"
 
 namespace SHERPA {
   class Sherpa;
 }
 
-namespace HepMC {
-  class GenEvent;
-}
 
 class Sherpa_i : public GenModule {
 public:
diff --git a/Generators/TruthIO/CMakeLists.txt b/Generators/TruthIO/CMakeLists.txt
index ea13ffbe704..ffe7a4f709d 100644
--- a/Generators/TruthIO/CMakeLists.txt
+++ b/Generators/TruthIO/CMakeLists.txt
@@ -16,7 +16,6 @@ atlas_depends_on_subdirs( PUBLIC
                           Generators/GeneratorObjects )
 
 # External dependencies:
-find_package( HepMC COMPONENTS HepMC HepMCfio )
 find_package( HepPDT )
 
 # Component(s) in the package:
@@ -24,8 +23,8 @@ atlas_add_component( TruthIO
                      src/*.cxx
                      src/*.F
                      src/components/*.cxx
-                     INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel GeneratorModulesLib StoreGateLib SGtests EventInfo GeneratorObjects )
+                     INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} 
+                     LINK_LIBRARIES ${HEPPDT_LIBRARIES} AtlasHepMCLib AtlasHepMCfioLib AthenaBaseComps GaudiKernel GeneratorModulesLib StoreGateLib SGtests EventInfo GeneratorObjects )
 
 # Install files from the package:
 atlas_install_headers( TruthIO )
diff --git a/Generators/TruthIO/TruthIO/HepMCReadFromFile.h b/Generators/TruthIO/TruthIO/HepMCReadFromFile.h
index 1201f4dc574..2b0c41c4471 100644
--- a/Generators/TruthIO/TruthIO/HepMCReadFromFile.h
+++ b/Generators/TruthIO/TruthIO/HepMCReadFromFile.h
@@ -6,7 +6,7 @@
 #define TRUTHIO_HEPMCREADFROMFILE_H
 
 #include "GeneratorModules/GenBase.h"
-#include "HepMC/IO_GenEvent.h"
+#include "AtlasHepMC/IO_GenEvent.h"
 #include <memory>
 
 class StoreGateSvc;
diff --git a/Generators/TruthIO/TruthIO/ReadHepEvtFromAscii.h b/Generators/TruthIO/TruthIO/ReadHepEvtFromAscii.h
index 94d73de726d..87992b5d260 100644
--- a/Generators/TruthIO/TruthIO/ReadHepEvtFromAscii.h
+++ b/Generators/TruthIO/TruthIO/ReadHepEvtFromAscii.h
@@ -3,7 +3,7 @@
 */
 
 #include "AthenaBaseComps/AthAlgorithm.h"
-#include "HepMC/IO_GenEvent.h"
+#include "AtlasHepMC/IO_GenEvent.h"
 
 class StoreGateSvc;
 
diff --git a/Generators/TruthIO/TruthIO/WriteHepMC.h b/Generators/TruthIO/TruthIO/WriteHepMC.h
index 8140ccecae3..aa4ccc0b56b 100644
--- a/Generators/TruthIO/TruthIO/WriteHepMC.h
+++ b/Generators/TruthIO/TruthIO/WriteHepMC.h
@@ -6,7 +6,7 @@
 #define TRUTHIO_WRITEHEPMC_H
 
 #include "GeneratorModules/GenBase.h"
-#include "HepMC/IO_GenEvent.h"
+#include "AtlasHepMC/IO_GenEvent.h"
 #include <memory>
 
 
diff --git a/Generators/TruthIO/src/HepMCReadFromFile.cxx b/Generators/TruthIO/src/HepMCReadFromFile.cxx
index 6cabf7a0251..b323637adcb 100644
--- a/Generators/TruthIO/src/HepMCReadFromFile.cxx
+++ b/Generators/TruthIO/src/HepMCReadFromFile.cxx
@@ -4,9 +4,9 @@
 
 #include "TruthIO/HepMCReadFromFile.h"
 #include "GeneratorObjects/McEventCollection.h"
-#include "HepMC/GenEvent.h"
-#include "HepMC/IO_HEPEVT.h"
-#include "HepMC/HEPEVT_Wrapper.h"
+#include "AtlasHepMC/GenEvent.h"
+#include "AtlasHepMC/IO_HEPEVT.h"
+#include "AtlasHepMC/HEPEVT_Wrapper.h"
 
 #include "GaudiKernel/DataSvc.h"
 
diff --git a/Generators/TruthIO/src/PrintMC.cxx b/Generators/TruthIO/src/PrintMC.cxx
index e23c8aa4faa..f210ffe1617 100644
--- a/Generators/TruthIO/src/PrintMC.cxx
+++ b/Generators/TruthIO/src/PrintMC.cxx
@@ -13,7 +13,7 @@
 
 #include "HepPDT/ParticleData.hh"
 #include "HepPDT/ParticleDataTable.hh"
-#include "HepMC/GenEvent.h"
+#include "AtlasHepMC/GenEvent.h"
 
 
 inline void drawLine(std::ostream& os) {
diff --git a/Generators/TruthIO/src/ReadHepEvtFromAscii.cxx b/Generators/TruthIO/src/ReadHepEvtFromAscii.cxx
index 4fa18d7b520..06831e5d4a2 100644
--- a/Generators/TruthIO/src/ReadHepEvtFromAscii.cxx
+++ b/Generators/TruthIO/src/ReadHepEvtFromAscii.cxx
@@ -6,9 +6,9 @@
 
 #include "TruthIO/ReadHepEvtFromAscii.h"
 #include "GeneratorObjects/McEventCollection.h"
-#include "HepMC/GenEvent.h"
-#include "HepMC/IO_HEPEVT.h"
-#include "HepMC/HEPEVT_Wrapper.h"
+#include "AtlasHepMC/GenEvent.h"
+#include "AtlasHepMC/IO_HEPEVT.h"
+#include "AtlasHepMC/HEPEVT_Wrapper.h"
 
 #include "GaudiKernel/DataSvc.h"
 
diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEvent/CMakeLists.txt b/PhysicsAnalysis/TruthParticleID/McParticleEvent/CMakeLists.txt
index f84711b2e51..37b70bc2217 100644
--- a/PhysicsAnalysis/TruthParticleID/McParticleEvent/CMakeLists.txt
+++ b/PhysicsAnalysis/TruthParticleID/McParticleEvent/CMakeLists.txt
@@ -24,15 +24,14 @@ atlas_depends_on_subdirs(
 # External dependencies:
 find_package( Boost )
 find_package( CLHEP )
-find_package( HepMC )
 
 # Component(s) in the package:
 atlas_add_library( McParticleEvent
    McParticleEvent/*.h src/*.cxx
    PUBLIC_HEADERS McParticleEvent
-   INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
+   INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
    PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
-   LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaKernel AthContainers AthLinks Navigation
+   LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaKernel AthContainers AthLinks Navigation
    EventKernel NavFourMom GeneratorObjects ParticleEvent VxVertex
    PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} )
 
@@ -50,8 +49,8 @@ set( _jobOPath "${_jobOPath}:$ENV{JOBOPTSEARCHPATH}" )
 # Test(s) in the package:
 atlas_add_test( TruthParticle_test
    SOURCES test/TruthParticle_test.cxx
-   INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
-   LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GeneratorObjects
+   INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} 
+   LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib GeneratorObjects
    TestTools GaudiKernel McParticleEvent
    ENVIRONMENT "JOBOPTSEARCHPATH=${_jobOPath}" )
 
diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthEtIsolations.h b/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthEtIsolations.h
index 20be30414bf..fa2a630b35f 100644
--- a/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthEtIsolations.h
+++ b/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthEtIsolations.h
@@ -37,8 +37,6 @@
 #include "McParticleEvent/TruthParticleParamDefs.h"
 
 // Forward declaration
-namespace HepMC { class GenEvent; }
-namespace HepMC { class GenParticle; }
 class McEventCollection;
 
 class TruthEtIsolations
diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h b/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h
index 2e7eb1d1ced..5f20cd14894 100644
--- a/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h
+++ b/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h
@@ -25,7 +25,9 @@
 
 // HepMC / CLHEP includes
 #include "CLHEP/Vector/LorentzVector.h"
-#include "HepMC/GenParticle.h"
+#include "AtlasHepMC/GenParticle.h"
+#include "AtlasHepMC/Polarization.h"
+#include "AtlasHepMC/Flow.h"
 
 // Gaudi includes
 
@@ -45,7 +47,6 @@
 #include "McParticleEvent/TruthEtIsolations.h"
 
 // Forward declaration
-namespace HepMC { class GenEvent; }
 namespace Trk   { class RecVertex; }
 class TruthParticleContainer;
 
diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleBase.h b/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleBase.h
index be8c2b186b8..bb5c3fe8b1a 100644
--- a/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleBase.h
+++ b/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleBase.h
@@ -14,7 +14,7 @@
 // STL includes
 
 // HepMC / CLHEP includes
-#include "HepMC/GenParticle.h"
+#include "AtlasHepMC/GenParticle.h"
 
 // Gaudi includes
 
diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleMomentum.h b/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleMomentum.h
index 61ef93e52ee..b13eac5c2de 100644
--- a/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleMomentum.h
+++ b/PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticleMomentum.h
@@ -18,7 +18,7 @@
 // HepMC / CLHEP includes
 #include "CLHEP/Vector/LorentzVector.h"
 #include "CLHEP/Units/SystemOfUnits.h"
-#include "HepMC/SimpleVector.h"
+#include "AtlasHepMC/SimpleVector.h"
 #include "EventKernel/I4Momentum.h"
 
 // Forward declaration
diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthEtIsolations.cxx b/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthEtIsolations.cxx
index 7e31fa1ec53..e6681817dde 100644
--- a/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthEtIsolations.cxx
+++ b/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthEtIsolations.cxx
@@ -17,9 +17,9 @@
 
 // HepMC / CLHEP includes
 #include "CLHEP/Units/SystemOfUnits.h"
-#include "HepMC/GenParticle.h"
-#include "HepMC/GenEvent.h"
-#include "HepMC/GenVertex.h"
+#include "AtlasHepMC/GenParticle.h"
+#include "AtlasHepMC/GenEvent.h"
+#include "AtlasHepMC/GenVertex.h"
 #include "GeneratorObjects/McEventCollection.h"
 
 // McParticleEvent includes
diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthParticle.cxx b/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthParticle.cxx
index 9c7ce29ed6b..d1a09ef0a76 100644
--- a/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthParticle.cxx
+++ b/PhysicsAnalysis/TruthParticleID/McParticleEvent/src/TruthParticle.cxx
@@ -14,9 +14,9 @@
 #include <string>
 
 // HepMC / CLHEP includes
-#include "HepMC/GenParticle.h"
-#include "HepMC/GenEvent.h"
-#include "HepMC/GenVertex.h"
+#include "AtlasHepMC/GenParticle.h"
+#include "AtlasHepMC/GenEvent.h"
+#include "AtlasHepMC/GenVertex.h"
 
 #include "VxVertex/RecVertex.h"
 
diff --git a/Reconstruction/MissingETEvent/CMakeLists.txt b/Reconstruction/MissingETEvent/CMakeLists.txt
index e4537ce12d0..f39849d5f0c 100644
--- a/Reconstruction/MissingETEvent/CMakeLists.txt
+++ b/Reconstruction/MissingETEvent/CMakeLists.txt
@@ -22,22 +22,21 @@ atlas_depends_on_subdirs( PUBLIC
 # External dependencies:
 find_package( Boost COMPONENTS filesystem thread system )
 find_package( CLHEP )
-find_package( HepMC )
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
 
 # Component(s) in the package:
 atlas_add_library( MissingETEvent
                    src/*.cxx
                    PUBLIC_HEADERS MissingETEvent
-                   INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
+                   INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
-                   LINK_LIBRARIES ${Boost_LIBRARIES} ${HEPMC_LIBRARIES} CaloEvent CaloGeoHelpers AthContainers Navigation EventKernel NavFourMom GaudiKernel
+                   LINK_LIBRARIES ${Boost_LIBRARIES} AtlasHepMCLib CaloEvent CaloGeoHelpers AthContainers Navigation EventKernel NavFourMom GaudiKernel
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} CxxUtils TruthHelper )
 
 atlas_add_dictionary( MissingETEventDict
                       MissingETEvent/MissingETEventDict.h
                       MissingETEvent/selection.xml
                       INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} CaloEvent CaloGeoHelpers AthContainers Navigation EventKernel NavFourMom GaudiKernel CxxUtils TruthHelper MissingETEvent )
+                      LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib CaloEvent CaloGeoHelpers AthContainers Navigation EventKernel NavFourMom GaudiKernel CxxUtils TruthHelper MissingETEvent )
 
diff --git a/Reconstruction/MissingETEvent/MissingETEvent/MissingEtTruth.h b/Reconstruction/MissingETEvent/MissingETEvent/MissingEtTruth.h
index 22bee632de7..a0b336d266f 100644
--- a/Reconstruction/MissingETEvent/MissingETEvent/MissingEtTruth.h
+++ b/Reconstruction/MissingETEvent/MissingETEvent/MissingEtTruth.h
@@ -18,8 +18,8 @@ PURPOSE:
 #include "MissingETEvent/MissingET.h"
 #include "MissingETEvent/MissingEtRegions.h"
 
-#include "HepMC/GenEvent.h"
-#include "HepMC/GenParticle.h"
+#include "AtlasHepMC/GenEvent.h"
+#include "AtlasHepMC/GenParticle.h"
 
 #include <vector>
 
-- 
GitLab