From 41c876160dc0b5133c81a35b9bf105b4be4bbffa Mon Sep 17 00:00:00 2001
From: John Chapman <jchapman@cern.ch>
Date: Mon, 24 Aug 2020 14:22:30 +0200
Subject: [PATCH] Replace const HepMC::GenParticlePtr with
 HepMC::ConstGenParticlePtr

For HepMC2
```
const HepMC::GenParticlePtr == HepMC::GenParticle* const
HepMC::ConstGenParticlePtr == const HepMC::GenParticle*
```
---
 .../EvgenProdTools/EvgenProdTools/FixHepMC.h  |  6 ++---
 Generators/EvgenProdTools/src/FixHepMC.cxx    |  6 ++---
 .../EvtGen_i/EvtGen_i/EvtInclusiveDecay.h     |  8 +++----
 Generators/EvtGen_i/src/EvtInclusiveDecay.cxx |  8 +++----
 Generators/FlowAfterburner/src/CheckFlow.cxx  |  2 +-
 .../src/CheckFlow_New_Minbias.cxx             |  2 +-
 .../test/HepMcParticleLink_test.cxx           | 22 +++++++++----------
 .../test/HepMcParticleLinkCnv_p1_test.cxx     |  8 +++----
 .../test/HepMcParticleLinkCnv_p2_test.cxx     |  8 +++----
 Generators/Rivet_i/src/Rivet_i.cxx            |  2 +-
 .../MissingETEvent/MissingEtTruth.h           |  2 +-
 .../MissingETEvent/src/MissingEtTruth.cxx     |  2 +-
 .../GenParticleEnergyDepositMap.h             |  2 +-
 .../G4AtlasTests/src/CalibHitValidate.cxx     |  2 +-
 .../ISF_HitAnalysis.h                         |  4 ++--
 .../src/LarEMSamplingFraction.cxx             |  2 +-
 16 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/Generators/EvgenProdTools/EvgenProdTools/FixHepMC.h b/Generators/EvgenProdTools/EvgenProdTools/FixHepMC.h
index d4da6123745..6b61e0e169a 100644
--- a/Generators/EvgenProdTools/EvgenProdTools/FixHepMC.h
+++ b/Generators/EvgenProdTools/EvgenProdTools/FixHepMC.h
@@ -36,9 +36,9 @@ private:
 
   /// @name Classifiers for identifying particles to be removed
   //@{
-  bool isPID0(const HepMC::GenParticlePtr p);
-  bool isNonTransportableInDecayChain(const HepMC::GenParticlePtr p);
-  bool isLoop(const HepMC::GenParticlePtr p);
+  bool isPID0(HepMC::ConstGenParticlePtr p);
+  bool isNonTransportableInDecayChain(HepMC::ConstGenParticlePtr p);
+  bool isLoop(HepMC::ConstGenParticlePtr p);
   //@}
 
   /// @name Config properties
diff --git a/Generators/EvgenProdTools/src/FixHepMC.cxx b/Generators/EvgenProdTools/src/FixHepMC.cxx
index a6e4c42216c..e6b8fa97ffa 100644
--- a/Generators/EvgenProdTools/src/FixHepMC.cxx
+++ b/Generators/EvgenProdTools/src/FixHepMC.cxx
@@ -200,17 +200,17 @@ StatusCode FixHepMC::finalize() {
 //@{
 
 // Identify PDG ID = 0 particles, usually from HEPEVT padding
-bool FixHepMC::isPID0(const HepMC::GenParticlePtr p) {
+bool FixHepMC::isPID0(HepMC::ConstGenParticlePtr p) {
   return p->pdg_id() == 0;
 }
 
 // Identify non-transportable stuff _after_ hadronisation
-bool FixHepMC::isNonTransportableInDecayChain(const HepMC::GenParticlePtr p) {
+bool FixHepMC::isNonTransportableInDecayChain(HepMC::ConstGenParticlePtr p) {
   return !MC::PID::isTransportable(p->pdg_id()) && MC::fromDecay(p);
 }
 
 // Identify internal "loop" particles
-bool FixHepMC::isLoop(const HepMC::GenParticlePtr p) {
+bool FixHepMC::isLoop(HepMC::ConstGenParticlePtr p) {
   if (p->production_vertex() == p->end_vertex() && p->end_vertex() != NULL) return true;
   if (m_loopByBC && p->production_vertex()) {
     /// @todo Use new particle MC::parents(...) tool
diff --git a/Generators/EvtGen_i/EvtGen_i/EvtInclusiveDecay.h b/Generators/EvtGen_i/EvtGen_i/EvtInclusiveDecay.h
index cfd13ef5ec8..8b614cc57e5 100644
--- a/Generators/EvtGen_i/EvtGen_i/EvtInclusiveDecay.h
+++ b/Generators/EvtGen_i/EvtGen_i/EvtInclusiveDecay.h
@@ -88,23 +88,23 @@ class EvtInclusiveDecay:public GenBase {
 					EvtParticle* evtPart, EvtVector4R treeStart,
                                         double momentumScaleFactor = 1.0);
 
-		bool isToBeDecayed(const HepMC::GenParticlePtr p, bool doCrossChecks);
+		bool isToBeDecayed(HepMC::ConstGenParticlePtr p, bool doCrossChecks);
 		bool isDefaultB(const int pId) const;
     
     bool passesUserSelection(HepMC::GenEvent* hepMC);
-    double invMass(const HepMC::GenParticlePtr p1, const HepMC::GenParticlePtr p2);
+    double invMass(HepMC::ConstGenParticlePtr p1, HepMC::ConstGenParticlePtr p2);
 
 		// Utility functions to print HepMC record for debugging with optional
 		// coloring by status code and highlighting of particles in a specific list of barcodes
 #ifdef HEPMC3
 		void printHepMC(HepMC::GenEvent* hepMC, std::set<HepMC::GenParticlePtr>* barcodeList = nullptr);
 		unsigned int printTree(HepMC::GenParticlePtr p, std::set<HepMC::GenVertexPtr>& visited, int level, std::set<HepMC::GenParticlePtr>* barcodeList = nullptr);
-		std::string pdgName(const HepMC::GenParticlePtr p, bool statusHighlighting = false, std::set<HepMC::GenParticlePtr>* barcodeList = nullptr);
+		std::string pdgName(HepMC::ConstGenParticlePtr p, bool statusHighlighting = false, std::set<HepMC::GenParticlePtr>* barcodeList = nullptr);
 #else
 		void printHepMC(HepMC::GenEvent* hepMC, std::set<int>* barcodeList = nullptr);
 		unsigned int printTree(HepMC::GenParticlePtr p, std::set<HepMC::GenVertexPtr>& visited,
 				       int level, std::set<int>* barcodeList = 0);
-		std::string pdgName(const HepMC::GenParticlePtr p, bool statusHighlighting = false, std::set<int>* barcodeList = nullptr);
+		std::string pdgName(HepMC::ConstGenParticlePtr p, bool statusHighlighting = false, std::set<int>* barcodeList = nullptr);
 #endif
       
 		// StoreGate access
diff --git a/Generators/EvtGen_i/src/EvtInclusiveDecay.cxx b/Generators/EvtGen_i/src/EvtInclusiveDecay.cxx
index ed66103f0d0..6ee1f9f94eb 100644
--- a/Generators/EvtGen_i/src/EvtInclusiveDecay.cxx
+++ b/Generators/EvtGen_i/src/EvtInclusiveDecay.cxx
@@ -531,7 +531,7 @@ void EvtInclusiveDecay::addEvtGenDecayTree(HepMC::GenEvent* hepMC, HepMC::GenPar
 // The parameter doCrossChecks is used to prevent double-counting for cross-checks
 // if isToBeDecayed is called more than once for the same particle.
 //
-bool EvtInclusiveDecay::isToBeDecayed(const HepMC::GenParticlePtr p, bool doCrossChecks) {
+bool EvtInclusiveDecay::isToBeDecayed(HepMC::ConstGenParticlePtr p, bool doCrossChecks) {
   int id = p->pdg_id();
   int stat = p->status();
   int nDaughters = 0;
@@ -665,7 +665,7 @@ bool EvtInclusiveDecay::passesUserSelection(HepMC::GenEvent* hepMC) {
   return passed;
 }
 
-double EvtInclusiveDecay::invMass(const HepMC::GenParticlePtr p1, const HepMC::GenParticlePtr p2) {
+double EvtInclusiveDecay::invMass(HepMC::ConstGenParticlePtr p1, HepMC::ConstGenParticlePtr p2) {
   double p1Px = p1->momentum().px();
   double p1Py = p1->momentum().py();
   double p1Pz = p1->momentum().pz();
@@ -815,7 +815,7 @@ unsigned int EvtInclusiveDecay::printTree(HepMC::GenParticlePtr p,
 #endif
 
 #ifdef HEPMC3
-std::string EvtInclusiveDecay::pdgName(const HepMC::GenParticlePtr p, bool statusHighlighting, std::set<HepMC::GenParticlePtr>* barcodeList) {
+std::string EvtInclusiveDecay::pdgName(HepMC::ConstGenParticlePtr p, bool statusHighlighting, std::set<HepMC::GenParticlePtr>* barcodeList) {
   std::ostringstream buf;
   if (statusHighlighting) {
     if ( ((barcodeList!=0) && (barcodeList->find(p) != barcodeList->end())) ||
@@ -836,7 +836,7 @@ std::string EvtInclusiveDecay::pdgName(const HepMC::GenParticlePtr p, bool statu
   return buf.str();
 }
 #else
-std::string EvtInclusiveDecay::pdgName(const HepMC::GenParticlePtr p, bool statusHighlighting, std::set<int>* barcodeList) {
+std::string EvtInclusiveDecay::pdgName(HepMC::ConstGenParticlePtr p, bool statusHighlighting, std::set<int>* barcodeList) {
   std::ostringstream buf;
   if (statusHighlighting) {
     if ( ((barcodeList!=0) && (barcodeList->find(HepMC::barcode(p)) != barcodeList->end())) ||
diff --git a/Generators/FlowAfterburner/src/CheckFlow.cxx b/Generators/FlowAfterburner/src/CheckFlow.cxx
index db8292b1d17..adbe457fcd8 100644
--- a/Generators/FlowAfterburner/src/CheckFlow.cxx
+++ b/Generators/FlowAfterburner/src/CheckFlow.cxx
@@ -28,7 +28,7 @@
 
 using namespace TruthHelper;
 
-typedef std::vector<const HepMC::GenParticlePtr>  MCparticleCollection ;
+typedef std::vector<HepMC::ConstGenParticlePtr>  MCparticleCollection ;
 
 CheckFlow::CheckFlow(const std::string& name, ISvcLocator* pSvcLocator) :
   AthAlgorithm(name, pSvcLocator),
diff --git a/Generators/FlowAfterburner/src/CheckFlow_New_Minbias.cxx b/Generators/FlowAfterburner/src/CheckFlow_New_Minbias.cxx
index 764f5ce9be0..c245f15b2bf 100644
--- a/Generators/FlowAfterburner/src/CheckFlow_New_Minbias.cxx
+++ b/Generators/FlowAfterburner/src/CheckFlow_New_Minbias.cxx
@@ -39,7 +39,7 @@
 
 using namespace TruthHelper;
 
-//typedef std::vector<const HepMC::GenParticlePtr>  MCParticleCollection ;
+//typedef std::vector<HepMC::ConstGenParticlePtr>  MCParticleCollection ;
 
 CheckFlow_New_Minbias::CheckFlow_New_Minbias(const std::string& name, ISvcLocator* pSvcLocator) :
   AthAlgorithm(name, pSvcLocator)
diff --git a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
index 5ddedda834e..825a8e825d6 100644
--- a/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
+++ b/Generators/GeneratorObjects/test/HepMcParticleLink_test.cxx
@@ -141,7 +141,7 @@ namespace MCTesting {
 
   class is_photon {
   public:
-    bool operator() ( const HepMC::GenParticlePtr p ) {
+    bool operator() ( HepMC::ConstGenParticlePtr p ) {
       return ( p && p->pdg_id() == 22 );
     }
   };
@@ -263,7 +263,7 @@ namespace MCTesting {
                     back_inserter(theGammas), is_photon() );
 #endif
     ASSERT_EQ(1u, theGammas.size());
-    const HepMC::GenParticlePtr pGamma(theGammas.front());
+    HepMC::ConstGenParticlePtr pGamma(theGammas.front());
 #ifdef GENP_DEBUG
     pGamma->print();
     std::cout << "gamma barcode " << hex << HepMC::barcode(pGamma) << std::endl;
@@ -310,7 +310,7 @@ namespace MCTesting {
     // Fill it with a dummy GenEvent
     inputTestDataHandle->push_back(HepMC::newGenEvent(20,1));
     HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0));
-    const HepMC::GenParticlePtr particle1 = populateGenEvent(ge1);
+    HepMC::ConstGenParticlePtr particle1 = populateGenEvent(ge1);
     // A HepMcParticleLink built using a GenParticle pointer should
     // still work.
     HepMcParticleLink testLink1a(particle1,0);
@@ -334,7 +334,7 @@ namespace MCTesting {
     const HepMcParticleLink::index_type dummyIndex1(0);
     const HepMcParticleLink::index_type refEvtNum1 = static_cast<HepMcParticleLink::index_type>(event_number1);
     HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0));
-    const HepMC::GenParticlePtr particle1 = populateGenEvent(ge1);
+    HepMC::ConstGenParticlePtr particle1 = populateGenEvent(ge1);
     // Add a second dummy GenEvent
     const int process_id2(20);
     const int event_number2(25);
@@ -415,7 +415,7 @@ namespace MCTesting {
     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::GenParticlePtr particle2 = populateGenEvent2(ge2);
+    HepMC::ConstGenParticlePtr particle2 = populateGenEvent2(ge2);
     // Add a third dummy GenEvent (identical to the first)
     const int process_id3(20);
     const int event_number3(17);
@@ -482,7 +482,7 @@ namespace MCTesting {
     const int event_number1(17);
     inputTestDataHandle->push_back(HepMC::newGenEvent(process_id1, event_number1));
     HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0));
-    const HepMC::GenParticlePtr particle1 = populateGenEvent(ge1);
+    HepMC::ConstGenParticlePtr particle1 = populateGenEvent(ge1);
     // Add a second dummy GenEvent
     const int process_id2(20);
     const int event_number2(25);
@@ -496,7 +496,7 @@ namespace MCTesting {
     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::GenParticlePtr particle3 = populateGenEvent(ge3);
+    HepMC::ConstGenParticlePtr particle3 = populateGenEvent(ge3);
 
     const int event_number4(89);
     inputTestDataHandle->push_back(new HepMC::GenEvent(ge1));
@@ -573,7 +573,7 @@ namespace MCTesting {
     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::GenParticlePtr particle4 = populateFilteredGenEvent(ge4);
+    HepMC::ConstGenParticlePtr particle4 = populateFilteredGenEvent(ge4);
 
     const IProxyDict* sg = SG::CurrentEventStore::store();
 
@@ -742,7 +742,7 @@ namespace MCTesting {
     const int event_number5(460);
     const HepMcParticleLink::index_type refEvtNum5 = static_cast<HepMcParticleLink::index_type>(event_number5);
     const int cutBarcode(210001);
-    const HepMC::GenParticlePtr cutParticlePtr{};
+    HepMC::ConstGenParticlePtr cutParticlePtr{};
 
     // Link to a GenParticle which was not recorded to the
     // McEventCollection, even though other parts of the same GenEvent
@@ -781,7 +781,7 @@ namespace MCTesting {
     const HepMcParticleLink::index_type dummyIndex1(0);
     const HepMcParticleLink::index_type refEvtNum1 = static_cast<HepMcParticleLink::index_type>(event_number1);
     HepMC::GenEvent& ge1 = *(inputTestDataHandle->at(0));
-    const HepMC::GenParticlePtr particle1 = populateGenEvent(ge1);
+    HepMC::ConstGenParticlePtr particle1 = populateGenEvent(ge1);
     // Add a second dummy GenEvent
     const int process_id2(20);
     const int event_number2(25);
@@ -789,7 +789,7 @@ namespace MCTesting {
     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::GenParticlePtr particle2 = populateGenEvent2(ge2);
+    HepMC::ConstGenParticlePtr particle2 = populateGenEvent2(ge2);
     // Add a third dummy GenEvent
     const int process_id3(20);
     const int event_number3(17);
diff --git a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx
index 52dcb9a9fb0..7ad9786b9d7 100644
--- a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx
+++ b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p1_test.cxx
@@ -170,21 +170,21 @@ void test1()
   assert ( genPartList.size() == 13 );
   // HepMcParticleLinks pointing at GenParticles in the first GenEvent in the McEventCollection
   // By event_number
-  const HepMC::GenParticlePtr particle1 = genPartList.at(0);
+  HepMC::ConstGenParticlePtr particle1 = genPartList.at(0);
   HepMcParticleLink trans1a(HepMC::barcode(particle1),particle1->parent_event()->event_number());
   testit (trans1a);
   // By position
   HepMcParticleLink trans1b(HepMC::barcode(particle1),0,EBC_MAINEVCOLL,HepMcParticleLink::IS_POSITION);
   testit (trans1b);
   // HepMcParticleLinks pointing at GenParticles in other GenEvents in the McEventCollection
-  const HepMC::GenParticlePtr particle2 = genPartList.at(7);
+  HepMC::ConstGenParticlePtr particle2 = genPartList.at(7);
   HepMcParticleLink trans2(HepMC::barcode(particle2),particle2->parent_event()->event_number());
   testit (trans2);
-  const HepMC::GenParticlePtr particle3 = genPartList.at(8);
+  HepMC::ConstGenParticlePtr particle3 = genPartList.at(8);
   HepMcParticleLink trans3(HepMC::barcode(particle3),particle3->parent_event()->event_number());
   testit (trans3);
   // HepMcParticleLinks pointing at filtered pileup truth
-  const HepMC::GenParticlePtr particle4 = genPartList.at(12);
+  HepMC::ConstGenParticlePtr particle4 = genPartList.at(12);
   HepMcParticleLink trans4(HepMC::barcode(particle4),particle4->parent_event()->event_number());
   testit (trans4);
   // HepMcParticleLinks pointing at delta-ray (barcode=0 - not recorded in McEventCollection) using event_number
diff --git a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx
index bc858ae3ec3..301fb60487f 100644
--- a/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx
+++ b/Generators/GeneratorObjectsTPCnv/test/HepMcParticleLinkCnv_p2_test.cxx
@@ -171,21 +171,21 @@ void test1()
   assert ( genPartList.size() == 13 );
   // HepMcParticleLinks pointing at GenParticles in the first GenEvent in the McEventCollection
   // By event_number
-  const HepMC::GenParticlePtr particle1 = genPartList.at(0);
+  HepMC::ConstGenParticlePtr particle1 = genPartList.at(0);
   HepMcParticleLink trans1a(HepMC::barcode(particle1),particle1->parent_event()->event_number());
   testit (trans1a);
   // By position
   HepMcParticleLink trans1b(HepMC::barcode(particle1),0,EBC_MAINEVCOLL,HepMcParticleLink::IS_POSITION);
   testit (trans1b);
   // HepMcParticleLinks pointing at GenParticles in other GenEvents in the McEventCollection
-  const HepMC::GenParticlePtr particle2 = genPartList.at(7);
+  HepMC::ConstGenParticlePtr particle2 = genPartList.at(7);
   HepMcParticleLink trans2(HepMC::barcode(particle2),particle2->parent_event()->event_number());
   testit (trans2);
-  const HepMC::GenParticlePtr particle3 = genPartList.at(8);
+  HepMC::ConstGenParticlePtr particle3 = genPartList.at(8);
   HepMcParticleLink trans3(HepMC::barcode(particle3),particle3->parent_event()->event_number());
   testit (trans3);
   // HepMcParticleLinks pointing at filtered pileup truth
-  const HepMC::GenParticlePtr particle4 = genPartList.at(12);
+  HepMC::ConstGenParticlePtr particle4 = genPartList.at(12);
   HepMcParticleLink trans4(HepMC::barcode(particle4),particle4->parent_event()->event_number());
   testit (trans4);
   // HepMcParticleLinks pointing at delta-ray (barcode=0 - not recorded in McEventCollection) using event number
diff --git a/Generators/Rivet_i/src/Rivet_i.cxx b/Generators/Rivet_i/src/Rivet_i.cxx
index 6d49035b639..990fb28989d 100644
--- a/Generators/Rivet_i/src/Rivet_i.cxx
+++ b/Generators/Rivet_i/src/Rivet_i.cxx
@@ -231,7 +231,7 @@ StatusCode Rivet_i::finalize() {
 
 /// Helper function to sort GenParticles by descending energy
 /// @todo Move into GeneratorUtils (with many friends)
-bool cmpGenParticleByEDesc(const HepMC::GenParticlePtr a, const HepMC::GenParticlePtr b) {
+bool cmpGenParticleByEDesc(HepMC::ConstGenParticlePtr a, HepMC::ConstGenParticlePtr b) {
   return a->momentum().e() > b->momentum().e();
 }
 
diff --git a/Reconstruction/MissingETEvent/MissingETEvent/MissingEtTruth.h b/Reconstruction/MissingETEvent/MissingETEvent/MissingEtTruth.h
index 08eb6b14a98..0cbac24dd86 100644
--- a/Reconstruction/MissingETEvent/MissingETEvent/MissingEtTruth.h
+++ b/Reconstruction/MissingETEvent/MissingETEvent/MissingEtTruth.h
@@ -51,7 +51,7 @@ class MissingEtTruth : public MissingET
   virtual ~MissingEtTruth();
 
   // add a cell
-  void addPart(const HepMC::GenParticlePtr aPart, double etaFull);
+  void addPart(HepMC::ConstGenParticlePtr aPart, double etaFull);
 
   // set Truth contributions
   void setExTruth(TruthIndex aTruth,  double theEx);
diff --git a/Reconstruction/MissingETEvent/src/MissingEtTruth.cxx b/Reconstruction/MissingETEvent/src/MissingEtTruth.cxx
index a23dbc28661..d6a61b19008 100644
--- a/Reconstruction/MissingETEvent/src/MissingEtTruth.cxx
+++ b/Reconstruction/MissingETEvent/src/MissingEtTruth.cxx
@@ -48,7 +48,7 @@ MissingEtTruth::~MissingEtTruth()
   this->setup();
 }
 
-void MissingEtTruth::addPart(const HepMC::GenParticlePtr Part, double etaFull)
+void MissingEtTruth::addPart(HepMC::ConstGenParticlePtr Part, double etaFull)
 {
   
   double weight = 1.;
diff --git a/Simulation/FastSimulation/FastSimulationEvent/FastSimulationEvent/GenParticleEnergyDepositMap.h b/Simulation/FastSimulation/FastSimulationEvent/FastSimulationEvent/GenParticleEnergyDepositMap.h
index 1b61f3fb453..158bd161958 100644
--- a/Simulation/FastSimulation/FastSimulationEvent/FastSimulationEvent/GenParticleEnergyDepositMap.h
+++ b/Simulation/FastSimulation/FastSimulationEvent/FastSimulationEvent/GenParticleEnergyDepositMap.h
@@ -61,7 +61,7 @@ namespace FSim {
 
 }
  
-typedef std::multimap<const HepMC::GenParticlePtr , FSim::EnergyDeposit> GenParticleEnergyDepositMap;
+typedef std::multimap<HepMC::ConstGenParticlePtr , FSim::EnergyDeposit> GenParticleEnergyDepositMap;
 typedef std::multimap<int, FSim::EnergyDeposit>                       BarcodeEnergyDepositMap;
 
 CLASS_DEF( GenParticleEnergyDepositMap, 97004131, 1)
diff --git a/Simulation/G4Atlas/G4AtlasTests/src/CalibHitValidate.cxx b/Simulation/G4Atlas/G4AtlasTests/src/CalibHitValidate.cxx
index 7cded8382cc..d27b20c1d01 100644
--- a/Simulation/G4Atlas/G4AtlasTests/src/CalibHitValidate.cxx
+++ b/Simulation/G4Atlas/G4AtlasTests/src/CalibHitValidate.cxx
@@ -64,7 +64,7 @@ StatusCode CalibHitValidate::execute()
     return StatusCode::FAILURE;
   }
   HepMC::GenEvent::particle_const_iterator pit  = truthEvent->at(0)->particles_begin();
-  const HepMC::GenParticlePtr   gen  = *pit;
+  HepMC::ConstGenParticlePtr   gen  = *pit;
 
 
   std::vector<std::string>::iterator containerNameIter;
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/ISF_HitAnalysis.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/ISF_HitAnalysis.h
index 49fc9578c76..8b3a212ba61 100755
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/ISF_HitAnalysis.h
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/ISF_FastCaloSimParametrization/ISF_HitAnalysis.h
@@ -254,8 +254,8 @@ class ISF_HitAnalysis : public AthAlgorithm {
    double m_distetaCaloBorder[CaloCell_ID_FCS::MaxSample][3];
 
 
-   void extrapolate(const HepMC::GenParticlePtr  part,std::vector<Trk::HitInfo>* hitVector);
-   void extrapolate_to_ID(const HepMC::GenParticlePtr  part,std::vector<Trk::HitInfo>* hitVector);
+   void extrapolate(HepMC::ConstGenParticlePtr  part,std::vector<Trk::HitInfo>* hitVector);
+   void extrapolate_to_ID(HepMC::ConstGenParticlePtr  part,std::vector<Trk::HitInfo>* hitVector);
 
    HepPDT::ParticleDataTable*     m_particleDataTable;
 
diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/src/LarEMSamplingFraction.cxx b/Simulation/Tools/CaloSamplingFractionAnalysis/src/LarEMSamplingFraction.cxx
index 091a00c8f72..7e5fa4fb69b 100644
--- a/Simulation/Tools/CaloSamplingFractionAnalysis/src/LarEMSamplingFraction.cxx
+++ b/Simulation/Tools/CaloSamplingFractionAnalysis/src/LarEMSamplingFraction.cxx
@@ -158,7 +158,7 @@ StatusCode LarEMSamplingFraction::execute()
 		return StatusCode::FAILURE;
 	}
 	HepMC::GenEvent::particle_const_iterator pit  = truthEvent->at(0)->particles_begin();
-	const HepMC::GenParticlePtr   gen  = *pit;
+	HepMC::ConstGenParticlePtr   gen  = *pit;
 	m_mc_pdg = gen->pdg_id();
 	m_mc_eta = gen->momentum().pseudoRapidity();
 	m_mc_phi = gen->momentum().phi();
-- 
GitLab