Back to home page

EIC code displayed by LXR

 
 

    


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