From 9965195edfad1bbc7183fa40b9710b9879db8a74 Mon Sep 17 00:00:00 2001 From: Andre Sailer <andre.philippe.sailer@cern.ch> Date: Wed, 17 Jul 2019 10:43:17 +0200 Subject: [PATCH] Make the rest of the examples work --- DDDigi/CMakeLists.txt | 4 +- DDG4/CMakeLists.txt | 5 +- cmake/DD4hepBuild.cmake | 9 +- examples/CMakeLists.txt | 34 +- examples/ClientTests/CMakeLists.txt | 2 +- examples/DDCMS/CMakeLists.txt | 47 ++- examples/DDCodex/CMakeLists.txt | 23 +- examples/DDDB/CMakeLists.txt | 435 +++++++++++++------------ examples/DDDigi/CMakeLists.txt | 19 +- examples/DDG4/CMakeLists.txt | 18 +- examples/DDG4_MySensDet/CMakeLists.txt | 28 +- examples/Persistency/CMakeLists.txt | 15 +- examples/SimpleDetector/CMakeLists.txt | 17 +- 13 files changed, 319 insertions(+), 337 deletions(-) diff --git a/DDDigi/CMakeLists.txt b/DDDigi/CMakeLists.txt index df872f784..b45a205da 100644 --- a/DDDigi/CMakeLists.txt +++ b/DDDigi/CMakeLists.txt @@ -55,4 +55,6 @@ new_dd4hep_add_plugin(DDDigiPlugins #---Package installation procedure(s) ---------------------------------------------- file(GLOB DDigi_python python/*.py python/*.C) install(FILES ${DDigi_python} DESTINATION python) -install(TARGETS DDDigi EXPORT DD4hep DESTINATION lib) +install(TARGETS DDDigi DDDigiPlugins EXPORT DD4hep LIBRARY DESTINATION lib) +install(DIRECTORY include/DDDigi DESTINATION include) + diff --git a/DDG4/CMakeLists.txt b/DDG4/CMakeLists.txt index 59feb2f2a..56ed3b896 100644 --- a/DDG4/CMakeLists.txt +++ b/DDG4/CMakeLists.txt @@ -129,7 +129,4 @@ INSTALL(TARGETS DDG4 EXPORT DD4hep DESTINATION lib) INSTALL(TARGETS DDG4 DDG4Plugins LIBRARY DESTINATION lib) -INSTALL(DIRECTORY - include/DDG4 - DESTINATION include - ) +INSTALL(DIRECTORY include/DDG4 DESTINATION include) diff --git a/cmake/DD4hepBuild.cmake b/cmake/DD4hepBuild.cmake index ad0bdb076..456d41b76 100644 --- a/cmake/DD4hepBuild.cmake +++ b/cmake/DD4hepBuild.cmake @@ -1617,20 +1617,18 @@ endfunction() # Arguments # --------- # binary -> plugin name -# SOURCES -> list of source files. Will be expanded to absolute names +# SOURCES -> Globbing expression to find source files +# GENERATED -> List of source files # -# The following variables EXTEND the package defaults # INCLUDE_DIRS -> Additional include directories need to compile the binary # LINK_LIBRARIES -> Additional libraries needed to link the binary -# USES -> Required package dependencies # DEFINITIONS -> Optional compiler definitions to compile the sources -# # \author A.Sailer # \version 1.0 # #--------------------------------------------------------------------------------------------------- function(new_dd4hep_add_plugin binary) - cmake_parse_arguments(ARG "NOINSTALL" "" "SOURCES;GENERATED;LINK_LIBRARIES;INCLUDE_DIRS;USES;DEFINITIONS" ${ARGN}) + cmake_parse_arguments(ARG "NOINSTALL" "" "SOURCES;GENERATED;LINK_LIBRARIES;INCLUDE_DIRS;DEFINITIONS" ${ARGN}) if ( ${ARG_NOINSTALL} ) set(NOINSTALL NOINSTALL) endif() @@ -1646,7 +1644,6 @@ function(new_dd4hep_add_plugin binary) TARGET_INCLUDE_DIRECTORIES(${binary} PUBLIC ${ARG_INCLUDE_DIRS}) TARGET_COMPILE_DEFINITIONS(${binary} PUBLIC ${ARG_DEFINITIONS}) # what do these options mean? - #GENERATED ${ARG_GENERATED} #NOINSTALL # Generate ROOTMAP if the plugin will be built: dd4hep_generate_rootmap( ${binary} ) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 23dac178c..69542c19e 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -52,30 +52,14 @@ add_subdirectory(LHeD) add_subdirectory(AlignDet) add_subdirectory(ClientTests) add_subdirectory(Conditions) -# add_subdirectory(DDG4) -# add_subdirectory(DDDigi) -# #add_subdirectory(OpticalSurfaces) ## needs root version >= 6.18 -# add_subdirectory(Persistency) -# add_subdirectory(SimpleDetector) -# add_subdirectory(DDG4_MySensDet) -# add_subdirectory(DDCodex) +add_subdirectory(DDG4) +add_subdirectory(DDDigi) +#add_subdirectory(OpticalSurfaces) ## needs root version >= 6.18 +add_subdirectory(Persistency) +add_subdirectory(SimpleDetector) +add_subdirectory(DDG4_MySensDet) +add_subdirectory(DDCodex) +add_subdirectory(DDDB) +add_subdirectory(DDCMS) -# # XercesC dependent stuff -# if(DD4HEP_USE_XERCESC) -# dd4hep_print("|++> XercesC PRESENT. Building DDDB examples.") -# add_subdirectory(DDDB) -# else() -# dd4hep_print("|++> XercesC is not present. NOT building DDDB examples.") -# endif() - -# # CLHEP dependent stuff: -# find_package (CLHEP QUIET) -# string(FIND "${CLHEP_DIR}" "NOTFOUND" HaveDDCMS) -# if (TARGET CLHEP::CLHEP) -# dd4hep_print("|++> CLHEP PRESENT. Building DDCMS examples.") -# add_subdirectory(DDCMS) -# else() -# dd4hep_print("|++> CLHEP is not present. NOT building DDCMS examples.") -# endif() ->>>>>>> Modifications in examples diff --git a/examples/ClientTests/CMakeLists.txt b/examples/ClientTests/CMakeLists.txt index 812d7e086..1784a2d76 100644 --- a/examples/ClientTests/CMakeLists.txt +++ b/examples/ClientTests/CMakeLists.txt @@ -39,7 +39,7 @@ add_executable( multipleGeo main/MultipleGeometries.cpp ) #----------------------------------------------------------------------------------- # # -set(ClientTestsEx_INSTALL ${CMAKE_INSTALL_PREFIX}/examples/ClientTests) +set(ClientTestsEx_INSTALL ${CMAKE_INSTALL_PREFIX}/examples/ClientTests) dd4hep_install_dir( compact scripts ref DESTINATION ${ClientTestsEx_INSTALL} ) #-------------------------------------------------------------------------- diff --git a/examples/DDCMS/CMakeLists.txt b/examples/DDCMS/CMakeLists.txt index 3059c11de..4e0e64f40 100644 --- a/examples/DDCMS/CMakeLists.txt +++ b/examples/DDCMS/CMakeLists.txt @@ -16,38 +16,53 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR) include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) #------------------------------------------------------------------------------ + +# dd4hep_package( DDCMS +# USES [DD4hep REQUIRED COMPONENTS DDCore] +# [ROOT REQUIRED COMPONENTS Geom GenVector] +# OPTIONAL ${CLHEP} XERCESC +# INCLUDE_DIRS include +# INSTALL_INCLUDES include/DDCMS) + +# CLHEP dependent stuff +if(NOT TARGET CLHEP::CLHEP) + # ensure we only look for CLHEP once + find_package(CLHEP QUIET) +endif() +if (TARGET CLHEP::CLHEP) + dd4hep_print("|++> CLHEP PRESENT. Building DDCMS examples.") +else() + dd4hep_print("|++> CLHEP is not present. NOT building DDCMS examples.") + return() +endif() + dd4hep_configure_output () # #---Trick to allow building with Geant4 internal CLHEP if ( DD4HEP_USE_GEANT4 AND Geant4_builtin_clhep_FOUND) set(CLHEP "") else() - set(CLHEP CLHEP) + set(CLHEP CLHEP::CLHEP) endif() # -dd4hep_package( DDCMS - USES [DD4hep REQUIRED COMPONENTS DDCore] - [ROOT REQUIRED COMPONENTS Geom GenVector] - OPTIONAL ${CLHEP} XERCESC - INCLUDE_DIRS include - INSTALL_INCLUDES include/DDCMS) + # -# We only create only library for DDCMS. The whole package is a single component +# we only create only library for DDCMS. The whole package is a single component # library. A priory there is no need to seperate the implementation from the # plugins.... # # If need arises, this can be changed easily. # #---DDCMS plugin library ------------------------------------------------------- -dd4hep_add_plugin ( DDCMS SOURCES src/*.cpp src/plugins/*.cpp - USES [DD4hep REQUIRED COMPONENTS DDCore DDAlign DDCond] - [ROOT REQUIRED COMPONENTS Geom GenVector] -OPTIONAL XERCESC) - +new_dd4hep_add_plugin ( DDCMS SOURCES src/*.cpp src/plugins/*.cpp + LINK_LIBRARIES DD4hep::DDCore DD4hep::DDAlign DD4hep::DDCond + ROOT::Core ROOT::Geom ROOT::GenVector + ) +install(TARGETS DDCMS LIBRARY DESTINATION lib) +target_include_directories(DDCMS PUBLIC include) +install(DIRECTORY include/DDCMS DESTINATION include) #---Package installation procedure(s) ----------------------------------------- -dd4hep_install_dir( data DESTINATION ${DD4hep_DIR}/examples/DDCMS ) -dd4hep_install_dir( eve DESTINATION ${DD4hep_DIR}/examples/DDCMS ) -dd4hep_install_dir( scripts DESTINATION ${DD4hep_DIR}/examples/DDCMS ) +install(DIRECTORY data eve scripts DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/DDCMS ) # #---Testing-------------------------------------------------------------------- dd4hep_configure_scripts ( DDCMS DEFAULT_SETUP WITH_TESTS ) diff --git a/examples/DDCodex/CMakeLists.txt b/examples/DDCodex/CMakeLists.txt index 9899701da..4e9679471 100755 --- a/examples/DDCodex/CMakeLists.txt +++ b/examples/DDCodex/CMakeLists.txt @@ -11,27 +11,16 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR) include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) -#----------------------------------------------------------------------------------- -dd4hep_configure_output () -dd4hep_package ( DDCodex MAJOR 0 MINOR 0 PATCH 1 - USES [ROOT REQUIRED COMPONENTS Geom] - [DD4hep REQUIRED COMPONENTS DDCore] - OPTIONAL XERCESC - ) -# #---DDCodex plugin library ------------------------------------------------------- -dd4hep_add_plugin(DDCodexPlugins +new_dd4hep_add_plugin(DDCodexPlugins SOURCES src/*.cpp - USES [ROOT REQUIRED COMPONENTS Geom GenVector] - OPTIONAL XERCESC -) + LINK_LIBRARIES DD4hep::DDCore ROOT::Core ROOT::Geom ROOT::GenVector + ) +install(TARGETS DDCodexPlugins DESTINATION lib) # # -dd4hep_install_dir( compact python eve DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/DDCodex ) -dd4hep_install_files(FILES Upgrade.root DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/DDCodex ) +install(DIRECTORY compact python eve DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/DDCodex ) +install(FILES Upgrade.root DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/DDCodex ) #-------------------------------------------------------------------------- # dd4hep_configure_scripts ( DDCodex DEFAULT_SETUP WITH_TESTS ) -# -#---Testing------------------------------------------------------------------------- -# diff --git a/examples/DDDB/CMakeLists.txt b/examples/DDDB/CMakeLists.txt index 83b738ecd..cb0a2942b 100644 --- a/examples/DDDB/CMakeLists.txt +++ b/examples/DDDB/CMakeLists.txt @@ -19,222 +19,229 @@ #========================================================================== cmake_minimum_required(VERSION 3.3 FATAL_ERROR) -if (DD4HEP_USE_XERCESC) - include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) +# XercesC dependent stuff +if(DD4HEP_USE_XERCESC) + dd4hep_print("|++> XercesC PRESENT. Building DDDB examples.") +else() + dd4hep_print("|++> XercesC is not present. NOT building DDDB examples.") + return() +endif() + + +include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) - #------------------------------------------------------------------------------ - dd4hep_configure_output () - dd4hep_package (DDDB MAJOR 0 MINOR 0 PATCH 1 - USES [XERCESC REQUIRED] - [ROOT REQUIRED COMPONENTS Geom] - [DD4hep REQUIRED COMPONENTS DDCore DDCond] - INCLUDE_DIRS include - ) +#------------------------------------------------------------------------------ +dd4hep_configure_output () - # - #---DDDB library -------------------------------------------------------------- - dd4hep_add_package_library(DDDB - SOURCES src/*.cpp src/Detector/*.cpp - USES [ROOT REQUIRED COMPONENTS Geom GenVector] - [DD4hep REQUIRED COMPONENTS DDCore DDCond] - ) - # - #---DDDB plugin library ------------------------------------------------------- - dd4hep_add_plugin(DDDBPlugins - SOURCES src/plugins/*.cpp - USES [ROOT REQUIRED COMPONENTS Geom GenVector] DDDB - [DD4hep REQUIRED COMPONENTS DDCore DDCond] - ) +# +#---DDDB library -------------------------------------------------------------- +FILE(GLOB DDDB_SOURCES src/*.cpp src/Detector/*.cpp) +add_library(DDDB SHARED ${DDDB_SOURCES}) +target_link_libraries(DDDB + DD4hep::DDCore + DD4hep::DDCond + ROOT::Core ROOT::Geom ROOT::GenVector + ) - #---Package installation procedure(s) ----------------------------------------- - install ( PROGRAMS scripts/run_dddb.sh DESTINATION bin) - install ( PROGRAMS scripts/display_dddb.sh DESTINATION bin) - install ( PROGRAMS scripts/extract_dddb.sh DESTINATION bin) - install ( FILES data/DDDB.tar.gz DESTINATION examples/DDDB) - #---Testing-------------------------------------------------------------------- - dd4hep_configure_scripts ( DDDB DEFAULT_SETUP WITH_TESTS ) - # - #---Testing: Extract DDDB data from zip archive ------------------------------- - dd4hep_add_test_reg( DDDB_extract_LONGTEST - COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" - EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/extract_dddb.sh - REGEX_PASS "DDDB Database successfully installed." - ) - # - #---Testing: Load the geometry from archive ----------------------------------- - dd4hep_add_test_reg( DDDB_load_LONGTEST - COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" - EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller - DEPENDS DDDB_extract_LONGTEST - REGEX_PASS "\\+ Converted 12852 placements" - REGEX_FAIL "EXCEPTION;Exception" - ) - # - #---Testing: Load the geometry + conditions from archive ---------------------- - dd4hep_add_test_reg( DDDB_conditions_LONGTEST - COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" - EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller - DEPENDS DDDB_extract_LONGTEST - REGEX_PASS "\\+ Converted 9353 conditions" - REGEX_FAIL "EXCEPTION;Exception" - ) - # - #---Testing: Load the geometry + conditions dump as view from DetElement ------ - dd4hep_add_test_reg( DDDB_conditions_dump_simple_LONGTEST - COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" - EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller - -exec DDDB_ConditionsSummary - DEPENDS DDDB_extract_LONGTEST - REGEX_PASS "\\+ DDDB Total Number of parameters: 13642 " - REGEX_FAIL "EXCEPTION;Exception" - ) - # - #---Testing: Load the geometry + dump detector elemets ------------------------ - dd4hep_add_test_reg( DDDB_det_elements_LONGTEST - COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" - EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller -end-plugin - -plugin DDDB_DetectorDump -print DEBUG -end-plugin - DEPENDS DDDB_extract_LONGTEST - REGEX_PASS "\\+ DDDB: Number of DetElements in the geometry: 6261" - REGEX_FAIL "EXCEPTION;Exception" - ) - # - #---Testing: Load the geometry + dump volumes --------------------------------- - dd4hep_add_test_reg( DDDB_det_volumes_LONGTEST - COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" - EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller - -plugin DDDB_DetectorVolumeDump -print DEBUG - DEPENDS DDDB_extract_LONGTEST - REGEX_PASS "\\+ DDDB: Number of DetElement placements: 6253" - REGEX_FAIL "EXCEPTION;Exception" - ) - # - #---Testing: Load the geometry + dump condition keys -------------------------- - dd4hep_add_test_reg( DDDB_det_conditions_keys_LONGTEST - COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" - EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller - -plugin DDDB_DetectorConditionKeysDump -print DEBUG - DEPENDS DDDB_extract_LONGTEST - REGEX_PASS "\\+ DDDB: Number of DetElement condition keys: 9043" - REGEX_FAIL "EXCEPTION;Exception" - ) - # - #---Testing: Load the geometry + dump condition keys -------------------------- - dd4hep_add_test_reg( DDDB_det_catalog_data_LONGTEST - COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" - EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller - -plugin DDDB_DetectorConditionDump -print DEBUG - DEPENDS DDDB_extract_LONGTEST - REGEX_PASS "\\+ DDDBConditions Total Number of parameters: 346312 " - REGEX_FAIL "EXCEPTION;Exception" - ) - # - #---Testing: Load the geometry + dump condition keys -------------------------- - dd4hep_add_test_reg( DDDB_det_catalog_align_LONGTEST - COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" - EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller - -plugin DDDB_DetectorAlignmentDump -print DEBUG - DEPENDS DDDB_extract_LONGTEST - REGEX_PASS "\\+ DDDB: Number of attached alignments: 5408" - REGEX_FAIL "EXCEPTION;Exception" - ) - # - #---Testing: Load the geometry + conditions dump as view from DetElement ------ - dd4hep_add_test_reg( DDDB_detelement_conditions_dump_LONGTEST - COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" - EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller - -plugin DDDB_DetElementConditionDump -print DEBUG - DEPENDS DDDB_extract_LONGTEST - REGEX_PASS "\\+ DDDB: Total number of DetElement parameters: 13136" - ) - # - #---Testing: Load the geometry + conditions + conditions derives - dd4hep_add_test_reg( DDDB_derived_conditions_LONGTEST - COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" - EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller - -plugin DDDB_DerivedCondTest -print DEBUG - DEPENDS DDDB_extract_LONGTEST - REGEX_PASS "\\+ DDDB: Total Number of callbacks: 16221" - REGEX_FAIL "EXCEPTION;Exception" - ) - # - #---Testing: Load the geometry + conditions + run basic derived alignments test - dd4hep_add_test_reg( DDDB_alignment_derived_LONGTEST - COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" - EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller - -plugin DDDB_DerivedAlignmentsTest -print DEBUG -turns 1 -access 3 - DEPENDS DDDB_extract_LONGTEST - REGEX_PASS "\\+ DDDB: AlignmentManager: 9352 conditions \\(S:9352,L:0,C:0,M:0\\) alignments: \\(A:6200,M:0\\) for IOV:epoch\\(0\\)" - REGEX_FAIL "EXCEPTION;Exception" - ) - # - #---Testing: Load the geometry + conditions + access derived alignments from DetElement structures - dd4hep_add_test_reg( DDDB_alignment_access_LONGTEST - COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" - EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -config DD4hep_ConditionsManagerInstaller - -plugin DDDB_AlignmentsAccessTest -print DEBUG - DEPENDS DDDB_extract_LONGTEST - REGEX_PASS "\\+ DDDB: Accessed 5407 alignments from 5407 DetElement objects" - REGEX_FAIL "EXCEPTION;Exception" - ) - # - #---Testing: Load the geometry + conditions + create DeVelo detector elements - dd4hep_add_test_reg( DDDB_DeVelo_LONGTEST - COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" - EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -iov_start 31-12-2000-00:00:00 -iov_end 31-12-2019-00:00:00 - -config DD4hep_ConditionsManagerInstaller - -plugin DDDB_DeVeloTest -print DEBUG - DEPENDS DDDB_extract_LONGTEST - REGEX_PASS "TestSummary Total 9110 conditions load summary \\(S:2286,L:4020,C:2804,M:0\\)" - REGEX_FAIL "EXCEPTION" - ) - # - #---Testing: As above, but access conditions using Gaudi-like service - dd4hep_add_test_reg( DDDB_DeVelo_Gaudi_LONGTEST - COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" - EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh - -iov_start 31-12-2000-00:00:00 -iov_end 31-12-2019-00:00:00 - -config DD4hep_ConditionsManagerInstaller - -plugin DDDB_DeVeloServiceTest -print DEBUG - DEPENDS DDDB_extract_LONGTEST - REGEX_PASS "TestSummary Total 10 slices created and accessed during the test." - REGEX_FAIL "EXCEPTION" - ) - # - #---Testing: Extract DDDB data from zip archive ------------------------------- - dd4hep_add_test_reg( DDDB_clean_LONGTEST - COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" - EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/extract_dddb.sh -clean - DEPENDS DDDB_extract_LONGTEST - DDDB_alignment_access_LONGTEST - DDDB_alignment_derived_LONGTEST - DDDB_derived_conditions_LONGTEST - DDDB_detelement_conditions_dump_LONGTEST - DDDB_det_catalog_align_LONGTEST - DDDB_det_catalog_data_LONGTEST - DDDB_det_conditions_keys_LONGTEST - DDDB_det_volumes_LONGTEST - DDDB_det_elements_LONGTEST - DDDB_conditions_dump_simple_LONGTEST - DDDB_conditions_LONGTEST - DDDB_load_LONGTEST - DDDB_DeVelo_Gaudi_LONGTEST - DDDB_DeVelo_LONGTEST - DDDB_extract_LONGTEST - REGEX_PASS "DDDB Database successfully removed" +target_include_directories(DDDB + PUBLIC include + ) + +#---DDDB plugin library ------------------------------------------------------- +new_dd4hep_add_plugin(DDDBPlugins + SOURCES src/plugins/*.cpp + LINK_LIBRARIES DDDB + ) +install(TARGETS DDDB DDDBPlugins LIBRARY DESTINATION lib) + +#---Package installation procedure(s) ----------------------------------------- +install ( PROGRAMS scripts/run_dddb.sh DESTINATION bin) +install ( PROGRAMS scripts/display_dddb.sh DESTINATION bin) +install ( PROGRAMS scripts/extract_dddb.sh DESTINATION bin) +install ( FILES data/DDDB.tar.gz DESTINATION examples/DDDB) +#---Testing-------------------------------------------------------------------- +dd4hep_configure_scripts ( DDDB DEFAULT_SETUP WITH_TESTS ) +# +#---Testing: Extract DDDB data from zip archive ------------------------------- +dd4hep_add_test_reg( DDDB_extract_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/extract_dddb.sh + REGEX_PASS "DDDB Database successfully installed." + ) +# +#---Testing: Load the geometry from archive ----------------------------------- +dd4hep_add_test_reg( DDDB_load_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh + -config DD4hep_ConditionsManagerInstaller + DEPENDS DDDB_extract_LONGTEST + REGEX_PASS "\\+ Converted 12852 placements" + REGEX_FAIL "EXCEPTION;Exception" + ) +# +#---Testing: Load the geometry + conditions from archive ---------------------- +dd4hep_add_test_reg( DDDB_conditions_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh + -config DD4hep_ConditionsManagerInstaller + DEPENDS DDDB_extract_LONGTEST + REGEX_PASS "\\+ Converted 9353 conditions" + REGEX_FAIL "EXCEPTION;Exception" + ) +# +#---Testing: Load the geometry + conditions dump as view from DetElement ------ +dd4hep_add_test_reg( DDDB_conditions_dump_simple_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh + -config DD4hep_ConditionsManagerInstaller + -exec DDDB_ConditionsSummary + DEPENDS DDDB_extract_LONGTEST + REGEX_PASS "\\+ DDDB Total Number of parameters: 13642 " + REGEX_FAIL "EXCEPTION;Exception" + ) +# +#---Testing: Load the geometry + dump detector elemets ------------------------ +dd4hep_add_test_reg( DDDB_det_elements_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh + -config DD4hep_ConditionsManagerInstaller -end-plugin + -plugin DDDB_DetectorDump -print DEBUG -end-plugin + DEPENDS DDDB_extract_LONGTEST + REGEX_PASS "\\+ DDDB: Number of DetElements in the geometry: 6261" + REGEX_FAIL "EXCEPTION;Exception" + ) +# +#---Testing: Load the geometry + dump volumes --------------------------------- +dd4hep_add_test_reg( DDDB_det_volumes_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh + -config DD4hep_ConditionsManagerInstaller + -plugin DDDB_DetectorVolumeDump -print DEBUG + DEPENDS DDDB_extract_LONGTEST + REGEX_PASS "\\+ DDDB: Number of DetElement placements: 6253" + REGEX_FAIL "EXCEPTION;Exception" + ) +# +#---Testing: Load the geometry + dump condition keys -------------------------- +dd4hep_add_test_reg( DDDB_det_conditions_keys_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh + -config DD4hep_ConditionsManagerInstaller + -plugin DDDB_DetectorConditionKeysDump -print DEBUG + DEPENDS DDDB_extract_LONGTEST + REGEX_PASS "\\+ DDDB: Number of DetElement condition keys: 9043" + REGEX_FAIL "EXCEPTION;Exception" + ) +# +#---Testing: Load the geometry + dump condition keys -------------------------- +dd4hep_add_test_reg( DDDB_det_catalog_data_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh + -config DD4hep_ConditionsManagerInstaller + -plugin DDDB_DetectorConditionDump -print DEBUG + DEPENDS DDDB_extract_LONGTEST + REGEX_PASS "\\+ DDDBConditions Total Number of parameters: 346312 " + REGEX_FAIL "EXCEPTION;Exception" + ) +# +#---Testing: Load the geometry + dump condition keys -------------------------- +dd4hep_add_test_reg( DDDB_det_catalog_align_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh + -config DD4hep_ConditionsManagerInstaller + -plugin DDDB_DetectorAlignmentDump -print DEBUG + DEPENDS DDDB_extract_LONGTEST + REGEX_PASS "\\+ DDDB: Number of attached alignments: 5408" + REGEX_FAIL "EXCEPTION;Exception" + ) +# +#---Testing: Load the geometry + conditions dump as view from DetElement ------ +dd4hep_add_test_reg( DDDB_detelement_conditions_dump_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh + -config DD4hep_ConditionsManagerInstaller + -plugin DDDB_DetElementConditionDump -print DEBUG + DEPENDS DDDB_extract_LONGTEST + REGEX_PASS "\\+ DDDB: Total number of DetElement parameters: 13136" + ) +# +#---Testing: Load the geometry + conditions + conditions derives +dd4hep_add_test_reg( DDDB_derived_conditions_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh + -config DD4hep_ConditionsManagerInstaller + -plugin DDDB_DerivedCondTest -print DEBUG + DEPENDS DDDB_extract_LONGTEST + REGEX_PASS "\\+ DDDB: Total Number of callbacks: 16221" + REGEX_FAIL "EXCEPTION;Exception" + ) +# +#---Testing: Load the geometry + conditions + run basic derived alignments test +dd4hep_add_test_reg( DDDB_alignment_derived_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh + -config DD4hep_ConditionsManagerInstaller + -plugin DDDB_DerivedAlignmentsTest -print DEBUG -turns 1 -access 3 + DEPENDS DDDB_extract_LONGTEST + REGEX_PASS "\\+ DDDB: AlignmentManager: 9352 conditions \\(S:9352,L:0,C:0,M:0\\) alignments: \\(A:6200,M:0\\) for IOV:epoch\\(0\\)" + REGEX_FAIL "EXCEPTION;Exception" + ) +# +#---Testing: Load the geometry + conditions + access derived alignments from DetElement structures +dd4hep_add_test_reg( DDDB_alignment_access_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh + -config DD4hep_ConditionsManagerInstaller + -plugin DDDB_AlignmentsAccessTest -print DEBUG + DEPENDS DDDB_extract_LONGTEST + REGEX_PASS "\\+ DDDB: Accessed 5407 alignments from 5407 DetElement objects" + REGEX_FAIL "EXCEPTION;Exception" + ) +# +#---Testing: Load the geometry + conditions + create DeVelo detector elements +dd4hep_add_test_reg( DDDB_DeVelo_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh + -iov_start 31-12-2000-00:00:00 -iov_end 31-12-2019-00:00:00 + -config DD4hep_ConditionsManagerInstaller + -plugin DDDB_DeVeloTest -print DEBUG + DEPENDS DDDB_extract_LONGTEST + REGEX_PASS "TestSummary Total 9110 conditions load summary \\(S:2286,L:4020,C:2804,M:0\\)" + REGEX_FAIL "EXCEPTION" + ) +# +#---Testing: As above, but access conditions using Gaudi-like service +dd4hep_add_test_reg( DDDB_DeVelo_Gaudi_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/run_dddb.sh + -iov_start 31-12-2000-00:00:00 -iov_end 31-12-2019-00:00:00 + -config DD4hep_ConditionsManagerInstaller + -plugin DDDB_DeVeloServiceTest -print DEBUG + DEPENDS DDDB_extract_LONGTEST + REGEX_PASS "TestSummary Total 10 slices created and accessed during the test." + REGEX_FAIL "EXCEPTION" + ) +# +#---Testing: Extract DDDB data from zip archive ------------------------------- +dd4hep_add_test_reg( DDDB_clean_LONGTEST + COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDB.sh" + EXEC_ARGS ${CMAKE_INSTALL_PREFIX}/bin/extract_dddb.sh -clean + DEPENDS DDDB_extract_LONGTEST + DDDB_alignment_access_LONGTEST + DDDB_alignment_derived_LONGTEST + DDDB_derived_conditions_LONGTEST + DDDB_detelement_conditions_dump_LONGTEST + DDDB_det_catalog_align_LONGTEST + DDDB_det_catalog_data_LONGTEST + DDDB_det_conditions_keys_LONGTEST + DDDB_det_volumes_LONGTEST + DDDB_det_elements_LONGTEST + DDDB_conditions_dump_simple_LONGTEST + DDDB_conditions_LONGTEST + DDDB_load_LONGTEST + DDDB_DeVelo_Gaudi_LONGTEST + DDDB_DeVelo_LONGTEST + DDDB_extract_LONGTEST + REGEX_PASS "DDDB Database successfully removed" ) -endif() diff --git a/examples/DDDigi/CMakeLists.txt b/examples/DDDigi/CMakeLists.txt index 2f087f771..0911c47ef 100644 --- a/examples/DDDigi/CMakeLists.txt +++ b/examples/DDDigi/CMakeLists.txt @@ -13,28 +13,23 @@ include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) #----------------------------------------------------------------------------------- dd4hep_configure_output () -dd4hep_package ( DDDigi MAJOR 0 MINOR 0 PATCH 1 - USES [DD4hep REQUIRED COMPONENTS DDCore DDDigi] - ) + +link_libraries(DD4hep::DDDigi) set(DDDigiexamples_INSTALL ${CMAKE_INSTALL_PREFIX}/examples/DDDigi) # dd4hep_set_compiler_flags() # -dd4hep_add_plugin( DDDigiExampleLib - SOURCES src/*.cpp - USES [ROOT REQUIRED COMPONENTS Geom GenVector RIO] - BOOST - ) -# -dd4hep_install_dir(scripts DESTINATION ${DDDigiexamples_INSTALL}) +new_dd4hep_add_plugin(DDDigiExampleLib SOURCES src/*.cpp ) +target_link_libraries(DDDigiExampleLib Boost::boost ROOT::Geom ROOT::GenVector ROOT::RIO) +install(TARGETS DDDigiExampleLib LIBRARY DESTINATION lib) +install(DIRECTORY scripts DESTINATION ${DDDigiexamples_INSTALL}) # dd4hep_configure_scripts (DDDigi DEFAULT_SETUP WITH_TESTS) # # Test HepMC input reader -dd4hep_add_test_reg( DDDigi_framework +dd4hep_add_test_reg(DDDigi_framework COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh" EXEC_ARGS python ${DDDigiexamples_INSTALL}/scripts/TestFramework.py - REQUIRES DDDigi REGEX_PASS "\\+\\+\\+ 10 Events out of 10 processed." REGEX_FAIL "Error;ERROR;Exception" ) diff --git a/examples/DDG4/CMakeLists.txt b/examples/DDG4/CMakeLists.txt index 20d6d01a9..1fc466d49 100644 --- a/examples/DDG4/CMakeLists.txt +++ b/examples/DDG4/CMakeLists.txt @@ -13,9 +13,8 @@ include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) #----------------------------------------------------------------------------------- dd4hep_configure_output () -dd4hep_package ( DDG4 MAJOR 0 MINOR 0 PATCH 1 - USES [DD4hep REQUIRED COMPONENTS DDCore] -) +link_libraries(DD4hep::DDCore) + set(DDG4examples_INSTALL ${CMAKE_INSTALL_PREFIX}/examples/DDG4) # #---Geant4 Testsing----------------------------------------------------------------- @@ -25,18 +24,17 @@ if (DD4HEP_USE_GEANT4) dd4hep_set_compiler_flags() # #---- Dictionary of classes to be written to the ROOT file -------------------- - dd4hep_add_dictionary(G__DDG4UserDict + new_dd4hep_add_dictionary(G__DDG4UserDict SOURCES ${DD4hep_DIR}/include/ROOT/Warnings.h src/Dictionary.h LINKDEF ${DD4hep_DIR}/include/ROOT/LinkDef.h OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lib ) #---- Example of a client library with user defined plugins -------------------- - dd4hep_add_plugin( DDG4UserLib - GENERATED G__DDG4UserDict.cxx + new_dd4hep_add_plugin( DDG4UserLib SOURCES src/*.cpp - USES [GEANT4 REQUIRED] - [ROOT REQUIRED COMPONENTS Geom GenVector RIO] - [DD4hep REQUIRED COMPONENTS DDCore DDG4] + GENERATED G__DDG4UserDict.cxx + LINK_LIBRARIES DD4hep::DDCore DD4hep::DDG4 + Geant4::Interface ROOT::Core ROOT::Geom ROOT::GenVector ROOT::RIO ) # # @@ -49,7 +47,6 @@ if (DD4HEP_USE_GEANT4) COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh" EXEC_ARGS python ${DD4hep_DIR}/examples/DDG4/examples/readHEPMC.py ${DDG4examples_INSTALL}/data/hepmc_geant4.dat - REQUIRES DDG4 Geant4 REGEX_PASS "Geant4InputAction\\[Input\\]: Event 10 Error when moving to event - EOF") # # Test HepMC input reader with slightly non-standard HEPMC file @@ -57,6 +54,5 @@ if (DD4HEP_USE_GEANT4) COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4.sh" EXEC_ARGS python ${DD4hep_DIR}/examples/DDG4/examples/readHEPMC.py ${DDG4examples_INSTALL}/data/LHCb_MinBias_HepMC.txt - REQUIRES DDG4 Geant4 REGEX_PASS "Geant4InputAction\\[Input\\]: Event 27 Error when moving to event - EOF") endif() diff --git a/examples/DDG4_MySensDet/CMakeLists.txt b/examples/DDG4_MySensDet/CMakeLists.txt index 8391f42f8..349b421df 100644 --- a/examples/DDG4_MySensDet/CMakeLists.txt +++ b/examples/DDG4_MySensDet/CMakeLists.txt @@ -11,15 +11,17 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR) include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) +if(NOT TARGET Geant4::Interface) + MESSAGE(STATUS "Not creating DDG4_MySensDet tests") + return() +endif() + +link_libraries(Geant4::Interface ROOT::Core ROOT::Geom ROOT::GenVector ROOT::RIO + DD4hep::DDCore DD4hep::DDG4) + #----------------------------------------------------------------------------------- -dd4hep_configure_output () -dd4hep_package ( DDG4_MySensDet MAJOR 0 MINOR 0 PATCH 1 - USES [GEANT4 REQUIRED] - [ROOT REQUIRED COMPONENTS Geom GenVector RIO] - [DD4hep REQUIRED COMPONENTS DDCore DDG4] -) set(DDG4_MySensDet_INSTALL ${CMAKE_INSTALL_PREFIX}/examples/DDG4_MySensDet) -dd4hep_install_dir(scripts DESTINATION ${DDG4_MySensDet_INSTALL} ) +install(DIRECTORY scripts DESTINATION ${DDG4_MySensDet_INSTALL}) dd4hep_configure_scripts(DDG4_MySensDet DEFAULT_SETUP WITH_TESTS) # #---Geant4 Testsing----------------------------------------------------------------- @@ -28,20 +30,20 @@ if (DD4HEP_USE_GEANT4) # dd4hep_set_compiler_flags() #--------------------------- Plugin library for the simulation framework --------- - dd4hep_add_dictionary(G__DDG4_MySensDet + new_dd4hep_add_dictionary(G__DDG4_MySensDet SOURCES ${DD4hep_DIR}/include/ROOT/Warnings.h src/MyTrackerHit.h LINKDEF ${DD4hep_DIR}/include/ROOT/LinkDef.h ) #---- Example of a client library with user defined plugins -------------------- - dd4hep_add_plugin( DDG4_MySensDet + new_dd4hep_add_plugin( DDG4_MySensDet GENERATED G__DDG4_MySensDet.cxx SOURCES src/*.cpp - USES [GEANT4 REQUIRED] - [ROOT REQUIRED COMPONENTS Geom GenVector RIO] - [DD4hep REQUIRED COMPONENTS DDCore DDG4] + LINK_LIBRARIES Geant4::Interface ROOT::Core ROOT::Geom ROOT::GenVector ROOT::RIO + DD4hep::DDCore DD4hep::DDG4 ) - + install(TARGETS DDG4_MySensDet DESTINATION lib) + # Geant4 material scan. From position=0,0,0 to end-of-world dd4hep_add_test_reg( DDG4_MySensDet_g4material_scan_SiliconBlock_LONGTEST COMMAND "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDG4_MySensDet.sh" diff --git a/examples/Persistency/CMakeLists.txt b/examples/Persistency/CMakeLists.txt index 3b614ceba..30dddb30b 100644 --- a/examples/Persistency/CMakeLists.txt +++ b/examples/Persistency/CMakeLists.txt @@ -11,15 +11,14 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR) include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) -#-------------------------------------------------------------------------- -dd4hep_configure_output () -dd4hep_package ( Persistency MAJOR 0 MINOR 0 PATCH 1 - USES [ROOT REQUIRED COMPONENTS Geom GenVector] - [DD4hep REQUIRED COMPONENTS DDCore] - OPTIONAL XERCESC -) +if(TARGET XercesC::XercesC) + link_libraries(XercesC::XercesC) +endif() +link_libraries(ROOT::Core ROOT::Geom ROOT::GenVector DD4hep::DDCore) + #----------------------------------------------------------------------------------- -dd4hep_add_plugin(PersistencyExample SOURCES src/*.cpp) +new_dd4hep_add_plugin(PersistencyExample SOURCES src/*.cpp) +install(TARGETS PersistencyExample LIBRARY DESTINATION lib) dd4hep_configure_scripts (Persistency DEFAULT_SETUP WITH_TESTS ) #-------------------------------------------------------------------------- # diff --git a/examples/SimpleDetector/CMakeLists.txt b/examples/SimpleDetector/CMakeLists.txt index 370e4a944..dd8835cba 100644 --- a/examples/SimpleDetector/CMakeLists.txt +++ b/examples/SimpleDetector/CMakeLists.txt @@ -12,16 +12,15 @@ cmake_minimum_required(VERSION 3.3 FATAL_ERROR) include ( ${DD4hep_DIR}/cmake/DD4hep.cmake ) #----------------------------------------------------------------------------------- -dd4hep_configure_output() -dd4hep_package (SimpleDetector MAJOR 0 MINOR 0 PATCH 1 - USES [ROOT REQUIRED COMPONENTS Geom GenVector] - [DD4hep REQUIRED COMPONENTS DDCore DDRec] - OPTIONAL XERCESC - INCLUDE_DIRS include ) +if(TARGET XercesC::XercesC) + link_libraries(XercesC::XercesC) +endif() -#----------------------------------------------------------------------------------- -dd4hep_add_plugin(SimpleDetector SOURCES src/*.cpp) -dd4hep_install_dir(compact DESTINATION ${CMAKE_INSTALL_PREFIX}/examples/ClientTests) +link_libraries(ROOT::Core ROOT::Geom ROOT::GenVector DD4hep::DDCore DD4hep::DDRec) + +new_dd4hep_add_plugin(SimpleDetector SOURCES src/*.cpp) +install(TARGETS SimpleDetector LIBRARY DESTINATION lib) +install(DIRECTORY compact DESTINATION examples/ClientTests) #----------------------------------------------------------------------------------- dd4hep_configure_scripts(SimpleDetector DEFAULT_SETUP WITH_TESTS) -- GitLab