From 439a0ab36037d4ee4d1907dcfeea33bec224ca6f Mon Sep 17 00:00:00 2001
From: adrien-matta <a.matta@surrey.ac.uk>
Date: Mon, 4 May 2015 12:06:42 +0100
Subject: [PATCH] * NPS now compatible with geant4 10

---
 NPSimulation/CMakeLists.txt                        | 2 +-
 NPSimulation/Core/EventGeneratorBeam.cc            | 4 ++--
 NPSimulation/Core/EventGeneratorGammaDecay.cc      | 4 ++--
 NPSimulation/Core/EventGeneratorIsotropic.cc       | 4 ++--
 NPSimulation/Core/EventGeneratorParticleDecay.cc   | 3 ++-
 NPSimulation/Core/EventGeneratorTwoBodyReaction.cc | 5 +++--
 NPSimulation/Core/MaterialManager.cc               | 2 +-
 7 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/NPSimulation/CMakeLists.txt b/NPSimulation/CMakeLists.txt
index e867dc2d7..9781c3815 100644
--- a/NPSimulation/CMakeLists.txt
+++ b/NPSimulation/CMakeLists.txt
@@ -44,7 +44,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${root_cflags}")
 
 # If the compiler is Clang, silence the unrecognised flags
 if(${CMAKE_CXX_COMPILER_ID} MATCHES ".*Clang.*")
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics -Wno-deprecated-register")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments -fcolor-diagnostics -Wno-deprecated-register -Wno-shadow")
 endif()
 
 set(CMAKE_BINARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
diff --git a/NPSimulation/Core/EventGeneratorBeam.cc b/NPSimulation/Core/EventGeneratorBeam.cc
index 5626d714c..d9121520e 100644
--- a/NPSimulation/Core/EventGeneratorBeam.cc
+++ b/NPSimulation/Core/EventGeneratorBeam.cc
@@ -25,7 +25,7 @@
 
 // G4 header
 #include "G4ParticleTable.hh"
-
+#include "G4IonTable.hh"
 // G4 headers including CLHEP headers
 // for generating random numbers
 #include "Randomize.hh"
@@ -75,7 +75,7 @@ void EventGeneratorBeam::GenerateEvent(G4Event* anEvent){
 
   if( anEvent->GetEventID()==0){
     // Define the particle to be shoot
-    m_particle = G4ParticleTable::GetParticleTable()->GetIon(m_Beam->GetZ(), m_Beam->GetA() ,m_Beam->GetExcitationEnergy());
+    m_particle = G4ParticleTable::GetParticleTable()->GetIonTable()->GetIon(m_Beam->GetZ(), m_Beam->GetA() ,m_Beam->GetExcitationEnergy());
   }
   
   ///////////////////////////////////////////////////////////////////////
diff --git a/NPSimulation/Core/EventGeneratorGammaDecay.cc b/NPSimulation/Core/EventGeneratorGammaDecay.cc
index 838f8f90c..7078ccb89 100644
--- a/NPSimulation/Core/EventGeneratorGammaDecay.cc
+++ b/NPSimulation/Core/EventGeneratorGammaDecay.cc
@@ -41,7 +41,7 @@ using namespace NPL;
 
 // G4
 #include "G4ParticleTable.hh"
-
+#include "G4IonTable.hh"
 // ROOT
 #include "TLorentzVector.h"
 #include "TVector3.h"
@@ -239,7 +239,7 @@ void EventGeneratorGammaDecay::GenerateEvent(G4Event*){
   
   // Put back the decaying nucleus with its new excitation energy
   G4ParticleDefinition* FinalParticleDefition
-  = G4ParticleTable::GetParticleTable()->GetIon(decayingParticle.GetParticleDefinition()->GetAtomicNumber(), decayingParticle.GetParticleDefinition()->GetAtomicMass(), FinalExcitationEnergy*MeV);
+  = G4ParticleTable::GetParticleTable()->GetIonTable()->GetIon(decayingParticle.GetParticleDefinition()->GetAtomicNumber(), decayingParticle.GetParticleDefinition()->GetAtomicMass(), FinalExcitationEnergy*MeV);
   
   Particle FinalParticle = Particle(  FinalParticleDefition,
                                     decayingParticle.GetParticleThetaCM(),
diff --git a/NPSimulation/Core/EventGeneratorIsotropic.cc b/NPSimulation/Core/EventGeneratorIsotropic.cc
index 18787ac68..ce6ae242b 100644
--- a/NPSimulation/Core/EventGeneratorIsotropic.cc
+++ b/NPSimulation/Core/EventGeneratorIsotropic.cc
@@ -24,7 +24,7 @@
 
 // G4 headers
 #include "G4ParticleTable.hh"
-
+#include "G4IonTable.hh"
 // G4 headers including CLHEP headers
 // for generating random numbers
 #include "Randomize.hh"
@@ -206,7 +206,7 @@ void EventGeneratorIsotropic::GenerateEvent(G4Event*){
     }
     else{
       NPL::Nucleus* N = new NPL::Nucleus(m_particleName);
-      m_particle = G4ParticleTable::GetParticleTable()->GetIon(N->GetZ(), N->GetA(),m_ExcitationEnergy);
+      m_particle = G4ParticleTable::GetParticleTable()->GetIonTable()->GetIon(N->GetZ(), N->GetA(),m_ExcitationEnergy);
       delete N;
     }
     
diff --git a/NPSimulation/Core/EventGeneratorParticleDecay.cc b/NPSimulation/Core/EventGeneratorParticleDecay.cc
index a136f556a..976188985 100644
--- a/NPSimulation/Core/EventGeneratorParticleDecay.cc
+++ b/NPSimulation/Core/EventGeneratorParticleDecay.cc
@@ -31,6 +31,7 @@
 
 // G4
 #include "G4ParticleTable.hh"
+#include "G4IonTable.hh"
 
 // G4 headers including CLHEP headers
 // for generating random numbers
@@ -363,7 +364,7 @@ void EventGeneratorParticleDecay::SetDecay(vector<string> DaughterName, vector<b
     
     else{
       Nucleus*  myNucleus = new Nucleus(DaughterName[i]);
-      m_DaughterNuclei.push_back(G4ParticleTable::GetParticleTable()->GetIon(myNucleus->GetZ(),
+      m_DaughterNuclei.push_back(G4ParticleTable::GetParticleTable()->GetIonTable()->GetIon(myNucleus->GetZ(),
                                                                              myNucleus->GetA(),
                                                                              m_ExcitationEnergy[i]*MeV));
       FinalMass+=myNucleus->GetA();
diff --git a/NPSimulation/Core/EventGeneratorTwoBodyReaction.cc b/NPSimulation/Core/EventGeneratorTwoBodyReaction.cc
index 624488844..59e4bcd23 100644
--- a/NPSimulation/Core/EventGeneratorTwoBodyReaction.cc
+++ b/NPSimulation/Core/EventGeneratorTwoBodyReaction.cc
@@ -34,6 +34,7 @@
 
 // G4 headers
 #include "G4ParticleTable.hh"
+#include "G4IonTable.hh"
 #include "G4RotationMatrix.hh"
 
 // G4 headers including CLHEP headers
@@ -107,7 +108,7 @@ void EventGeneratorTwoBodyReaction::GenerateEvent(G4Event*){
   G4int LightA = m_Reaction->GetNucleus3()->GetA() ;
   
   G4ParticleDefinition* LightName
-  = G4ParticleTable::GetParticleTable()->GetIon(LightZ, LightA, m_Reaction->GetExcitation3()*MeV);
+  = G4ParticleTable::GetParticleTable()->GetIonTable()->GetIon(LightZ, LightA, m_Reaction->GetExcitation3()*MeV);
   
   // Nucleus 4
   G4int HeavyZ = m_Reaction->GetNucleus4()->GetZ() ;
@@ -117,7 +118,7 @@ void EventGeneratorTwoBodyReaction::GenerateEvent(G4Event*){
   m_Reaction->ShootRandomExcitationEnergy();
 
   G4ParticleDefinition* HeavyName
-  = G4ParticleTable::GetParticleTable()->GetIon(HeavyZ, HeavyA, m_Reaction->GetExcitation4()*MeV);
+  = G4ParticleTable::GetParticleTable()->GetIonTable()->GetIon(HeavyZ, HeavyA, m_Reaction->GetExcitation4()*MeV);
   
   // Get the beam particle form the Particle Stack
   Particle BeamParticle = m_ParticleStack->SearchAndRemoveParticle(m_BeamName);
diff --git a/NPSimulation/Core/MaterialManager.cc b/NPSimulation/Core/MaterialManager.cc
index c7ca16dee..f86c6f8b6 100644
--- a/NPSimulation/Core/MaterialManager.cc
+++ b/NPSimulation/Core/MaterialManager.cc
@@ -35,7 +35,7 @@
 #include <iostream>
 #include <string>
 using namespace std;
-
+using namespace CLHEP;
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 MaterialManager* MaterialManager::instance = 0 ;
 
-- 
GitLab