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 install(TARGETS DDG4UserLib LIBRARY DESTINATION lib)
0044 install(FILES ${LIBRARY_OUTPUT_PATH}/G__DDG4UserDict.rootmap DESTINATION lib)
0045 #
0046 #
0047 dd4hep_install_dir(data DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/DDG4 )
0048 dd4hep_install_dir(compact DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/DDG4 )
0049 dd4hep_install_dir(scripts DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/DDG4 )
0050 #
0051 dd4hep_configure_scripts (DDG4 DEFAULT_SETUP WITH_TESTS)
0052 #
0053 # Test HepMC input reader
0054 dd4hep_add_test_reg( DDG4_HepMC_reader
0055 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0056 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/examples/DDG4/examples/readHEPMC.py
0057 ${DDG4examples_INSTALL}/data/hepmc_geant4.dat
0058 REGEX_PASS "Geant4InputAction\\[Input\\]: Event 10 Error when moving to event - EOF")
0059 #
0060 # Test HepMC input reader with slightly non-standard HEPMC file
0061 dd4hep_add_test_reg( DDG4_HepMC_reader_minbias
0062 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0063 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/examples/DDG4/examples/readHEPMC.py
0064 ${DDG4examples_INSTALL}/data/LHCb_MinBias_HepMC.txt
0065 REGEX_PASS "Geant4InputAction\\[Input\\]: Event 27 Error when moving to event - EOF")
0066 #
0067 # Test property types with specialized action
0068 dd4hep_add_test_reg( DDG4_Test_property_types
0069 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0070 EXEC_ARGS ${Python_EXECUTABLE} ${DDG4examples_INSTALL}/scripts/TestProperties.py
0071 REGEX_PASS "Test PASSED"
0072 REGEX_FAIL " ERROR ;EXCEPTION;Exception"
0073 )
0074 #
0075 # Test material and volume properties
0076 dd4hep_add_test_reg( DDG4_material_volume_string_properties
0077 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0078 EXEC_ARGS geoDisplay file:${DDG4examples_INSTALL}/compact/Channeling.xml -load -destroy
0079 REGEX_PASS "7 nodes/ 3 volume UID's in Detector Geometry"
0080 REGEX_FAIL " ERROR ;EXCEPTION;Exception"
0081 )
0082 #
0083 # Test G4 creation of G4ExtendedMaterial and G4LogicalCrystalVolume
0084 dd4hep_add_test_reg( DDG4_G4ExtendedMaterial_G4LogicalCrystalVolume
0085 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0086 EXEC_ARGS ${Python_EXECUTABLE} ${DDG4examples_INSTALL}/scripts/Channeling.py -batch -events 3
0087 REGEX_PASS "Created specialize logical volume \\[G4LogicalCrystalVolume\\]: ChannelingDevice_vol"
0088 REGEX_FAIL " ERROR ;EXCEPTION;Exception"
0089 )
0090 #
0091 # Test G4 stacking action
0092 dd4hep_add_test_reg( DDG4_TestStackingAction
0093 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0094 EXEC_ARGS ${Python_EXECUTABLE} ${DDG4examples_INSTALL}/scripts/TestStacking.py -batch -events 3
0095 REGEX_PASS " \\[2\\] Calling classifyNewTrack. StackManager"
0096 REGEX_FAIL " ERROR ;EXCEPTION;Exception"
0097 )
0098 #
0099 # Test G4 stepping action
0100 dd4hep_add_test_reg( DDG4_TestSteppingAction
0101 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0102 EXEC_ARGS ${Python_EXECUTABLE} ${DDG4examples_INSTALL}/scripts/TestStepping.py -batch -events 3
0103 REGEX_PASS " Track Calls Suspended: [1-9][0-9]*"
0104 REGEX_FAIL " ERROR ;EXCEPTION;Exception"
0105 )
0106 #
0107 # Test G4 command UI
0108 dd4hep_add_test_reg( DDG4_UIManager
0109 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0110 EXEC_ARGS ${Python_EXECUTABLE} ${DDG4examples_INSTALL}/scripts/TestUserCommands.py
0111 REGEX_PASS " Parameter value at call 13 is 'terminate-command-2'"
0112 REGEX_FAIL " ERROR ;EXCEPTION;Exception"
0113 )
0114 #
0115 # Test G4 SIGINT handler
0116 dd4hep_add_test_reg( DDG4_SIGINT_handler
0117 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh"
0118 EXEC_ARGS ${Python_EXECUTABLE} ${DDG4examples_INSTALL}/scripts/TestSIGINT.py
0119 REGEX_PASS "Event loop STOP signalled. Processing stops"
0120 REGEX_FAIL " ERROR ;EXCEPTION"
0121 )
0122 #
0123 endif()