Back to home page

EIC code displayed by LXR

 
 

    


Warning, /DD4hep/examples/DDCAD/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 # Only newer versions of ROOT support tessellated shapes!
0021 if(${ROOT_VERSION} VERSION_LESS 6.21.01)
0022   return()
0023 endif()
0024 #
0025 # We need the DDCAD module to run these tests!
0026 if(NOT TARGET DD4hep::DDCAD)
0027   MESSAGE(STATUS "+++> DDCAD examples shall not be built! [DDCAD not enabled]")
0028   return()
0029 endif()
0030 #
0031 dd4hep_set_compiler_flags()
0032 #==========================================================================
0033 #
0034 set(DDCAD_INSTALL ${CMAKE_INSTALL_PREFIX}/examples/DDCAD)
0035 dd4hep_install_dir( compact models scripts ref DESTINATION ${DDCAD_INSTALL} )
0036 #--------------------------------------------------------------------------
0037 find_package(assimp QUIET)
0038 MESSAGE(STATUS "ASSIMP VERSION IS ${assimp_VERSION}")
0039 #--------------------------------------------------------------------------
0040 dd4hep_configure_scripts( DDCAD DEFAULT_SETUP WITH_TESTS)
0041 enable_testing ()
0042 include(CTest)
0043 #---  Testing  ------------------------------------------------------------
0044 #
0045 #
0046 #  Test basic shapes by comparing mesh vertices with reference file
0047 set(DDCAD_Tests)
0048 set(DDCADEx_INSTALL       ${CMAKE_INSTALL_PREFIX}/examples/DDCAD)
0049 set(CLICSiDEx_INSTALL     ${CMAKE_INSTALL_PREFIX}/examples/CLICSiD)
0050 set(ClientTestsEx_INSTALL ${CMAKE_INSTALL_PREFIX}/examples/ClientTests)
0051 #
0052 # Single shape tests:
0053 
0054 #Reference for test depends on assimp version
0055 if(assimp_VERSION VERSION_GREATER_EQUAL 5.2.7)
0056   set(assimp_duck_VERSION 5.2.7)
0057 elseif(assimp_VERSION VERSION_GREATER_EQUAL 5.2.0)
0058   set(assimp_duck_VERSION 5.2.0)
0059 else()
0060   set(assimp_duck_VERSION 5.0.0)
0061 endif()
0062 configure_file(${CMAKE_CURRENT_LIST_DIR}/compact/Check_Shape_Collada_duck.xml.in
0063   ${CMAKE_CURRENT_LIST_DIR}/compact/Check_Shape_Collada_duck.xml @ONLY
0064 )
0065 
0066 list(APPEND DDCAD_Tests BHV_Boxing_Toes Collada_duck PLY_Wuson)
0067 foreach (test ${DDCAD_Tests})
0068   dd4hep_add_test_reg( DDCAD_Check_Shape_${test}
0069       COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCAD.sh"
0070       EXEC_ARGS  geoDisplay file:${DDCADEx_INSTALL}/compact/Check_Shape_${test}.xml -load -destroy
0071       REGEX_PASS "Shape verification SUCCESSFUL."
0072       REGEX_FAIL "ERROR;FAILED" )
0073 endforeach()
0074 #
0075 # Multi-shape tests
0076 # Not working: OBJ_spider
0077 list(APPEND DDCAD_Tests_MV COB_dwarf MS3D_jeep RelativePath)
0078 foreach (test ${DDCAD_Tests_MV})
0079   dd4hep_add_test_reg( DDCAD_Check_Shape_${test}
0080     COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCAD.sh"
0081     EXEC_ARGS  geoDisplay file:${DDCAD_INSTALL}/compact/Check_Shape_${test}.xml -load -destroy
0082     REGEX_PASS "Read [0-9]([0-9]*) meshes"
0083     REGEX_FAIL "Exception"
0084   )
0085 endforeach()
0086 #
0087 #  Test CAD export from a simplyfied model
0088 dd4hep_add_test_reg( DDCAD_export_sid_vertex
0089   COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCAD.sh"
0090   EXEC_ARGS  geoPluginRun -input ${CLICSiDEx_INSTALL}/compact/SiD_multiple_inputs.xml
0091                           -input ${CLICSiDEx_INSTALL}/compact/SiD_Vertex.xml
0092                           -plugin DD4hep_CAD_export -output clicsid_vertex.collada
0093                           -type collada -recursive -detector /world -recursive -scale 1.0 
0094   REGEX_PASS "Analysed 383 out of 383 meshes"
0095   REGEX_FAIL "Exception"
0096   REGEX_FAIL "FAILED"
0097 )
0098 #
0099 #  Test CAD import from the exported simplyfied model
0100 dd4hep_add_test_reg( DDCAD_import_sid_vertex
0101   COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCAD.sh"
0102   EXEC_ARGS  geoDisplay -input ${CLICSiDEx_INSTALL}/compact/SiD_multiple_inputs.xml
0103                         -input ${DDCADEx_INSTALL}/compact/Import_SiD_Vertex.xml -load -destroy
0104   DEPENDS    DDCAD_export_sid_vertex
0105   REGEX_PASS "Read 383 meshes"
0106   REGEX_FAIL "Exception"
0107 )
0108 #
0109 #  Test CAD export from a simplyfied model
0110 dd4hep_add_test_reg( DDCAD_export_cal_endcaps
0111   COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCAD.sh"
0112   EXEC_ARGS  geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/CaloEndcapReflection.xml
0113   -plugin DD4hep_CAD_export -output endcap_reflection.collada
0114   -type collada -recursive -detector /world -recursive -scale 1.0
0115   REGEX_PASS "Analysed 96 out of 96 meshes"
0116   REGEX_FAIL "Exception"
0117   REGEX_FAIL "FAILED"
0118 )
0119 #
0120 #  Test CAD import from the exported simplyfied model
0121 dd4hep_add_test_reg( DDCAD_import_cal_endcaps
0122   COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCAD.sh"
0123   EXEC_ARGS  geoDisplay -input ${DDCADEx_INSTALL}/compact/Import_CaloEndcap.xml -load -destroy
0124   DEPENDS    DDCAD_export_cal_endcaps
0125   REGEX_PASS "Read 96 meshes"
0126   REGEX_FAIL "Exception"
0127 )
0128 #
0129 #  Test CAD export of FCC machine part
0130 dd4hep_add_test_reg( DDCAD_export_FCC_machine
0131   COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCAD.sh"
0132   EXEC_ARGS  geoPluginRun -input ${ClientTestsEx_INSTALL}/compact/FCCmachine/FCCee_DectMaster.xml
0133   -plugin DD4hep_CAD_export -output Machine.collada
0134   -type collada -recursive -detector /world -recursive -scale 1.0
0135   REGEX_PASS "Analysed 49 out of 49 meshes"
0136   REGEX_FAIL "Exception"
0137   REGEX_FAIL "FAILED"
0138 )
0139 #
0140 #  Test CAD import of FCC machine part
0141 dd4hep_add_test_reg( DDCAD_import_FCC_machine
0142   COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCAD.sh"
0143   EXEC_ARGS  geoDisplay -input ${DDCADEx_INSTALL}/compact/Import_FCC_Machine.xml -load -destroy
0144   DEPENDS    DDCAD_export_FCC_machine
0145   REGEX_PASS "Read 49 meshes"
0146   REGEX_FAIL "Exception"
0147 )
0148 #
0149 #  Geometry loading the CAD file from Armin Ilg's example
0150 dd4hep_add_test_reg( DDCAD_Issue1134_geometry_load
0151   COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCAD.sh"
0152   EXEC_ARGS  geoDisplay ${DDCADEx_INSTALL}/compact/DD4hep_Issue_1134.xml -load -destroy
0153   REGEX_PASS "Created successfull shape of type: CAD_MultiVolume \\[CAD_MultiVolume\\]"
0154   REGEX_FAIL "Exception;ERROR;FAILED"
0155 )
0156 #
0157 #  ROOT based Overlap check of Armin Ilg's example
0158 dd4hep_add_test_reg( DDCAD_Issue1134_overlap_check
0159   COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCAD.sh"
0160   EXEC_ARGS  checkOverlaps --compact=file:${DDCADEx_INSTALL}/compact/DD4hep_Issue_1134.xml
0161               --print=1 --tolerance 0.000001
0162   REGEX_PASS "Number of illegal overlaps/extrusions : 0"
0163   REGEX_FAIL "Exception;ERROR;FAILED"
0164 )
0165 if(TARGET DD4hep::DDG4)
0166   #
0167   #  Overlap check of Armin Ilg's example
0168   dd4hep_add_test_reg( DDCAD_Issue1134_g4overlap_check
0169     COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCAD.sh"
0170     EXEC_ARGS  ddsim --compactFile ${DDCADEx_INSTALL}/compact/DD4hep_Issue_1134.xml
0171     --enableG4Gun --runType run
0172     --macroFile ${DDCADEx_INSTALL}/scripts/overlap.mac
0173     REGEX_PASS "Checking overlaps for volume AV_2.Shape_STL_0.0.tessellated_.* .G4TessellatedSolid. ... OK"
0174     REGEX_FAIL "EXCEPTION;ERROR;Error;FAILED"
0175   )
0176   #
0177   #  Geometry scan of Armin Ilg's example
0178   dd4hep_add_test_reg( DDCAD_Issue1134_g4geometry_scan
0179     COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCAD.sh"
0180     EXEC_ARGS  g4GeometryScan
0181     --compact=file:${DDCADEx_INSTALL}/compact/DD4hep_Issue_1134.xml
0182     --position=-35,-35,-300 --direction=7,7,60
0183     REGEX_PASS ".  -1.29,  -1.29, -11.06.  Path:./world/AV_2.Shape_STL_0.0.tessellated_.* Shape:G4TessellatedSolid  Mat:Gold"
0184     REGEX_FAIL "EXCEPTION;ERROR;Error;FAILED"
0185   )
0186   #
0187 endif()