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 PseudoTrap PseudoTrap1 PseudoTrap2 Sphere Torus Trap Trd1 Trd2)
0207 list(APPEND ClientTests_ShapeTests TruncatedTube ExtrudedPolygon)
0208 #
0209 #
0210 if( ${ROOT_VERSION} VERSION_GREATER 6.21.00 )
0211 # message(STATUS "++ ROOT version: ${ROOT_VERSION} ... adding tests...")
0212 list(APPEND ClientTests_ShapeTests Tessellated)
0213 else()
0214 message(STATUS "++ ROOT version: ${ROOT_VERSION} ... NO version specific tests for ROOT>6.21...")
0215 endif()
0216 #
0217 if (DD4HEP_USE_GEANT4)
0218 if( ${Geant4_VERSION} VERSION_GREATER 10.2.99 )
0219 # message(STATUS "++ Geant4 version: ${Geant4_VERSION} ... adding tests...")
0220 list(APPEND ClientTests_ShapeTests Scaled_Cone)
0221 else()
0222 message(STATUS "++ Geant4 version: ${Geant4_VERSION} ... NO version specific tests for G4>=10.3...")
0223 endif()
0224 endif()
0225 #
0226 foreach (test ${ClientTests_ShapeTests})
0227 dd4hep_add_test_reg( ClientTests_Check_Shape_${test}
0228 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0229 EXEC_ARGS geoDisplay file:${ClientTestsEx_INSTALL}/compact/Check_Shape_${test}.xml -load -destroy
0230 REGEX_PASS "Shape verification SUCCESSFUL"
0231 REGEX_FAIL "ERROR;FAILED" )
0232 endforeach()
0233 #
0234 # Test Volume division procedure.
0235 dd4hep_add_test_reg( ClientTests_Check_VolumeDivisionTest
0236 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0237 EXEC_ARGS geoPluginRun
0238 -destroy -input file:${ClientTestsEx_INSTALL}/compact/VolumeDivisionTest.xml
0239 -plugin DD4hep_VolumeDump
0240 REGEX_PASS "Checked 8 physical volume placements")
0241 #
0242 # Test Setting temperature and pressure to material
0243 dd4hep_add_test_reg( ClientTests_Check_Temp_Pressure_Air
0244 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0245 EXEC_ARGS geoPluginRun
0246 -destroy -input file:${ClientTestsEx_INSTALL}/compact/Check_Air.xml
0247 -plugin DD4hep_MaterialTable -name Vacuum
0248 REGEX_PASS "Temp=111 \\[Kelvin\\] Pressure=1e-12 \\[hPa\\] state=Undefined"
0249 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error;FATAL" )
0250 #
0251 # Test Setting temperature and pressure to material
0252 dd4hep_add_test_reg( ClientTests_Check_Temp_Pressure_Air_NTP
0253 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0254 EXEC_ARGS geoPluginRun
0255 -destroy -input file:${ClientTestsEx_INSTALL}/compact/Check_Air_NTP.xml
0256 -plugin DD4hep_MaterialTable -name Vacuum
0257 REGEX_PASS "Temp=293 \\[Kelvin\\] Pressure=1013.2 \\[hPa\\] state=Undefined"
0258 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error;FATAL" )
0259 #
0260 # Test Setting temperature and pressure to material
0261 dd4hep_add_test_reg( ClientTests_Check_Temp_Pressure_Air_STP
0262 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0263 EXEC_ARGS geoPluginRun
0264 -destroy -input file:${ClientTestsEx_INSTALL}/compact/Check_Air_STP.xml
0265 -plugin DD4hep_MaterialTable -name Vacuum
0266 REGEX_PASS "Temp=273 \\[Kelvin\\] Pressure=1000 \\[hPa\\] state=Undefined"
0267 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error;FATAL" )
0268 #
0269 # Test reflection matrices
0270 dd4hep_add_test_reg( ClientTests_Check_reflection_matrices
0271 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0272 EXEC_ARGS geoDisplay
0273 -input file:${ClientTestsEx_INSTALL}/compact/ReflectionMatrices.xml
0274 -load -destroy -print WARNING
0275 REGEX_PASS "Analysed 7 right handed and 10 left handed matrices"
0276 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error;FATAL" )
0277 #
0278 # Test DetectorCheck plugin
0279 dd4hep_add_test_reg( ClientTests_DetectorCheck_plugin
0280 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0281 EXEC_ARGS geoPluginRun
0282 -input file:${ClientTestsEx_INSTALL}/compact/IllDetector.xml
0283 -volmgr -plugin DD4hep_DetectorCheck -name world -structure -geometry -sensitive -volmgr
0284 REGEX_PASS "FAILED: Checked a total of 110 elements. Num.Errors: 77"
0285 REGEX_FAIL "Exception;EXCEPTION;FATAL" )
0286 #
0287 # only if root version > 6.19: MaterialTester
0288 #
0289 foreach (test Assemblies BoxTrafos CaloEndcapReflection IronCylinder LheD_tracker MagnetFields
0290 MiniTel SectorBarrelCalorimeter SiliconBlock NestedSimple NestedDetectors
0291 ParamVolume1D ParamVolume2D ParamVolume3D
0292 MultiCollections MultiSegmentations )
0293
0294 # Test materials in volumes. Test here the proper access to the materials from the volumes,
0295 # which was broken at some point.
0296 dd4hep_add_test_reg( ClientTests_volume_materials_${test}
0297 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0298 EXEC_ARGS geoPluginRun -print WARNING -volmgr -destroy
0299 -input file:${ClientTestsEx_INSTALL}/compact/${test}.xml
0300 -plugin DD4hep_VolumeDump -materials
0301 REGEX_PASS "\\+\\+\\+ Checked [1-9][0-9]* materials in volume placements. 0 are BAD." )
0302
0303 # Test format conversions
0304 ##dd4hep_add_test_reg( ClientTests_converter_gdml_${test}
0305 ## COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0306 ## EXEC_ARGS geoConverter -compact2gdml
0307 ## -input file:${ClientTestsEx_INSTALL}/compact/${test}.xml
0308 ## -output file:${test}.gdml
0309 ## REGEX_PASS " Successfully extracted GDML to" )
0310 foreach( type description vis )
0311 dd4hep_add_test_reg( ClientTests_converter_${type}_${test}
0312 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0313 EXEC_ARGS geoConverter -compact2${type}
0314 -input file:${ClientTestsEx_INSTALL}/compact/${test}.xml
0315 -output file:${test}.${type}
0316 REGEX_PASS " Handled [1-9][0-9]* volumes" )
0317 endforeach(type)
0318 endforeach()
0319 #
0320 #
0321 # Note:
0322 # IronCylinder has no segmentation!
0323 # MaterialTester no geometry
0324 # SectorBarrelCalorimeter is bad
0325 foreach (test Assemblies BoxTrafos CaloEndcapReflection
0326 LheD_tracker MagnetFields MiniTel SiliconBlock
0327 ParamVolume1D ParamVolume2D ParamVolume3D
0328 NestedSimple NestedDetectors MultiCollections )
0329 #
0330 # Test material scans in [origine to 10 meters in y]
0331 dd4hep_add_test_reg( ClientTests_material_scan_${test}
0332 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0333 EXEC_ARGS materialScan file:${ClientTestsEx_INSTALL}/compact/${test}.xml 0 0 0 0 10000 0
0334 REGEX_PASS " Average Material " )
0335 #
0336 # Geant4 material scan. From position=0,0,0 to end-of-world
0337 if (DD4HEP_USE_GEANT4)
0338 dd4hep_add_test_reg( ClientTests_g4material_scan_${test}_LONGTEST
0339 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0340 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/bin/g4MaterialScan
0341 --compact=file:${ClientTestsEx_INSTALL}/compact/${test}.xml
0342 "--position=0,0,0" "--direction=0,1,0"
0343 REGEX_PASS " Terminate Geant4 and delete associated actions." )
0344 endif(DD4HEP_USE_GEANT4)
0345 endforeach()
0346 #
0347 #
0348 #
0349 foreach (test BoxTrafos CaloEndcapReflection IronCylinder MiniTel SiliconBlock NestedSimple MultiCollections )
0350 #
0351 # Read data from XML file. Then parse the pure XML string.
0352 dd4hep_add_test_reg( ClientTests_parse_xml_string_${test}
0353 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0354 EXEC_ARGS geoPluginRun -destroy -print WARNING
0355 -plugin DD4hep_XML_InMemory -input ${ClientTestsEx_INSTALL}/compact/${test}.xml
0356 -plugin DD4hep_VolumeDump -materials
0357 REGEX_PASS "\\+\\+\\+ Checked [1-9][0-9]* materials in volume placements. 0 are BAD." )
0358 #
0359 # ROOT Geometry checks
0360 dd4hep_add_test_reg( ClientTests_check_geometry_${test}_LONGTEST
0361 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0362 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/bin/checkGeometry
0363 --compact=file:${ClientTestsEx_INSTALL}/compact/${test}.xml
0364 --full=true --ntracks=10
0365 REGEX_PASS " Execution finished..." )
0366 #
0367 # ROOT Geometry overlap checks
0368 dd4hep_add_test_reg( ClientTests_check_overlaps_${test}_LONGTEST
0369 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0370 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/bin/checkOverlaps
0371 --compact=file:${ClientTestsEx_INSTALL}/compact/${test}.xml
0372 --tolerance=0.1
0373 REGEX_PASS " Execution finished..." )
0374 endforeach()
0375 #
0376 #
0377 # Test Minitel for missing DetElement placements
0378 dd4hep_add_test_reg( MiniTel_check_missing_placements
0379 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0380 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/MiniTel_err_place.xml
0381 -plugin DD4hep_DetectorDump --volids --shapes --materials --positions
0382 REGEX_PASS "ERROR 004 /MyLHCBdetector1/side_0/module_9 DetElement with INVALID PLACEMENT"
0383 REGEX_FAIL "Exception;EXCEPTION"
0384 )
0385 #
0386 # Checksum test of the Minitel3 sub-detector
0387 dd4hep_add_test_reg( MiniTel_check_checksum_Minitel3
0388 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0389 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/MiniTelGenerate.xml
0390 -plugin DD4hepDetectorChecksum -readout -detector Minitel3
0391 REGEX_PASS "Combined hash code 22de2a78a15abd64 \\(54 sub-codes\\)"
0392 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0393 )
0394 #
0395 # Checksum test of the full detector
0396 dd4hep_add_test_reg( MiniTel_check_checksum_full
0397 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0398 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/MiniTelGenerate.xml
0399 -plugin DD4hepDetectorChecksum -readout
0400 REGEX_PASS "Combined hash code cbcafd06b9ee34c1 \\(207 sub-codes\\)"
0401 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0402 )
0403 #
0404 # Checksum test of a tessellated solid (default, without meshes)
0405 dd4hep_add_test_reg( Check_Shape_Tessellated_check_checksum
0406 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0407 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/Check_Shape_Tessellated.xml
0408 -plugin DD4hepDetectorChecksum
0409 REGEX_PASS "Combined hash code 13a268b6718de7a8 \\(13 sub-codes\\)"
0410 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0411 )
0412 #
0413 # Checksum test of a tessellated solid (with meshes)
0414 dd4hep_add_test_reg( Check_Shape_Tessellated_check_checksum_with_meshes
0415 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_CLICSiD.sh"
0416 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/Check_Shape_Tessellated.xml
0417 -plugin DD4hepDetectorChecksum -meshes -precision 3
0418 REGEX_PASS "Combined hash code 1fc84f1c2d93fd80 \\(13 sub-codes\\)"
0419 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0420 )
0421 #
0422 # Test the sequential processing of two xml files
0423 dd4hep_add_test_reg( minitel_config_plugins_include_command_line
0424 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0425 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/MiniTel.xml
0426 -input ${ClientTestsEx_INSTALL}/compact/ExamplePlugins.xml
0427 REGEX_PASS "\\+\\+\\+ Tested 5 numeric constants for expression evaluation"
0428 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0429 )
0430 #
0431 # Test the sequential processing of two xml files
0432 dd4hep_add_test_reg( minitel_config_plugins_include_command_xml
0433 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0434 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/IncludePlugins.xml
0435 REGEX_PASS "Tested 5 numeric constants for expression evaluation"
0436 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0437 )
0438 #
0439 # Test setting properties to the world volume and a single sub-detector
0440 dd4hep_add_test_reg( minitel_config_world_volume
0441 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0442 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/WorldSettings.xml
0443 REGEX_PASS "\\+\\+ Applied 5 settings to MyLHCBdetector5"
0444 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0445 )
0446 #
0447 # Test creation of the world volume with user specified material
0448 dd4hep_add_test_reg( minitel_config_world_material
0449 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0450 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/WorldMaterial.xml -print INFO -destroy -load
0451 REGEX_PASS "\\+\\+ Created world volume 'world_volume' as TGeoBBox \\(50.00, 50.00 50.00 \\[cm\\]\\) material:Steel235"
0452 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0453 )
0454 #
0455 # Test setting properties to the world volume and a single sub-detector
0456 dd4hep_add_test_reg( minitel_config_world
0457 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0458 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/WorldSettings.xml
0459 REGEX_PASS "\\+\\+ Applied 3 settings to /world"
0460 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0461 )
0462 #
0463 # Test setting build type to BUILD_DISPLAY rather than the default BUILD_DEFAULT/BUILD_SIMU
0464 dd4hep_add_test_reg( box_shape_build_type
0465 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0466 EXEC_ARGS geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/Check_Shape_Box.xml -build_type BUILD_DISPLAY
0467 -print DEBUG -destroy -load
0468 REGEX_PASS "\\+\\+\\+ Create shape: Shape_Box build type is: BUILD_DISPLAY"
0469 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0470 )
0471 #
0472 # Test interrupt handling in the middle of the geometry construction
0473 dd4hep_add_test_reg( ClientTests_interrupt_geometry_construction
0474 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0475 EXEC_ARGS geoDisplay -compact ${ClientTestsEx_INSTALL}/compact/InterruptTrigger.xml
0476 -load -print INFO
0477 REGEX_PASS "\\+\\+\\+ Caught signal: 2 context: 0xfeedbabe. exit process."
0478 REGEX_FAIL "Exception;EXCEPTION;ERROR"
0479 )
0480 #
0481 # EXEC_ARGS test_with_root.sh ${script}
0482 #
0483 if (DD4HEP_USE_GEANT4)
0484 #
0485 # Test Setting temperature and pressure to material
0486 dd4hep_add_test_reg( ClientTests_sim_Check_Temp_Pressure_Air
0487 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0488 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/Check_Air.py
0489 -geometry ${ClientTestsEx_INSTALL}/compact/Check_Air.xml batch
0490 REGEX_PASS "Imean: 85.538 eV temperature: 333.33 K pressure: 2.22 atm"
0491 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error;FATAL" )
0492 #
0493 # Geant4 test with gdml input file (LHCb:FT)
0494 dd4hep_add_test_reg( ClientTests_g4_gdml_detector
0495 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0496 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/bin/g4GeometryScan
0497 --compact=${ClientTestsEx_INSTALL}/compact/GdmlDetector.xml
0498 --position=200,200,-2000 --direction=0,0,1
0499 REGEX_PASS " 122 2777.0000 5200.000 "
0500 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error;FATAL" )
0501 #
0502 # Geant4 test with gdml input file (LHCb:MT)
0503 dd4hep_add_test_reg( ClientTests_g4_gdml_MT
0504 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0505 EXEC_ARGS ${Python_EXECUTABLE} ${DD4hep_ROOT}/bin/g4GeometryScan
0506 --compact=${ClientTestsEx_INSTALL}/compact/MT.xml
0507 --position=200,200,7900 --direction=0,0,1
0508 REGEX_PASS " 15 2777.0000 4210.000 "
0509 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error;FATAL" )
0510 #
0511 # Geant4 test if production cuts are processed
0512 dd4hep_add_test_reg( ClientTests_sim_MiniTel_prod_cuts
0513 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0514 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/MiniTelRegions.py batch
0515 REGEX_PASS "minitel_region_1: Set cut \\[gamma/0\\] = 5.000"
0516 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" )
0517 #
0518 # Geant4 test if production cuts are processed
0519 dd4hep_add_test_reg( ClientTests_sim_MiniTel_limitset
0520 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0521 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/MiniTelRegions.py batch
0522 REGEX_PASS "LimitSet: Particle type: mu- PDG: 13 : 3.000000"
0523 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" )
0524 #
0525 # Test of an example user analysis creating an N-tuple instead of an output file with events
0526 # Note: Exception: *** G4Exception : PART5107
0527 # issued by : G4IonTable::FindIon()
0528 # Isomer level 9 may be ambiguous.
0529 # *** This is just a warning message. ***
0530 # This is NOT an error!
0531 dd4hep_add_test_reg( ClientTests_sim_UserAnalysis
0532 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0533 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/MiniTelEnergyDeposits.py batch
0534 REGEX_PASS "Entries : 200 "
0535 REGEX_FAIL "EXCEPTION;ERROR;Error" )
0536 #
0537 # Test of an example user analysis creating an N-tuple instead of an output file with events
0538 dd4hep_add_test_reg( ClientTests_sim_TrackingRegion
0539 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0540 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/TrackingRegion.py batch
0541 REGEX_PASS "Placement tracking_volume_1 not converted \\[Veto'ed for simulation\\]"
0542 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" )
0543 #
0544 # Geant4 full simulation checks of simple detectors
0545 foreach(script Assemblies LheD_tracker MiniTel MiniTel_hepmc NestedDetectors )
0546 dd4hep_add_test_reg( ClientTests_sim_${script}
0547 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0548 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/${script}.py -batch
0549 REGEX_PASS NONE
0550 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" )
0551 endforeach(script)
0552 #
0553 # Geant4 full simulation checks of multi-collection/segmentation detectors
0554 foreach(script MultiCollections MultiSegmentations MultiSegmentCollections )
0555 dd4hep_add_test_reg( ClientTests_sim_${script}
0556 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0557 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/MultiCollections.py
0558 -compact ${ClientTestsEx_INSTALL}/compact/${script}.xml -batch
0559 REGEX_PASS NONE
0560 REGEX_FAIL "Exception;EXCEPTION;ERROR;Error" )
0561 endforeach(script)
0562 #
0563 # Test setting properties to a single sub-detector
0564 dd4hep_add_test_reg( minitel_config_region_subdet_geant4
0565 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0566 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/MiniTel.py
0567 -batch -debug -events 1 -geometry /examples/ClientTests/compact/WorldSettings.xml
0568 REGEX_PASS "\\+ Apply REGION settings: minitel_region_5 to volume MyLHCBdetector5."
0569 REGEX_FAIL "EXCEPTION; Exception;ERROR"
0570 )
0571 #
0572 # Test setting properties to the world volume
0573 dd4hep_add_test_reg( minitel_config_region_world_geant4
0574 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0575 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/MiniTel.py
0576 -batch -debug -events 1 -geometry /examples/ClientTests/compact/WorldSettings.xml
0577 REGEX_PASS "Volume world_volume Region: DefaultRegionForTheWorld. Apply user limits from world_region"
0578 REGEX_FAIL "EXCEPTION; Exception;ERROR"
0579 )
0580 #
0581 # Test importing a geometry from ROOT and placing DetElements
0582 dd4hep_add_test_reg( import_geo_place_det_elements
0583 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0584 EXEC_ARGS geoPluginRun -destroy -input ${ClientTestsEx_INSTALL}/compact/lhcbfull_plugins.xml
0585 WORKING_DIRECTORY ${ClientTestsEx_INSTALL}/compact
0586 REGEX_PASS "PASSED Checked 216249 VolumeManager contexts. Num.Errors: 0"
0587 REGEX_FAIL "EXCEPTION;Exception"
0588 )
0589 #
0590 if(Geant4_VERSION VERSION_LESS 10.7)
0591 dd4hep_print("|++> Geant4 fast simulation not supported for Geant4 ${Geant4_VERSION}")
0592 else()
0593 # Geant4 full simulation checks of multi-collection/segmentation detectors
0594 dd4hep_print("|++> Geant4 fast simulation tests enabled for Geant4 ${Geant4_VERSION}")
0595 foreach(script SiliconBlockGFlash SiliconBlockFastSim)
0596 dd4hep_add_test_reg( ClientTests_sim_${script}_LONGTEST
0597 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0598 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/${script}.py -batch -events 2
0599 -geometry ${ClientTestsEx_INSTALL}/compact/SiliconBlock.xml -batch -events 2
0600 REGEX_PASS "Event 1 Begin event action. Access event related information"
0601 REGEX_FAIL "EXCEPTION; Exception;ERROR;Error" )
0602 endforeach(script)
0603 endif()
0604 #
0605 foreach(script ParamVolume1D ParamVolume2D ParamVolume3D)
0606 dd4hep_add_test_reg( ClientTests_sim_${script}_LONGTEST
0607 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0608 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/ParamVolume.py
0609 -geometry ${script}.xml -batch -events 2
0610 REGEX_PASS "Event 1 Begin event action. Access event related information"
0611 REGEX_FAIL "EXCEPTION; Exception;ERROR;Error" )
0612 endforeach(script)
0613 #
0614 #
0615 # Test EDM4HEP output module
0616 if (DD4HEP_USE_EDM4HEP)
0617 # Test EDM4HEP write (needs to be expanded)
0618 dd4hep_add_test_reg(ClientTests_sim_MinitTel_edm4hep_write
0619 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0620 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/MiniTelGenerate.py
0621 -batch -events 5 -output MiniTel_ddg4_edm4hep.edm4hep.root
0622 REGEX_PASS "\\+\\+\\+ Finished run 0 after 5 events \\(5 events in total\\)"
0623 REGEX_FAIL "Error;ERROR; Exception"
0624 )
0625 endif()
0626 #
0627 # Test Geant4VolumeManager resource usage
0628 dd4hep_add_test_reg(ClientTests_g4_setup_BoxOfStraws_sensitive
0629 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0630 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/BoxOfStraws.py
0631 -print_level 3 -sensitive
0632 REGEX_PASS "ResourcesAfterConstruction ConstructSD: VmRSS"
0633 REGEX_FAIL "Error;ERROR; Exception"
0634 )
0635 #
0636 # Test without Geant4VolumeManager, but sensitive detector assignment using regex
0637 dd4hep_add_test_reg(ClientTests_g4_setup_BoxOfStraws_non_sensitive
0638 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0639 EXEC_ARGS ${Python_EXECUTABLE} ${ClientTestsEx_INSTALL}/scripts/BoxOfStraws.py
0640 -print_level 3
0641 REGEX_PASS "ResourcesAfterConstruction ConstructSD: VmRSS"
0642 REGEX_FAIL "Error;ERROR; Exception"
0643 )
0644
0645 dd4hep_add_test_reg(ClientTests_ddsim_setup_BoxOfStraws
0646 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_ClientTests.sh"
0647 EXEC_ARGS ddsim
0648 --steeringFile ${ClientTestsEx_INSTALL}/scripts/BoxOfStraws_DDSim.py
0649 --compactFile ${ClientTestsEx_INSTALL}/compact/BoxOfStraws.xml
0650 --enableGun
0651 --numberOfEvents 1
0652 --outputFile regex.slcio
0653
0654 REGEX_PASS "BoxOfStrawsDet Handled 1 nodes with 1 sensitive volume type"
0655 REGEX_FAIL "Error;ERROR; Exception"
0656 )
0657
0658 endif(DD4HEP_USE_GEANT4)