From f5ffc56a84baefccef59b513634da8fed0eadf67 Mon Sep 17 00:00:00 2001
From: matta <matta@npt>
Date: Thu, 18 Nov 2010 17:18:57 +0000
Subject: [PATCH] * Changing NPEnergyLoss so it can also find table away fron
 the standard directory

---
 NPLib/Tools/NPEnergyLoss.cxx   | 14 +++++++++++---
 NPSimulation/src/MUST2Array.cc | 10 +++++-----
 NPSimulation/src/Target.cc     | 10 ++++++++++
 3 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/NPLib/Tools/NPEnergyLoss.cxx b/NPLib/Tools/NPEnergyLoss.cxx
index f41ac75f9..69bcb90d6 100644
--- a/NPLib/Tools/NPEnergyLoss.cxx
+++ b/NPLib/Tools/NPEnergyLoss.cxx
@@ -63,7 +63,7 @@ EnergyLoss::EnergyLoss(string Path , string Source, int NumberOfSlice=100 ,  int
 	fNumberOfMass  = NumberOfMass  ;
 	
 	string globalPath = getenv("NPTOOL");
-	Path = globalPath + "/Inputs/EnergyLoss/" + Path;
+	string StandardPath = globalPath + "/Inputs/EnergyLoss/" + Path;
 	
 	cout << "///////////////////////////////// " << endl ;
 	cout << "Initialising an EnergyLoss object " << endl ;
@@ -72,11 +72,19 @@ EnergyLoss::EnergyLoss(string Path , string Source, int NumberOfSlice=100 ,  int
 		TableFile.open(Path.c_str())	;
 
  		// Opening dE/dX file
-	 if(!TableFile) cout << "ERROR: TABLE FILE NOT FOUND" << endl; 
+	  if(TableFile.is_open()) 	cout << "Reading Energy Loss File: " << Path << endl ; 
+  	// In case the file is not found in the standard path, the programm try to interpret the file name as an absolute or relative file path.
+       else 
+        {
+          TableFile.open( Path.c_str() );
+          if(TableFile.is_open()) { cout << "Reading Energy Loss File: " << Path << endl ;}
+          
+          else { cout << "ERROR: TABLE FILE NOT FOUND" << endl; return; }
+        }
+	
 	  
 	 if (Source == "G4Table")
 	 	{
-	   	cout << "Reading Energy Loss File: " << Path << endl ;
 			// Reading Data
 			double energy, total;
 			string dummy;
diff --git a/NPSimulation/src/MUST2Array.cc b/NPSimulation/src/MUST2Array.cc
index b8c5f4328..e644c5950 100644
--- a/NPSimulation/src/MUST2Array.cc
+++ b/NPSimulation/src/MUST2Array.cc
@@ -164,11 +164,11 @@ void MUST2Array::VolumeMaker(G4int TelescopeNumber ,
 
 
    PVPBuffer =    new G4PVPlacement(	G4Transform3D(*MMrot, MMpos)      ,
-														         	logicMM                    ,
-														         	Name                    ,
-														         	world                   ,
-														         	false                   ,
-														         	0);
+														         	logicMM                           ,
+														         	Name                              ,
+														         	world                             ,
+														         	false                             ,
+														         	0                                 );
 
 
 
diff --git a/NPSimulation/src/Target.cc b/NPSimulation/src/Target.cc
index 6e8d1d6b4..3b3b32aa5 100644
--- a/NPSimulation/src/Target.cc
+++ b/NPSimulation/src/Target.cc
@@ -216,6 +216,16 @@ G4Material* Target::GetMaterialFromLibrary(G4String MaterialName, G4double Tempe
       return myMaterial;
    }
 
+  else if (MaterialName == "Si") {
+      G4Material* myMaterial = new G4Material("Si", 14., 28.0855 * g / mole,  2.321 * g / cm3);
+      return myMaterial;
+   }
+
+  else if (MaterialName == "Al") {
+      G4Material* myMaterial = new G4Material("Aluminium",  13.,  26.98 * g / mole, 2.702 * g / cm3);
+      return myMaterial;
+   }
+
    else {
       G4cout << "No Matching Material in the Target Library Default is Vacuum" << G4endl;
       G4Element* N = new G4Element("Nitrogen", "N", 7., 14.01*g / mole);
-- 
GitLab