Warning, /DD4hep/examples/CLICSiD/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(CLICSiDEx_INSTALL ${CMAKE_INSTALL_PREFIX}/examples/CLICSiD)
0025 dd4hep_install_dir( scripts sim compact DESTINATION ${CLICSiDEx_INSTALL} )
0026 #--------------------------------------------------------------------------
0027 if (DD4HEP_USE_GEANT4)
0028 add_executable(CLICSiDXML scripts/CLICSiDXML.C)
0029 target_link_libraries(CLICSiDXML DD4hep::DDCore DD4hep::DDG4)
0030
0031 add_executable(CLICSiDAClick scripts/CLICSiDAClick.C)
0032 target_link_libraries(CLICSiDAClick DD4hep::DDCore DD4hep::DDG4)
0033 install(TARGETS CLICSiDXML CLICSiDAClick DESTINATION bin)
0034 endif()
0035 #
0036 #
0037 dd4hep_configure_scripts ( CLICSiD DEFAULT_SETUP WITH_TESTS )
0038 #
0039 enable_testing ()
0040 include(CTest)
0041
0042
0043 #
0044 #---Testing-------------------------------------------------------------------------
0045 #
0046 #----- Tests for CLICSid: here we simply require that at least 100 volumes have been converted
0047 ##dd4hep_add_test_reg ( "CLICSiD_converter_gdml_LONGTEST"
0048 ## COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0049 ## EXEC_ARGS geoConverter -compact2gdml
0050 ## -input file:${DD4hep_ROOT}/DDDetectors/compact/SiD.xml
0051 ## -output file:CLICSiD.gdml
0052 ## REGEX_PASS " Successfully extracted GDML to" )
0053 foreach ( typ description vis )
0054 dd4hep_add_test_reg ( "CLICSiD_converter_${typ}_LONGTEST"
0055 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0056 EXEC_ARGS geoConverter -compact2${typ}
0057 -input file:${DD4hep_ROOT}/DDDetectors/compact/SiD.xml
0058 -output file:CLICSiD.${typ}
0059 REGEX_PASS " Handled [1-9][0-9][0-9]+ volumes" )
0060 endforeach()
0061 #
0062 # ROOT Geometry overlap checks
0063 dd4hep_add_test_reg( CLICSiD_check_geometry_LONGTEST
0064 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0065 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/bin/checkGeometry --compact=file:${DD4hep_ROOT}/DDDetectors/compact/SiD.xml
0066 # This takes too long --full=true --ntracks=10 --option=o --vx=0 --vy=0 --vz=0
0067 REGEX_PASS " Execution finished..." )
0068 #
0069 # ROOT Geometry overlap checks
0070 dd4hep_add_test_reg( CLICSiD_check_overlaps_LONGTEST
0071 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0072 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/bin/checkOverlaps --compact=file:${DD4hep_ROOT}/DDDetectors/compact/SiD.xml
0073 --tolerance=0.1
0074 REGEX_PASS " Execution finished..." )
0075 #
0076 #
0077 # Load geometry from multiple input files
0078 dd4hep_add_test_reg( CLICSiD_multiple_inputs
0079 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0080 EXEC_ARGS geoDisplay -input file:${CLICSiDEx_INSTALL}/compact/SiD_multiple_inputs.xml
0081 -input file:${CLICSiDEx_INSTALL}/compact/SiD_detectors_1.xml
0082 -input file:${CLICSiDEx_INSTALL}/compact/SiD_detectors_2.xml
0083 -input file:${CLICSiDEx_INSTALL}/compact/SiD_close.xml
0084 -print INFO -destroy -volmgr -load
0085 REGEX_PASS "VolumeManager INFO - populating volume ids - done. 29366 nodes."
0086 REGEX_FAIL "Exception;EXCEPTION;ERROR" )
0087 #
0088 #
0089 if( "${ROOT_VERSION}" VERSION_GREATER "6.13.0" )
0090 # ROOT Geometry export to GDML
0091 dd4hep_add_test_reg( CLICSiD_GDML_export_LONGTEST
0092 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0093 EXEC_ARGS geoPluginRun -input file:${DD4hep_ROOT}/DDDetectors/compact/SiD.xml -print WARNING -destroy -volmgr
0094 -plugin DD4hep_ROOTGDMLExtract -output EcalBarrel.gdml -path /world/EcalBarrel
0095 -plugin DD4hep_ROOTGDMLExtract -output EcalEndcap.gdml -path /world/EcalEndcap
0096 -plugin DD4hep_ROOTGDMLExtract -output HcalBarrel.gdml -path /world/HcalBarrel
0097 -plugin DD4hep_ROOTGDMLExtract -output HcalEndcap.gdml -path /world/HcalEndcap
0098 -plugin DD4hep_ROOTGDMLExtract -output HcalPlug.gdml -path /world/HcalPlug
0099 -plugin DD4hep_ROOTGDMLExtract -output MuonBarrel.gdml -path /world/MuonBarrel
0100 -plugin DD4hep_ROOTGDMLExtract -output MuonEndcap.gdml -path /world/MuonEndcap
0101 -plugin DD4hep_ROOTGDMLExtract -output LumiCal.gdml -path /world/LumiCal
0102 -plugin DD4hep_ROOTGDMLExtract -output BeamCal.gdml -path /world/BeamCal
0103 -plugin DD4hep_ROOTGDMLExtract -output LumiReadout_Forward.gdml -path /world/LumiReadout_Forward
0104 -plugin DD4hep_ROOTGDMLExtract -output LumiReadout_Backward.gdml -path /world/LumiReadout_Backward
0105 -plugin DD4hep_VolumeDump --topstat
0106 REGEX_PASS "\\+\\+\\+ Checked 130882 physical volume placements."
0107 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0108 )
0109 #
0110 # ROOT Geometry export to GDML
0111 dd4hep_add_test_reg( CLICSiD_GDML_import_LONGTEST
0112 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0113 EXEC_ARGS geoPluginRun -input file:${CLICSiDEx_INSTALL}/compact/SiD_empty.xml -print WARNING -destroy -volmgr
0114 -plugin DD4hep_ROOTGDMLParse -input EcalBarrel.gdml -path /world/EcalBarrel
0115 -plugin DD4hep_ROOTGDMLParse -input EcalEndcap.gdml -path /world/EcalEndcap
0116 -plugin DD4hep_ROOTGDMLParse -input HcalBarrel.gdml -path /world/HcalBarrel
0117 -plugin DD4hep_ROOTGDMLParse -input HcalEndcap.gdml -path /world/HcalEndcap
0118 -plugin DD4hep_ROOTGDMLParse -input HcalPlug.gdml -path /world/HcalPlug
0119 -plugin DD4hep_ROOTGDMLParse -input MuonBarrel.gdml -path /world/MuonBarrel
0120 -plugin DD4hep_ROOTGDMLParse -input MuonEndcap.gdml -path /world/MuonEndcap
0121 -plugin DD4hep_ROOTGDMLParse -input LumiCal.gdml -path /world/LumiCal
0122 -plugin DD4hep_ROOTGDMLParse -input BeamCal.gdml -path /world/BeamCal
0123 -plugin DD4hep_ROOTGDMLParse -input LumiReadout_Forward.gdml -path /world/LumiReadout_Forward
0124 -plugin DD4hep_ROOTGDMLParse -input LumiReadout_Backward.gdml -path /world/LumiReadout_Backward
0125 -plugin DD4hep_VolumeDump --topstat
0126 DEPENDS CLICSiD_GDML_export_LONGTEST
0127 REGEX_PASS "\\+\\+\\+ Checked 11282 physical volume placements."
0128 REGEX_FAIL "Exception;EXCEPTION;ERROR" )
0129 #
0130 endif()
0131 #
0132 # Checksum test of the EcalBarrel sub-detector
0133 dd4hep_add_test_reg( CLICSiD_check_checksum_EcalBarrel
0134 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0135 EXEC_ARGS geoPluginRun -input ${DD4hep_ROOT}/DDDetectors/compact/SiD.xml -plugin DD4hepDetectorChecksum -readout -detector EcalBarrel
0136 REGEX_PASS "Combined hash code ec2a9dbb0aeccacc \\(10375 sub-codes\\)"
0137 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0138 )
0139 #
0140 # Checksum test of the full detector
0141 dd4hep_add_test_reg( CLICSiD_check_checksum_full
0142 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0143 EXEC_ARGS geoPluginRun -input ${DD4hep_ROOT}/DDDetectors/compact/SiD.xml -plugin DD4hepDetectorChecksum -readout
0144 REGEX_PASS "Combined hash code a2e90886360b3b75 \\(3395674 sub-codes\\)"
0145 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0146 )
0147 #
0148 #---Geant4 Testing-----------------------------------------------------------------
0149 #
0150 if (DD4HEP_USE_GEANT4)
0151 #
0152 # Basic DDG4 component/unit tests
0153 foreach(script testDDPython CLICMagField CLICPhysics CLICRandom CLICSiDScan)
0154 dd4hep_add_test_reg( CLICSiD_DDG4_${script}_LONGTEST
0155 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0156 EXEC_ARGS ${Python_EXECUTABLE} ${CLICSiDEx_INSTALL}/scripts/${script}.py
0157 REGEX_PASS "TEST_PASSED"
0158 REGEX_FAIL "Exception;EXCEPTION;ERROR" )
0159 endforeach(script)
0160 #
0161 # Write GDML from Geant4 using UI
0162 #dd4hep_add_test_reg( CLICSiD_DDG4_GDML_LONGTEST
0163 # COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0164 # EXEC_ARGS ${Python_EXECUTABLE} ${CLICSiDEx_INSTALL}/scripts/CLIC_GDML.py
0165 # REGEX_PASS "G4GDML. Writing 'CLICSiD.gdml' done !"
0166 # REGEX_FAIL "Exception;EXCEPTION;ERROR" )
0167 #
0168 # Material scan
0169 dd4hep_add_test_reg( CLICSiD_DDG4_g4material_scan_LONGTEST
0170 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0171 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/bin/g4MaterialScan --compact=${DD4hep_ROOT}/DDDetectors/compact/SiD.xml
0172 "--position=0,0,0" "--direction=0,1,0"
0173 REGEX_PASS " Terminate Geant4 and delete associated actions." )
0174 #
0175 # Geometry scan
0176 dd4hep_add_test_reg( CLICSiD_DDG4_g4geometry_scan_LONGTEST
0177 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0178 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/bin/g4GeometryScan --compact=${DD4hep_ROOT}/DDDetectors/compact/SiD.xml
0179 "--position=0,0,0" "--direction=0,1,0"
0180 REGEX_PASS " +856 +2374\.8789 +3000\.000 +. +0\.00,3000\.00, *0\.00. +Path:\"/world\" +Shape:G4Box +Mat:Air" )
0181 #
0182 # Geant4 simulations with initialization using AClick and XMl
0183 foreach(script CLICSiDXML CLICSiDAClick)
0184 #
0185 # Build AClick from the source file
0186 dd4hep_add_test_reg( CLICSiD_DDG4_${script}_as_AClick_LONGTEST
0187 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0188 EXEC_ARGS root.exe -b -x -n -q -l "${DD4hep_ROOT}/examples/DDG4/examples/run.C(\"${CLICSiDEx_INSTALL}/scripts/${script}\")"
0189 REGEX_PASS "UserEvent_1 INFO Geant4TestEventAction> calling end.event_id=2"
0190 REGEX_FAIL "EXCEPTION;ERROR;Error" )
0191 set_property(TEST t_CLICSiD_DDG4_${script}_as_AClick_LONGTEST PROPERTY RESOURCE_LOCK "INIT_SID_ACLICK")
0192 #
0193 # Execute identical source linked executable
0194 dd4hep_add_test_reg( CLICSiD_DDG4_${script}_as_exe_LONGTEST
0195 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0196 EXEC_ARGS ${script}
0197 REGEX_PASS "UserEvent_1 INFO Geant4TestEventAction> calling end.event_id=2"
0198 REGEX_FAIL "EXCEPTION;ERROR;Error" )
0199 endforeach(script)
0200 #
0201 # Invoke G4 multi-threading tests if enabled
0202 if (Geant4_TLS_MODEL)
0203 dd4hep_print("|++> Geant4 Multi-threading ENABLED. Configuring multi-threaded DDG4 tests.")
0204 else()
0205 dd4hep_print("|++> Geant4 Multi-threading NOT ENABLED. Shall not execute multi-threaded DDG4 tests.")
0206 endif()
0207 endif()