From c4bfc6cd4eb6ad6504a6dcfb8920845410065f68 Mon Sep 17 00:00:00 2001
From: adrien-matta <a.matta@surrey.ac.uk>
Date: Mon, 14 Dec 2015 14:30:07 +0000
Subject: [PATCH] * Adding sigmaX and sigmaY to isotropic source generation

---
 NPSimulation/Core/EventGeneratorIsotropic.cc | 17 ++++++++++++++++-
 NPSimulation/Core/EventGeneratorIsotropic.hh |  2 ++
 NPSimulation/MUST2/MUST2Array.hh             |  2 +-
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/NPSimulation/Core/EventGeneratorIsotropic.cc b/NPSimulation/Core/EventGeneratorIsotropic.cc
index 7437ab295..e1cdcd423 100644
--- a/NPSimulation/Core/EventGeneratorIsotropic.cc
+++ b/NPSimulation/Core/EventGeneratorIsotropic.cc
@@ -152,6 +152,18 @@ void EventGeneratorIsotropic::ReadConfiguration(string Path,int){
         G4cout << "z0 " << m_z0 << " mm" << G4endl;
       }
       
+      else if (DataBuffer == "SigmaX=" ) {
+        ReactionFile >> DataBuffer;
+        m_SigmaX = atof(DataBuffer.c_str()) * mm;
+        G4cout << "SigmaX " << m_SigmaX << " mm" << G4endl;
+      }
+  
+      else if (DataBuffer == "SigmaY=" ) {
+        ReactionFile >> DataBuffer;
+        m_SigmaY = atof(DataBuffer.c_str()) * mm;
+        G4cout << "SigmaY " << m_SigmaY << " mm" << G4endl;
+      }
+     
       else if (DataBuffer=="Particle=" || DataBuffer=="particle=") {
         check_particle = true ;
         ReactionFile >> m_particleName;
@@ -224,7 +236,10 @@ void EventGeneratorIsotropic::GenerateEvent(G4Event*){
   G4double momentum_y = sin(theta) * sin(phi)  ;
   G4double momentum_z = cos(theta)             ;
   
-  Particle particle(m_particle, theta,particle_energy,G4ThreeVector(momentum_x, momentum_y, momentum_z),G4ThreeVector(m_x0, m_y0, m_z0));
+  G4double x0 = RandGauss::shoot(m_x0,m_SigmaX);
+  G4double y0 = RandGauss::shoot(m_y0,m_SigmaY);
+
+  Particle particle(m_particle, theta,particle_energy,G4ThreeVector(momentum_x, momentum_y, momentum_z),G4ThreeVector(x0, y0, m_z0));
   
   
   m_ParticleStack->AddParticleToStack(particle);
diff --git a/NPSimulation/Core/EventGeneratorIsotropic.hh b/NPSimulation/Core/EventGeneratorIsotropic.hh
index 6a7b2ab02..bfba18b34 100644
--- a/NPSimulation/Core/EventGeneratorIsotropic.hh
+++ b/NPSimulation/Core/EventGeneratorIsotropic.hh
@@ -51,6 +51,8 @@ private:    // Source parameter from input file
   G4double               m_x0               ;  // Vertex Position X
   G4double               m_y0               ;  // Vertex Position Y
   G4double               m_z0               ;  // Vertex Position Z
+  G4double               m_SigmaX           ;
+  G4double               m_SigmaY           ;
   G4ParticleDefinition*  m_particle         ;  // Kind of particle to shoot isotropically
   G4double               m_ExcitationEnergy ;  // Excitation energy of the emitted particle
   string                 m_particleName     ;
diff --git a/NPSimulation/MUST2/MUST2Array.hh b/NPSimulation/MUST2/MUST2Array.hh
index 33c9bf018..fcddab3ea 100644
--- a/NPSimulation/MUST2/MUST2Array.hh
+++ b/NPSimulation/MUST2/MUST2Array.hh
@@ -37,7 +37,7 @@ namespace MUST2
    const G4double ResoTimeMust = 0.212765957    ;// = 500ps                 //   Unit is  ns/2.35
    const G4double ResoSiLi     = 0.055          ;// = 130 keV of resolution //   Unit is MeV/2.35
    const G4double ResoCsI      = 0.08           ;// = 188 kev of resolution //   Unit is MeV/2.35
-   const G4double ResoStrip    = 0.022          ;// = 52keV of Resolution   //   Unit is MeV/2.35
+   const G4double ResoStrip    = 0.017          ;// = 52keV of Resolution   //   Unit is MeV/2.35
 
    // Geometry
    const G4double FaceFront = 11.*cm ;
-- 
GitLab