Skip to content
Snippets Groups Projects
Commit 8ab6dbfa authored by moukaddam's avatar moukaddam
Browse files

Merge branch 'NPTool.2.dev' of https://github.com/adrien-matta/nptool into NPTool.2.dev

parents 26977107 8eae5fe1
No related branches found
No related tags found
No related merge requests found
...@@ -226,10 +226,8 @@ void ShowResults(const char * fname = "benchmark_gaspard"){ ...@@ -226,10 +226,8 @@ void ShowResults(const char * fname = "benchmark_gaspard"){
hEfficiency->Draw(); hEfficiency->Draw();
TFile* referenceFile = new TFile("reference.root"); TFile* referenceFile = new TFile("reference.root");
TCanvas* canvas1_ref = (TCanvas*) referenceFile->FindObjectAny("canvas1"); TCanvas* canvas1_ref = (TCanvas*) referenceFile->FindObjectAny("canvas1_ref");
TCanvas* canvas2_ref = (TCanvas*) referenceFile->FindObjectAny("canvas2"); TCanvas* canvas2_ref = (TCanvas*) referenceFile->FindObjectAny("canvas2_ref");
canvas1_ref->SetName("canvas1_ref");
canvas2_ref->SetName("canvas2_ref");
canvas1_ref->Draw(); canvas1_ref->Draw();
canvas2_ref->Draw(); canvas2_ref->Draw();
...@@ -241,6 +239,8 @@ void ShowResults(const char * fname = "benchmark_gaspard"){ ...@@ -241,6 +239,8 @@ void ShowResults(const char * fname = "benchmark_gaspard"){
// DO NOT USE UNLESS YOU WANT TO MAKE A CHANGE TO THE BENCHMARK // DO NOT USE UNLESS YOU WANT TO MAKE A CHANGE TO THE BENCHMARK
void WriteGaspardReference(){ void WriteGaspardReference(){
TFile *outFile = new TFile("reference.root","RECREATE"); TFile *outFile = new TFile("reference.root","RECREATE");
canvas1->SetName("canvas1_ref");
canvas2->SetName("canvas2_ref");
canvas1->Write(); canvas1->Write();
canvas2->Write(); canvas2->Write();
outFile->Close(); outFile->Close();
......
...@@ -22,6 +22,7 @@ Target ...@@ -22,6 +22,7 @@ Target
THICKNESS= 5 THICKNESS= 5
RADIUS= 7.5 RADIUS= 7.5
MATERIAL= CD2 MATERIAL= CD2
ANGLE= 0
X= 0 X= 0
Y= 0 Y= 0
Z= 0 Z= 0
......
No preview for this file type
add_custom_command(OUTPUT NPOnlineDict.cxx COMMAND ../scripts/build_dict.sh NPOnline.h NPOnlineDict.cxx NPOnline.rootmap libNPCore.dylib NPOnlineLinkDef.h DEPENDS NPOnline.h) add_custom_command(OUTPUT NPOnlineDict.cxx COMMAND ../scripts/build_dict.sh NPOnline.h NPOnlineDict.cxx NPOnline.rootmap libNPCore.dylib NPOnlineLinkDef.h DEPENDS NPOnline.h)
add_library(NPOnline SHARED NPOnline.cxx NPOnlineDict.cxx ) add_library(NPOnline SHARED NPOnline.cxx NPOnlineDict.cxx )
target_link_libraries(NPOnline ${ROOT_LIBRARIES} -lGui -lGpad -lThread -lGraf -lHist -lMatrix NPCore) target_link_libraries(NPOnline ${ROOT_LIBRARIES} Thread NPCore)
install(FILES NPOnline.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) install(FILES NPOnline.h DESTINATION ${CMAKE_INCLUDE_OUTPUT_DIRECTORY})
...@@ -4,10 +4,10 @@ add_custom_command(OUTPUT TInitialConditionsDict.cxx COMMAND ../scripts/build_di ...@@ -4,10 +4,10 @@ add_custom_command(OUTPUT TInitialConditionsDict.cxx COMMAND ../scripts/build_di
add_custom_command(OUTPUT TInteractionCoordinatesDict.cxx COMMAND ../scripts/build_dict.sh TInteractionCoordinates.h TInteractionCoordinatesDict.cxx TInteractionCoordinates.rootmap libNPInteractionCoordinates.so DEPENDS TInteractionCoordinates.h) add_custom_command(OUTPUT TInteractionCoordinatesDict.cxx COMMAND ../scripts/build_dict.sh TInteractionCoordinates.h TInteractionCoordinatesDict.cxx TInteractionCoordinates.rootmap libNPInteractionCoordinates.so DEPENDS TInteractionCoordinates.h)
add_library(NPPhysics SHARED NPBeam.cxx NPEnergyLoss.cxx NPFunction.cxx NPNucleus.cxx NPReaction.cxx NPReactionDict.cxx NPEnergyLossDict.cxx ) add_library(NPPhysics SHARED NPBeam.cxx NPEnergyLoss.cxx NPFunction.cxx NPNucleus.cxx NPReaction.cxx NPReactionDict.cxx NPEnergyLossDict.cxx )
target_link_libraries(NPPhysics ${ROOT_LIBRARIES} NPCore) target_link_libraries(NPPhysics ${ROOT_LIBRARIES} Physics NPCore)
add_library(NPInitialConditions SHARED TInitialConditions.cxx TInitialConditionsDict.cxx ) add_library(NPInitialConditions SHARED TInitialConditions.cxx TInitialConditionsDict.cxx )
target_link_libraries(NPInitialConditions ${ROOT_LIBRARIES} NPCore) target_link_libraries(NPInitialConditions ${ROOT_LIBRARIES} )
add_library(NPInteractionCoordinates SHARED TInteractionCoordinates.cxx TInteractionCoordinatesDict.cxx) add_library(NPInteractionCoordinates SHARED TInteractionCoordinates.cxx TInteractionCoordinatesDict.cxx)
target_link_libraries(NPInteractionCoordinates ${ROOT_LIBRARIES} ) target_link_libraries(NPInteractionCoordinates ${ROOT_LIBRARIES} )
......
...@@ -34,27 +34,8 @@ endif() ...@@ -34,27 +34,8 @@ endif()
## Collect the different information ## ## Collect the different information ##
# Lib # List of Root dependencies
exec_program(${NPTOOL_ROOT_CONFIG} ARGS "--glibs" OUTPUT_VARIABLE ROOT_LIBRARIES) set(ROOT_LIBRARIES dl Gui Core RIO Net Hist Gpad Tree Physics MathCore Thread )
# Remove unnecessary dependencies from the list return by root
# This actually improve slightly performances
string(REPLACE "-lGui" "" ROOT_LIBRARIES "${ROOT_LIBRARIES}")
#string(REPLACE "-lCore" "" ROOT_LIBRARIES "${ROOT_LIBRARIES}")
#string(REPLACE "-lRIO" "" ROOT_LIBRARIES "${ROOT_LIBRARIES}")
#string(REPLACE "-lNet" "" ROOT_LIBRARIES "${ROOT_LIBRARIES}")
#string(REPLACE "-lHist" "" ROOT_LIBRARIES "${ROOT_LIBRARIES}")
string(REPLACE "-lGraf " " " ROOT_LIBRARIES "${ROOT_LIBRARIES}")
string(REPLACE "-lGraf3d" "" ROOT_LIBRARIES "${ROOT_LIBRARIES}")
#string(REPLACE "-lGpad" "" ROOT_LIBRARIES "${ROOT_LIBRARIES}")
#string(REPLACE "-lTree" "" ROOT_LIBRARIES "${ROOT_LIBRARIES}")
string(REPLACE "-lRint" "" ROOT_LIBRARIES "${ROOT_LIBRARIES}")
string(REPLACE "-lPostscript" "" ROOT_LIBRARIES "${ROOT_LIBRARIES}")
string(REPLACE "-lMatrix" "" ROOT_LIBRARIES "${ROOT_LIBRARIES}")
#string(REPLACE "-lPhysics" "" ROOT_LIBRARIES "${ROOT_LIBRARIES}")
#string(REPLACE "-lMathCore" "" ROOT_LIBRARIES "${ROOT_LIBRARIES}")
string(REPLACE "-lThread" "" ROOT_LIBRARIES "${ROOT_LIBRARIES}")
string(REPLACE "-lpthread" "" ROOT_LIBRARIES "${ROOT_LIBRARIES}")
# Lib directories # Lib directories
exec_program(${NPTOOL_ROOT_CONFIG} ARGS "--libdir" OUTPUT_VARIABLE ROOT_LIBRARY_DIR) exec_program(${NPTOOL_ROOT_CONFIG} ARGS "--libdir" OUTPUT_VARIABLE ROOT_LIBRARY_DIR)
......
...@@ -56,11 +56,11 @@ namespace DETECTORNAME_NS{ ...@@ -56,11 +56,11 @@ namespace DETECTORNAME_NS{
// Energy and time Resolution // Energy and time Resolution
const double EnergyThreshold = 0.1*MeV; const double EnergyThreshold = 0.1*MeV;
const double ResoTime = 4.5*ns ; const double ResoTime = 4.5*ns ;
const double ResoEnergy = 5.0*MeV ; const double ResoEnergy = 1.0*MeV ;
const double Radius = 50*mm ; const double Radius = 50*mm ;
const double Width = 100*mm ; const double Width = 100*mm ;
const double Thickness = 300*mm ; const double Thickness = 300*mm ;
const string Scintillator = "BC400"; const string Material = "BC400";
} }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
...@@ -96,8 +96,8 @@ G4LogicalVolume* DETECTORNAME::BuildSquareDetector(){ ...@@ -96,8 +96,8 @@ G4LogicalVolume* DETECTORNAME::BuildSquareDetector(){
G4Box* box = new G4Box("DETECTORNAME_Box",DETECTORNAME_NS::Width*0.5, G4Box* box = new G4Box("DETECTORNAME_Box",DETECTORNAME_NS::Width*0.5,
DETECTORNAME_NS::Width*0.5,DETECTORNAME_NS::Thickness*0.5); DETECTORNAME_NS::Width*0.5,DETECTORNAME_NS::Thickness*0.5);
G4Material* ScintMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary(DETECTORNAME_NS::Scintillator); G4Material* DetectorMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary(DETECTORNAME_NS::Material);
m_SquareDetector = new G4LogicalVolume(box,ScintMaterial,"logic_DETECTORNAME_Box",0,0,0); m_SquareDetector = new G4LogicalVolume(box,DetectorMaterial,"logic_DETECTORNAME_Box",0,0,0);
m_SquareDetector->SetVisAttributes(m_VisSquare); m_SquareDetector->SetVisAttributes(m_VisSquare);
m_SquareDetector->SetSensitiveDetector(m_DETECTORNAMEScorer); m_SquareDetector->SetSensitiveDetector(m_DETECTORNAMEScorer);
} }
...@@ -109,8 +109,8 @@ G4LogicalVolume* DETECTORNAME::BuildCylindricalDetector(){ ...@@ -109,8 +109,8 @@ G4LogicalVolume* DETECTORNAME::BuildCylindricalDetector(){
if(!m_CylindricalDetector){ if(!m_CylindricalDetector){
G4Tubs* tub = new G4Tubs("DETECTORNAME_Cyl",0,DETECTORNAME_NS::Radius,DETECTORNAME_NS::Thickness*0.5,0,360*deg); G4Tubs* tub = new G4Tubs("DETECTORNAME_Cyl",0,DETECTORNAME_NS::Radius,DETECTORNAME_NS::Thickness*0.5,0,360*deg);
G4Material* ScintMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary(DETECTORNAME_NS::Scintillator); G4Material* DetectorMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary(DETECTORNAME_NS::Material);
m_CylindricalDetector = new G4LogicalVolume(tub,ScintMaterial,"logic_DETECTORNAME_tub",0,0,0); m_CylindricalDetector = new G4LogicalVolume(tub,DetectorMaterial,"logic_DETECTORNAME_tub",0,0,0);
m_CylindricalDetector->SetVisAttributes(m_VisSquare); m_CylindricalDetector->SetVisAttributes(m_VisSquare);
m_CylindricalDetector->SetSensitiveDetector(m_DETECTORNAMEScorer); m_CylindricalDetector->SetSensitiveDetector(m_DETECTORNAMEScorer);
...@@ -342,8 +342,6 @@ void DETECTORNAME::ReadSensitive(const G4Event* event){ ...@@ -342,8 +342,6 @@ void DETECTORNAME::ReadSensitive(const G4Event* event){
for (Calo_itr = CaloHitMap->GetMap()->begin() ; Calo_itr != CaloHitMap->GetMap()->end() ; Calo_itr++){ for (Calo_itr = CaloHitMap->GetMap()->begin() ; Calo_itr != CaloHitMap->GetMap()->end() ; Calo_itr++){
G4double* Info = *(Calo_itr->second); G4double* Info = *(Calo_itr->second);
//(Info[0]/2.35)*((Info[0]*1.02)*pow((Info[0]*1.8),.5))
// double Energy = RandGauss::shoot(Info[0],((Info[0]*1000*1.02/2.35)*pow((Info[0]*1000*1.8),.5)) );
double Energy = RandGauss::shoot(Info[0],DETECTORNAME_NS::ResoEnergy); double Energy = RandGauss::shoot(Info[0],DETECTORNAME_NS::ResoEnergy);
if(Energy>DETECTORNAME_NS::EnergyThreshold){ if(Energy>DETECTORNAME_NS::EnergyThreshold){
double Time = RandGauss::shoot(Info[1],DETECTORNAME_NS::ResoTime); double Time = RandGauss::shoot(Info[1],DETECTORNAME_NS::ResoTime);
......
...@@ -50,11 +50,10 @@ NPTool components are compiled and installed using the CMake build system, ...@@ -50,11 +50,10 @@ NPTool components are compiled and installed using the CMake build system,
so be sure to have a working CMake installation before starting. so be sure to have a working CMake installation before starting.
In order to compile NPLib, the NPTool core libraries, ROOT 5 (tested with 5.34) In order to compile NPLib, the NPTool core libraries, ROOT 5 (tested with 5.34)
or 6 should be installed with the libMathMore.so library. or 6 should be installed. This is sufficient to compile NPLib and any analysis project.
This is sufficient to compile NPLib and any analysis project.
In order to compile NPSimulation, a recent installation of Geant4 (tested In order to compile NPSimulation, a recent installation of Geant4 (tested
with version 9.6 and 10.1) is needed. If you want to use GDML format in with version 9.6 and 10.1) is needed. If you want to use GDML support in
NPTool, Geant4 should be installed with GDML support. NPTool, Geant4 should be installed with GDML support.
### Preparing the build ### Preparing the build
......
#!/usr/bin/env tcsh
printf "WARNING: Using a shell that does not comply with POSIX is bad practice. Switch to bash !\n"
# endifnd script path
set rootdir=`dirname $0` # may be relative path
set scriptpath=`cd $rootdir && pwd` # ensure absolute path
#echo $SCRIPTPATH
# export NPTOOL environment variable
setenv NPTOOL $scriptpath
printenv NPTOOL
set NPARCH=`uname`
# mac os x case
if ( "${NPARCH}" == "Darwin" ) then
setenv DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH}:${NPTOOL}/NPLib/lib
setenv DYLD_LIBRARY_PATH ${DYLD_LIBRARY_PATH}:${NPTOOL}/NPSimulation/lib
else
setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH":$NPTOOL/NPLib/lib"
setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH":$NPTOOL/NPSimulation/lib"
endif
setenv PATH $PATH":$NPTOOL/NPLib/bin"
setenv PATH $PATH":$NPTOOL/NPSimulation"
alias npt cd `printenv NPTOOL`
alias npl cd `printenv NPTOOL`/NPLib
alias nps cd `printenv NPTOOL`/NPSimulation
alias npa_not_supported npa is now longer supported, use npp instead
alias npa echo $npa_not_supported
alias npp cd `printenv NPTOOL`/Projects
setenv Geant4_DIR $G4LIB
setenv NPLib_DIR $NPTOOL/NPLib
#!/bin/bash #!/bin/bash
CMD="export"
CMD="export" SEP="="
SEP="="
# test if export is supported # test if export is supported
export 1>/dev/null 2>/dev/null export 1>/dev/null 2>/dev/null
...@@ -80,7 +79,15 @@ _npp() { ...@@ -80,7 +79,15 @@ _npp() {
return 0 return 0
} }
complete -F _npp -o filenames npp
# associate the tab completion to npp
if [ -n "$ZSH_VERSION" ]; then
# ZSH have its own command to make things easy
compdef _function foobar
else
# the rest of the world use standard posix complete
complete -F _npp -o filenames npp
fi
${CMD} Geant4_DIR${SEP}$G4LIB ${CMD} Geant4_DIR${SEP}$G4LIB
${CMD} NPLib_DIR${SEP}$NPTOOL/NPLib ${CMD} NPLib_DIR${SEP}$NPTOOL/NPLib
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