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(TARGETS DDCMS LIBRARY DESTINATION lib)
0065 install(DIRECTORY include/DDCMS DESTINATION include)
0066 #
0067 #---Package installation procedure(s) -----------------------------------------
0068 install(DIRECTORY data eve scripts DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/DDCMS )
0069 #
0070 #---Testing--------------------------------------------------------------------
0071 dd4hep_configure_scripts ( DDCMS DEFAULT_SETUP WITH_TESTS )
0072 #
0073 #
0074 # Test CMS tracker detector construction
0075 dd4hep_add_test_reg( DDCMS_TestShapes
0076 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0077 EXEC_ARGS geoPluginRun -destroy -print WARNING -plugin DD4hep_XMLLoader
0078 file:${CMAKE_CURRENT_SOURCE_DIR}/data/cms_test_solids.xml
0079 REGEX_PASS "Request to process unknown shape 'para' \\[Parallelepiped\\]"
0080 REGEX_FAIL "Exception"
0081 REGEX_FAIL "FAILED"
0082 )
0083 #
0084 # Test CMS tracker detector construction
0085 dd4hep_add_test_reg( DDCMS_NamespaceConstants
0086 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0087 EXEC_ARGS geoPluginRun -destroy -print WARNING
0088 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0089 -plugin DD4hep_TestConstantsMultiplier
0090 REGEX_PASS "Tested 2553 numeric constants for expression evaluation"
0091 REGEX_FAIL "Exception"
0092 REGEX_FAIL "FAILED"
0093 )
0094 #
0095 # Test CMS tracker detector construction
0096 dd4hep_add_test_reg( DDCMS_LoadGeometry
0097 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0098 EXEC_ARGS geoDisplay
0099 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0100 -destroy -print WARNING -load
0101 REGEX_PASS "Instrumented 5 subdetectors with 36091 DetElements 25776 sensitives out of 224404 volumes and 1161 sensitive placements."
0102 REGEX_FAIL "Exception"
0103 REGEX_FAIL "FAILED"
0104 )
0105 #
0106 # Dump CMS material table
0107 dd4hep_add_test_reg( DDCMS_DumpMaterials
0108 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0109 EXEC_ARGS geoPluginRun -print WARNING
0110 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0111 -destroy -plugin DD4hep_MaterialTable -type xml
0112 REGEX_PASS "material name=\"tobmaterial:TOB_ax_services_C18\""
0113 REGEX_FAIL "Exception"
0114 REGEX_FAIL "FAILED"
0115 )
0116 #
0117 # Dump CMS volume tree
0118 dd4hep_add_test_reg( DDCMS_DumpVolumes
0119 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0120 EXEC_ARGS geoPluginRun -print WARNING
0121 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0122 -destroy -plugin DD4hep_VolumeDump -sensitive -volids
0123 REGEX_PASS "Checked 224414 physical volume placements. 25776 are sensitive."
0124 REGEX_FAIL "Exception"
0125 REGEX_FAIL "FAILED"
0126 )
0127 #
0128 # Dump CMS detector element tree
0129 dd4hep_add_test_reg( DDCMS_DumpDetElements
0130 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0131 EXEC_ARGS geoPluginRun -print WARNING
0132 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0133 -destroy -plugin DD4hep_DetectorDump -sensitive
0134 REGEX_PASS "Scanned a total of 36096 elements."
0135 REGEX_FAIL "Exception"
0136 REGEX_FAIL "FAILED"
0137 )
0138 #
0139 # Dump CMS detector element tree of SD PixelBarrel
0140 dd4hep_add_test_reg( DDCMS_VolumeMgrTest_PixelBarrel
0141 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0142 EXEC_ARGS geoPluginRun
0143 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0144 -destroy -print WARNING
0145 -plugin DD4hep_DetectorCheck -name PixelBarrel_1 -geometry -structure -volmgr -sensitive
0146 REGEX_PASS "\\+\\+\\+ PASSED: Checked a total of 32141 elements. Num.Errors: 0"
0147 REGEX_FAIL "Exception"
0148 REGEX_FAIL "FAILED"
0149 )
0150 #
0151 # Dump CMS detector element tree of SD TIB
0152 dd4hep_add_test_reg( DDCMS_VolumeMgrTest_TIB
0153 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0154 EXEC_ARGS geoPluginRun
0155 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0156 -destroy -print WARNING
0157 -plugin DD4hep_DetectorCheck -name TIB_1 -geometry -structure -volmgr -sensitive
0158 REGEX_PASS "\\+\\+\\+ PASSED: Checked a total of 115218 elements. Num.Errors: 0"
0159 REGEX_FAIL "Exception"
0160 REGEX_FAIL "FAILED"
0161 )
0162 #
0163 # Dump CMS detector element tree of SD TOB
0164 dd4hep_add_test_reg( DDCMS_VolumeMgrTest_TOB
0165 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0166 EXEC_ARGS geoPluginRun
0167 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0168 -destroy -print WARNING
0169 -plugin DD4hep_DetectorCheck -name TOB_1 -geometry -structure -volmgr -sensitive
0170 REGEX_PASS "\\+\\+\\+ PASSED: Checked a total of 354124 elements. Num.Errors: 0"
0171 REGEX_FAIL "Exception"
0172 REGEX_FAIL "FAILED"
0173 )
0174 #
0175 # Test DDCMS Geant4 event generation
0176 #dd4hep_add_test_reg( DDCMS_Geant4_LONGTEST
0177 # COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0178 # EXEC_ARGS ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/CMSTrackerSim.py batch test numevents 2
0179 # REGEX_PASS "\\+\\+\\+ Finished run 0 after 2 events \\(2 events in total\\)"
0180 # REGEX_FAIL "Exception;EXCEPTION;ERROR;FAILED"
0181 # )
0182 #
0183 # Test saving geometry to ROOT file
0184 dd4hep_add_test_reg( DDCMS_Persist_Save_LONGTEST
0185 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0186 EXEC_ARGS geoPluginRun
0187 -input file:${CMAKE_CURRENT_SOURCE_DIR}/data/dd4hep-config.xml
0188 -destroy -print WARNING
0189 -plugin DD4hep_Geometry2ROOT -output DDCMS_geometry.root
0190 REGEX_PASS "\\+\\+\\+ Successfully saved geometry data to file."
0191 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;WriteObjectAny"
0192 )
0193 #
0194 # Test restoring geometry from ROOT file: Volume Manager
0195 dd4hep_add_test_reg( DDCMS_Persist_Restore_LONGTEST
0196 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0197 EXEC_ARGS geoPluginRun -print WARNING
0198 -plugin DD4hep_RootLoader DDCMS_geometry.root
0199 DEPENDS DDCMS_Persist_Save_LONGTEST
0200 REGEX_PASS "\\+\\+\\+ Successfully loaded detector description from file"
0201 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0202 )
0203 #
0204 # Test restoring geometry from ROOT file: Volume Manager loading+nominals
0205 dd4hep_add_test_reg( DDCMS_Persist_Restore_DetTest1_LONGTEST
0206 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0207 EXEC_ARGS geoPluginRun -print WARNING
0208 -plugin DD4hep_RootLoader DDCMS_geometry.root
0209 -plugin DD4hep_CheckVolumeManager
0210 DEPENDS DDCMS_Persist_Save_LONGTEST
0211 REGEX_PASS "\\+\\+\\+ PASSED Checked 36096 VolumeManager contexts. Num.Errors: 0"
0212 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0213 )
0214 #
0215 # Test restoring geometry from ROOT file: Test Volume Manager results
0216 dd4hep_add_test_reg( DDCMS_Persist_Restore_DetTest2_LONGTEST
0217 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0218 EXEC_ARGS geoPluginRun -print WARNING
0219 -plugin DD4hep_RootLoader DDCMS_geometry.root
0220 -plugin DD4hep_DetectorCheck -name PixelBarrel_1 -geometry -structure -volmgr -sensitive
0221 DEPENDS DDCMS_Persist_Save_LONGTEST
0222 REGEX_PASS "\\+\\+\\+ PASSED: Checked a total of 32141 elements. Num.Errors: 0"
0223 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0224 )
0225 #
0226 # Test restoring geometry from ROOT file: DetElement nominal alignments
0227 # Note: BeamCal has a problem. Need to be taken into account
0228 dd4hep_add_test_reg( DDCMS_Persist_Restore_Nominal_LONGTEST
0229 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0230 EXEC_ARGS geoPluginRun -print WARNING
0231 -plugin DD4hep_RootLoader DDCMS_geometry.root
0232 -plugin DD4hep_CheckNominals
0233 DEPENDS DDCMS_Persist_Save_LONGTEST
0234 REGEX_PASS "\\+\\+\\+ PASSED Checked 25776 DetElements. Num.Errors: 0"
0235 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0236 )
0237 #
0238 # Test restoring geometry from ROOT file: Sensitive detectors
0239 dd4hep_add_test_reg( DDCMS_Persist_Restore_Sensitives_LONGTEST
0240 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0241 EXEC_ARGS geoPluginRun -print WARNING
0242 -plugin DD4hep_RootLoader DDCMS_geometry.root
0243 -plugin DD4hep_CheckSensitives
0244 DEPENDS DDCMS_Persist_Save_LONGTEST
0245 REGEX_PASS "\\+\\+\\+ PASSED Checked 5 SensitiveDetector objects. Num.Errors: 0"
0246 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0247 )
0248 #
0249 # Test restoring geometry from ROOT file: Readout structures
0250 dd4hep_add_test_reg( DDCMS_Persist_Restore_Readouts_LONGTEST
0251 COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDCMS.sh"
0252 EXEC_ARGS geoPluginRun -print WARNING
0253 -plugin DD4hep_RootLoader DDCMS_geometry.root
0254 -plugin DD4hep_CheckReadouts
0255 DEPENDS DDCMS_Persist_Save_LONGTEST
0256 REGEX_PASS "\\+\\+\\+ PASSED Checked 5 readout objects. Num.Errors: 0"
0257 REGEX_FAIL " ERROR ;EXCEPTION;Exception;FAILED;TStreamerInfo"
0258 )