Skip to content
Snippets Groups Projects
Commit faeeb796 authored by Adrien Matta's avatar Adrien Matta :skull_crossbones:
Browse files

* adding mettalic lithium to material manager

parent 71deea02
No related branches found
No related tags found
No related merge requests found
......@@ -59,6 +59,8 @@ MaterialManager::MaterialManager() {
m_D = NULL;
m_T = NULL;
m_He3 = NULL;
m_Li6 = NULL;
m_Li7 = NULL;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
......@@ -78,6 +80,8 @@ void MaterialManager::ClearMaterialLibrary() {
m_D = NULL;
m_T = NULL;
m_He3 = NULL;
m_Li6 = NULL;
m_Li7 = NULL;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
......@@ -216,7 +220,30 @@ G4Material* MaterialManager::GetMaterialFromLibrary(string Name, double density)
m_Material[Name] = material;
return material;
}
else if (Name == "Li") {
if (!density)
density = 0.534 * g / cm3;
G4Material* material = new G4Material("NPS_" + Name, density, 1);
material->AddElement(GetElementFromLibrary("Li"), 1);
m_Material[Name] = material;
return material;
}
else if (Name == "6Li") {
if (!density)
density = 0.534 * g / cm3;
G4Material* material = new G4Material("NPS_" + Name, density, 1);
material->AddElement(GetElementFromLibrary("Li6"), 1);
m_Material[Name] = material;
return material;
}
else if (Name == "7Li") {
if (!density)
density = 0.534 * g / cm3;
G4Material* material = new G4Material("NPS_" + Name, density, 1);
material->AddElement(GetElementFromLibrary("Li7"), 1);
m_Material[Name] = material;
return material;
}
// Cooling
else if (Name == "N2_liquid") {
if (!density)
......@@ -527,7 +554,7 @@ G4Material* MaterialManager::GetMaterialFromLibrary(string Name, double density)
return material;
}
else if (Name == "Ge" || Name=="Germanium") {
else if (Name == "Ge" || Name == "Germanium") {
if (!density)
density = 5.323 * g / cm3;
G4Material* material = new G4Material("NPS_" + Name, density, 1);
......@@ -1163,6 +1190,22 @@ G4Element* MaterialManager::GetElementFromLibrary(string Name) {
}
return m_He3;
}
else if (Name == "Li6" || Name == "6Li") {
if (!m_Li6) {
m_Li6 = new G4Element(Name.c_str(), Name.c_str(), 1);
G4Isotope* isotope = new G4Isotope(Name.c_str(), 3, 3, 6.01512289 * g / mole);
m_Li6->AddIsotope(isotope, 1);
}
return m_Li6;
}
else if (Name == "Li7" || Name == "7Li") {
if (!m_Li7) {
m_Li7 = new G4Element(Name.c_str(), Name.c_str(), 1);
G4Isotope* isotope = new G4Isotope(Name.c_str(), 3, 4, 7.01600343 * g / mole);
m_Li7->AddIsotope(isotope, 1);
}
return m_Li7;
}
G4NistManager* man = G4NistManager::Instance();
return man->FindOrBuildElement(Name.c_str());
......
......@@ -24,18 +24,18 @@
*****************************************************************************/
// Geant4
#include "G4Material.hh"
#include "G4Element.hh"
#include "G4ParticleDefinition.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4ParticleDefinition.hh"
// STL
#include<map>
#include<set>
#include <map>
#include <set>
using namespace std;
class MaterialManager{
class MaterialManager {
public:
public:
// Designed to be a singleton (i.e. only one instance
// can exist). A member function called Instance is defined, which allows
// the user to get a pointer to the existing instance or to create it if
......@@ -48,23 +48,26 @@ public:
// called directly):
static void Destroy();
protected:
// Constructor and Destructor are not public
MaterialManager();
~MaterialManager();
protected:
// Constructor and Destructor are not public
MaterialManager();
~MaterialManager();
private:
private:
// The static instance of MaterialManager:
static MaterialManager* instance;
// Map of element and material:
map<string,G4Material*> m_Material;
private:
map<string, G4Material*> m_Material;
private:
G4Element* m_D;
G4Element* m_T;
G4Element* m_He3;
public:
G4Element* m_Li6;
G4Element* m_Li7;
public:
// clear all exising material from the library
void ClearMaterialLibrary();
......@@ -78,32 +81,30 @@ public:
G4Material* GetGasFromLibrary(string Name, double Pressure, double Temperature);
// Same as above but for Element.
G4Element* GetElementFromLibrary(string Name);
G4Element* GetElementFromLibrary(string Name);
// Let the user directly add a custom material to the library
// It is howver overwritting existing material having the same name
void AddMaterialToLibrary(G4Material*);
// Create tiny block of active material so the DEDX tables are generated
// Create tiny block of active material so the DEDX tables are generated
// prevent crash if the user define material but don't use it
void CreateSampleVolumes(G4LogicalVolume* world_log);
// Write the DEDx table for all material instantiate in the MaterialManager
// for a given particle
void WriteDEDXTable(G4ParticleDefinition* Particle ,G4double Emin,G4double Emax);
void WriteDEDXTable(G4ParticleDefinition* Particle, G4double Emin, G4double Emax);
// Write the DEDx table for all material instantiate in the MaterialManager
// for a list of particle name
void WriteDEDXTable(std::set<string> Particle ,G4double Emin,G4double Emax);
void WriteDEDXTable(std::set<string> Particle, G4double Emin, G4double Emax);
// Write the Cross Section table for all material instantiate in the MaterialManager
// for a given particle
void WriteCrossSectionTable(G4ParticleDefinition* Particle ,G4double Emin,G4double Emax);
void WriteCrossSectionTable(G4ParticleDefinition* Particle, G4double Emin, G4double Emax);
// Write the Cross Section table for all material instantiate in the MaterialManager
// for a list of particle name
void WriteCrossSectionTable(std::set<string> Particle ,G4double Emin,G4double Emax);
void WriteCrossSectionTable(std::set<string> Particle, G4double Emin, G4double Emax);
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment