From 1dcc348d4318264398530da5617eb9ecebdd8dea Mon Sep 17 00:00:00 2001
From: adrien matta <matta@lpccaen.in2p3.fr>
Date: Mon, 19 Dec 2016 10:11:24 +0100
Subject: [PATCH] * New Directory structure for NPS         - Now use separate
 folder for scorer, event generator and           physics

---
 NPSimulation/CMakeLists.txt                   |   8 +-
 NPSimulation/Core/CMakeLists.txt              |   4 +-
 NPSimulation/Core/MaterialManager.cc          |  45 ++++++-
 NPSimulation/Core/MaterialManager.hh          |   4 +
 NPSimulation/EventGenerator/CMakeLists.txt    |   2 +
 .../EventGeneratorBeam.cc                     |   0
 .../EventGeneratorBeam.hh                     |   0
 .../EventGeneratorGammaDecay.cc               |   0
 .../EventGeneratorGammaDecay.hh               |   0
 .../EventGeneratorIsotropic.cc                |   0
 .../EventGeneratorIsotropic.hh                |   0
 .../EventGeneratorParticleDecay.cc            |   0
 .../EventGeneratorParticleDecay.hh            |   0
 .../EventGeneratorTwoBodyReaction.cc          |   0
 .../EventGeneratorTwoBodyReaction.hh          |   0
 .../EventGeneratorpBUU.cc                     |   0
 .../EventGeneratorpBUU.hh                     |   0
 .../VEventGenerator.cc                        |   0
 .../VEventGenerator.hh                        |   0
 NPSimulation/Process/CMakeLists.txt           |   2 +
 NPSimulation/Process/FastDriftElectron.cc     | 119 ++++++++++++++++++
 NPSimulation/Process/FastDriftElectron.hh     |  48 +++++++
 .../NPIonIonInelasticPhysic.cc                |   0
 .../NPIonIonInelasticPhysic.hh                |   0
 NPSimulation/{Core => Process}/PhysicsList.cc |  21 +++-
 NPSimulation/{Core => Process}/PhysicsList.hh |   1 +
 NPSimulation/Scorers/CMakeLists.txt           |   2 +
 .../{Core => Scorers}/CalorimeterScorers.cc   |   0
 .../{Core => Scorers}/CalorimeterScorers.hh   |   0
 .../ObsoleteGeneralScorers.cc                 |   0
 .../ObsoleteGeneralScorers.hh                 |   0
 .../{Core => Scorers}/PhotoDiodeScorers.cc    |   0
 .../{Core => Scorers}/PhotoDiodeScorers.hh    |   0
 .../{Core => Scorers}/SiliconScorers.cc       |   0
 .../{Core => Scorers}/SiliconScorers.hh       |   0
 Projects/Sharc/Analysis.cxx                   |   2 +-
 36 files changed, 249 insertions(+), 9 deletions(-)
 create mode 100644 NPSimulation/EventGenerator/CMakeLists.txt
 rename NPSimulation/{Core => EventGenerator}/EventGeneratorBeam.cc (100%)
 rename NPSimulation/{Core => EventGenerator}/EventGeneratorBeam.hh (100%)
 rename NPSimulation/{Core => EventGenerator}/EventGeneratorGammaDecay.cc (100%)
 rename NPSimulation/{Core => EventGenerator}/EventGeneratorGammaDecay.hh (100%)
 rename NPSimulation/{Core => EventGenerator}/EventGeneratorIsotropic.cc (100%)
 rename NPSimulation/{Core => EventGenerator}/EventGeneratorIsotropic.hh (100%)
 rename NPSimulation/{Core => EventGenerator}/EventGeneratorParticleDecay.cc (100%)
 rename NPSimulation/{Core => EventGenerator}/EventGeneratorParticleDecay.hh (100%)
 rename NPSimulation/{Core => EventGenerator}/EventGeneratorTwoBodyReaction.cc (100%)
 rename NPSimulation/{Core => EventGenerator}/EventGeneratorTwoBodyReaction.hh (100%)
 rename NPSimulation/{Core => EventGenerator}/EventGeneratorpBUU.cc (100%)
 rename NPSimulation/{Core => EventGenerator}/EventGeneratorpBUU.hh (100%)
 rename NPSimulation/{Core => EventGenerator}/VEventGenerator.cc (100%)
 rename NPSimulation/{Core => EventGenerator}/VEventGenerator.hh (100%)
 create mode 100644 NPSimulation/Process/CMakeLists.txt
 create mode 100644 NPSimulation/Process/FastDriftElectron.cc
 create mode 100644 NPSimulation/Process/FastDriftElectron.hh
 rename NPSimulation/{Core => Process}/NPIonIonInelasticPhysic.cc (100%)
 rename NPSimulation/{Core => Process}/NPIonIonInelasticPhysic.hh (100%)
 rename NPSimulation/{Core => Process}/PhysicsList.cc (95%)
 rename NPSimulation/{Core => Process}/PhysicsList.hh (99%)
 create mode 100644 NPSimulation/Scorers/CMakeLists.txt
 rename NPSimulation/{Core => Scorers}/CalorimeterScorers.cc (100%)
 rename NPSimulation/{Core => Scorers}/CalorimeterScorers.hh (100%)
 rename NPSimulation/{Core => Scorers}/ObsoleteGeneralScorers.cc (100%)
 rename NPSimulation/{Core => Scorers}/ObsoleteGeneralScorers.hh (100%)
 rename NPSimulation/{Core => Scorers}/PhotoDiodeScorers.cc (100%)
 rename NPSimulation/{Core => Scorers}/PhotoDiodeScorers.hh (100%)
 rename NPSimulation/{Core => Scorers}/SiliconScorers.cc (100%)
 rename NPSimulation/{Core => Scorers}/SiliconScorers.hh (100%)

diff --git a/NPSimulation/CMakeLists.txt b/NPSimulation/CMakeLists.txt
index ea83530ac..283f9d086 100644
--- a/NPSimulation/CMakeLists.txt
+++ b/NPSimulation/CMakeLists.txt
@@ -94,8 +94,12 @@ ENDMACRO()
 
 # Call the Macro
 subdirlist(SUB_DIRECTORY ${CMAKE_BINARY_DIR})
-set(SUB_DIRECTORY ${SUB_DIRECTORY} Core)
+set(SUB_DIRECTORY ${SUB_DIRECTORY} Core EventGenerator Process Scorers)
 include_directories("Core/")
+include_directories("Process/")
+include_directories("EventGenerator/")
+include_directories("Scorers/")
+
 
 # Add each sub folder to the project
 foreach(subdir ${SUB_DIRECTORY})
@@ -104,7 +108,7 @@ foreach(subdir ${SUB_DIRECTORY})
  endforeach()
 
 add_executable(npsimulation Simulation.cc)
-target_Link_libraries(npsimulation ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} NPSCore)
+target_Link_libraries(npsimulation ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} NPSCore NPSScorers NPSProcess NPSEventGenerator)
 configure_file(ressources/macro/gui.mac.in ressources/macro/gui.mac @ONLY) 
 configure_file(ressources/macro/aliases.mac.in ressources/macro/aliases.mac @ONLY) 
 
diff --git a/NPSimulation/Core/CMakeLists.txt b/NPSimulation/Core/CMakeLists.txt
index c952ba812..fa51b1eb9 100644
--- a/NPSimulation/Core/CMakeLists.txt
+++ b/NPSimulation/Core/CMakeLists.txt
@@ -1,2 +1,2 @@
-add_library(NPSCore SHARED CalorimeterScorers.cc EventAction.cc EventGeneratorParticleDecay.cc ObsoleteGeneralScorers.cc PrimaryGeneratorAction.cc Target.cc Chamber.cc EventGeneratorBeam.cc EventGeneratorTwoBodyReaction.cc EventGeneratorpBUU.cc Particle.cc PrimaryGeneratorActionMessenger.cc NPSVDetector.cc DetectorConstruction.cc EventGeneratorGammaDecay.cc MaterialManager.cc ParticleStack.cc SiliconScorers.cc PhotoDiodeScorers.cc VEventGenerator.cc DetectorMessenger.cc EventGeneratorIsotropic.cc MyMagneticField.cc PhysicsList.cc SteppingVerbose.cc NPSDetectorFactory.cc RunAction.cc NPIonIonInelasticPhysic.cc)
-target_link_libraries(NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPInitialConditions -lNPInteractionCoordinates)
+add_library(NPSCore SHARED EventAction.cc PrimaryGeneratorAction.cc Target.cc Chamber.cc Particle.cc PrimaryGeneratorActionMessenger.cc NPSVDetector.cc DetectorConstruction.cc MaterialManager.cc ParticleStack.cc DetectorMessenger.cc MyMagneticField.cc  SteppingVerbose.cc NPSDetectorFactory.cc RunAction.cc )
+target_link_libraries(NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} NPSEventGenerator NPSScorers -lNPInitialConditions -lNPInteractionCoordinates )
diff --git a/NPSimulation/Core/MaterialManager.cc b/NPSimulation/Core/MaterialManager.cc
index 820f3e6b4..32fb26971 100644
--- a/NPSimulation/Core/MaterialManager.cc
+++ b/NPSimulation/Core/MaterialManager.cc
@@ -588,6 +588,16 @@ G4Material* MaterialManager::GetMaterialFromLibrary(string Name,double density){
             return material;
         }
         
+        else if(Name == "CF4"){ // 52 torr
+            if(!density)
+                density =  3.78*mg/cm3;
+            G4Material* material = new G4Material("NPS_"+Name,density,2,kStateGas,300,0.0693276*bar);
+            material->AddElement(GetElementFromLibrary("C"), 1);
+            material->AddElement(GetElementFromLibrary("F"), 4);
+            m_Material[Name]=material;
+            return material;
+        }
+
         else  if(Name == "Wood"){
             if(!density)
                 density =  0.9*mg/cm3;
@@ -673,8 +683,9 @@ G4Material* MaterialManager::GetMaterialFromLibrary(string Name,double density){
 
         
         else{
-          G4cout << "ERROR: Material requested \""<< Name <<"\" is not available in the Material Library" << G4endl;
-        exit(1);
+        G4cout << "ERROR: Material requested \""<< Name <<"\" is not available in the Material Library, trying with NIST" << G4endl;
+        G4NistManager* man = G4NistManager::Instance();
+        return man->FindOrBuildMaterial(Name.c_str());
         }
     }
     
@@ -723,6 +734,36 @@ G4Element* MaterialManager::GetElementFromLibrary(string Name){
     
 }
 
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+//   
+G4Material* MaterialManager::GetGasFromLibrary(string Name, double Pressure, double Temperature){
+    ostringstream oss;
+    oss << Name<< "_"<<Pressure<<"_"<<Temperature;
+    string newName= oss.str();
+    map<string,G4Material*>::iterator it;
+    it = m_Material.find(Name);
+    double density = 0 ; 
+    // The element is not found
+    if(it==m_Material.end()){
+        if(Name == "CF4"){ // 52 torr
+            density =  3.72*kg/m3;
+            double refTemp= (273.15+15)*kelvin;
+            double refPres= 1.01325*bar;
+            density = density*(refTemp/Temperature)/(refPres/Pressure);
+            G4Material* material = new G4Material("NPS_"+newName,density,2,kStateGas,Temperature,Pressure);
+            material->AddElement(GetElementFromLibrary("C"), 1);
+            material->AddElement(GetElementFromLibrary("F"), 4);
+            m_Material[Name]=material;
+            return material;
+        }
+        
+        else{
+          exit(1);
+        }
+     }
+  return NULL;
+}
+
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 //   Generate a DEDX file table using the material used in the geometry
 void MaterialManager::WriteDEDXTable(G4ParticleDefinition* Particle ,G4double Emin,G4double Emax){
diff --git a/NPSimulation/Core/MaterialManager.hh b/NPSimulation/Core/MaterialManager.hh
index 5e848ff82..15df20222 100644
--- a/NPSimulation/Core/MaterialManager.hh
+++ b/NPSimulation/Core/MaterialManager.hh
@@ -72,6 +72,10 @@ public:
   // If the Material is instantiate it return it
   G4Material* GetMaterialFromLibrary(string Name, double density = 0);
 
+  // Look for a known gas
+  // Compute the correct density using Gas Law and density at STP
+  G4Material* GetGasFromLibrary(string Name, double Pressure, double Temperature);
+
   // Same as above but for Element.
   G4Element*  GetElementFromLibrary(string Name);
   
diff --git a/NPSimulation/EventGenerator/CMakeLists.txt b/NPSimulation/EventGenerator/CMakeLists.txt
new file mode 100644
index 000000000..d60da08c7
--- /dev/null
+++ b/NPSimulation/EventGenerator/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSEventGenerator SHARED EventGeneratorParticleDecay.cc EventGeneratorBeam.cc EventGeneratorTwoBodyReaction.cc EventGeneratorpBUU.cc EventGeneratorGammaDecay.cc EventGeneratorIsotropic.cc VEventGenerator.cc)
+target_link_libraries(NPSEventGenerator ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPInitialConditions -lNPInteractionCoordinates)
diff --git a/NPSimulation/Core/EventGeneratorBeam.cc b/NPSimulation/EventGenerator/EventGeneratorBeam.cc
similarity index 100%
rename from NPSimulation/Core/EventGeneratorBeam.cc
rename to NPSimulation/EventGenerator/EventGeneratorBeam.cc
diff --git a/NPSimulation/Core/EventGeneratorBeam.hh b/NPSimulation/EventGenerator/EventGeneratorBeam.hh
similarity index 100%
rename from NPSimulation/Core/EventGeneratorBeam.hh
rename to NPSimulation/EventGenerator/EventGeneratorBeam.hh
diff --git a/NPSimulation/Core/EventGeneratorGammaDecay.cc b/NPSimulation/EventGenerator/EventGeneratorGammaDecay.cc
similarity index 100%
rename from NPSimulation/Core/EventGeneratorGammaDecay.cc
rename to NPSimulation/EventGenerator/EventGeneratorGammaDecay.cc
diff --git a/NPSimulation/Core/EventGeneratorGammaDecay.hh b/NPSimulation/EventGenerator/EventGeneratorGammaDecay.hh
similarity index 100%
rename from NPSimulation/Core/EventGeneratorGammaDecay.hh
rename to NPSimulation/EventGenerator/EventGeneratorGammaDecay.hh
diff --git a/NPSimulation/Core/EventGeneratorIsotropic.cc b/NPSimulation/EventGenerator/EventGeneratorIsotropic.cc
similarity index 100%
rename from NPSimulation/Core/EventGeneratorIsotropic.cc
rename to NPSimulation/EventGenerator/EventGeneratorIsotropic.cc
diff --git a/NPSimulation/Core/EventGeneratorIsotropic.hh b/NPSimulation/EventGenerator/EventGeneratorIsotropic.hh
similarity index 100%
rename from NPSimulation/Core/EventGeneratorIsotropic.hh
rename to NPSimulation/EventGenerator/EventGeneratorIsotropic.hh
diff --git a/NPSimulation/Core/EventGeneratorParticleDecay.cc b/NPSimulation/EventGenerator/EventGeneratorParticleDecay.cc
similarity index 100%
rename from NPSimulation/Core/EventGeneratorParticleDecay.cc
rename to NPSimulation/EventGenerator/EventGeneratorParticleDecay.cc
diff --git a/NPSimulation/Core/EventGeneratorParticleDecay.hh b/NPSimulation/EventGenerator/EventGeneratorParticleDecay.hh
similarity index 100%
rename from NPSimulation/Core/EventGeneratorParticleDecay.hh
rename to NPSimulation/EventGenerator/EventGeneratorParticleDecay.hh
diff --git a/NPSimulation/Core/EventGeneratorTwoBodyReaction.cc b/NPSimulation/EventGenerator/EventGeneratorTwoBodyReaction.cc
similarity index 100%
rename from NPSimulation/Core/EventGeneratorTwoBodyReaction.cc
rename to NPSimulation/EventGenerator/EventGeneratorTwoBodyReaction.cc
diff --git a/NPSimulation/Core/EventGeneratorTwoBodyReaction.hh b/NPSimulation/EventGenerator/EventGeneratorTwoBodyReaction.hh
similarity index 100%
rename from NPSimulation/Core/EventGeneratorTwoBodyReaction.hh
rename to NPSimulation/EventGenerator/EventGeneratorTwoBodyReaction.hh
diff --git a/NPSimulation/Core/EventGeneratorpBUU.cc b/NPSimulation/EventGenerator/EventGeneratorpBUU.cc
similarity index 100%
rename from NPSimulation/Core/EventGeneratorpBUU.cc
rename to NPSimulation/EventGenerator/EventGeneratorpBUU.cc
diff --git a/NPSimulation/Core/EventGeneratorpBUU.hh b/NPSimulation/EventGenerator/EventGeneratorpBUU.hh
similarity index 100%
rename from NPSimulation/Core/EventGeneratorpBUU.hh
rename to NPSimulation/EventGenerator/EventGeneratorpBUU.hh
diff --git a/NPSimulation/Core/VEventGenerator.cc b/NPSimulation/EventGenerator/VEventGenerator.cc
similarity index 100%
rename from NPSimulation/Core/VEventGenerator.cc
rename to NPSimulation/EventGenerator/VEventGenerator.cc
diff --git a/NPSimulation/Core/VEventGenerator.hh b/NPSimulation/EventGenerator/VEventGenerator.hh
similarity index 100%
rename from NPSimulation/Core/VEventGenerator.hh
rename to NPSimulation/EventGenerator/VEventGenerator.hh
diff --git a/NPSimulation/Process/CMakeLists.txt b/NPSimulation/Process/CMakeLists.txt
new file mode 100644
index 000000000..7c5ff535e
--- /dev/null
+++ b/NPSimulation/Process/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSProcess SHARED  FastDriftElectron.cc NPIonIonInelasticPhysic.cc PhysicsList.cc)
+target_link_libraries(NPSProcess ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPInitialConditions -lNPInteractionCoordinates)
diff --git a/NPSimulation/Process/FastDriftElectron.cc b/NPSimulation/Process/FastDriftElectron.cc
new file mode 100644
index 000000000..84c7ce8f1
--- /dev/null
+++ b/NPSimulation/Process/FastDriftElectron.cc
@@ -0,0 +1,119 @@
+/*****************************************************************************
+ * Copyright (C) 2009-2016   this file is part of the NPTool Project         *
+ *                                                                           *
+ * For the licensing terms see $NPTOOL/Licence/NPTool_Licence                *
+ * For the list of contributors see $NPTOOL/Licence/Contributors             *
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Original Author: Adrien MATTA  contact address: matta@lpccaen.in2p3.fr    *
+ *                                                                           *
+ * Creation Date  : December 2016                                            *
+ * Last update    :                                                          *
+ *---------------------------------------------------------------------------*
+ * Decription:                                                               *
+ * Class to simulate electron drift in a gas detector such as Ionisation     *
+ * chamber and TPC                                                           *
+ *                                                                           *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *                                                                           *
+ *****************************************************************************/
+
+#include <iostream>
+#include "FastDriftElectron.hh"
+#include "G4VPhysicalVolume.hh"
+#include "G4Electron.hh"
+#include "G4Gamma.hh"
+#include <iostream>
+#include "G4SystemOfUnits.hh"
+////////////////////////////////////////////////////////////////////////////////
+DriftElectron::DriftElectron(G4String modelName,G4Region* envelope) :
+  G4VFastSimulationModel(modelName, envelope) {
+  }
+
+////////////////////////////////////////////////////////////////////////////////
+DriftElectron::DriftElectron(G4String modelName) :
+  G4VFastSimulationModel(modelName) {
+  }
+
+////////////////////////////////////////////////////////////////////////////////
+DriftElectron::~DriftElectron() {
+}
+
+////////////////////////////////////////////////////////////////////////////////
+G4bool DriftElectron::IsApplicable( const G4ParticleDefinition& particleType) {
+  G4String particleName = particleType.GetParticleName();
+  if (particleName=="e-") {
+    return true;
+  }
+  return false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+G4bool DriftElectron::ModelTrigger(const G4FastTrack& fastTrack) {
+  G4String particleName = 
+    fastTrack.GetPrimaryTrack()->GetParticleDefinition()->GetParticleName();
+  if (particleName=="e-") {
+    return true;
+  }
+  return false;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DriftElectron::DoIt(const G4FastTrack& fastTrack,G4FastStep& fastStep) {
+  double v_drift = 8e-3*mm/ns;
+  double d_trans = 6e-5*mm2/ns;
+  double d_long  = 4e-5*mm2/ns;
+  double step = 100*ns;
+  double pair_energy=30*eV;
+  // fraction of electron drift to be produced
+  // 1 means all, 0 means none
+  // directly affect the simulation speed
+  double production_bias = 0.01; 
+  G4ThreeVector driftDir = G4ThreeVector(1,0,0);
+  G4ThreeVector TransDir = G4ThreeVector(0,1,0);
+  G4ThreeVector LongDir = G4ThreeVector(0,0,1);
+
+
+  G4ThreeVector pdirection = fastTrack.GetPrimaryTrack()->GetMomentum().unit();
+  G4ThreeVector localdir = fastTrack.GetPrimaryTrackLocalDirection();
+  
+  G4ThreeVector worldPosition = fastTrack.GetPrimaryTrack()->GetPosition();
+  G4ThreeVector localPosition = fastTrack.GetPrimaryTrackLocalPosition();
+
+  double energy = fastTrack.GetPrimaryTrack()->GetKineticEnergy();
+  double time = fastTrack.GetPrimaryTrack()->GetGlobalTime();
+
+  // If the electron is below the pair energy
+  // then propagate
+  if(energy<pair_energy*1.1){
+  // Vertical Drift
+  double step_length = v_drift*step;
+  double sigmaTrans  = d_trans*step/step_length;
+  double sigmaLong   = d_long*step/step_length;
+  G4ThreeVector newPos = localPosition +step_length*driftDir;
+  // trans drift
+  newPos += G4RandGauss::shoot(0,sigmaTrans)*TransDir;
+  newPos += G4RandGauss::shoot(0,sigmaLong)*LongDir;
+  G4ThreeVector Dir = localPosition-newPos;
+
+  // Set the end of the step conditions
+  fastStep.SetPrimaryTrackFinalKineticEnergyAndDirection(energy,Dir.unit());
+  fastStep.SetPrimaryTrackFinalPosition(newPos);  
+  fastStep.SetPrimaryTrackFinalTime (time+step);
+  }
+
+  // Else the energy is splitted into pairs
+  else{
+    int number_of_electron = production_bias*energy/pair_energy;
+	  fastStep.KillPrimaryTrack();
+	  fastStep.SetPrimaryTrackPathLength(0.0);
+    for(int i = 0 ; i < number_of_electron ; i++){
+      G4ThreeVector p(G4RandFlat::shoot(),G4RandFlat::shoot(),G4RandFlat::shoot()); 
+      G4DynamicParticle particle(G4Electron::ElectronDefinition(),p.unit(), pair_energy);
+		  fastStep.CreateSecondaryTrack(particle, localPosition, time);
+    }
+  }
+}
diff --git a/NPSimulation/Process/FastDriftElectron.hh b/NPSimulation/Process/FastDriftElectron.hh
new file mode 100644
index 000000000..21079eada
--- /dev/null
+++ b/NPSimulation/Process/FastDriftElectron.hh
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * Copyright (C) 2009-2016   this file is part of the NPTool Project         *
+ *                                                                           *
+ * For the licensing terms see $NPTOOL/Licence/NPTool_Licence                *
+ * For the list of contributors see $NPTOOL/Licence/Contributors             *
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Original Author: Adrien MATTA  contact address: matta@lpccaen.in2p3.fr    *
+ *                                                                           *
+ * Creation Date  : December 2016                                            *
+ * Last update    :                                                          *
+ *---------------------------------------------------------------------------*
+ * Decription:                                                               *
+ * Class to simulate electron drift in a gas detector such as Ionisation     *
+ * chamber and TPC                                                           *
+ *                                                                           *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *                                                                           *
+ *****************************************************************************/
+
+#ifndef ElectronDrift_h
+#define ElectronDrift_h
+
+#include "G4VFastSimulationModel.hh"
+#include "PhysicsList.hh"
+
+class G4VPhysicalVolume;
+
+class DriftElectron : public G4VFastSimulationModel{
+  public:
+    DriftElectron (G4String, G4Region*);
+    DriftElectron (G4String);
+    ~DriftElectron ();
+
+    virtual G4bool IsApplicable(const G4ParticleDefinition&);
+    virtual G4bool ModelTrigger(const G4FastTrack &);
+    virtual void DoIt(const G4FastTrack&, G4FastStep&);
+
+  private:
+
+    PhysicsList* m_PhysicsList;
+};
+
+
+#endif 
diff --git a/NPSimulation/Core/NPIonIonInelasticPhysic.cc b/NPSimulation/Process/NPIonIonInelasticPhysic.cc
similarity index 100%
rename from NPSimulation/Core/NPIonIonInelasticPhysic.cc
rename to NPSimulation/Process/NPIonIonInelasticPhysic.cc
diff --git a/NPSimulation/Core/NPIonIonInelasticPhysic.hh b/NPSimulation/Process/NPIonIonInelasticPhysic.hh
similarity index 100%
rename from NPSimulation/Core/NPIonIonInelasticPhysic.hh
rename to NPSimulation/Process/NPIonIonInelasticPhysic.hh
diff --git a/NPSimulation/Core/PhysicsList.cc b/NPSimulation/Process/PhysicsList.cc
similarity index 95%
rename from NPSimulation/Core/PhysicsList.cc
rename to NPSimulation/Process/PhysicsList.cc
index b86ebda16..d026b7f5c 100644
--- a/NPSimulation/Core/PhysicsList.cc
+++ b/NPSimulation/Process/PhysicsList.cc
@@ -36,7 +36,7 @@
 #include "G4LossTableManager.hh"
 #include "G4UnitsTable.hh"
 #include "G4ProcessManager.hh"
-
+#include "G4FastSimulationManagerProcess.hh"
 /////////////////////////////////////////////////////////////////////////////
 PhysicsList::PhysicsList() : G4VModularPhysicsList(){
     m_EmList = "Option4";
@@ -267,13 +267,30 @@ void PhysicsList::ConstructProcess(){
     em_option.SetFluo(true);
     em_option.SetAuger(true);
     
-    
+    AddParametrisation();
     
     return;
 }
 /////////////////////////////////////////////////////////////////////////////
 void PhysicsList::AddStepMax(){
 }
+/////////////////////////////////////////////////////////////////////////////
+void PhysicsList::AddParametrisation(){
+
+	G4FastSimulationManagerProcess* drift =
+			new G4FastSimulationManagerProcess("DriftElectron");
+  
+
+	theParticleIterator->reset();
+	while ((*theParticleIterator)()){
+		  G4ParticleDefinition* particle = theParticleIterator->value();
+      G4ProcessManager* pmanager = particle->GetProcessManager();
+
+      if(particle->GetParticleName()=="e-")
+        pmanager->AddDiscreteProcess(drift);
+  }
+}
+
 
 /////////////////////////////////////////////////////////////////////////////
 void PhysicsList::SetCuts(){
diff --git a/NPSimulation/Core/PhysicsList.hh b/NPSimulation/Process/PhysicsList.hh
similarity index 99%
rename from NPSimulation/Core/PhysicsList.hh
rename to NPSimulation/Process/PhysicsList.hh
index 6c8a458fe..9189b015b 100644
--- a/NPSimulation/Core/PhysicsList.hh
+++ b/NPSimulation/Process/PhysicsList.hh
@@ -79,6 +79,7 @@ class PhysicsList: public G4VModularPhysicsList{
     void SetCuts();
     void ConstructProcess();
     void AddStepMax();
+    void AddParametrisation();
     void AddPackage(const G4String& name);
     void BiasCrossSectionByFactor(double factor);
   
diff --git a/NPSimulation/Scorers/CMakeLists.txt b/NPSimulation/Scorers/CMakeLists.txt
new file mode 100644
index 000000000..d9c34975d
--- /dev/null
+++ b/NPSimulation/Scorers/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSScorers SHARED CalorimeterScorers.cc  SiliconScorers.cc PhotoDiodeScorers.cc ObsoleteGeneralScorers.cc)
+target_link_libraries(NPSScorers ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPInitialConditions -lNPInteractionCoordinates)
diff --git a/NPSimulation/Core/CalorimeterScorers.cc b/NPSimulation/Scorers/CalorimeterScorers.cc
similarity index 100%
rename from NPSimulation/Core/CalorimeterScorers.cc
rename to NPSimulation/Scorers/CalorimeterScorers.cc
diff --git a/NPSimulation/Core/CalorimeterScorers.hh b/NPSimulation/Scorers/CalorimeterScorers.hh
similarity index 100%
rename from NPSimulation/Core/CalorimeterScorers.hh
rename to NPSimulation/Scorers/CalorimeterScorers.hh
diff --git a/NPSimulation/Core/ObsoleteGeneralScorers.cc b/NPSimulation/Scorers/ObsoleteGeneralScorers.cc
similarity index 100%
rename from NPSimulation/Core/ObsoleteGeneralScorers.cc
rename to NPSimulation/Scorers/ObsoleteGeneralScorers.cc
diff --git a/NPSimulation/Core/ObsoleteGeneralScorers.hh b/NPSimulation/Scorers/ObsoleteGeneralScorers.hh
similarity index 100%
rename from NPSimulation/Core/ObsoleteGeneralScorers.hh
rename to NPSimulation/Scorers/ObsoleteGeneralScorers.hh
diff --git a/NPSimulation/Core/PhotoDiodeScorers.cc b/NPSimulation/Scorers/PhotoDiodeScorers.cc
similarity index 100%
rename from NPSimulation/Core/PhotoDiodeScorers.cc
rename to NPSimulation/Scorers/PhotoDiodeScorers.cc
diff --git a/NPSimulation/Core/PhotoDiodeScorers.hh b/NPSimulation/Scorers/PhotoDiodeScorers.hh
similarity index 100%
rename from NPSimulation/Core/PhotoDiodeScorers.hh
rename to NPSimulation/Scorers/PhotoDiodeScorers.hh
diff --git a/NPSimulation/Core/SiliconScorers.cc b/NPSimulation/Scorers/SiliconScorers.cc
similarity index 100%
rename from NPSimulation/Core/SiliconScorers.cc
rename to NPSimulation/Scorers/SiliconScorers.cc
diff --git a/NPSimulation/Core/SiliconScorers.hh b/NPSimulation/Scorers/SiliconScorers.hh
similarity index 100%
rename from NPSimulation/Core/SiliconScorers.hh
rename to NPSimulation/Scorers/SiliconScorers.hh
diff --git a/Projects/Sharc/Analysis.cxx b/Projects/Sharc/Analysis.cxx
index 4cd8a8b54..824b1b28c 100644
--- a/Projects/Sharc/Analysis.cxx
+++ b/Projects/Sharc/Analysis.cxx
@@ -8,7 +8,7 @@
 /*****************************************************************************
  * Original Author: Adrien MATTA  contact address: a.matta@surrey.ac.uk      *
  *                                                                           *
- * Creation Date  : march 2025                                               *
+ * Creation Date  : march 2012                                               *
  * Last update    :                                                          *
  *---------------------------------------------------------------------------*
  * Decription:                                                               *
-- 
GitLab