Warning, /DD4hep/examples/DDG4/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 #==========================================================================
0002 # AIDA Detector description implementation
0003 #--------------------------------------------------------------------------
0004 # Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 # All rights reserved.
0006 #
0007 # For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 # For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 #
0010 #==========================================================================
0011 cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
0012
0013 IF(NOT TARGET DD4hep::DDCore)
0014 find_package ( DD4hep REQUIRED )
0015 include ( ${DD4hep_DIR}/cmake/DD4hep.cmake )
0016 include ( ${DD4hep_DIR}/cmake/DD4hepBuild.cmake )
0017 dd4hep_configure_output()
0018 ENDIF()
0019
0020 dd4hep_set_compiler_flags()
0021 dd4hep_use_python_executable()
0022 #==========================================================================
0023
0024 set(DDG4examples_INSTALL ${CMAKE_INSTALL_PREFIX}/examples/DDG4)
0025 #
0026 #---Geant4 Testing-----------------------------------------------------------------
0027 #
0028 if (DD4HEP_USE_GEANT4)
0029 #---- Dictionary of classes to be written to the ROOT file --------------------
0030 dd4hep_add_dictionary(G__DDG4UserDict
0031 SOURCES ${DD4hep_DIR}/include/ROOT/Warnings.h src/Dictionary.h
0032 LINKDEF ${DD4hep_DIR}/include/ROOT/LinkDef.h
0033 DEFINITIONS DD4HEP_DICTIONARY_MODE
0034 OPTIONS -rmf ${LIBRARY_OUTPUT_PATH}/G__DDG4UserDict.rootmap -rml libDDG4UserLib.so
0035 OUTPUT ${LIBRARY_OUTPUT_PATH}
0036 )
0037 #---- Example of a client library with user defined plugins --------------------
0038 dd4hep_add_plugin( DDG4UserLib
0039 SOURCES src/*.cpp
0040 GENERATED G__DDG4UserDict.cxx
0041 USES DD4hep::DDCore DD4hep::DDG4 Geant4::Interface ROOT::Core ROOT::Geom ROOT::GenVector ROOT::RIO
0042 )
0043 set(DD4HEP_INSTALL_LIBRARY lib)
0044 if(CMAKE_INSTALL_LIBDIR)
0045 set(DD4HEP_INSTALL_LIBRARY ${CMAKE_INSTALL_LIBDIR})
0046 endif()
0047 install(FILES ${LIBRARY_OUTPUT_PATH}/G__DDG4UserDict.rootmap DESTINATION ${DD4HEP_INSTALL_LIBRARY} COMPONENT dev)
0048 unset(DD4HEP_INSTALL_LIBRARY)
0049 #
0050 #
0051 dd4hep_install_dir(data DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/DDG4 )
0052 dd4hep_install_dir(compact DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/DDG4 )
0053 dd4hep_install_dir(scripts DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/DDG4 )
0054 #
0055 dd4hep_configure_scripts (DDG4 DEFAULT_SETUP WITH_TESTS)
0056 #
0057 # Test HepMC input reader
0058 dd4hep_add_test_reg( DDG4_sim_HepMC_reader
0059 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0060 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/examples/DDG4/examples/readHEPMC.py
0061 ${DDG4examples_INSTALL}/data/hepmc_geant4.dat
0062 REGEX_PASS "Geant4InputAction\\[Input\\]: Event 10 Error when moving to event - EOF")
0063 #
0064 # Test HepMC input reader with slightly non-standard HEPMC file
0065 dd4hep_add_test_reg( DDG4_sim_HepMC_reader_minbias
0066 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0067 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/examples/DDG4/examples/readHEPMC.py
0068 ${DDG4examples_INSTALL}/data/LHCb_MinBias_HepMC.txt
0069 REGEX_PASS "Geant4InputAction\\[Input\\]: Event 27 Error when moving to event - EOF")
0070 #
0071 # Test property types with specialized action
0072 dd4hep_add_test_reg( DDG4_sim_Test_property_types
0073 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0074 EXEC_ARGS ${Python_EXECUTABLE} ${DDG4examples_INSTALL}/scripts/TestProperties.py
0075 REGEX_PASS "Test PASSED"
0076 REGEX_FAIL " ERROR ;EXCEPTION;Exception"
0077 )
0078 #
0079 # Test material and volume properties
0080 dd4hep_add_test_reg( DDG4_material_volume_string_properties
0081 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0082 EXEC_ARGS geoDisplay file:${DDG4examples_INSTALL}/compact/Channeling.xml -load -destroy
0083 REGEX_PASS "7 nodes/ 3 volume UID's in Detector Geometry"
0084 REGEX_FAIL " ERROR ;EXCEPTION;Exception"
0085 )
0086 #
0087 # Test G4 creation of G4ExtendedMaterial and G4LogicalCrystalVolume
0088 dd4hep_add_test_reg( DDG4_sim_G4ExtendedMaterial_G4LogicalCrystalVolume
0089 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0090 EXEC_ARGS ${Python_EXECUTABLE} ${DDG4examples_INSTALL}/scripts/Channeling.py -batch -events 3
0091 REGEX_PASS "Created specialize logical volume \\[G4LogicalCrystalVolume\\]: ChannelingDevice_vol"
0092 REGEX_FAIL " ERROR ;EXCEPTION;Exception"
0093 )
0094 #
0095 # Test G4 stacking action
0096 dd4hep_add_test_reg( DDG4_sim_TestStackingAction
0097 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0098 EXEC_ARGS ${Python_EXECUTABLE} ${DDG4examples_INSTALL}/scripts/TestStacking.py -batch -events 3
0099 REGEX_PASS " \\[2\\] Calling classifyNewTrack. StackManager"
0100 REGEX_FAIL " ERROR ;EXCEPTION;Exception"
0101 )
0102 #
0103 # Test G4 stepping action
0104 dd4hep_add_test_reg( DDG4_sim_TestSteppingAction
0105 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0106 EXEC_ARGS ${Python_EXECUTABLE} ${DDG4examples_INSTALL}/scripts/TestStepping.py -batch -events 3
0107 REGEX_PASS " Track Calls Suspended: [1-9][0-9]*"
0108 REGEX_FAIL " ERROR ;EXCEPTION;Exception"
0109 )
0110 #
0111 # Test G4 command UI
0112 dd4hep_add_test_reg( DDG4_sim_UIManager
0113 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0114 EXEC_ARGS ${Python_EXECUTABLE} ${DDG4examples_INSTALL}/scripts/TestUserCommands.py
0115 REGEX_PASS " Parameter value at call 13 is 'terminate-command-2'"
0116 REGEX_FAIL " ERROR ;EXCEPTION;Exception"
0117 )
0118 #
0119 # Test G4 SIGINT handler
0120 dd4hep_add_test_reg( DDG4_sim_SIGINT_handler
0121 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0122 EXEC_ARGS ${Python_EXECUTABLE} ${DDG4examples_INSTALL}/scripts/TestSIGINT.py
0123 REGEX_PASS "Event loop STOP signalled. Processing stops"
0124 REGEX_FAIL " ERROR ;EXCEPTION"
0125 )
0126 #
0127 endif()