diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f24763cba4af215294f44142ca8d5a34a68f73a..20b4738741680a961875cc3e868ff79e201deeb7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,34 +73,8 @@ if(DD4HEP_WITH_GEANT4) endif() -add_subdirectory(UtilityApps) - -##---Examples-------------------------------------------------------------- -# FG: examples are no longer built with DD4hep -# now in ./examples directory as standalone packages -#-------------------------------------------------------------------------- - -#add_subdirectory(DDExamples/AlignDet) -#add_subdirectory(DDExamples/CLICSiD) -# -# -### --- ILD examples ----- -#if( DD4HEP_WITH_LCIO ) -#add_subdirectory(DDExamples/ILDExDet) -#add_subdirectory(DDExamples/ILDExReco) -#add_subdirectory(DDExamples/ILDExTest) -#add_subdirectory(DDExamples/CaliceTbeam) -#endif() -# -# -#if(DD4HEP_WITH_GEANT4) -# add_subdirectory(DDExamples/CLICSiDSimu) -#endif() -# -#if(DD4HEP_WITH_GEANT4 AND DD4HEP_WITH_LCIO) -# add_subdirectory(DDExamples/ILDExSimu) -#endif() +add_subdirectory(UtilityApps) #---Configuration------------------------------------------------------------------- configure_file(cmake/thisdd4hep.csh thisdd4hep.csh @ONLY) diff --git a/ReadMe.txt b/ReadMe.txt index 0857be8ae8e09167025175e1683c78d1e9e2239b..c22db7bfd4cdb5b35ac8988cecee2d293fc593ef 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -28,9 +28,9 @@ build internally when required. The option DD4HEP_WITH_GEANT4:BOOL controls the building or not of this package that has the dependency to Geant4. The Geant4 installation needs to be located using the variable -DGeant4_DIR=<path to Geant4Config.cmake> -- DDExamples +- examples - Contains different detector examples (CLICSiD, ILDEx) together with example applications to illustrate + Contains different detector examples (CLICSiD, ILDExDet, ILDExSimu) together with example applications to illustrate the their usage for simulation, reconstruction and visualization with an emphasis to minimize software dependencies. For instance, the simulation application example will require to compiler and link against Geant4 but not the reconstruction application. @@ -39,9 +39,6 @@ against Geant4 but not the reconstruction application. directory 鈥榙rivers鈥� contains the Python functions to construct the detector from the XML, the 鈥榠nclude鈥� and 鈥榮rc鈥� contain the equivalent drivers for the XercesC parser. -- DDExamples/ILDEx - - Contains the original example ILDEx adapted from the Geant4 example N03 3) Pre-requisites ----------------- @@ -142,6 +139,15 @@ one needs to set the environment: cmake .. make -j install +or build all examples in one go: + + cd ./examples + mkdir build ; cd build + cmake .. + make -j install + + + - before running the example, initialize the environment: . ./bin/thisILDExDet.sh diff --git a/cmake/MakeRootMap.cmake b/cmake/MakeRootMap.cmake index 09b5006d5c2ef8fc69c99a1336829221daf11f60..40565d549129ef8b7bb50dd9e01798802088f5fe 100644 --- a/cmake/MakeRootMap.cmake +++ b/cmake/MakeRootMap.cmake @@ -1,16 +1,18 @@ -if(APPLE) - #MESSAGE( STATUS " set DYLD_LIBRARY_PATH to ./:$ENV{DYLD_LIBRARY_PATH} " ) - SET ( ENV{DYLD_LIBRARY_PATH} ./:$ENV{DYLD_LIBRARY_PATH}:$ENV{ROOTSYS}/lib ) -else() - SET ( ENV{LD_LIBRARY_PATH} ./:$ENV{LD_LIBRARY_PATH}:$ENV{ROOTSYS}/lib ) -endif() FIND_PROGRAM( ROOT_genmap_CMD genmap PATHS $ENV{ROOTSYS}/bin $ENV{PATH} ) MESSAGE( STATUS " *** MakeROOTMap.cmake run command : ${ROOT_genmap_CMD} -debug -i ${libname} -o ${rootmapfile} WORKING_DIRECTORY ${genmap_install_dir} " ) + +if(APPLE) + #MESSAGE( STATUS " set DYLD_LIBRARY_PATH to ./:$ENV{DYLD_LIBRARY_PATH} " ) + SET ( ENV{DYLD_LIBRARY_PATH} ./:$ENV{DYLD_LIBRARY_PATH}:$ENV{ROOTSYS}/lib:${genmap_install_dir} ) +else() + SET ( ENV{LD_LIBRARY_PATH} ./:$ENV{LD_LIBRARY_PATH}:$ENV{ROOTSYS}/lib:${genmap_install_dir} ) +endif() + EXECUTE_PROCESS( COMMAND ${ROOT_genmap_CMD} -debug -i ${libname} -o ${rootmapfile} WORKING_DIRECTORY ${genmap_install_dir} diff --git a/examples/CLICSiD/CMakeLists.txt b/examples/CLICSiD/CMakeLists.txt index 5f89d80365093766fab165cc66cf683bc465b3c5..46a85795d14f53b6d0694e281fe6c199b7c5a2d4 100644 --- a/examples/CLICSiD/CMakeLists.txt +++ b/examples/CLICSiD/CMakeLists.txt @@ -47,6 +47,7 @@ set( ROOT_COMPONENT_LIBRARIES Geom Reflex) #------------------------------------------------------------- include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include + include ${DD4hep_INCLUDE_DIRS} ${ROOT_INCLUDE_DIR} ) @@ -80,7 +81,7 @@ endif() #---- configure run environment --------------- configure_file( ${DD4hep_ROOT}/cmake/thisdd4hep_package.sh.in this${PackageName}.sh @ONLY) -install(FILES ${CMAKE_BINARY_DIR}/this${PackageName}.sh +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/this${PackageName}.sh DESTINATION bin ) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..ca47233499afaf75d65f316c4b2549fc8153cbf3 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,33 @@ +################################################### +# +# Simple CMakeList.txt file that allows to +# build all DD4hep examples in one go, e.g. +# +# . ./bin/thisDD4hep.sh +# cd examples ; +# mkdir build ; cd build +# cmake .. +# +# F.Gaede, DESY, 2013 +# +################################################## + +cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR) + +project(DD4hepExample) + +# +# (un)comment as needed +# +add_subdirectory(ILDExDet) + +add_subdirectory(ILDExSimu) + +add_subdirectory(CLICSiD) + +add_subdirectory(noviceN04) + +#---- does not build on mac ... +#add_subdirectory(Segmentation) + + diff --git a/examples/ILDExDet/CMakeLists.txt b/examples/ILDExDet/CMakeLists.txt index 517e01ae94beb0f0198b21750b468c09e737d79c..93e5e7814f56dcceae569a65ef6f4e5a211323cb 100644 --- a/examples/ILDExDet/CMakeLists.txt +++ b/examples/ILDExDet/CMakeLists.txt @@ -47,6 +47,7 @@ set( ROOT_COMPONENT_LIBRARIES Geom Reflex) #------------------------------------------------------------- include_directories( ${CMAKE_SOURCE_DIR}/include + include ${DD4hep_INCLUDE_DIRS} ${ROOT_INCLUDE_DIR} ) @@ -77,7 +78,7 @@ endif() #---- configure run environment --------------- configure_file( ${DD4hep_ROOT}/cmake/thisdd4hep_package.sh.in this${PackageName}.sh @ONLY) -install(FILES ${CMAKE_BINARY_DIR}/this${PackageName}.sh +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/this${PackageName}.sh DESTINATION bin ) diff --git a/examples/ILDExSimu/CMakeLists.txt b/examples/ILDExSimu/CMakeLists.txt index 5cc6fe8012e6508bbc54062e1b8a7880707faca6..c46f236dc87a8f2767e923e8777804bfa495ed4f 100644 --- a/examples/ILDExSimu/CMakeLists.txt +++ b/examples/ILDExSimu/CMakeLists.txt @@ -59,6 +59,7 @@ find_package(LCIO REQUIRED) #------------------------------------------------------------- include_directories( ${CMAKE_SOURCE_DIR}/include + include ${DD4hep_INCLUDE_DIRS} ${ROOT_INCLUDE_DIR} ${Geant4_INCLUDE_DIRS} @@ -101,7 +102,7 @@ target_link_libraries(${PackageName} ${DD4hep_LIBRARIES} #---- configure run environment --------------- configure_file( ${DD4hep_ROOT}/cmake/thisdd4hep_package.sh.in this${PackageName}.sh @ONLY) -install(FILES ${CMAKE_BINARY_DIR}/this${PackageName}.sh +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/this${PackageName}.sh DESTINATION bin ) diff --git a/examples/ILDExSimu/run1.mac b/examples/ILDExSimu/run1.mac index 43a21e00cfc696247b8d97b534dcd8fbdfe0d63b..7212f613059158ba88cc73883b952c0938a7d983 100644 --- a/examples/ILDExSimu/run1.mac +++ b/examples/ILDExSimu/run1.mac @@ -8,13 +8,14 @@ /control/verbose 1 /control/saveHistory # -/run/verbose 2 +/run/verbose 0 /event/verbose 0 -/tracking/verbose 1 +/tracking/verbose 0 # # 3 3 GeV Muons events # -##/generator/select gun +# uncomment when running slic +#/generator/select gun /gun/direction 1. 1. .1 /gun/particle mu+ /gun/energy 3 GeV diff --git a/examples/noviceN04/CMakeLists.txt b/examples/noviceN04/CMakeLists.txt index 4d3bbf81ba2012806a078a6fdde3e357b88b9325..127d3456512b02f80b6a07fe3eae3602084bb56a 100644 --- a/examples/noviceN04/CMakeLists.txt +++ b/examples/noviceN04/CMakeLists.txt @@ -59,6 +59,7 @@ INCLUDE(${Geant4_USE_FILE}) # this also takes care of geant 4 definitions and #------------------------------------------------------------- include_directories( ${CMAKE_SOURCE_DIR}/include + include ${DD4hep_INCLUDE_DIRS} ${ROOT_INCLUDE_DIR} ${Geant4_INCLUDE_DIRS} @@ -106,7 +107,7 @@ endif() #---- configure run environment --------------- configure_file( ${DD4hep_ROOT}/cmake/thisdd4hep_package.sh.in this${PackageName}.sh @ONLY) -install(FILES ${CMAKE_BINARY_DIR}/this${PackageName}.sh +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/this${PackageName}.sh DESTINATION bin )