diff --git a/NPLib/.gitignore b/NPLib/.gitignore
index 171aeb0eb400eabdede91bce8df7c0da7862e131..9c5203f63b06f291582445ac21b60a3f33fec02f 100644
--- a/NPLib/.gitignore
+++ b/NPLib/.gitignore
@@ -7,6 +7,11 @@ bin
 DetectorClassList.txt
 Utility/Makefile
 Utility/npanalysis
-Utility/nptool-libmap
+Utility/nptool-installer
+*.pcm
+*Dict*
 *rootmap*
 *_rflx.cpp
+*.dylib
+*.so
+*.cmake
diff --git a/NPLib/Tiara/TTiaraBarrelPhysics.cxx b/NPLib/Tiara/TTiaraBarrelPhysics.cxx
index 2c06f20a931eb891cdd1ca7e101323f6b21dd462..5b56db8bf140cef95215dc510ede88433d7f7529 100644
--- a/NPLib/Tiara/TTiaraBarrelPhysics.cxx
+++ b/NPLib/Tiara/TTiaraBarrelPhysics.cxx
@@ -368,13 +368,15 @@ void TTiaraBarrelPhysics::BuildPhysicalEvent(){
 
       getline(ConfigFile, LineBuffer);
       //  cout << LineBuffer << endl;
-      if (LineBuffer.compare(0, 11, "TiaraInnerBarrel") == 0)
+      if (LineBuffer.find("TiaraInnerBarrel") != std::string::npos)
         ReadingStatus = true;
 
       while (ReadingStatus && !ConfigFile.eof()) {
-        ConfigFile >> DataBuffer ;
+        check_X=true; check_Y=true ; check_Z=true;
         //   Comment Line
-        if (DataBuffer.compare(0, 1, "%") == 0) {   ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );}
+        if (DataBuffer.compare(0, 1, "%") == 0) {   
+           ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );
+        }
 
         ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////something here?
 
@@ -424,17 +426,13 @@ void TTiaraBarrelPhysics::BuildPhysicalEvent(){
         ///////////////////////////////////////////////////
         //   If no Detector Token and no comment, toggle out
         else {
-          ReadingStatusStrip= false;
-          cout << "Error: Wrong Token Sequence: Getting out " << DataBuffer << endl ;
-          exit(1);
         }
 
         /////////////////////////////////////////////////
         //   If All necessary information there, toggle out
 
         if (check_X && check_Y && check_Z){
-
-          ReadingStatusStrip= false;
+          ReadingStatus= false;
           AddDetector(X,Y,Z);
           //   Reinitialisation of Check Boolean
           check_X = false ;
@@ -690,6 +688,12 @@ void TTiaraBarrelPhysics::BuildPhysicalEvent(){
       return CalibrationManager::getInstance()->ApplyCalibration(name, m_EventData->GetBackEEnergy(i));
     }
 
+    ////////////////////////////////////////////////////////////////////////////
+    void TTiaraBarrelPhysics::WriteSpectra(){
+       m_Spectra->WriteSpectra();
+    }
+
+
     ////////////////////////////////////////////////////////////////////////////////
     //            Construct Method to be pass to the DetectorFactory              //
     ////////////////////////////////////////////////////////////////////////////////
diff --git a/NPLib/Tiara/TTiaraBarrelPhysics.h b/NPLib/Tiara/TTiaraBarrelPhysics.h
index 69ed35eb19bc840b9f3ee6be0090aa3486a04709..563086238f0bdb7cb9838f7c854d542a95c3bcdf 100644
--- a/NPLib/Tiara/TTiaraBarrelPhysics.h
+++ b/NPLib/Tiara/TTiaraBarrelPhysics.h
@@ -122,7 +122,8 @@ class TTiaraBarrelPhysics : public TObject, public NPA::VDetector{
     void CheckSpectra();
     // Used for Online only, clear all the spectra hold by the Spectra class
     void ClearSpectra();
-
+    // Write Spectra to file
+    void WriteSpectra();
   public://   Specific to TiaraBarrel Array
     //   Clear The PreTeated object
     void ClearPreTreatedData()   {m_PreTreatedData->Clear();}
diff --git a/NPLib/Utility/npanalysis.cxx b/NPLib/Utility/npanalysis.cxx
index 1e311068d1bc5f4577f3d7596cf959a1f49c35c7..de7e7e08e25ab49d7f7656211b328a044ef97bc8 100644
--- a/NPLib/Utility/npanalysis.cxx
+++ b/NPLib/Utility/npanalysis.cxx
@@ -148,6 +148,9 @@ int main(int argc , char** argv){
   myDetector->StopThread();
 #endif
   ProgressDisplay(begin,end,treated,inter,nentries,mean_rate,displayed);
+  if(myOptionManager->GetGenerateHistoOption())
+    myDetector->WriteSpectra();
+  
   RootOutput::getInstance()->Destroy();
   RootInput::getInstance()->Destroy();
   return 0;
diff --git a/NPSimulation/AnnularS1/CMakeLists.txt b/NPSimulation/AnnularS1/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d92dba83390abf5d2f9cc4b030abebd28289d87a
--- /dev/null
+++ b/NPSimulation/AnnularS1/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSAnnularS1 SHARED  AnnularS1.cc)
+target_link_libraries(NPSAnnularS1 NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPAnnularS1)
diff --git a/NPSimulation/CMakeLists.txt b/NPSimulation/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..b36553acf95c29eccddb9863f8bf914d649a0b68
--- /dev/null
+++ b/NPSimulation/CMakeLists.txt
@@ -0,0 +1,93 @@
+cmake_minimum_required (VERSION 2.8)
+include("../NPLib/FindROOT.cmake")
+
+project (NPSimulation)
+set (NPSimulation_VERSION_MAJOR 2)
+set (NPSimulation_VERSION_MINOR 0)
+
+set(CMAKE_BUILD_TYPE Release)
+
+# Finding Geant 4
+find_package(Geant4 REQUIRED ui_all vis_all)
+message(${Geant4_USE_FILE})
+include(${Geant4_USE_FILE}) 
+
+# Finding NPLib
+find_package(NPLib)
+include(${NPLib_USE_FILE})
+
+set(DETLIST ${NPLib_DETECTOR_LIST})
+
+if("${DETLIST}" MATCHES "")
+    message("Building all detectors")
+  else()
+    message("Building the following detectors ${DETLIST}") 
+endif()
+
+# Setting the policy to match Cmake version
+cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
+
+# Add root to the link and include directories
+include_directories( ${ROOT_INCLUDE_DIR})
+link_directories( ${ROOT_LIBRARY_DIR})
+
+# Get the compilator flag from root to assure consistancy
+EXEC_PROGRAM(${ROOT_CONFIG_EXECUTABLE}
+     ARGS "--cflags"
+     OUTPUT_VARIABLE root_cflags )
+
+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")
+endif()
+
+set(CMAKE_BINARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
+set(CMAKE_INCLUDE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/include )
+
+# A macro that return the list of directory to compile
+MACRO(subdirlist result curdir)
+  FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
+  SET(dirlist "")
+  FOREACH(child ${children})
+    IF(IS_DIRECTORY ${curdir}/${child})
+      string(COMPARE EQUAL "${child}" ".tmp" r0)
+      string(COMPARE EQUAL "${child}" "lib" r1)
+      string(COMPARE EQUAL "${child}" "scripts" r2)
+      string(COMPARE EQUAL "${child}" "CMakeFiles" r3)
+      string(COMPARE EQUAL "${child}" "Core" r4)
+      string(COMPARE EQUAL "${child}" "bin" r5)
+      string(COMPARE EQUAL "${child}" "macro" r6)
+      string(COMPARE EQUAL "${child}" "icons" r7)
+      IF(NOT r0 AND NOT r1 AND NOT r2 AND NOT r3 AND NOT r4 AND NOT r5 AND NOT r6 AND NOT r7)
+        string(COMPARE EQUAL "${DETLIST}" "" r100)
+        IF(r100)
+          LIST(APPEND dirlist ${child})
+        ELSEIF(${DETLIST} MATCHES ".*${child}.*" )
+          LIST(APPEND dirlist ${child}) 
+        ENDIF()
+      ENDIF()
+    ENDIF()
+  ENDFOREACH()
+  SET(${result} ${dirlist})
+ENDMACRO()
+
+# Call the Macro
+subdirlist(SUB_DIRECTORY ${CMAKE_BINARY_DIR})
+set(SUB_DIRECTORY ${SUB_DIRECTORY} Core)
+include_directories("Core/")
+
+# Add each sub folder to the project
+foreach(subdir ${SUB_DIRECTORY})
+# add the subdirectory
+  add_subdirectory(${subdir}) 
+ endforeach()
+
+add_executable(npsimulation Simulation.cc)
+target_Link_libraries(npsimulation ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} NPSCore)
+configure_file(macro/gui.mac.in macro/gui.mac @ONLY) 
+configure_file(macro/aliases.mac.in macro/aliases.mac @ONLY) 
+
+install(PROGRAMS npsimulation DESTINATION ${CMAKE_BINARY_OUTPUT_DIRECTORY})
diff --git a/NPSimulation/ComptonTelescope/CMakeLists.txt b/NPSimulation/ComptonTelescope/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d48945290d063a076c2a0cfb855cadd4de59a3df
--- /dev/null
+++ b/NPSimulation/ComptonTelescope/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSComptonTelescope SHARED  ComptonTelescope.cc ComptonTelescopeScorers.cc)
+target_link_libraries(NPSComptonTelescope NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPComptonTelescope)
diff --git a/NPSimulation/Core/CMakeLists.txt b/NPSimulation/Core/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..6b393c93875ea08fd239622034c262d5ddd550ca
--- /dev/null
+++ b/NPSimulation/Core/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSCore SHARED CalorimeterScorers.cc EventAction.cc EventGeneratorParticleDecay.cc ObsoleteGeneralScorers.cc PrimaryGeneratorAction.cc Target.cc Chamber.cc EventGeneratorBeam.cc EventGeneratorTwoBodyReaction.cc Particle.cc PrimaryGeneratorActionMessenger.cc NPSVDetector.cc DetectorConstruction.cc EventGeneratorGammaDecay.cc MaterialManager.cc ParticleStack.cc SiliconScorers.cc VEventGenerator.cc DetectorMessenger.cc EventGeneratorIsotropic.cc MyMagneticField.cc PhysicsList.cc SteppingVerbose.cc NPSDetectorFactory.cc)
+target_link_libraries(NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES})
diff --git a/NPSimulation/Core/NPSDetectorFactory.cc b/NPSimulation/Core/NPSDetectorFactory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..689c97e2278f98ae8c0dd3f16dbf31bd3ae585dd
--- /dev/null
+++ b/NPSimulation/Core/NPSDetectorFactory.cc
@@ -0,0 +1,132 @@
+#include"NPSDetectorFactory.hh"
+using namespace NPS;
+#include<dlfcn.h>
+#include<fstream>
+#include<iostream>
+#include<stdlib.h>
+
+DetectorFactory* DetectorFactory::m_Instance = 0;
+#ifdef __linux__
+std::string SHARED_LIB_EXTENSION = ".so";
+#endif
+
+#ifdef __FreeBSD__
+std::string SHARED_LIB_EXTENSION = ".so";
+#endif
+
+#ifdef __APPLE__
+std::string SHARED_LIB_EXTENSION = ".dylib";
+#endif
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+DetectorFactory::DetectorFactory(){
+
+}
+
+/////////////////////////////////////////////////////////////////////////////////
+DetectorFactory::~DetectorFactory(){
+  if(m_Instance!=0)
+    delete m_Instance;
+
+  m_Instance = 0 ;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+DetectorFactory* DetectorFactory::getInstance(){
+  if(!m_Instance){
+    m_Instance = new DetectorFactory();
+  }
+
+  return m_Instance;
+
+}
+////////////////////////////////////////////////////////////////////////////////
+void DetectorFactory::ReadClassList(std::string FileList){
+    std::ifstream InFile(FileList.c_str());
+
+    if(!InFile.is_open()){
+      cout << "ERROR: Detector Class List file " << FileList << " Not found" << endl;
+      exit(1);
+    }
+
+    string Token, LibName;
+    while(InFile >> Token >> LibName){
+      // Modify LibName from NPLib name to NPSimulation one
+      LibName = LibName.replace(LibName.find("libNP"), std::string("libNP").length(), "libNPS");
+      m_TokenLib[Token] = LibName; 
+    }
+}
+////////////////////////////////////////////////////////////////////////////////
+void DetectorFactory::CreateClassList(std::string FileList){
+  ofstream outFile(FileList.c_str());
+  std::map<string,string>::iterator it;
+
+  for(it = m_TokenLib.begin();it!=m_TokenLib.end();it++){
+    outFile << it->first << " " << it->second << std::endl;
+  
+  }
+
+
+}
+////////////////////////////////////////////////////////////////////////////////
+NPS::VDetector* DetectorFactory::Construct(std::string Token){
+  std::map<std::string,ClassDetectorFactoryFn>::iterator it;
+  
+  if(m_Construct.find(Token)!=m_Construct.end())
+    return  m_Construct[Token]();
+
+  else if( m_TokenLib.find(Token)!=m_TokenLib.end()){
+    // Add absolute path to library name
+    std::string path = getenv("NPTOOL"); 
+    std::string libName = path+"NPLib/lib/"+m_TokenLib[Token];
+    dlopen(libName.c_str(),RTLD_NOW);
+    
+    if(m_Construct.find(Token)!=m_Construct.end())
+      return  m_Construct[Token]();
+  
+    else{
+      std::cout << "Warning: Detector with Token " << Token << " has no Constructor or no Library" << std::endl;
+      return NULL;
+    }
+  }
+
+  return NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void DetectorFactory::AddDetector(std::string Token, ClassDetectorFactoryFn fn){
+  m_Construct[Token] = fn;
+}
+////////////////////////////////////////////////////////////////////////////////
+void DetectorFactory::AddToken(std::string Token, std::string LibName){
+  // Make sure the lib name is correct:
+  // Strip it from lib and NP and extension
+  std::string remword = "lib";
+  size_t pos;
+  if((pos=LibName.find(remword))!=std::string::npos){
+    LibName.swap(LibName.erase(pos,remword.length()));
+  }
+
+  remword = "NP";
+  if((pos=LibName.find(remword))!=std::string::npos){
+    LibName.swap(LibName.erase(pos,remword.length()));
+  }
+ 
+  remword = ".so";
+  if((pos=LibName.find(remword))!=std::string::npos){
+    LibName.swap(LibName.erase(pos,remword.length()));
+  }
+
+  remword = ".dylib";
+  if((pos=LibName.find(remword))!=std::string::npos){
+    LibName.swap(LibName.erase(pos,remword.length()));
+  }
+
+
+  // Create the full name:
+  LibName = "libNP"+LibName + SHARED_LIB_EXTENSION;
+  
+  m_TokenLib[Token] = LibName;
+}
diff --git a/NPSimulation/Core/NPSDetectorFactory.hh b/NPSimulation/Core/NPSDetectorFactory.hh
new file mode 100644
index 0000000000000000000000000000000000000000..19484638f27699625d62db76f9cd8f4a40bddfa9
--- /dev/null
+++ b/NPSimulation/Core/NPSDetectorFactory.hh
@@ -0,0 +1,30 @@
+#ifndef _DETECTORFACTORY_
+#define _DETECTORFACTORY_
+#include"NPSVDetector.hh"
+#include<map>
+#include<string>
+
+typedef NPS::VDetector* (*ClassDetectorFactoryFn)();
+
+namespace NPS{
+class DetectorFactory{
+  private:
+      DetectorFactory();
+      ~DetectorFactory();
+
+  public:
+      static DetectorFactory* getInstance();
+      NPS::VDetector* Construct(std::string Token);
+      void ReadClassList(std::string FileList);
+      void AddToken(std::string Token, std::string LibName);
+      void AddDetector(std::string Token, ClassDetectorFactoryFn fn);
+      void CreateClassList(string FileName);
+  private:
+      static DetectorFactory* m_Instance;
+      // Map that Match the Token with Constructor, once the lib is loaded
+      std::map<std::string,ClassDetectorFactoryFn> m_Construct;
+      // Map that Match the Token with the Lib to be loaded
+      std::map<std::string,std::string> m_TokenLib;
+};
+}
+#endif
diff --git a/NPSimulation/DUMMYDetector/CMakeLists.txt b/NPSimulation/DUMMYDetector/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..9cdb6906fa8544a7e1e3cbc8627a1051b33fee68
--- /dev/null
+++ b/NPSimulation/DUMMYDetector/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSDUMMYDetector SHARED  DummyDetector.cc)
+target_link_libraries(NPSDUMMYDetector NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPDUMMYDetector)
diff --git a/NPSimulation/Eurogam/CMakeLists.txt b/NPSimulation/Eurogam/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..33f2e2ef962cfe68321f26ccfac98c0a810e145b
--- /dev/null
+++ b/NPSimulation/Eurogam/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSEurogam SHARED  Eurogam.cc)
+target_link_libraries(NPSEurogam NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPEurogam)
diff --git a/NPSimulation/Fatima/CMakeLists.txt b/NPSimulation/Fatima/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..64db645896b7f8af95b017269dcfacf5f5ec7990
--- /dev/null
+++ b/NPSimulation/Fatima/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSFatima SHARED  Fatima.cc)
+target_link_libraries(NPSFatima NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPFatima)
diff --git a/NPSimulation/GASPARD/CMakeLists.txt b/NPSimulation/GASPARD/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..4799f4f45fc9dea1c28b9895492192b89e6be0c1
--- /dev/null
+++ b/NPSimulation/GASPARD/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSGASPARD SHARED  GaspardScorers.cc GaspardTracker.cc GaspardTrackerAnnular.cc GaspardTrackerDummyShape.cc GaspardTrackerModule.cc GaspardTrackerRectangle.cc GaspardTrackerSquare.cc GaspardTrackerTrapezoid.cc)
+target_link_libraries(NPSGASPARD NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPGASPARD)
diff --git a/NPSimulation/Helios/CMakeLists.txt b/NPSimulation/Helios/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..6928bf3e55672a43ab4a04c70fecaaaf55de873b
--- /dev/null
+++ b/NPSimulation/Helios/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSHelios SHARED  Helios.cc HeliosDetDummyShape.cc HeliosModule.cc HeliosScorers.cc)
+target_link_libraries(NPSHelios NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPHelios)
diff --git a/NPSimulation/Hyde2/CMakeLists.txt b/NPSimulation/Hyde2/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..03fb0db5c51da10e277d250905264ed517e1840f
--- /dev/null
+++ b/NPSimulation/Hyde2/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSHyde2 SHARED  Hyde2Scorers.cc Hyde2Tracker.cc Hyde2TrackerModule.cc Hyde2TrackerSquare1.cc Hyde2TrackerTrapezoid1.cc Hyde2TrackerTrapezoid2.cc)
+target_link_libraries(NPSHyde2 NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPHyde2)
diff --git a/NPSimulation/MUST2/CMakeLists.txt b/NPSimulation/MUST2/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..575f80c78eafba3c754d20d676dc7e689cd7cca1
--- /dev/null
+++ b/NPSimulation/MUST2/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSMUST2 SHARED  MUST2Array.cc MUST2Scorers.cc)
+target_link_libraries(NPSMUST2 NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPMUST2)
diff --git a/NPSimulation/Makefile b/NPSimulation/Makefile
deleted file mode 100644
index 5b8bf15b5b6b7f2492e4290c311566833dc00bec..0000000000000000000000000000000000000000
--- a/NPSimulation/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-COPYFILES	= CopyIncSrcFiles
-DELFILES	= DelIncSrcFiles
-NPSIM		= NPSimulation
-
-all:	$(DELFILES) $(COPYFILES) $(NPSIM)
-DelIncSrcFiles: $(NPTOOL)/NPLib/liblist
-	./scripts/deletefiles.sh
-
-CopyIncSrcFiles: DelIncSrcFiles
-	./scripts/copyfiles.sh
-
-NPSimulation: DelIncSrcFiles CopyIncSrcFiles
-	make -f Makefile.geant4
-
-clean:
-	./scripts/deletefiles.sh
-
-distclean:
-	./scripts/deletefiles.sh
-	@echo " + Deleting bin and tmp directories"
-	rm -rf bin
-	rm -rf tmp
diff --git a/NPSimulation/Makefile.geant4 b/NPSimulation/Makefile.geant4
deleted file mode 100644
index c736721bb6d3561186289373742d8d2f23fa310e..0000000000000000000000000000000000000000
--- a/NPSimulation/Makefile.geant4
+++ /dev/null
@@ -1,53 +0,0 @@
-# $Id: GNUmakefile,v 1.1 1999/01/07 16:05:40 gunter Exp $
-# --------------------------------------------------------------
-# GNUmakefile based on examples module by Gabriele Cosmo, 06/04/98.
-# --------------------------------------------------------------
-
-ROOTCONFIG   := root-config
-ARCH         := $(shell $(ROOTCONFIG) --arch)
-
-#COPYFILES	= CopyIncSrcFiles
-
-# G4 makefile
-name := Simulation
-G4TARGET := $(name)
-G4EXLIB := true
-
-ifndef G4INSTALL
-  G4INSTALL = ../../..
-endif
-
-# G4 work directory is the path where
-# Result of compilation is put in (./$G4WORKDIR/bin/$G4SYSTEM/)
-# to execute your programm : ./$G4WORKDIR/bin/$G4SYSTEM/Simulation xx.reaction xx.detector
-G4WORKDIR = ./
-G4BIN = ./bin
-
-CPPFLAGS += $(shell root-config --cflags) 
-CPPFLAGS += -I$(NPTOOL)/NPLib/include
-
-ifeq ($(ARCH),linuxx8664gcc)
-CPPFLAGS += -Xlinker --no-as-needed
-endif
-
-ifeq ($(ARCH),macosx64)
-CPPFLAGS += -Wno-deprecated-register
-endif
-
-
-EXTRALIBS = $(shell root-config --glibs) -lMathMore
-EXTRALIBS += `$(NPTOOL)/NPLib/liblist`
-.PHONY: all
-#all: $(COPYFILES) lib bin
-all: lib bin
-
-# copying files associated to selected detectors
-#CopyIncSrcFiles:
-#	./copyfiles.sh
-
-cleanVRML:
-	rm -r *.wrl
-
-include $(G4INSTALL)/config/architecture.gmk
-include $(G4INSTALL)/config/binmake.gmk
-
diff --git a/NPSimulation/Nana/CMakeLists.txt b/NPSimulation/Nana/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..9eaa1f6ef4ceca3bf78d5fe9c8262269c1992a89
--- /dev/null
+++ b/NPSimulation/Nana/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSNana SHARED  Nana.cc)
+target_link_libraries(NPSNana NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPNana)
diff --git a/NPSimulation/Paris/CMakeLists.txt b/NPSimulation/Paris/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..618fde020efe606fc43407250c1a9d2f8e99f8d0
--- /dev/null
+++ b/NPSimulation/Paris/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSParis SHARED  Paris.cc)
+target_link_libraries(NPSParis NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPParis)
diff --git a/NPSimulation/Plastic/CMakeLists.txt b/NPSimulation/Plastic/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d7994b4e9a1e2aecc90c362f28a5ea0458ddaf12
--- /dev/null
+++ b/NPSimulation/Plastic/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSPlastic SHARED  Plastic.cc)
+target_link_libraries(NPSPlastic NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPPlastic)
diff --git a/NPSimulation/SSSD/CMakeLists.txt b/NPSimulation/SSSD/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..f874cde2faca3de3f6e49b0a880c63e93aa63249
--- /dev/null
+++ b/NPSimulation/SSSD/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSSSSD SHARED  ThinSi.cc ThinSiScorers.cc)
+target_link_libraries(NPSSSSD NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPSSSD)
diff --git a/NPSimulation/Sharc/CMakeLists.txt b/NPSimulation/Sharc/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..eb358ec9b4fbf130cdae80109056581165bd133d
--- /dev/null
+++ b/NPSimulation/Sharc/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSSharc SHARED  Sharc.cc)
+target_link_libraries(NPSSharc NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPSharc)
diff --git a/NPSimulation/Tiara/CMakeLists.txt b/NPSimulation/Tiara/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..aa2f6600fef9b85de711db7260a234b725f6715a
--- /dev/null
+++ b/NPSimulation/Tiara/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSTiara SHARED  Tiara.cc)
+target_link_libraries(NPSTiara NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPTiara)
diff --git a/NPSimulation/Tigress/CMakeLists.txt b/NPSimulation/Tigress/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..c93d4e4c1fd9c440c11c5305a7f2044ec9983647
--- /dev/null
+++ b/NPSimulation/Tigress/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSTigress SHARED  Tigress.cc)
+target_link_libraries(NPSTigress NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPTigress)
diff --git a/NPSimulation/W1/CMakeLists.txt b/NPSimulation/W1/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..409e428296577f12a03369e83c5463055578edf4
--- /dev/null
+++ b/NPSimulation/W1/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSW1 SHARED  W1.cc W1Scorers.cc)
+target_link_libraries(NPSW1 NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPW1)
diff --git a/NPSimulation/macro/aliases.mac b/NPSimulation/macro/aliases.mac
deleted file mode 100644
index e1d0e473668b119d57e1a67d56a08fb9b3583ce4..0000000000000000000000000000000000000000
--- a/NPSimulation/macro/aliases.mac
+++ /dev/null
@@ -1,20 +0,0 @@
-# Aliases are needed to avoid warning
-/control/alias gui_beamon "/run/beamOn 1"
-/control/alias gui_vis "/control/execute /Users/am0067/Desktop/nptool/NPSimulation/macro/vis.mac"
-/control/alias gui_browser "/control/execute /Users/am0067/Desktop/nptool/NPSimulation/macro/browser.mac"
-/control/alias gui_tracking "/tracking/verbose 1"
-/control/alias gui_surface "/vis/viewer/set/style surface"
-/control/alias gui_wireframe "/vis/viewer/set/style wireframe"
-/control/alias gui_beam "/vis/scene/add/arrow 0 0 -1 0 0 1 m"
-/control/alias gui_home "/vis/viewer/set/viewpointThetaPhi 45. 45."
-/control/alias gui_front "/vis/viewer/set/viewpointThetaPhi 0. 0."
-/control/alias gui_back "/vis/viewer/set/viewpointThetaPhi 180. 0."
-/control/alias gui_left "/vis/viewer/set/viewpointThetaPhi 90. 0." 
-/control/alias gui_right "/vis/viewer/set/viewpointThetaPhi -90. 0."
-/control/alias gui_zoomin "/vis/viewer/zoom 2"
-/control/alias gui_zoomout "/vis/viewer/zoom 0.5"
-/control/alias gui_empty "/"
-/control/alias gui_exit "exit"
-/control/alias gui_nptool "./scripts/url.sh"
-/control/alias gui_update "/control/execute /Users/am0067/Desktop/nptool/NPSimulation/macro/reload.mac"
-/control/alias gui_open "/det/open"
diff --git a/NPSimulation/macro/gui.mac b/NPSimulation/macro/gui.mac
deleted file mode 100644
index c21bbdb458e33fac98ae82c69eea132b09fc9663..0000000000000000000000000000000000000000
--- a/NPSimulation/macro/gui.mac
+++ /dev/null
@@ -1,43 +0,0 @@
-# This file permits to customize, with commands,
-# the menu bar of the G4UIXm, G4UIQt, G4UIWin32 sessions.
-# It has no effect with G4UIterminal.
-
-# Viewer menu :
-/gui/addMenu viewer Viewer
-/gui/addButton viewer "New viewer" "{gui_vis}"
-/gui/addButton viewer "Set style surface" "{gui_surface}"
-/gui/addButton viewer "Set style wireframe" "{gui_wireframe}"
-
-# Custom visualisation menu
-/gui/addMenu custom "Custom View"
-/gui/addButton custom "Add axis" "/vis/scene/add/axes"
-/gui/addButton custom "Add beam axis" "{gui_beam}"
-/gui/addButton custom "Add event ID" "/vis/scene/add/eventID"
-/gui/addButton custom "Add step point" "/vis/modeling/trajectories/drawByParticleID-0/default/setDrawStepPts true"
-
-# No hit collection is implemented
-#/gui/addButton custom "Add Scorer Hits" "/vis/scene/add/psHits"
-#/gui/addButton custom "Add Hits" "/vis/scene/add/hits"
-
-# NPS tool bar
-/gui/addIcon "Follow us on GitHub" user_icon "/gui/system {gui_nptool}" /Users/am0067/Desktop/nptool/NPSimulation/icons/NPToolLogo.png
-/gui/addIcon "Exit" user_icon "{gui_exit}" /Users/am0067/Desktop/nptool/NPSimulation/icons/power.png
-/gui/addIcon "the star gaze" user_icon "{gui_empty}" /Users/am0067/Desktop/nptool/NPSimulation/icons/empty.png 
-/gui/addIcon "Update geometry" user_icon "{gui_update}" /Users/am0067/Desktop/nptool/NPSimulation/icons/recycle.png
-/gui/addIcon "Update generator" user_icon "/gen/update" /Users/am0067/Desktop/nptool/NPSimulation/icons/bolt.png
-/gui/addIcon "Open generator" user_icon "/gen/open" /Users/am0067/Desktop/nptool/NPSimulation/icons/folder.png
-/gui/addIcon "the moon beyond the clouds" user_icon "{gui_empty}" /Users/am0067/Desktop/nptool/NPSimulation/icons/empty.png 
-/gui/addIcon "Run beam on" user_icon "/run/beamOn" /Users/am0067/Desktop/nptool/NPSimulation/icons/rocket.png
-/gui/addIcon "One event" user_icon "{gui_beamon}" /Users/am0067/Desktop/nptool/NPSimulation/icons/play.png
-/gui/addIcon "Activate tracking verbose" user_icon "{gui_tracking}" /Users/am0067/Desktop/nptool/NPSimulation/icons/shoeprints.png
-/gui/addIcon "fill the empty dark" user_icon "{gui_empty}" /Users/am0067/Desktop/nptool/NPSimulation/icons/empty.png 
-/gui/addIcon "View Browser" user_icon "{gui_browser}" /Users/am0067/Desktop/nptool/NPSimulation/icons/browser.png
-/gui/addIcon "Take a screen shot" user_icon "/vis/ogl/printEPS" /Users/am0067/Desktop/nptool/NPSimulation/icons/camera.png
-/gui/addIcon "Home" user_icon     "{gui_home}" /Users/am0067/Desktop/nptool/NPSimulation/icons/eye.png
-/gui/addIcon "Front" user_icon    "{gui_front}" /Users/am0067/Desktop/nptool/NPSimulation/icons/arrow-up.png
-/gui/addIcon "Back" user_icon     "{gui_back}" /Users/am0067/Desktop/nptool/NPSimulation/icons/arrow-down.png
-/gui/addIcon "Left" user_icon     "{gui_left}" /Users/am0067/Desktop/nptool/NPSimulation/icons/arrow-left.png
-/gui/addIcon "Right" user_icon    "{gui_right}" /Users/am0067/Desktop/nptool/NPSimulation/icons/arrow-right.png
-/gui/addIcon "Zoom in" user_icon  "{gui_zoomin}" /Users/am0067/Desktop/nptool/NPSimulation/icons/zoomin.png
-/gui/addIcon "Zoom out" user_icon "{gui_zoomout}" /Users/am0067/Desktop/nptool/NPSimulation/icons/zoomout.png
-