From 721fdfdb0b8cea3bd85405e6bdb2480fada4fe33 Mon Sep 17 00:00:00 2001
From: adrien-matta <a.matta@surrey.ac.uk>
Date: Thu, 5 Feb 2015 14:26:03 +0000
Subject: [PATCH] * Fixing issue with neutron isotropic source

---
 NPSimulation/src/EventGeneratorIsotropic.cc | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/NPSimulation/src/EventGeneratorIsotropic.cc b/NPSimulation/src/EventGeneratorIsotropic.cc
index 070b18429..18787ac68 100644
--- a/NPSimulation/src/EventGeneratorIsotropic.cc
+++ b/NPSimulation/src/EventGeneratorIsotropic.cc
@@ -95,6 +95,7 @@ void EventGeneratorIsotropic::ReadConfiguration(string Path,int){
       G4cout << "///////////////////////////////////////////////////" << G4endl ;
       G4cout << "Isotropic Source Found" << G4endl ;
       ReadingStatus = true;}
+      
     
     
     while (ReadingStatus)
@@ -163,6 +164,8 @@ void EventGeneratorIsotropic::ReadConfiguration(string Path,int){
         else if(m_particleName=="triton"){ m_particleName="3H"  ; check_ExcitationEnergy = true ;}
         else if(m_particleName=="alpha") { m_particleName="4He" ; check_ExcitationEnergy = true ;}
         else if(m_particleName=="gamma") { check_ExcitationEnergy = true ;}
+        else if(m_particleName=="neutron") { check_ExcitationEnergy = true ;}
+
       }
       
       else if (DataBuffer=="ExcitationEnergy=") {
@@ -198,14 +201,14 @@ void EventGeneratorIsotropic::ReadConfiguration(string Path,int){
 void EventGeneratorIsotropic::GenerateEvent(G4Event*){
   
   if(m_particle==NULL){
-    if(m_particleName!="gamma"){
+    if(m_particleName=="gamma" || m_particleName=="neutron"){
+      m_particle =  G4ParticleTable::GetParticleTable()->FindParticle(m_particleName.c_str());
+    }
+    else{
       NPL::Nucleus* N = new NPL::Nucleus(m_particleName);
       m_particle = G4ParticleTable::GetParticleTable()->GetIon(N->GetZ(), N->GetA(),m_ExcitationEnergy);
       delete N;
     }
-    else{
-      m_particle =  G4ParticleTable::GetParticleTable()->FindParticle("gamma");
-    }
     
   }
   
-- 
GitLab