Back to home page

EIC code displayed by LXR

 
 

    


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