Warning, /DD4hep/examples/Persistency/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 if(TARGET XercesC::XercesC)
0024 SET(OPT_XERCESC XercesC::XercesC)
0025 endif()
0026
0027 #-----------------------------------------------------------------------------------
0028 dd4hep_add_plugin(PersistencyExample SOURCES src/*.cpp
0029 USES DD4hep::DDCore ROOT::Core ROOT::Geom ROOT::GenVector ${OPT_XERCESC}
0030 )
0031 install(TARGETS PersistencyExample LIBRARY DESTINATION lib)
0032 dd4hep_configure_scripts (Persistency DEFAULT_SETUP WITH_TESTS )
0033 #--------------------------------------------------------------------------
0034 #
0035 # Test saving conditions to ROOT file
0036 dd4hep_add_test_reg( Persist_Conditions_Save
0037 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0038 EXEC_ARGS geoPluginRun
0039 -plugin DD4hep_PersistencyExample_write_cond -output Conditions.root
0040 REGEX_PASS "\\+\\+\\+ PASSED Wrote 14 conditions to file."
0041 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;WriteObjectAny"
0042 )
0043 #
0044 # Test restoring geometry from ROOT file: Volume Manager
0045 dd4hep_add_test_reg( Persist_Conditions_Restore
0046 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0047 EXEC_ARGS geoPluginRun
0048 -plugin DD4hep_PersistencyExample_read_cond -input Conditions.root
0049 DEPENDS Persist_Conditions_Save
0050 REGEX_PASS "\\+\\+\\+ Read successfully 14 conditions. Result=172"
0051 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0052 )
0053 #
0054 # Test saving geometry to ROOT file
0055 dd4hep_add_test_reg( Persist_MiniTel_Save_LONGTEST
0056 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0057 EXEC_ARGS geoPluginRun
0058 -volmgr -destroy -input file:${CMAKE_CURRENT_SOURCE_DIR}/../ClientTests/compact/MiniTel.xml
0059 -plugin DD4hep_Geometry2ROOT -output MiniTel_geometry.root
0060 REGEX_PASS "\\+\\+\\+ Successfully saved geometry data to file."
0061 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;WriteObjectAny"
0062 )
0063 #
0064 # Test restoring geometry from ROOT file: Volume Manager
0065 dd4hep_add_test_reg( Persist_MiniTel_Restore_LONGTEST
0066 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0067 EXEC_ARGS geoPluginRun -print WARNING
0068 -plugin DD4hep_RootLoader MiniTel_geometry.root
0069 DEPENDS Persist_MiniTel_Save_LONGTEST
0070 REGEX_PASS "\\+\\+\\+ Successfully loaded detector description from file"
0071 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0072 )
0073 #
0074 # Test restoring geometry from ROOT file: Volume Manager loading+nominals
0075 dd4hep_add_test_reg( Persist_MiniTel_Restore_VolMgr1_LONGTEST
0076 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0077 EXEC_ARGS geoPluginRun -print WARNING
0078 -plugin DD4hep_RootLoader MiniTel_geometry.root
0079 -plugin DD4hep_CheckVolumeManager
0080 DEPENDS Persist_MiniTel_Save_LONGTEST
0081 REGEX_PASS "\\+\\+\\+ PASSED Checked 40 VolumeManager contexts. Num.Errors: 0"
0082 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0083 )
0084 #
0085 # Test restoring geometry from ROOT file: DetElement nominal alignments
0086 dd4hep_add_test_reg( Persist_MiniTel_Restore_Nominal_LONGTEST
0087 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0088 EXEC_ARGS geoPluginRun -print WARNING
0089 -plugin DD4hep_RootLoader MiniTel_geometry.root
0090 -plugin DD4hep_CheckNominals
0091 DEPENDS Persist_MiniTel_Save_LONGTEST
0092 REGEX_PASS "\\+\\+\\+ PASSED Checked 20 DetElements. Num.Errors: 0"
0093 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0094 )
0095 #
0096 # Test restoring geometry from ROOT file: Sensitive detectors
0097 dd4hep_add_test_reg( Persist_MiniTel_Restore_Sensitives_LONGTEST
0098 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0099 EXEC_ARGS geoPluginRun -print WARNING
0100 -plugin DD4hep_RootLoader MiniTel_geometry.root
0101 -plugin DD4hep_CheckSensitives
0102 DEPENDS Persist_MiniTel_Save_LONGTEST
0103 REGEX_PASS "\\+\\+\\+ PASSED Checked 10 SensitiveDetector objects. Num.Errors: 0"
0104 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0105 )
0106 #
0107 # Test restoring geometry from ROOT file: Readout segmentations
0108 dd4hep_add_test_reg( Persist_MiniTel_Restore_Segmentations_LONGTEST
0109 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0110 EXEC_ARGS geoPluginRun -print WARNING
0111 -plugin DD4hep_RootLoader MiniTel_geometry.root
0112 -plugin DD4hep_CheckSegmentations
0113 DEPENDS Persist_MiniTel_Save_LONGTEST
0114 REGEX_PASS "\\+\\+\\+ PASSED Checked 10 readout segmentations. Num.Errors: 0"
0115 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0116 )
0117 #
0118 # Test restoring geometry from ROOT file: Readout structures
0119 dd4hep_add_test_reg( Persist_MiniTel_Restore_Readouts_LONGTEST
0120 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0121 EXEC_ARGS geoPluginRun -print WARNING
0122 -plugin DD4hep_RootLoader MiniTel_geometry.root
0123 -plugin DD4hep_CheckReadouts
0124 DEPENDS Persist_MiniTel_Save_LONGTEST
0125 REGEX_PASS "\\+\\+\\+ PASSED Checked 10 readout objects. Num.Errors: 0"
0126 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0127 )
0128 #
0129 # Test saving geometry to ROOT file
0130 dd4hep_add_test_reg( Persist_CLICSiD_Save_LONGTEST
0131 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0132 EXEC_ARGS geoPluginRun
0133 -volmgr -destroy -input file:${DD4hep_ROOT}/DDDetectors/compact/SiD.xml
0134 -plugin DD4hep_Geometry2ROOT -output CLICSiD_geometry.root
0135 REGEX_PASS "\\+\\+\\+ Successfully saved geometry data to file."
0136 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;WriteObjectAny"
0137 )
0138 #
0139 # Test restoring geometry from ROOT file: Volume Manager
0140 dd4hep_add_test_reg( Persist_CLICSiD_Restore_LONGTEST
0141 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0142 EXEC_ARGS geoPluginRun -print WARNING
0143 -plugin DD4hep_RootLoader CLICSiD_geometry.root
0144 DEPENDS Persist_CLICSiD_Save_LONGTEST
0145 REGEX_PASS "\\+\\+\\+ Successfully loaded detector description from file"
0146 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0147 )
0148 #
0149 # Test restoring geometry from ROOT file: Volume Manager loading+nominals
0150 # Note: BeamCal has a problem. Need to be taken into account
0151 dd4hep_add_test_reg( Persist_CLICSiD_Restore_VolMgr1_LONGTEST
0152 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0153 EXEC_ARGS geoPluginRun -print WARNING
0154 -plugin DD4hep_RootLoader CLICSiD_geometry.root
0155 -plugin DD4hep_CheckVolumeManager
0156 DEPENDS Persist_CLICSiD_Save_LONGTEST
0157 REGEX_PASS "\\+\\+\\+ PASSED Checked 29366 VolumeManager contexts. Num.Errors: 0"
0158 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0159 )
0160 #
0161 # Test restoring geometry from ROOT file: Test Volume Manager results
0162 dd4hep_add_test_reg( Persist_CLICSiD_Restore_DetCheck_LONGTEST
0163 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0164 EXEC_ARGS geoPluginRun -print WARNING
0165 -plugin DD4hep_RootLoader CLICSiD_geometry.root
0166 -plugin DD4hep_DetectorCheck -name SiTrackerBarrel -geometry -structure -volmgr -sensitive
0167 DEPENDS Persist_CLICSiD_Save_LONGTEST
0168 REGEX_PASS "\\+\\+\\+ PASSED: Checked a total of 195137 elements. Num.Errors: 0"
0169 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0170 )
0171 #
0172 # Test restoring geometry from ROOT file: DetElement nominal alignments
0173 # Note: BeamCal has a problem. Need to be taken into account
0174 dd4hep_add_test_reg( Persist_CLICSiD_Restore_Nominal_LONGTEST
0175 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0176 EXEC_ARGS geoPluginRun -print WARNING
0177 -plugin DD4hep_RootLoader CLICSiD_geometry.root
0178 -plugin DD4hep_CheckNominals
0179 DEPENDS Persist_CLICSiD_Save_LONGTEST
0180 REGEX_PASS "\\+\\+\\+ PASSED Checked 16044 DetElements. Num.Errors: 0"
0181 REGEX_FAIL "EXCEPTION;Exception;TStreamerInfo"
0182 )
0183 #
0184 # Test restoring geometry from ROOT file: Sensitive detectors
0185 dd4hep_add_test_reg( Persist_CLICSiD_Restore_Sensitives_LONGTEST
0186 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0187 EXEC_ARGS geoPluginRun -print WARNING
0188 -plugin DD4hep_RootLoader CLICSiD_geometry.root
0189 -plugin DD4hep_CheckSensitives
0190 DEPENDS Persist_CLICSiD_Save_LONGTEST
0191 REGEX_PASS "\\+\\+\\+ PASSED Checked 14 SensitiveDetector objects. Num.Errors: 0"
0192 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0193 )
0194 #
0195 # Test restoring geometry from ROOT file: Readout segmentations
0196 dd4hep_add_test_reg( Persist_CLICSiD_Restore_Segmentations_LONGTEST
0197 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0198 EXEC_ARGS geoPluginRun -print WARNING
0199 -plugin DD4hep_RootLoader CLICSiD_geometry.root
0200 -plugin DD4hep_CheckSegmentations
0201 DEPENDS Persist_CLICSiD_Save_LONGTEST
0202 REGEX_PASS "\\+\\+\\+ PASSED Checked 9 readout segmentations. Num.Errors: 0"
0203 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0204 )
0205 #
0206 # Test restoring geometry from ROOT file: Readout structures
0207 dd4hep_add_test_reg( Persist_CLICSiD_Restore_Readouts_LONGTEST
0208 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0209 EXEC_ARGS geoPluginRun -print WARNING
0210 -plugin DD4hep_RootLoader CLICSiD_geometry.root
0211 -plugin DD4hep_CheckReadouts
0212 DEPENDS Persist_CLICSiD_Save_LONGTEST
0213 REGEX_PASS "\\+\\+\\+ PASSED Checked 14 readout objects. Num.Errors: 0"
0214 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0215 )
0216 #
0217 if (DD4HEP_USE_GEANT4)
0218 #
0219 #
0220 # Test restoring geometry from ROOT file and start Geant4
0221 dd4hep_add_test_reg( Persist_CLICSiD_Geant4_LONGTEST
0222 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_Persistency.sh"
0223 EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../CLICSiD/scripts/CLICSiD_LoadROOTGeo.py batch
0224 DEPENDS Persist_CLICSiD_Save_LONGTEST
0225 REGEX_PASS "\\+\\+\\+ Finished run 0 after 10 events \\(10 events in total\\)"
0226 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0227 )
0228 endif()