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

* New Directory structure for NPS

        - Now use separate folder for scorer, event generator and
          physics
parent 3074c396
No related branches found
No related tags found
No related merge requests found
Showing
with 59 additions and 6 deletions
......@@ -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)
......
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 )
......@@ -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){
......
......@@ -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);
......
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)
add_library(NPSProcess SHARED FastDriftElectron.cc NPIonIonInelasticPhysic.cc PhysicsList.cc)
target_link_libraries(NPSProcess ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} -lNPInitialConditions -lNPInteractionCoordinates)
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