Warning, /DD4hep/examples/ClientTests/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 if(TARGET Boost::boost)
0029 SET(CT_BOOST_SOURCES src_boost/*.cpp)
0030 set(CT_BOOST_LIB Boost::boost)
0031 endif()
0032 #
0033 dd4hep_add_plugin(ClientTests
0034 SOURCES src/*.cpp ${CT_BOOST_SOURCES}
0035 USES DD4hep::DDCore DD4hep::DDCond DD4hep::DDAlign
0036 ROOT::Core ROOT::Geom ROOT::GenVector
0037 ${OPT_XERCESC} ${CT_BOOST_LIB}
0038 )
0039 #
0040 #-----------------------------------------------------------------------------------
0041 add_executable( multipleGeo main/MultipleGeometries.cpp )
0042 target_link_libraries(multipleGeo DD4hep::DDCore DD4hep::DDCond DD4hep::DDAlign)
0043 install(TARGETS multipleGeo RUNTIME DESTINATION bin)
0044 #-----------------------------------------------------------------------------------
0045 add_executable( testLoad main/Test_loadDetector.cpp )
0046 target_link_libraries(testLoad DD4hep::DDCore )
0047 install(TARGETS testLoad RUNTIME DESTINATION bin)
0048 #-----------------------------------------------------------------------------------
0049 #
0050 #
0051 set(ClientTestsEx_INSTALL ${CMAKE_INSTALL_PREFIX}/examples/ClientTests)
0052 dd4hep_install_dir( compact scripts ref eve DESTINATION ${ClientTestsEx_INSTALL} )
0053 #--------------------------------------------------------------------------
0054
0055 #--------------------------------------------------------------------------
0056 dd4hep_configure_scripts( ClientTests DEFAULT_SETUP WITH_TESTS)
0057 enable_testing ()
0058 include(CTest)
0059 #--- Testing ------------------------------------------------------------
0060 #
0061 # Test Component properties
0062 dd4hep_add_test_reg( ClientTests_property_test
0063 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0064 EXEC_ARGS geoPluginRun -plugin DD4hep_property_test
0065 REGEX_PASS "Test PASSED"
0066 REGEX_FAIL "Test FAILED"
0067 REGEX_FAIL "FAILED"
0068 )
0069 #
0070 # Test Volume scanner for CMS
0071 dd4hep_add_test_reg( ClientTests_volume_scanner
0072 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0073 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/MiniTel.xml
0074 -destroy -plugin DD4hep_PlacedVolumeScannerTest -detector /world
0075 REGEX_PASS "Visited a total of 51 placed volumes"
0076 REGEX_FAIL "Exception"
0077 REGEX_FAIL "FAILED"
0078 )
0079 #
0080 # Test namespaces for constants
0081 dd4hep_add_test_reg( ClientTests_namespace_constants
0082 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0083 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/NamespaceConstants.xml
0084 -destroy -plugin DD4hep_VolumeDump -plugin DD4hep_TestConstantsMultiplier
0085 REGEX_PASS "Constant: world_z = world::Z \\[number\\] -> world_z = 100"
0086 REGEX_FAIL "Exception"
0087 REGEX_FAIL "FAILED"
0088 )
0089 #
0090 # Test constant overlayed electric and magnetc field
0091 dd4hep_add_test_reg( ClientTests_constant_overlayed_field
0092 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0093 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/ConstantField.xml
0094 -destroy -plugin DD4hep_PrintField -points ${ClientTestsEx_INSTALL}/compact/ConstantField_points.xml
0095 REGEX_PASS "Position: 0.00 0.00 -50.00 .cm. electric field: 1.00e.03 1.00e.03 5.00e.03 .V/m. magnetic field: 0.00e.00 0.00e.00 2.00e.00 .tesla."
0096 REGEX_FAIL "Exception"
0097 REGEX_FAIL "FAILED"
0098 )
0099 #
0100 # Test JSON based parser
0101 dd4hep_add_test_reg( ClientTests_MiniTel_JSON_Dump
0102 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0103 EXEC_ARGS geoPluginRun -destroy -plugin DD4hep_JsonDumper
0104 ${ClientTestsEx_INSTALL}/compact/MiniTel.json
0105 REGEX_PASS "Successfully dumped json input"
0106 REGEX_FAIL "Exception"
0107 REGEX_FAIL "FAILED"
0108 )
0109 #
0110 # Test JSON based detector construction
0111 dd4hep_add_test_reg( ClientTests_MiniTel_JSON_Detector
0112 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0113 EXEC_ARGS geoPluginRun -volmgr -destroy -plugin DD4hep_XMLLoader
0114 file:${ClientTestsEx_INSTALL}/compact/MiniTel_json.xml
0115 REGEX_PASS "Successfully processed JSON input"
0116 REGEX_FAIL "Exception"
0117 REGEX_FAIL "FAILED"
0118 )
0119 #
0120 # Test JSON based detector construction
0121 dd4hep_add_test_reg( ClientTests_DumpMaterials
0122 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0123 EXEC_ARGS geoPluginRun
0124 -input file:${ClientTestsEx_INSTALL}/compact/MiniTel.xml
0125 -volmgr -destroy -plugin DD4hep_MaterialTable -type xml
0126 REGEX_PASS "material name=\"PEEK\""
0127 REGEX_FAIL "Exception"
0128 REGEX_FAIL "FAILED"
0129 )
0130 #
0131 # Test readout strings of the form: <id>system:8,barrel:-2</id>
0132 dd4hep_add_test_reg( ClientTests_MultipleGeometries
0133 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0134 EXEC_ARGS multipleGeo
0135 -compact file:${DD4hep_ROOT}/DDDetectors/compact/SiD.xml
0136 -compact file:${ClientTestsEx_INSTALL}/compact/MiniTel.xml
0137 -compact file:${ClientTestsEx_INSTALL}/compact/NestedDetectors.xml
0138 -no-interp
0139 REGEX_PASS "DELETE Geometry: .*/NestedDetectors.xml"
0140 REGEX_FAIL "Exception"
0141 REGEX_FAIL "FAILED"
0142 )
0143 #
0144 # Test readout strings of the form: <id>system:8,barrel:-2</id>
0145 dd4hep_add_test_reg( ClientTests_DumpElements
0146 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0147 EXEC_ARGS geoPluginRun
0148 -input file:${ClientTestsEx_INSTALL}/compact/MiniTel.xml
0149 -volmgr -destroy -plugin DD4hep_ElementTable -type xml
0150 REGEX_PASS "formula=\"Zr\" name=\"Zr\""
0151 REGEX_FAIL "Exception"
0152 REGEX_FAIL "FAILED"
0153 )
0154 #
0155 # Test long volume IDs Detector setups with placements of
0156 # identical volumes at different levels of the hierarchy
0157 dd4hep_add_test_reg( ClientTests_MultiPlace
0158 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0159 EXEC_ARGS geoPluginRun
0160 -input file:${ClientTestsEx_INSTALL}/compact/SiBarrelMultiSensitiveLongVolID.xml -volmgr -destroy
0161 -plugin DD4hep_DetectorCheck -name SiTrackerBarrel -geometry -structure -volmgr -sensitive
0162
0163 REGEX_PASS "Volume:component1_1 IDDesc:OK \\[S\\] vid:00200668000000ff system:00ff barrel:0000 layer:0001 module:0033 sensor:0001"
0164 REGEX_FAIL "FAILED: World transformation DIFFER"
0165 )
0166 #
0167 # Test long volume IDs exceeding 32 bit addressing of the form: <id>system:32,barrel:16:-5....</id>
0168 dd4hep_add_test_reg( ClientTests_Bitfield64_LongVoldID
0169 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0170 EXEC_ARGS geoPluginRun
0171 -input file:${ClientTestsEx_INSTALL}/compact/SiBarrelMultiSensitiveLongVolID.xml -volmgr -destroy
0172 -plugin DD4hep_DetectorCheck -name SiTrackerBarrel -geometry -structure -volmgr -sensitive
0173
0174 REGEX_PASS "Volume:component1_1 IDDesc:OK \\[S\\] vid:00200668000000ff system:00ff barrel:0000 layer:0001 module:0033 sensor:0001"
0175 REGEX_FAIL "FAILED: World transformation DIFFER"
0176 )
0177 #
0178 # Test readout strings of the form: <id>system:8,barrel:-2</id>
0179 dd4hep_add_test_reg( ClientTests_Bitfield64_BarrelSides
0180 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0181 EXEC_ARGS geoPluginRun
0182 -input file:${ClientTestsEx_INSTALL}/compact/Bitfield_SidesTest.xml -volmgr -destroy
0183 -plugin DD4hep_DetectorVolumeDump
0184 -plugin DD4hep_VolumeDump volids
0185 -plugin DD4hep_DetectorCheck -name all -geometry -structure -volmgr -sensitive
0186 REGEX_PASS "Volume:Shell_2 IDDesc:OK \\[S\\] vid:0000000000000102 system:0002 barrel:0001")
0187 #
0188 # Test readout strings of the form: <id>system:16,barrel:16:-5</id>
0189 dd4hep_add_test_reg( ClientTests_Bitfield64_BarrelSides2
0190 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0191 EXEC_ARGS geoPluginRun
0192 -input file:${ClientTestsEx_INSTALL}/compact/Bitfield_SidesTest2.xml -volmgr -destroy
0193 -plugin DD4hep_DetectorVolumeDump
0194 -plugin DD4hep_VolumeDump volids
0195 -plugin DD4hep_DetectorCheck -name all -geometry -structure -volmgr -sensitive
0196 REGEX_PASS "Volume:Shell_2 IDDesc:OK \\[S\\] vid:0000000000010002 system:0002 barrel:0001")
0197 #
0198 # Test handle casting procedures.
0199 dd4hep_add_test_reg( ClientTests_Check_Handle_Casts
0200 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0201 EXEC_ARGS geoPluginRun
0202 -volmgr -destroy -input file:${ClientTestsEx_INSTALL}/compact/Check_Handles.xml
0203 -plugin DD4hep_DetectorVolumeDump
0204 REGEX_PASS "| 164 casts PASSED 90 casts FAILED |")
0205 #
0206 # Test saving geometry to file
0207 dd4hep_add_test_reg( ClientTests_Save_ROOT_MiniTel_LONGTEST
0208 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0209 EXEC_ARGS geoPluginRun
0210 -volmgr -destroy -input file:${ClientTestsEx_INSTALL}/compact/MiniTel.xml
0211 -plugin DD4hep_Geometry2ROOT -output MiniTel_geometry.root
0212 REGEX_PASS "\\+\\+\\+ Successfully saved geometry data to file.")
0213 #
0214 # Test basic shapes by comparing mesh vertices with reference file
0215 set(ClientTests_ShapeTests)
0216 list(APPEND ClientTests_ShapeTests Box Cone ConeSegment Tube ElTube CutTube Hyperboloid Paraboloid)
0217 list(APPEND ClientTests_ShapeTests EightPointSolid Eightpoint_Reflect_Volume Eightpoint_Reflect_DetElement)
0218 list(APPEND ClientTests_ShapeTests Polycone Polyhedra Sphere Torus Trap Trd1 Trd2)
0219 list(APPEND ClientTests_ShapeTests TruncatedTube ExtrudedPolygon)
0220
0221 IF(NOT DD4HEP_USE_GEANT4_UNITS AND ROOT_VERSION VERSION_GREATER_EQUAL 6.35.01 AND NOT ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
0222 # pseudoTrap tests fail on aarch64 because of a different mesh
0223 list(APPEND ClientTests_ShapeTests PseudoTrap PseudoTrap1 PseudoTrap2)
0224 ENDIF()
0225 #
0226 #
0227 if( ${ROOT_VERSION} VERSION_GREATER 6.21.00 )
0228 # message(STATUS "++ ROOT version: ${ROOT_VERSION} ... adding tests...")
0229 list(APPEND ClientTests_ShapeTests Tessellated)
0230 else()
0231 message(STATUS "++ ROOT version: ${ROOT_VERSION} ... NO version specific tests for ROOT>6.21...")
0232 endif()
0233 #
0234 if (DD4HEP_USE_GEANT4)
0235 if( ${Geant4_VERSION} VERSION_GREATER 10.2.99 )
0236 # message(STATUS "++ Geant4 version: ${Geant4_VERSION} ... adding tests...")
0237 list(APPEND ClientTests_ShapeTests Scaled_Cone)
0238 else()
0239 message(STATUS "++ Geant4 version: ${Geant4_VERSION} ... NO version specific tests for G4>=10.3...")
0240 endif()
0241 endif()
0242 #
0243 foreach (test ${ClientTests_ShapeTests})
0244 dd4hep_add_test_reg( ClientTests_Check_Shape_${test}
0245 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0246 EXEC_ARGS geoDisplay file:${ClientTestsEx_INSTALL}/compact/Check_Shape_${test}.xml -load -destroy
0247 REGEX_PASS "Shape verification SUCCESSFUL"
0248 REGEX_FAIL "ERROR;FAILED" )
0249 endforeach()
0250 #
0251 # Test Volume division procedure.
0252 dd4hep_add_test_reg( ClientTests_Check_VolumeDivisionTest
0253 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0254 EXEC_ARGS geoPluginRun
0255 -destroy -input file:${ClientTestsEx_INSTALL}/compact/VolumeDivisionTest.xml
0256 -plugin DD4hep_VolumeDump
0257 REGEX_PASS "Checked 8 physical volume placements")
0258 #
0259 # Test Setting temperature and pressure to material
0260 dd4hep_add_test_reg( ClientTests_Check_Temp_Pressure_Air
0261 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0262 EXEC_ARGS geoPluginRun
0263 -destroy -input file:${ClientTestsEx_INSTALL}/compact/Check_Air.xml
0264 -plugin DD4hep_MaterialTable -name Vacuum
0265 REGEX_PASS "Temp=111 \\[Kelvin\\] Pressure=1e-12 \\[hPa\\] state=Undefined"
0266 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error;FATAL" )
0267 #
0268 # Test Setting temperature and pressure to material
0269 dd4hep_add_test_reg( ClientTests_Check_Temp_Pressure_Air_NTP
0270 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0271 EXEC_ARGS geoPluginRun
0272 -destroy -input file:${ClientTestsEx_INSTALL}/compact/Check_Air_NTP.xml
0273 -plugin DD4hep_MaterialTable -name Vacuum
0274 REGEX_PASS "Temp=293 \\[Kelvin\\] Pressure=1013.2 \\[hPa\\] state=Undefined"
0275 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error;FATAL" )
0276 #
0277 # Test Setting temperature and pressure to material
0278 dd4hep_add_test_reg( ClientTests_Check_Temp_Pressure_Air_STP
0279 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0280 EXEC_ARGS geoPluginRun
0281 -destroy -input file:${ClientTestsEx_INSTALL}/compact/Check_Air_STP.xml
0282 -plugin DD4hep_MaterialTable -name Vacuum
0283 REGEX_PASS "Temp=273 \\[Kelvin\\] Pressure=1000 \\[hPa\\] state=Undefined"
0284 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error;FATAL" )
0285 #
0286 # Test reflection matrices
0287 dd4hep_add_test_reg( ClientTests_Check_reflection_matrices
0288 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0289 EXEC_ARGS geoDisplay
0290 -input file:${ClientTestsEx_INSTALL}/compact/ReflectionMatrices.xml
0291 -load -destroy -print WARNING
0292 REGEX_PASS "Analysed 7 right handed and 10 left handed matrices"
0293 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error;FATAL" )
0294 #
0295 # Test DetectorCheck plugin
0296 dd4hep_add_test_reg( ClientTests_DetectorCheck_plugin
0297 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0298 EXEC_ARGS geoPluginRun
0299 -input file:${ClientTestsEx_INSTALL}/compact/IllDetector.xml
0300 -volmgr -plugin DD4hep_DetectorCheck -name world -structure -geometry -sensitive -volmgr
0301 REGEX_PASS "FAILED: Checked a total of 110 elements. Num.Errors: 77"
0302 REGEX_FAIL "Exception;EXCEPTION;FATAL" )
0303 #
0304 # only if root version > 6.19: MaterialTester
0305 #
0306 foreach (test Assemblies BoxTrafos CaloEndcapReflection IronCylinder LheD_tracker MagnetFields
0307 MiniTel SectorBarrelCalorimeter SiliconBlock NestedSimple NestedDetectors
0308 ParamVolume1D ParamVolume2D ParamVolume3D
0309 MultiCollections MultiSegmentations )
0310
0311 # Test materials in volumes. Test here the proper access to the materials from the volumes,
0312 # which was broken at some point.
0313 dd4hep_add_test_reg( ClientTests_volume_materials_${test}
0314 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0315 EXEC_ARGS geoPluginRun -print WARNING -volmgr -destroy
0316 -input file:${ClientTestsEx_INSTALL}/compact/${test}.xml
0317 -plugin DD4hep_VolumeDump -materials
0318 REGEX_PASS "\\+\\+\\+ Checked [1-9][0-9]* materials in volume placements. 0 are BAD." )
0319
0320 # Test format conversions
0321 ##dd4hep_add_test_reg( ClientTests_converter_gdml_${test}
0322 ## COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0323 ## EXEC_ARGS geoConverter -compact2gdml
0324 ## -input file:${ClientTestsEx_INSTALL}/compact/${test}.xml
0325 ## -output file:${test}.gdml
0326 ## REGEX_PASS " Successfully extracted GDML to" )
0327 foreach( type vis )
0328 dd4hep_add_test_reg( ClientTests_converter_${type}_${test}
0329 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0330 EXEC_ARGS geoConverter -compact2${type}
0331 -input file:${ClientTestsEx_INSTALL}/compact/${test}.xml
0332 -output file:${test}.${type}
0333 REGEX_PASS " Handled [1-9][0-9]* volumes" )
0334 endforeach(type)
0335 endforeach()
0336 #
0337 #
0338 # Note:
0339 # IronCylinder has no segmentation!
0340 # MaterialTester no geometry
0341 # SectorBarrelCalorimeter is bad
0342 foreach (test Assemblies BoxTrafos CaloEndcapReflection
0343 LheD_tracker MagnetFields MiniTel SiliconBlock
0344 ParamVolume1D ParamVolume2D ParamVolume3D
0345 NestedSimple NestedDetectors MultiCollections )
0346 #
0347 # Test material scans in [origine to 10 meters in y]
0348 dd4hep_add_test_reg( ClientTests_material_scan_${test}
0349 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0350 EXEC_ARGS materialScan file:${ClientTestsEx_INSTALL}/compact/${test}.xml 0 0 0 0 10000 0
0351 REGEX_PASS " Average Material " )
0352 #
0353 # Geant4 material scan. From position=0,0,0 to end-of-world
0354 if (DD4HEP_USE_GEANT4)
0355 dd4hep_add_test_reg( ClientTests_sim_geant4_g4material_scan_${test}_LONGTEST
0356 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0357 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/bin/g4MaterialScan
0358 --compact=file:${ClientTestsEx_INSTALL}/compact/${test}.xml
0359 "--position=0,0,0" "--direction=0,1,0"
0360 REGEX_PASS " Terminate Geant4 and delete associated actions." )
0361 endif(DD4HEP_USE_GEANT4)
0362 endforeach()
0363 #
0364 #
0365 #
0366 foreach (test BoxTrafos CaloEndcapReflection IronCylinder MiniTel SiliconBlock NestedSimple MultiCollections )
0367 #
0368 # Read data from XML file. Then parse the pure XML string.
0369 dd4hep_add_test_reg( ClientTests_parse_xml_string_${test}
0370 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0371 EXEC_ARGS geoPluginRun -destroy -print WARNING
0372 -plugin DD4hep_XML_InMemory -input ${ClientTestsEx_INSTALL}/compact/${test}.xml
0373 -plugin DD4hep_VolumeDump -materials
0374 REGEX_PASS "\\+\\+\\+ Checked [1-9][0-9]* materials in volume placements. 0 are BAD." )
0375 #
0376 # ROOT Geometry checks
0377 dd4hep_add_test_reg( ClientTests_check_geometry_${test}_LONGTEST
0378 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0379 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/bin/checkGeometry
0380 --compact=file:${ClientTestsEx_INSTALL}/compact/${test}.xml
0381 --full=true --ntracks=10
0382 REGEX_PASS " Execution finished..." )
0383 #
0384 # ROOT Geometry overlap checks
0385 dd4hep_add_test_reg( ClientTests_check_overlaps_${test}_LONGTEST
0386 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0387 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/bin/checkOverlaps
0388 --compact=file:${ClientTestsEx_INSTALL}/compact/${test}.xml
0389 --tolerance=0.1
0390 REGEX_PASS " Execution finished..." )
0391 endforeach()
0392 #
0393 #
0394 # Test Minitel for missing DetElement placements
0395 dd4hep_add_test_reg( MiniTel_check_missing_placements
0396 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0397 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/MiniTel_err_place.xml
0398 -plugin DD4hep_DetectorDump --volids --shapes --materials --positions
0399 REGEX_PASS "ERROR 004 /MyLHCBdetector1/side_0/module_9 DetElement with INVALID PLACEMENT"
0400 REGEX_FAIL "Exception;EXCEPTION"
0401 )
0402 #
0403 # Checksum test of the Minitel3 sub-detector
0404 dd4hep_add_test_reg( MiniTel_check_checksum_Minitel3
0405 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0406 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/MiniTelGenerate.xml
0407 -plugin DD4hepDetectorChecksum -readout -detector Minitel3
0408 REGEX_PASS "Combined hash code 5373250faed5e515 \\(54 sub-codes\\)"
0409 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0410 )
0411 #
0412 # Checksum test of the full detector
0413 dd4hep_add_test_reg( MiniTel_check_checksum_full
0414 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0415 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/MiniTelGenerate.xml
0416 -plugin DD4hepDetectorChecksum -readout
0417 REGEX_PASS "Combined hash code e0b451e964100859 \\(207 sub-codes\\)"
0418 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0419 )
0420 #
0421 # Checksum test of a tessellated solid (default, without meshes)
0422 dd4hep_add_test_reg( Check_Shape_Tessellated_check_checksum
0423 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0424 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/Check_Shape_Tessellated.xml
0425 -plugin DD4hepDetectorChecksum
0426 REGEX_PASS "Combined hash code 716a174589b62a5c \\(13 sub-codes\\)"
0427 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0428 )
0429 #
0430 # Checksum test of a tessellated solid (with meshes)
0431 dd4hep_add_test_reg( Check_Shape_Tessellated_check_checksum_with_meshes
0432 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0433 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/Check_Shape_Tessellated.xml
0434 -plugin DD4hepDetectorChecksum -meshes -precision 3
0435 REGEX_PASS "Combined hash code 8372633493ec703a \\(13 sub-codes\\)"
0436 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0437 )
0438 #
0439 # Test the sequential processing of two xml files
0440 dd4hep_add_test_reg( minitel_config_plugins_include_command_line
0441 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0442 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/MiniTel.xml
0443 -input ${ClientTestsEx_INSTALL}/compact/ExamplePlugins.xml
0444 REGEX_PASS "\\+\\+\\+ Tested 5 numeric constants for expression evaluation"
0445 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0446 )
0447 #
0448 # Test the sequential processing of two xml files
0449 dd4hep_add_test_reg( minitel_config_plugins_include_command_xml
0450 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0451 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/IncludePlugins.xml
0452 REGEX_PASS "Tested 5 numeric constants for expression evaluation"
0453 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0454 )
0455 #
0456 # Test setting properties to the world volume and a single sub-detector
0457 dd4hep_add_test_reg( minitel_config_world_volume
0458 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0459 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/WorldSettings.xml
0460 REGEX_PASS "\\+\\+ Applied 5 settings to MyLHCBdetector5"
0461 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0462 )
0463 #
0464 # Test creation of the world volume with user specified material
0465 dd4hep_add_test_reg( minitel_config_world_material
0466 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0467 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/WorldMaterial.xml -print INFO -destroy -load
0468 REGEX_PASS "\\+\\+ Created world volume 'world_volume' as TGeoBBox \\(50.00, 50.00 50.00 \\[cm\\]\\) material:Steel235"
0469 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0470 )
0471 #
0472 # Test setting properties to the world volume and a single sub-detector
0473 dd4hep_add_test_reg( minitel_config_world
0474 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0475 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/WorldSettings.xml
0476 REGEX_PASS "\\+\\+ Applied 3 settings to /world"
0477 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0478 )
0479 #
0480 # Test setting build type to BUILD_DISPLAY rather than the default BUILD_DEFAULT/BUILD_SIMU
0481 dd4hep_add_test_reg( box_shape_build_type
0482 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0483 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/Check_Shape_Box.xml -build_type BUILD_DISPLAY
0484 -print DEBUG -destroy -load
0485 REGEX_PASS "\\+\\+\\+ Create shape: Shape_Box build type is: BUILD_DISPLAY"
0486 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0487 )
0488 #
0489 # Test interrupt handling in the middle of the geometry construction
0490 dd4hep_add_test_reg( ClientTests_interrupt_geometry_construction
0491 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0492 EXEC_ARGS geoDisplay -compact ${ClientTestsEx_INSTALL}/compact/InterruptTrigger.xml
0493 -load -print INFO
0494 REGEX_PASS "\\+\\+\\+ Caught signal: 2 context: 0xfeedbabe. exit process."
0495 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0496 )
0497 #
0498 # Test if multiple Detector::Header structure are be parsed, which is not allowed,
0499 # since it results in data inconsistencies and memory leaks.
0500 dd4hep_add_test_reg( ClientTests_check_for_multiple_headers
0501 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0502 EXEC_ARGS geoDisplay -compact ${ClientTestsEx_INSTALL}/compact/Test_2ndHeader.xml
0503 -load -print INFO
0504 REGEX_PASS "INFO \\+\\+ Overwriting/updating Header structure is dangerous. Try to avoid this."
0505 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0506 )
0507 #
0508 # EXEC_ARGS test_with_root.sh ${script}
0509 #
0510 if (DD4HEP_USE_GEANT4)
0511 #
0512 # Test Setting temperature and pressure to material
0513 dd4hep_add_test_reg( ClientTests_sim_geant4_Check_Temp_Pressure_Air
0514 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0515 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/Check_Air.py
0516 -geometry ${ClientTestsEx_INSTALL}/compact/Check_Air.xml batch
0517 REGEX_PASS "Imean: 85.538 eV temperature: 333.33 K pressure: 2.22 atm"
0518 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error;FATAL" )
0519 #
0520 # Geant4 test with gdml input file (LHCb:FT)
0521 dd4hep_add_test_reg( ClientTests_sim_geant4_gdml_detector
0522 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0523 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/bin/g4GeometryScan
0524 --compact=${ClientTestsEx_INSTALL}/compact/GdmlDetector.xml
0525 --position=200,200,-2000 --direction=0,0,1
0526 REGEX_PASS " 122 2777.0000 5200.000 "
0527 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error;FATAL" )
0528 #
0529 # Geant4 test with gdml input file (LHCb:MT)
0530 dd4hep_add_test_reg( ClientTests_sim_geant4_gdml_MT
0531 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0532 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/bin/g4GeometryScan
0533 --compact=${ClientTestsEx_INSTALL}/compact/MT.xml
0534 --position=200,200,7900 --direction=0,0,1
0535 REGEX_PASS " 15 2777.0000 4210.000 "
0536 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error;FATAL" )
0537 #
0538 # Geant4 test if production cuts are processed
0539 dd4hep_add_test_reg( ClientTests_sim_geant4_MiniTel_prod_cuts
0540 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0541 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/MiniTelRegions.py batch
0542 REGEX_PASS "minitel_region_1: Set cut \\[gamma/0\\] = 5.000"
0543 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" )
0544 #
0545 # Geant4 test if production cuts are processed
0546 dd4hep_add_test_reg( ClientTests_sim_geant4_MiniTel_limitset
0547 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0548 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/MiniTelRegions.py batch
0549 REGEX_PASS "LimitSet: Particle type: mu- PDG: 13 : 3.000000"
0550 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" )
0551 #
0552 # Test of an example user analysis creating an N-tuple instead of an output file with events
0553 # Note: Exception: *** G4Exception : PART5107
0554 # issued by : G4IonTable::FindIon()
0555 # Isomer level 9 may be ambiguous.
0556 # *** This is just a warning message. ***
0557 # This is NOT an error!
0558 dd4hep_add_test_reg( ClientTests_sim_geant4_UserAnalysis
0559 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0560 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/MiniTelEnergyDeposits.py batch
0561 REGEX_PASS "Entries : 200 "
0562 REGEX_FAIL "EXCEPTION;ERROR;Error" )
0563 #
0564 # Test of an example user analysis creating an N-tuple instead of an output file with events
0565 dd4hep_add_test_reg( ClientTests_sim_geant4_TrackingRegion
0566 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0567 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/TrackingRegion.py batch
0568 REGEX_PASS "Placement tracking_volume_1 not converted \\[Veto'ed for simulation\\]"
0569 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" )
0570 #
0571 # Geant4 full simulation checks of simple detectors
0572 foreach(script Assemblies LheD_tracker MiniTel MiniTel_hepmc NestedDetectors )
0573 dd4hep_add_test_reg( ClientTests_sim_geant4_${script}
0574 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0575 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/${script}.py -batch
0576 REGEX_PASS NONE
0577 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" )
0578 endforeach(script)
0579 #
0580 # Geant4 full simulation checks of multi-collection/segmentation detectors
0581 foreach(script MultiCollections MultiSegmentations MultiSegmentCollections )
0582 dd4hep_add_test_reg( ClientTests_sim_geant4_${script}
0583 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0584 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/MultiCollections.py
0585 -compact ${ClientTestsEx_INSTALL}/compact/${script}.xml -batch
0586 REGEX_PASS NONE
0587 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" )
0588 endforeach(script)
0589 #
0590 # Test setting properties to a single sub-detector
0591 dd4hep_add_test_reg( ClientTests_sim_geant4_minitel_config_region_subdet
0592 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0593 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/MiniTel.py
0594 -batch -debug -events 1 -geometry /examples/ClientTests/compact/WorldSettings.xml
0595 REGEX_PASS "\\+ Apply REGION settings: minitel_region_5 to volume MyLHCBdetector5."
0596 REGEX_FAIL "EXCEPTION; Exception;ERROR"
0597 )
0598 #
0599 # Test setting properties to the world volume
0600 dd4hep_add_test_reg( ClientTests_sim_geant4_minitel_config_region_world
0601 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0602 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/MiniTel.py
0603 -batch -debug -events 1 -geometry /examples/ClientTests/compact/WorldSettings.xml
0604 REGEX_PASS "Volume world_volume Region: DefaultRegionForTheWorld. Apply user limits from world_region"
0605 REGEX_FAIL "EXCEPTION; Exception;ERROR"
0606 )
0607 #
0608 # Test specialized configurable G4PhysicsConstructor:
0609 dd4hep_add_test_reg( ClientTests_sim_geant4_minitel_step_limiter
0610 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0611 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/MiniTel_steplimiter.py
0612 -batch -debug -events 1
0613 REGEX_PASS "Registered Geant4 physics constructor G4StepLimiterPhysics to modular physics list id:0"
0614 REGEX_FAIL "EXCEPTION; Exception;ERROR"
0615 )
0616 #
0617 # Test importing a geometry from ROOT and placing DetElements
0618 dd4hep_add_test_reg( ClientTests_import_geo_place_det_elements
0619 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0620 EXEC_ARGS geoPluginRun -destroy -input ${ClientTestsEx_INSTALL}/compact/lhcbfull_plugins.xml
0621 WORKING_DIRECTORY ${ClientTestsEx_INSTALL}/compact
0622 REGEX_PASS "PASSED Checked 216249 VolumeManager contexts. Num.Errors: 0"
0623 REGEX_FAIL "EXCEPTION;Exception"
0624 )
0625 #
0626 if(Geant4_VERSION VERSION_LESS 10.7)
0627 dd4hep_print("|++> Geant4 fast simulation not supported for Geant4 ${Geant4_VERSION}")
0628 else()
0629 # Geant4 full simulation checks of multi-collection/segmentation detectors
0630 dd4hep_print("|++> Geant4 fast simulation tests enabled for Geant4 ${Geant4_VERSION}")
0631 foreach(script SiliconBlockGFlash SiliconBlockFastSim)
0632 dd4hep_add_test_reg( ClientTests_sim_geant4_${script}_LONGTEST
0633 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0634 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/${script}.py -batch -events 2
0635 -geometry ${ClientTestsEx_INSTALL}/compact/SiliconBlock.xml -batch -events 2
0636 REGEX_PASS "Event 1 Begin event action. Access event related information"
0637 REGEX_FAIL "EXCEPTION; Exception;ERROR;Error" )
0638 endforeach(script)
0639 endif()
0640 #
0641 foreach(script ParamVolume1D ParamVolume2D ParamVolume3D)
0642 dd4hep_add_test_reg( ClientTests_sim_geant4_${script}_LONGTEST
0643 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0644 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/ParamVolume.py
0645 -geometry ${script}.xml -batch -events 2
0646 REGEX_PASS "Event 1 Begin event action. Access event related information"
0647 REGEX_FAIL "EXCEPTION; Exception;ERROR;Error" )
0648 endforeach(script)
0649 #
0650 #
0651 # Test EDM4HEP output module
0652 if (DD4HEP_USE_EDM4HEP)
0653 # Test EDM4HEP write (needs to be expanded)
0654 dd4hep_add_test_reg(ClientTests_sim_geant4_MinitTel_edm4hep_write
0655 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0656 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/MiniTelGenerate.py
0657 -batch -events 5 -output MiniTel_ddg4_edm4hep.edm4hep.root
0658 REGEX_PASS "\\+\\+\\+ Finished run 0 after 5 events \\(5 events in total\\)"
0659 REGEX_FAIL "Error;ERROR; Exception"
0660 )
0661 endif()
0662 #
0663 # Test Geant4VolumeManager resource usage
0664 dd4hep_add_test_reg(ClientTests_sim_g4_setup_BoxOfStraws_sensitive
0665 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0666 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/BoxOfStraws.py
0667 -print_level 3 -sensitive
0668 REGEX_PASS "ResourcesAfterConstruction ConstructSD: VmRSS"
0669 REGEX_FAIL "Error;ERROR; Exception"
0670 )
0671 #
0672 # Test without Geant4VolumeManager, but sensitive detector assignment using regex
0673 dd4hep_add_test_reg(ClientTests_sim_geant4_setup_BoxOfStraws_non_sensitive
0674 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0675 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/BoxOfStraws.py
0676 -print_level 3
0677 REGEX_PASS "ResourcesAfterConstruction ConstructSD: VmRSS"
0678 REGEX_FAIL "Error;ERROR; Exception"
0679 )
0680 #
0681 #
0682 dd4hep_add_test_reg(ClientTests_sim_geant4_ddsim_setup_BoxOfStraws
0683 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0684 EXEC_ARGS ddsim
0685 --steeringFile ${ClientTestsEx_INSTALL}/scripts/BoxOfStraws_DDSim.py
0686 --compactFile ${ClientTestsEx_INSTALL}/compact/BoxOfStraws.xml
0687 --enableGun
0688 --numberOfEvents 5
0689 --outputFile regex.slcio
0690 REGEX_PASS "BoxOfStrawsDet Handled 1 nodes with 1 sensitive volume type"
0691 REGEX_FAIL "Error;ERROR; Exception"
0692 )
0693 #
0694 # Test Changing Geant4 voxelization
0695 dd4hep_add_test_reg( ClientTests_sim_geant4_change_voxelization
0696 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0697 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/DriftChamber.py
0698 -verbose 2 -events 1
0699 REGEX_PASS "[0-9.]* 0... 0... 0k DriftChamber_vol"
0700 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error;FATAL"
0701 )
0702 #
0703 # Test if calling innerMaterial before outerMaterial changes the result
0704 add_test(NAME ClientTests_inner_outer_material
0705 COMMAND bash -c "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/call_inner_outer_material.py &&
0706 ${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/call_inner_outer_material.py --call-inner-material &&
0707 diff surfaces_bad.txt surfaces_good.txt"
0708 )
0709 endif(DD4HEP_USE_GEANT4)