Warning, /DD4hep/examples/LHeD/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 set(LHeDEx_INSTALL ${CMAKE_INSTALL_PREFIX}/examples/LHeD)
0024 dd4hep_install_dir( src compact scripts sim DESTINATION ${LHeDEx_INSTALL} )
0025 #-----------------------------------------------------------------------------------
0026 set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
0027 set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
0028
0029 dd4hep_add_plugin(LHeD
0030 SOURCES src/*.cpp
0031 USES DD4hep::DDRec DD4hep::DDCore DD4hep::DDCond DD4hep::DDAlign ROOT::Core ROOT::Geom ROOT::GenVector
0032 )
0033
0034 if (DD4HEP_USE_GEANT4)
0035 add_executable(LHeDXML scripts/LHeDXML.C)
0036 target_link_libraries(LHeDXML DD4hep::DDCore DD4hep::DDG4 Geant4::Interface)
0037 #--------------------------------------------------------------------------
0038 add_executable(LHeDACLick scripts/LHeDACLick.C)
0039 target_link_libraries(LHeDACLick DD4hep::DDCore DD4hep::DDG4 Geant4::Interface)
0040 INSTALL(TARGETS LHeDXML LHeDACLick LHeD
0041 RUNTIME DESTINATION bin
0042 LIBRARY DESTINATION lib
0043 )
0044 endif()
0045
0046 #
0047 dd4hep_configure_scripts(LHeD DEFAULT_SETUP WITH_TESTS)
0048 enable_testing ()
0049 include(CTest)
0050 #
0051 #---Testing-------------------------------------------------------------------------
0052 #
0053 #----- Tests for LHeD: here we simply require that at least 100 volumes have been converted
0054 ##dd4hep_add_test_reg ( "LHeD_converter_gdml_LONGTEST"
0055 ## COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_LHeD.sh"
0056 ## EXEC_ARGS geoConverter -compact2gdml
0057 ## -input file:${LHeDEx_INSTALL}/compact/compact.xml
0058 ## -output file:LHeD.gdml
0059 ## REGEX_PASS " Successfully extracted GDML to" )
0060 foreach ( typ description vis )
0061 dd4hep_add_test_reg ( "LHeD_converter_${typ}_LONGTEST"
0062 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_LHeD.sh"
0063 EXEC_ARGS geoConverter -compact2${typ}
0064 -input file:${LHeDEx_INSTALL}/compact/compact.xml
0065 -output file:LHeD.${typ}
0066 REGEX_PASS " Handled [1-9][0-9][0-9]+ volumes" )
0067 endforeach()
0068 #
0069 # ROOT Geometry overlap checks
0070 dd4hep_add_test_reg( LHeD_check_geometry_LONGTEST
0071 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_LHeD.sh"
0072 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/bin/checkGeometry --compact=file:${LHeDEx_INSTALL}/compact/compact.xml
0073 # This takes too long --full=true --ntracks=10 --option=o --vx=0 --vy=0 --vz=0
0074 REGEX_PASS " Execution finished..." )
0075 #
0076 # ROOT Geometry overlap checks
0077 dd4hep_add_test_reg( LHeD_check_overlaps_LONGTEST
0078 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_LHeD.sh"
0079 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/bin/checkOverlaps --compact=file:${LHeDEx_INSTALL}/compact/compact.xml
0080 --tolerance=0.1
0081 REGEX_PASS " Execution finished..." )
0082 #
0083 #---Geant4 Testing-----------------------------------------------------------------
0084 #
0085 if (DD4HEP_USE_GEANT4)
0086 #
0087 # Basic DDG4 component/unit tests
0088 foreach(script LHeDMagField LHeDPhysics LHeDRandom LHeDScan)
0089 dd4hep_add_test_reg( LHeD_DDG4_${script}_LONGTEST
0090 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_LHeD.sh"
0091 EXEC_ARGS ${Python_EXECUTABLE} ${LHeDEx_INSTALL}/scripts/${script}.py
0092 REGEX_PASS "TEST_PASSED"
0093 REGEX_FAIL "Exception;EXCEPTION;ERROR" )
0094 endforeach(script)
0095 #
0096 # Material scan
0097 dd4hep_add_test_reg( LHeD_DDG4_g4material_scan_LONGTEST
0098 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_LHeD.sh"
0099 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/bin/g4MaterialScan --compact=file:${LHeDEx_INSTALL}/compact/compact.xml
0100 "--position=0,0,0" "--direction=0,1,0"
0101 REGEX_PASS " Terminate Geant4 and delete associated actions." )
0102 #
0103 # Geant4 simulations with initialization using ACLick and XMl
0104 foreach(script LHeDXML LHeDACLick)
0105 #
0106 # Build ACLick from the source file
0107 dd4hep_add_test_reg( LHeD_DDG4_${script}_as_ACLick_LONGTEST
0108 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_LHeD.sh"
0109 EXEC_ARGS root.exe -b -x -n -q -l "${LHeDEx_INSTALL}/scripts/run.C(\"${LHeDEx_INSTALL}/scripts/${script}\")"
0110 REGEX_PASS "UserEvent_1 INFO Geant4TestEventAction> calling end.event_id=2"
0111 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" )
0112 set_property(TEST t_LHeD_DDG4_${script}_as_ACLick_LONGTEST PROPERTY RESOURCE_LOCK "INIT_ACLICK")
0113 #
0114 # Execute identical source linked executable
0115 dd4hep_add_test_reg( LHeD_DDG4_${script}_as_exe_LONGTEST
0116 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_LHeD.sh"
0117 EXEC_ARGS ${script}
0118 REGEX_PASS "UserEvent_1 INFO Geant4TestEventAction> calling end.event_id=2"
0119 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" )
0120 endforeach(script)
0121 endif()