Warning, /DD4hep/examples/DDDigi/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 IF(NOT TARGET DD4hep::DDDigi)
0021 MESSAGE(STATUS "+++> DDDigi examples shall not be built! [DDDigi not enabled]")
0022 return()
0023 ENDIF()
0024 #
0025 dd4hep_set_compiler_flags()
0026 dd4hep_use_python_executable()
0027 #==========================================================================
0028 dd4hep_configure_output ()
0029 #
0030 set(DDDigiexamples_INSTALL ${CMAKE_INSTALL_PREFIX}/examples/DDDigi)
0031 #
0032 dd4hep_add_plugin(DDDigiExampleLib SOURCES src/*.cpp )
0033 target_link_libraries(DDDigiExampleLib DD4hep::DDDigi Boost::boost ROOT::Geom ROOT::GenVector ROOT::RIO ROOT::Gui ROOT::Hist)
0034 install(TARGETS DDDigiExampleLib LIBRARY DESTINATION lib)
0035 install(DIRECTORY scripts DESTINATION ${DDDigiexamples_INSTALL})
0036 #
0037 dd4hep_configure_scripts (DDDigi DEFAULT_SETUP WITH_TESTS)
0038 #
0039 # Test basic processing chain
0040 dd4hep_add_test_reg(DDDigi_framework
0041 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0042 EXEC_ARGS ${Python_EXECUTABLE} ${DDDigiexamples_INSTALL}/scripts/TestFramework.py
0043 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed."
0044 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0045 )
0046 #
0047 # Test colored noise factory
0048 dd4hep_add_test_reg(DDDigi_colored_noise
0049 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0050 EXEC_ARGS geoPluginRun -ui -plugin DD4hep_FalphaNoise -shots 1000000 -variance 1 -alpha 0.5
0051 DEPENDS DDDigi_framework
0052 REGEX_PASS "FalphaNoise INFO Distribution RMS 1.0"
0053 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0054 )
0055 #
0056 # Test new properties
0057 dd4hep_add_test_reg(DDDigi_properties
0058 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0059 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestProperties.py
0060 REGEX_PASS "roperty test PASSED"
0061 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0062 )
0063 #
0064 if (DD4HEP_USE_GEANT4)
0065 # Generate test data
0066 dd4hep_add_test_reg(DDDigi_generate_ddg4_data
0067 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0068 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/ClientTests/scripts/MiniTelGenerate.py
0069 -batch -events 30 -runs 8
0070 REGEX_PASS "\\+\\+\\+ Finished run 7 after 30 events \\(240 events in total\\)."
0071 # Space is intentional to avoid G4Exception (From FindIon)
0072 REGEX_FAIL "Error;ERROR;FATAL; Exception"
0073 )
0074 # Test basic input reading from DDG4
0075 dd4hep_add_test_reg(DDDigi_test_input_reading
0076 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0077 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestInput.py
0078 DEPENDS DDDigi_generate_ddg4_data
0079 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed"
0080 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0081 )
0082 # Test DDDigi exception while processing
0083 dd4hep_add_test_reg(DDDigi_test_processing_exception
0084 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0085 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestInput.py
0086 -num_events 1000
0087 DEPENDS DDDigi_generate_ddg4_data
0088 REGEX_PASS "\\+\\+ Terminate Digi and delete associated actions."
0089 )
0090 # Test signal attenuation for spillover
0091 dd4hep_add_test_reg(DDDigi_test_attenuate
0092 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0093 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestAttenuate.py
0094 DEPENDS DDDigi_generate_ddg4_data
0095 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed"
0096 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0097 )
0098 # Test moving IP
0099 dd4hep_add_test_reg(DDDigi_test_move_IP
0100 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0101 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestIPMove.py
0102 DEPENDS DDDigi_generate_ddg4_data
0103 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed"
0104 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0105 )
0106 # Test deposit count
0107 dd4hep_add_test_reg(DDDigi_test_deposit_count
0108 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0109 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestDepositCount.py
0110 DEPENDS DDDigi_generate_ddg4_data
0111 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed"
0112 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0113 )
0114 # Test weighted deposit overlay
0115 dd4hep_add_test_reg(DDDigi_test_weighted_deposit_overlay
0116 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0117 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestDepositWeighted.py
0118 DEPENDS DDDigi_generate_ddg4_data
0119 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed"
0120 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0121 )
0122 # Test deposit energy smearing
0123 dd4hep_add_test_reg(DDDigi_test_deposit_smear_energy
0124 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0125 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestDepositSmearEnergy.py
0126 DEPENDS DDDigi_generate_ddg4_data
0127 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed"
0128 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0129 )
0130 # Test deposit time resolution smearing
0131 dd4hep_add_test_reg(DDDigi_test_deposit_smear_time
0132 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0133 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestDepositSmearTime.py
0134 DEPENDS DDDigi_generate_ddg4_data
0135 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed"
0136 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0137 )
0138 # Test deposit position resolution smearing
0139 dd4hep_add_test_reg(DDDigi_test_smear_position
0140 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0141 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestPositionSmearResolution.py
0142 DEPENDS DDDigi_generate_ddg4_data
0143 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed"
0144 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0145 )
0146 # Test deposit track position resolution smearing
0147 dd4hep_add_test_reg(DDDigi_test_smear_track
0148 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0149 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestPositionSmearTrack.py
0150 DEPENDS DDDigi_generate_ddg4_data
0151 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed"
0152 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0153 )
0154 # Test multiple interaction input
0155 dd4hep_add_test_reg(DDDigi_test_multi_interactions
0156 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0157 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestMultiInteractions.py
0158 DEPENDS DDDigi_generate_ddg4_data
0159 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed"
0160 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0161 )
0162 # Test spillover input (multi interactions with attenuation)
0163 dd4hep_add_test_reg(DDDigi_test_spillover
0164 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0165 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestSpillover.py
0166 DEPENDS DDDigi_generate_ddg4_data
0167 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed"
0168 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0169 )
0170 # Test container parellization
0171 dd4hep_add_test_reg(DDDigi_test_containers_parallel
0172 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0173 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestMultiContainerParallel.py
0174 DEPENDS DDDigi_generate_ddg4_data
0175 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed"
0176 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0177 )
0178 # Test hit resegmentation
0179 dd4hep_add_test_reg(DDDigi_test_detector_resegmentation
0180 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0181 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestResegmentation.py
0182 DEPENDS DDDigi_generate_ddg4_data
0183 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed"
0184 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0185 )
0186 # Test work splitting by segmentation
0187 dd4hep_add_test_reg(DDDigi_test_segmentation_split_1
0188 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0189 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestSegmentationSplit.py
0190 DEPENDS DDDigi_generate_ddg4_data
0191 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed"
0192 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0193 )
0194 # Test work splitting by segmentation (2)
0195 dd4hep_add_test_reg(DDDigi_test_segmentation_split_2
0196 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0197 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestSegmentationSplit2.py
0198 DEPENDS DDDigi_generate_ddg4_data
0199 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed"
0200 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0201 )
0202 # Test simple ADC response
0203 dd4hep_add_test_reg(DDDigi_test_simple_adc_response
0204 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0205 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestSimpleADCResponse.py
0206 DEPENDS DDDigi_generate_ddg4_data
0207 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed"
0208 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0209 )
0210 #
0211 # Test raw digi write
0212 dd4hep_add_test_reg(DDDigi_test_digi_root_write
0213 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0214 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestWriteDigi.py
0215 DEPENDS DDDigi_generate_ddg4_data
0216 REGEX_PASS "\\+\\+\\+ Closing ROOT output file dddigi_write_digi_00000000.root after 5 events"
0217 REGEX_FAIL "Error;ERROR;FATAL;Exception"
0218 )
0219 #
0220 # Test EDM4HEP output module
0221 if (DD4HEP_USE_EDM4HEP)
0222 # Generate edm4hep test data
0223 dd4hep_add_test_reg(DDDigi_generate_edm4hep_data
0224 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0225 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/ClientTests/scripts/MiniTelGenerate.py
0226 -batch -events 30 -runs 3 -output MiniTel_DDG4_edm4hep_data.root
0227 DEPENDS DDDigi_generate_ddg4_data
0228 REGEX_PASS "\\+\\+\\+ Finished run 2 after 30 events \\(90 events in total\\)."
0229 REGEX_FAIL "Error;ERROR;FATAL; Exception"
0230 )
0231 # Test reading EDM4HEP input written with DDG4
0232 dd4hep_add_test_reg(DDDigi_test_edm4hep_read
0233 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0234 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestEdm4hepInput.py
0235 -num_events 15 -num_threads 10 -events_parallel 5
0236 DEPENDS DDDigi_generate_edm4hep_data
0237 REGEX_PASS "\\+\\+\\+ 15 Events out of 15 processed."
0238 REGEX_FAIL "ERROR;FATAL;Exception"
0239 )
0240 #
0241 # Test EDM4HEP writing OUTPUT from ddg4 input (needs to be expanded)
0242 dd4hep_add_test_reg(DDDigi_test_edm4hep_output
0243 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
0244 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_INSTALL_PREFIX}/examples/DDDigi/scripts/TestEdm4hepOutput.py
0245 -num_events 5 -num_threads 10 -events_parallel 4
0246 DEPENDS DDDigi_generate_ddg4_data
0247 DEPENDS DDDigi_generate_edm4hep_data
0248 REGEX_PASS "\\+\\+\\+ 5 Events out of 5 processed."
0249 REGEX_FAIL "ERROR;FATAL;Exception"
0250 )
0251 endif()
0252 #
0253 endif()
0254 #