Warning, /DD4hep/examples/DDCMS/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 #
0012 # DDCMS is a detector description convention developed by the CMS experiment.
0013 #
0014 #==========================================================================
0015 cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
0016
0017 IF(NOT TARGET DD4hep::DDCore)
0018 find_package ( DD4hep REQUIRED )
0019 include ( ${DD4hep_DIR}/cmake/DD4hep.cmake )
0020 include ( ${DD4hep_DIR}/cmake/DD4hepBuild.cmake )
0021 dd4hep_configure_output()
0022 ENDIF()
0023
0024 dd4hep_set_compiler_flags()
0025 dd4hep_use_python_executable()
0026 #==========================================================================
0027 # CLHEP dependent stuff
0028 if(NOT TARGET CLHEP::CLHEP)
0029 # ensure we only look for CLHEP once
0030 find_package(CLHEP QUIET)
0031 endif()
0032 if (TARGET CLHEP::CLHEP)
0033 dd4hep_print("|++> CLHEP PRESENT. Building DDCMS examples.")
0034 else()
0035 dd4hep_print("|++> CLHEP is not present. NOT building DDCMS examples.")
0036 return()
0037 endif()
0038 #==========================================================================
0039 if(NOT TARGET Geant4::Interface)
0040 dd4hep_print("Not creating DDCMS tests [No Geant4 found]")
0041 return()
0042 endif()
0043 #==========================================================================
0044 #
0045 dd4hep_configure_output ()
0046 #
0047 #-------------------------------------------------------------------------------
0048 # we only create only library for DDCMS. The whole package is a single component
0049 # library. A priory there is no need to seperate the implementation from the
0050 # plugins....
0051 #
0052 # If need arises, this can be changed easily.
0053 #
0054 #---DDCMS plugin library -------------------------------------------------------
0055 dd4hep_add_plugin ( DDCMS
0056 SOURCES src/*.cpp src/plugins/*.cpp
0057 USES DD4hep::DDCore DD4hep::DDAlign DD4hep::DDCond
0058 ROOT::Core ROOT::Geom ROOT::GenVector CLHEP::CLHEP Geant4::Interface
0059 )
0060 target_include_directories(DDCMS PUBLIC include)
0061 #message (STATUS "CLHEP: ${CLHEP}")
0062 #
0063 #
0064 install(DIRECTORY include/DDCMS DESTINATION include)
0065 #
0066 #---Package installation procedure(s) -----------------------------------------
0067 install(DIRECTORY data eve scripts DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/DDCMS )
0068 #
0069 #---Testing--------------------------------------------------------------------
0070 dd4hep_configure_scripts ( DDCMS DEFAULT_SETUP WITH_TESTS )
0071 #
0072 #
0073 # Test CMS tracker detector construction
0074 dd4hep_add_test_reg( DDCMS_TestShapes
0075 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0076 EXEC_ARGS geoPluginRun -destroy -print WARNING -plugin DD4hep_XMLLoader
0077 file:${CMAKE_CURRENT_SOURCE_DIR}/data/cms_test_solids.xml
0078 REGEX_PASS "Request to process unknown shape 'para' \\[Parallelepiped\\]"
0079 REGEX_FAIL "Exception"
0080 REGEX_FAIL "FAILED"
0081 )
0082 #
0083 # Test CMS tracker detector construction
0084 dd4hep_add_test_reg( DDCMS_NamespaceConstants
0085 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0086 EXEC_ARGS geoPluginRun -destroy -print WARNING
0087 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0088 -plugin DD4hep_TestConstantsMultiplier
0089 REGEX_PASS "Tested 2553 numeric constants for expression evaluation"
0090 REGEX_FAIL "Exception"
0091 REGEX_FAIL "FAILED"
0092 )
0093 #
0094 # Test CMS tracker detector construction
0095 dd4hep_add_test_reg( DDCMS_LoadGeometry
0096 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0097 EXEC_ARGS geoDisplay
0098 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0099 -destroy -print WARNING -load
0100 REGEX_PASS "Instrumented 5 subdetectors with 36091 DetElements 25776 sensitives out of 224404 volumes and 1161 sensitive placements."
0101 REGEX_FAIL "Exception"
0102 REGEX_FAIL "FAILED"
0103 )
0104 #
0105 # Dump CMS material table
0106 dd4hep_add_test_reg( DDCMS_DumpMaterials
0107 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0108 EXEC_ARGS geoPluginRun -print WARNING
0109 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0110 -destroy -plugin DD4hep_MaterialTable -type xml
0111 REGEX_PASS "material name=\"tobmaterial:TOB_ax_services_C18\""
0112 REGEX_FAIL "Exception"
0113 REGEX_FAIL "FAILED"
0114 )
0115 #
0116 # Dump CMS volume tree
0117 dd4hep_add_test_reg( DDCMS_DumpVolumes
0118 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0119 EXEC_ARGS geoPluginRun -print WARNING
0120 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0121 -destroy -plugin DD4hep_VolumeDump -sensitive -volids
0122 REGEX_PASS "Checked 224414 physical volume placements. 25776 are sensitive."
0123 REGEX_FAIL "Exception"
0124 REGEX_FAIL "FAILED"
0125 )
0126 #
0127 # Dump CMS detector element tree
0128 dd4hep_add_test_reg( DDCMS_DumpDetElements
0129 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0130 EXEC_ARGS geoPluginRun -print WARNING
0131 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0132 -destroy -plugin DD4hep_DetectorDump -sensitive
0133 REGEX_PASS "Scanned a total of 36096 elements."
0134 REGEX_FAIL "Exception"
0135 REGEX_FAIL "FAILED"
0136 )
0137 #
0138 # Dump CMS detector element tree of SD PixelBarrel
0139 dd4hep_add_test_reg( DDCMS_VolumeMgrTest_PixelBarrel
0140 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0141 EXEC_ARGS geoPluginRun
0142 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0143 -destroy -print WARNING
0144 -plugin DD4hep_DetectorCheck -name PixelBarrel_1 -geometry -structure -volmgr -sensitive
0145 REGEX_PASS "\\+\\+\\+ PASSED: Checked a total of 32141 elements. Num.Errors: 0"
0146 REGEX_FAIL "Exception"
0147 REGEX_FAIL "FAILED"
0148 )
0149 #
0150 # Dump CMS detector element tree of SD TIB
0151 dd4hep_add_test_reg( DDCMS_VolumeMgrTest_TIB
0152 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0153 EXEC_ARGS geoPluginRun
0154 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0155 -destroy -print WARNING
0156 -plugin DD4hep_DetectorCheck -name TIB_1 -geometry -structure -volmgr -sensitive
0157 REGEX_PASS "\\+\\+\\+ PASSED: Checked a total of 115218 elements. Num.Errors: 0"
0158 REGEX_FAIL "Exception"
0159 REGEX_FAIL "FAILED"
0160 )
0161 #
0162 # Dump CMS detector element tree of SD TOB
0163 dd4hep_add_test_reg( DDCMS_VolumeMgrTest_TOB
0164 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0165 EXEC_ARGS geoPluginRun
0166 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0167 -destroy -print WARNING
0168 -plugin DD4hep_DetectorCheck -name TOB_1 -geometry -structure -volmgr -sensitive
0169 REGEX_PASS "\\+\\+\\+ PASSED: Checked a total of 354124 elements. Num.Errors: 0"
0170 REGEX_FAIL "Exception"
0171 REGEX_FAIL "FAILED"
0172 )
0173 #
0174 # Test DDCMS Geant4 event generation
0175 #dd4hep_add_test_reg( DDCMS_Geant4_LONGTEST
0176 # COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0177 # EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/CMSTrackerSim.py batch test numevents 2
0178 # REGEX_PASS "\\+\\+\\+ Finished run 0 after 2 events \\(2 events in total\\)"
0179 # REGEX_FAIL "Exception;EXCEPTION;ERROR;FAILED"
0180 # )
0181 #
0182 # Test saving geometry to ROOT file
0183 dd4hep_add_test_reg( DDCMS_Persist_Save_LONGTEST
0184 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0185 EXEC_ARGS geoPluginRun
0186 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0187 -destroy -print WARNING
0188 -plugin DD4hep_Geometry2ROOT -output DDCMS_geometry.root
0189 REGEX_PASS "\\+\\+\\+ Successfully saved geometry data to file."
0190 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;WriteObjectAny"
0191 )
0192 #
0193 # Test restoring geometry from ROOT file: Volume Manager
0194 dd4hep_add_test_reg( DDCMS_Persist_Restore_LONGTEST
0195 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0196 EXEC_ARGS geoPluginRun -print WARNING
0197 -plugin DD4hep_RootLoader DDCMS_geometry.root
0198 DEPENDS DDCMS_Persist_Save_LONGTEST
0199 REGEX_PASS "\\+\\+\\+ Successfully loaded detector description from file"
0200 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0201 )
0202 #
0203 # Test restoring geometry from ROOT file: Volume Manager loading+nominals
0204 dd4hep_add_test_reg( DDCMS_Persist_Restore_DetTest1_LONGTEST
0205 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0206 EXEC_ARGS geoPluginRun -print WARNING
0207 -plugin DD4hep_RootLoader DDCMS_geometry.root
0208 -plugin DD4hep_CheckVolumeManager
0209 DEPENDS DDCMS_Persist_Save_LONGTEST
0210 REGEX_PASS "\\+\\+\\+ PASSED Checked 36096 VolumeManager contexts. Num.Errors: 0"
0211 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0212 )
0213 #
0214 # Test restoring geometry from ROOT file: Test Volume Manager results
0215 dd4hep_add_test_reg( DDCMS_Persist_Restore_DetTest2_LONGTEST
0216 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0217 EXEC_ARGS geoPluginRun -print WARNING
0218 -plugin DD4hep_RootLoader DDCMS_geometry.root
0219 -plugin DD4hep_DetectorCheck -name PixelBarrel_1 -geometry -structure -volmgr -sensitive
0220 DEPENDS DDCMS_Persist_Save_LONGTEST
0221 REGEX_PASS "\\+\\+\\+ PASSED: Checked a total of 32141 elements. Num.Errors: 0"
0222 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0223 )
0224 #
0225 # Test restoring geometry from ROOT file: DetElement nominal alignments
0226 # Note: BeamCal has a problem. Need to be taken into account
0227 dd4hep_add_test_reg( DDCMS_Persist_Restore_Nominal_LONGTEST
0228 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0229 EXEC_ARGS geoPluginRun -print WARNING
0230 -plugin DD4hep_RootLoader DDCMS_geometry.root
0231 -plugin DD4hep_CheckNominals
0232 DEPENDS DDCMS_Persist_Save_LONGTEST
0233 REGEX_PASS "\\+\\+\\+ PASSED Checked 25776 DetElements. Num.Errors: 0"
0234 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0235 )
0236 #
0237 # Test restoring geometry from ROOT file: Sensitive detectors
0238 dd4hep_add_test_reg( DDCMS_Persist_Restore_Sensitives_LONGTEST
0239 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0240 EXEC_ARGS geoPluginRun -print WARNING
0241 -plugin DD4hep_RootLoader DDCMS_geometry.root
0242 -plugin DD4hep_CheckSensitives
0243 DEPENDS DDCMS_Persist_Save_LONGTEST
0244 REGEX_PASS "\\+\\+\\+ PASSED Checked 5 SensitiveDetector objects. Num.Errors: 0"
0245 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0246 )
0247 #
0248 # Test restoring geometry from ROOT file: Readout structures
0249 dd4hep_add_test_reg( DDCMS_Persist_Restore_Readouts_LONGTEST
0250 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0251 EXEC_ARGS geoPluginRun -print WARNING
0252 -plugin DD4hep_RootLoader DDCMS_geometry.root
0253 -plugin DD4hep_CheckReadouts
0254 DEPENDS DDCMS_Persist_Save_LONGTEST
0255 REGEX_PASS "\\+\\+\\+ PASSED Checked 5 readout objects. Num.Errors: 0"
0256 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0257 )