From 58e39c9ff0c179589cd6c02cd4301ec7a2a576fa Mon Sep 17 00:00:00 2001
From: Morfouace <pierre.morfouace@gmail.com>
Date: Wed, 13 May 2020 11:53:49 +0200
Subject: [PATCH] Writting neutron induced fission cross section in
 MaterialManager

---
 NPSimulation/Core/MaterialManager.cc | 10 +++++++++-
 Projects/PISTA/PISTA.detector        |  2 +-
 Projects/Scone/Analysis.cxx          |  9 +++++----
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/NPSimulation/Core/MaterialManager.cc b/NPSimulation/Core/MaterialManager.cc
index 5ad7f3859..a4fe23398 100644
--- a/NPSimulation/Core/MaterialManager.cc
+++ b/NPSimulation/Core/MaterialManager.cc
@@ -1192,6 +1192,7 @@ void MaterialManager::WriteCrossSectionTable(G4ParticleDefinition* Particle, G4d
       G4String path1;
       G4String path2;
       G4String path3;
+      G4String path4;
       G4String ParticleName = Particle->GetParticleName();
       G4String MaterialName = it->second->GetName();
       G4String ElementName = it->second->GetElement(i)->GetName();
@@ -1199,13 +1200,16 @@ void MaterialManager::WriteCrossSectionTable(G4ParticleDefinition* Particle, G4d
       path1 = GlobalPath + "/Inputs/CrossSection/" + "G4XS_elastic_" + ParticleName + "_" + ElementName + ".dat";
       path2 = GlobalPath + "/Inputs/CrossSection/" + "G4XS_inelastic_" + ParticleName + "_" + ElementName + ".dat";
       path3 = GlobalPath + "/Inputs/CrossSection/" + "G4XS_capture_" + ParticleName + "_" + ElementName + ".dat";
+      path4 = GlobalPath + "/Inputs/CrossSection/" + "G4XS_fission_" + ParticleName + "_" + ElementName + ".dat";
       
       ofstream ofile_elastic;
       ofstream ofile_inelastic;
       ofstream ofile_capture;
+      ofstream ofile_fission;
       ofile_elastic.open(path1);
       ofile_inelastic.open(path2);
       ofile_capture.open(path3);
+      ofile_fission.open(path4);
       //std::cout << path << std::endl;
       double xs;
       double step_keV = 1*keV;
@@ -1230,12 +1234,16 @@ void MaterialManager::WriteCrossSectionTable(G4ParticleDefinition* Particle, G4d
         // Capture Cross Section  
         xs = store->GetCaptureCrossSectionPerAtom(Particle, E, it->second->GetElement(i), it->second);
         ofile_capture << E/MeV << " " << xs/barn << G4endl;
-        
+       
+        // Fission Cross Section
+        xs = store->GetFissionCrossSectionPerAtom(Particle, E, it->second->GetElement(i), it->second);
+        ofile_fission << E/MeV << " " << xs/barn << G4endl;
       }
 
       ofile_elastic.close();
       ofile_inelastic.close();
       ofile_capture.close();
+      ofile_fission.close();
     }
   }
 }
diff --git a/Projects/PISTA/PISTA.detector b/Projects/PISTA/PISTA.detector
index a9f6077ef..bc33042c2 100644
--- a/Projects/PISTA/PISTA.detector
+++ b/Projects/PISTA/PISTA.detector
@@ -1,6 +1,6 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 Target
- THICKNESS= 0.44 micrometer
+ THICKNESS= 0.22 micrometer
  RADIUS= 20 mm
  MATERIAL= C
  ANGLE= 0 deg
diff --git a/Projects/Scone/Analysis.cxx b/Projects/Scone/Analysis.cxx
index 01bb49a29..c7210aba9 100644
--- a/Projects/Scone/Analysis.cxx
+++ b/Projects/Scone/Analysis.cxx
@@ -84,9 +84,9 @@ void Analysis::TreatEvent(){
       E_sum += Scone->Energy[i];
     }
   }
-
+  E_sum = E_sum - E_init;
   //if(Time_max>50) m_DetectedNeutron++;
-  if(Time_max>40 && E_sum>2) m_DetectedNeutron++;
+  if(Time_max>50 && E_sum>0) m_DetectedNeutron++;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -125,11 +125,12 @@ void Analysis::End(){
   cout << "DetectedNeutron: " << endl;
 
   ofstream ofile;
-  ofile.open("macro/eff_scone_natGd25um_Esum2MeV.txt");
+  ofile.open("macro/eff_scone_natGd25um.txt");
   //ofile.open("macro/eff_scone_menate.txt");
   for(int i=0; i< vDetectedNeutron.size(); i++){
+    //cout << "* " << vE_init[i] << " / " << vDetectedNeutron[i]/vDetectedNeutron[0]*99.4 << endl;
     cout << "* " << vE_init[i] << " / " << vDetectedNeutron[i]/1e5*100 << endl;
-    //ofile << vE_init[i] << "  " << vDetectedNeutron[i]/vDetectedNeutron[0]*99.3 << endl;
+    //ofile << vE_init[i] << "  " << vDetectedNeutron[i]/vDetectedNeutron[0]*99.4 << endl;
     ofile << vE_init[i] << "  " << vDetectedNeutron[i]/1e5*100 << endl;
   }
   ofile.close();
-- 
GitLab