diff --git a/FullSimLight/CMakeLists.txt b/FullSimLight/CMakeLists.txt index 1d5a0a8c8c658ebadfeab20ab7f17bfe41f1510f..ce36c8e37b641abb42c622a9d9b0c362b87b004c 100644 --- a/FullSimLight/CMakeLists.txt +++ b/FullSimLight/CMakeLists.txt @@ -99,6 +99,8 @@ file(GLOB headers ${PROJECT_SOURCE_DIR}/inc/*.hh) set(OUTPUT bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${OUTPUT}) +add_definitions (-DG4SHAREDIR="${CMAKE_INSTALL_PREFIX}/share" ) + add_executable(fullSimLight fullSimLight.cc ${sources} ${headers}) add_executable(gmclash geoModelClash.cc ${sources} ${headers}) add_executable(gmmasscalc geoModelMassCalculator.cc ${sources} ${headers}) diff --git a/FullSimLight/fullSimLight.cc b/FullSimLight/fullSimLight.cc index 7ebd744ce6d88403aaa94e82c234df83f982a086..16c64362b468247bbfc26d5ff7bfe5995ed6068d 100644 --- a/FullSimLight/fullSimLight.cc +++ b/FullSimLight/fullSimLight.cc @@ -44,6 +44,21 @@ void Help(); int main(int argc, char** argv) { + // JFB if the G4 environment does not already set path to these variables, look for + // them in standard places. + const std::string g4ShareDir=G4SHAREDIR; + setenv("G4NEUTRONHPDATA",(g4ShareDir+"/Geant4-10.6.1/data/G4NDL4.6").c_str(), 0); + setenv("G4LEDATA",(g4ShareDir+"/Geant4-10.6.1/data/G4EMLOW7.9.1").c_str(), 0); + setenv("G4LEVELGAMMADATA",(g4ShareDir+"/Geant4-10.6.1/data/PhotonEvaporation5.5").c_str(), 0); + setenv("G4RADIOACTIVEDATA",(g4ShareDir+"/Geant4-10.6.1/data/RadioactiveDecay5.4").c_str(), 0); + setenv("G4PARTICLEXSDATA",(g4ShareDir+"/Geant4-10.6.1/data/G4PARTICLEXS2.1").c_str(), 0); + setenv("G4PIIDATA",(g4ShareDir+"/Geant4-10.6.1/data/G4PII1.3").c_str(), 0); + setenv("G4REALSURFACEDATA",(g4ShareDir+"/Geant4-10.6.1/data/RealSurface2.1.1").c_str() , 0); + setenv("G4SAIDXSDATA",(g4ShareDir+"/Geant4-10.6.1/data/G4SAIDDATA2.0").c_str(), 0); + setenv("G4ABLADATA",(g4ShareDir+"/Geant4-10.6.1/data/G4ABLA3.1").c_str(), 0); + setenv("G4INCLDATA",(g4ShareDir+"/Geant4-10.6.1/data/G4INCL1.0").c_str(), 0); + setenv("G4ENSDFSTATEDATA",(g4ShareDir+"/Geant4-10.6.1/data/G4ENSDFSTATE2.2").c_str(), 0); + // Get input arguments GetInputArguments(argc, argv); diff --git a/FullSimLight/geantinoMaps.cc b/FullSimLight/geantinoMaps.cc index bb7af271c823bb360635e07a01ebb06d630aaa0f..1d358784ca67da27c62f06d5324987d4a987cf42 100644 --- a/FullSimLight/geantinoMaps.cc +++ b/FullSimLight/geantinoMaps.cc @@ -82,15 +82,23 @@ int main(int argc, char** argv) { return 1; } - // JFB: Check that the macro file exists and is readable: - if (!getenv("G4ENSDFSTATEDATA")) { - G4cout << G4endl; - G4cout << "INFO: It appears that your Geant4 environment is not set up" << G4endl; - G4cout << "INFO: Please source the script geant4.sh" << G4endl; - G4cout << "INFO: Possible locations: /usr/bin or /usr/local/bin" << G4endl; - G4cout << "INFO: Exiting" <<G4endl; - return 1; - } + // JFB. In case the user has not set up the pointers to G4 data files, look for them + // in standard directories. + + const std::string g4ShareDir=G4SHAREDIR; + setenv("G4NEUTRONHPDATA",(g4ShareDir+"/Geant4-10.6.1/data/G4NDL4.6").c_str(), 0); + setenv("G4LEDATA",(g4ShareDir+"/Geant4-10.6.1/data/G4EMLOW7.9.1").c_str(), 0); + setenv("G4LEVELGAMMADATA",(g4ShareDir+"/Geant4-10.6.1/data/PhotonEvaporation5.5").c_str(), 0); + setenv("G4RADIOACTIVEDATA",(g4ShareDir+"/Geant4-10.6.1/data/RadioactiveDecay5.4").c_str(), 0); + setenv("G4PARTICLEXSDATA",(g4ShareDir+"/Geant4-10.6.1/data/G4PARTICLEXS2.1").c_str(), 0); + setenv("G4PIIDATA",(g4ShareDir+"/Geant4-10.6.1/data/G4PII1.3").c_str(), 0); + setenv("G4REALSURFACEDATA",(g4ShareDir+"/Geant4-10.6.1/data/RealSurface2.1.1").c_str() , 0); + setenv("G4SAIDXSDATA",(g4ShareDir+"/Geant4-10.6.1/data/G4SAIDDATA2.0").c_str(), 0); + setenv("G4ABLADATA",(g4ShareDir+"/Geant4-10.6.1/data/G4ABLA3.1").c_str(), 0); + setenv("G4INCLDATA",(g4ShareDir+"/Geant4-10.6.1/data/G4INCL1.0").c_str(), 0); + setenv("G4ENSDFSTATEDATA",(g4ShareDir+"/Geant4-10.6.1/data/G4ENSDFSTATE2.2").c_str(), 0); + + //#if G4VERSION_NUMBER>=1040 // std::cout<<"G4VERSION_NUMBER:::: "<<G4VERSION_NUMBER<<std::endl; // exit(1); diff --git a/GeoModelVisualization/GeoModelExplorer/CMakeLists.txt b/GeoModelVisualization/GeoModelExplorer/CMakeLists.txt index 8b28c7e3b2ac95b9419d2031791ca5d784546f90..b41741b94c974c1a56ac2c1b06536f1636494bb0 100644 --- a/GeoModelVisualization/GeoModelExplorer/CMakeLists.txt +++ b/GeoModelVisualization/GeoModelExplorer/CMakeLists.txt @@ -2,6 +2,9 @@ # Add the executable. add_executable( gmex src/main.cxx ) + +add_definitions (-DGXPLUGINDIR="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/gxplugins" ) + target_link_libraries( gmex PRIVATE GXGui Qt5::Core ) target_compile_definitions( gmex PRIVATE GEOMODEL_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}" ) diff --git a/GeoModelVisualization/GeoModelExplorer/src/main.cxx b/GeoModelVisualization/GeoModelExplorer/src/main.cxx index b5c7d412b1d86e9ca8065b4a4ea724e4a09a6f2c..538026364ec0e3c7f90a624dbb198fe1ba5ec530 100644 --- a/GeoModelVisualization/GeoModelExplorer/src/main.cxx +++ b/GeoModelVisualization/GeoModelExplorer/src/main.cxx @@ -38,23 +38,10 @@ int main(int argc, char** argv) setenv(variable, plus, true); } }; - // Preprocessor: we are passing the install directory to this - // class, from the CMake configuration. - // Drivers will be loaded from this install directory. - // However in some cases "linux" is part of the install directory - // name and that may be defined in a macro to be 1. So if that is - // the case we temporarily undef it. -#ifdef linux -#define waslinux linux -#undef linux - const char * standardPlaces = GEOMODEL_INSTALL_PREFIX; -#define linux waslinux -#else - const char * standardPlaces = GEOMODEL_INSTALL_PREFIX; -#endif - std::cout << "standardPlaces: " << standardPlaces << std::endl; - std::string gxpluginpath= std::string(standardPlaces)+"/lib/gxplugins"; + + std::string gxpluginpath= GXPLUGINDIR; pManip("GXPLUGINPATH",gxpluginpath.c_str()); + std::cout << "Plugins resolved in path: " << getenv("GXPLUGINPATH") << std::endl; QStringList arguments; for (int i = 0; i<=argc; i++){ arguments << argv[i];