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