diff --git a/CMakeLists.txt b/CMakeLists.txt index 498eec13ba2e3bd26b74698dd255f3b971ebd0dc..8152ced1a9c268a73e0af90e55eea55ebc33f869 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,11 +24,23 @@ IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) #---Options------------------------------------------------------------------------- + +#For backward compatibility for now +IF( DEFINED DD4HEP_WITH_GEANT4 ) + SET ( DD4HEP_USE_GEANT4 ${DD4HEP_WITH_GEANT4} ) +ENDIF() + +IF( DEFINED DD4HEP_WITH_GEAR ) + SET ( DD4HEP_USE_GEAR ${DD4HEP_WITH_GEAR} ) +ENDIF() + + + option(DD4HEP_USE_XERCESC "Enable 'Detector Builders' based on XercesC" OFF) option(DD4HEP_USE_PYROOT "Enable 'Detector Builders' based on PyROOT" OFF) # does not work (compile error) -option(DD4HEP_WITH_GEANT4 "Enable the simulation part based on Geant4" OFF) - -option(DD4HEP_WITH_GEAR "Build gear wrapper for backward compatibility" OFF) +option(DD4HEP_USE_GEANT4 "Enable the simulation part based on Geant4" OFF) +option(DD4HEP_USE_GEAR "Build gear wrapper for backward compatibility" OFF) +option(DD4HEP_USE_LCIO "Build lcio extensions" OFF) #--------------------------------------------------------------------------------------- @@ -43,8 +55,9 @@ include( DD4hepMacros ) #----------------------------- find_package(ROOT REQUIRED) + if(DD4HEP_USE_XERCESC) - find_package(XercesC) + find_package(XercesC REQUIRED) endif() #---Testing------------------------------------------------------------------------- @@ -81,11 +94,11 @@ add_subdirectory(DDSurfaces) add_subdirectory(DDRec) add_subdirectory(DDSense) -if(DD4HEP_WITH_GEANT4) +if(DD4HEP_USE_GEANT4) add_subdirectory(DDG4) #--- create a geant4 variables for the thisdd4hep.sh script - find_package( Geant4 ) + find_package( Geant4 REQUIRED ) get_filename_component(Geant4_ROOT "${Geant4_INCLUDE_DIR}/../../" ABSOLUTE) #----- if geant4 is build with external CLHEP we also need to export this fact @@ -94,7 +107,7 @@ if(DD4HEP_WITH_GEANT4) if( NOT "${CLHEP_POS}" STREQUAL "-1" ) - set( GEANT4_WITH_CLHEP 1 ) + set( GEANT4_USE_CLHEP 1 ) #---- use FindCLHEP shipped with geant4 ----------- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${Geant4_ROOT}/cmake/Modules ) @@ -103,13 +116,13 @@ if(DD4HEP_WITH_GEANT4) set( CLHEP_ROOT_DIR ${CLHEP_DIR} ) endif() - find_package( CLHEP REQUIRED) + find_package( CLHEP REQUIRED ) get_filename_component(CLHEP_LIBRARY_PATH "${CLHEP_LIBRARIES}" PATH) message( STATUS " *** geant4 was build with external CLHEP *** CLHEP_LIBRARY_PATH = ${CLHEP_LIBRARY_PATH}" ) else() - set( GEANT4_WITH_CLHEP 0 ) + set( GEANT4_USE_CLHEP 0 ) endif() endif() @@ -139,6 +152,15 @@ install(PROGRAMS ${CMAKE_BINARY_DIR}/run_test.sh #----------------------------------------------------------------------------------- display_std_variables() +IF( DEFINED DD4HEP_WITH_GEANT4) + MESSAGE ( WARNING "DD4HEP_WITH_GEANT4 is deprecated use DD4HEP_USE_GEANT4") +ENDIF() + +IF( DEFINED DD4HEP_WITH_GEAR ) + MESSAGE (WARNING "DD4HEP_WITH_GEAR is deprecated use DD4HEP_USE_GEAR") +ENDIF() + + ############################################################################## # generate and install following configuration files diff --git a/DDRec/CMakeLists.txt b/DDRec/CMakeLists.txt index e8dc9e11c33c4e0622db354526f6f5c4f83e949a..a04d2005acc143bb11d7d5078750b056202d1cfa 100644 --- a/DDRec/CMakeLists.txt +++ b/DDRec/CMakeLists.txt @@ -11,7 +11,7 @@ file(GLOB sources src/*.cpp) #--------------------------- GEAR wrappers for backward compatibility ----------- -if(DD4HEP_WITH_GEAR) +if(DD4HEP_USE_GEAR) find_package(GEAR REQUIRED COMPONENTS geartgeo) @@ -19,14 +19,14 @@ if(DD4HEP_WITH_GEAR) set(sources ${sources} src/gear/DDGear.cpp) - add_definitions("-D DD4HEP_WITH_GEAR") + add_definitions("-D DD4HEP_USE_GEAR") endif() #------------------------------------------------------------------------------------- add_library(DD4hepRec SHARED ${sources} ) -if(DD4HEP_WITH_GEAR) +if(DD4HEP_USE_GEAR) target_link_libraries(DD4hepRec ${ROOT_LIBRARIES} ${DDSegmentation_LIBRARIES} DD4hepCore Geom Reflex ${libraries} ${GEAR_LIBRARIES} ${GEAR_COMPONENT_LIBRARIES}) #------ binary ---------- @@ -40,7 +40,7 @@ if(DD4HEP_WITH_GEAR) else() target_link_libraries(DD4hepRec ${ROOT_LIBRARIES} ${DDSegmentation_LIBRARIES} DD4hepCore Geom Reflex ${libraries}) -endif(DD4HEP_WITH_GEAR) +endif(DD4HEP_USE_GEAR) SET(CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic -Wno-long-long") @@ -51,7 +51,7 @@ install(DIRECTORY include/DDRec DESTINATION include PATTERN ".svn" EXCLUDE ) -if(DD4HEP_WITH_GEAR) +if(DD4HEP_USE_GEAR) install(TARGETS DD4hepRec convertToGear RUNTIME DESTINATION bin LIBRARY DESTINATION lib diff --git a/DDTest/CMakeLists.txt b/DDTest/CMakeLists.txt index 21e4a03f408f5fc566fb22fb294e1768c2b748a7..85b3c8927258e7bbfcaae7373fa1c1d5f942c8bb 100644 --- a/DDTest/CMakeLists.txt +++ b/DDTest/CMakeLists.txt @@ -10,11 +10,11 @@ include_directories( ${CMAKE_SOURCE_DIR}/include ${ROOT_INCLUDE_DIR} ) -if(DD4HEP_WITH_GEANT4) +if(DD4HEP_USE_GEANT4) include_directories( ${CMAKE_SOURCE_DIR}/DDG4/include ) endif() -if(DD4HEP_WITH_GEANT4) +if(DD4HEP_USE_GEANT4) link_libraries(DD4hepG4 DD4hepCore DD4hepRec DDSegmentation ${ROOT_LIBRARIES} Reflex ${Geant4_LIBRARIES}) else() link_libraries(DD4hepCore DD4hepRec DDSegmentation ${ROOT_LIBRARIES} Reflex ${Geant4_LIBRARIES}) diff --git a/ReadMe.txt b/ReadMe.txt index aa78b9618b99644fca02983923e40522439f9da1..f3f6e929e482e6bbe692134501ae5ed28b6c9592 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -25,7 +25,7 @@ on the C++ XercesC parser, and another one based on Python and using the PyROOT Is the package that contains the conversion of DD4hep geometry into Geant4 geometry to be used for simulation. The conversion is currently based on the Virtual Geometry Modeler (VGM) package that is build internally when required. - The option DD4HEP_WITH_GEANT4:BOOL controls the building or not of this package that has the dependency + The option DD4HEP_USE_GEANT4:BOOL controls the building or not of this package that has the dependency to Geant4. The Geant4 installation needs to be located using the variable -DGeant4_DIR=<path to Geant4Config.cmake> - examples @@ -91,7 +91,7 @@ To build and run the simulation examples Geant4 will be required. -D INSTALL_DOC=on * build with geant4 support: - -D DD4HEP_WITH_GEANT4=on -D Geant4_DIR=__path_to_Geant4Config.cmake__ + -D DD4HEP_USE_GEANT4=on -D Geant4_DIR=__path_to_Geant4Config.cmake__ [note: you might have to update your environment beforehand to have all needed libraries in the shared lib search path (this will vary with OS, shell, etc.) e.g @@ -108,9 +108,9 @@ To build and run the simulation examples Geant4 will be required. -DDD4HEP_USE_PYROOT=ON - examples for building a 'complete' DD4hep: - cmake -D DD4HEP_WITH_GEANT4=1 -DDD4HEP_USE_BOOST=ON -DDD4HEP_USE_LCIO=ON -DBOOST_ROOT=/data/ilcsoft/boost/1.55.0 -DBUILD_TESTING=On .. + cmake -D DD4HEP_USE_GEANT4=1 -DDD4HEP_USE_BOOST=ON -DDD4HEP_USE_LCIO=ON -DBOOST_ROOT=/data/ilcsoft/boost/1.55.0 -DBUILD_TESTING=On .. (if geant4 was built with external CLHEP, add: -D CLHEP_DIR=_path_to_CLHEP ) - cmake -D DD4HEP_WITH_GEANT4=1 -DGeant4_DIR=/data/ilcsoft/geant4/9.6.p01/lib/Geant4-9.6.1 -DDD4HEP_USE_BOOST=ON -DDD4HEP_USE_LCIO=ON -DBOOST_ROOT=/data/ilcsoft/boost/1.55.0 -DBUILD_TESTING=On -D CLHEP_DIR=/data/ilcsoft/HEAD/CLHEP/2.1.3.1 .. + cmake -D DD4HEP_USE_GEANT4=1 -DGeant4_DIR=/data/ilcsoft/geant4/9.6.p01/lib/Geant4-9.6.1 -DDD4HEP_USE_BOOST=ON -DDD4HEP_USE_LCIO=ON -DBOOST_ROOT=/data/ilcsoft/boost/1.55.0 -DBUILD_TESTING=On -D CLHEP_DIR=/data/ilcsoft/HEAD/CLHEP/2.1.3.1 .. - Setup the environment for running diff --git a/cmake/DD4hepConfig.cmake.in b/cmake/DD4hepConfig.cmake.in index 1d469348e8872aa8787e6a12d2b3ae16fff81883..03cd342e02e65d629fe23c678c77aec3db9b5b46 100644 --- a/cmake/DD4hepConfig.cmake.in +++ b/cmake/DD4hepConfig.cmake.in @@ -45,12 +45,12 @@ INCLUDE( ${DD4hep_ROOT}/cmake/DD4hepMacros.cmake ) # only standard libraries should be passed as arguments to CHECK_PACKAGE_LIBS # additional components are set by cmake in variable PKG_FIND_COMPONENTS # first argument should be the package name -if(@DD4HEP_WITH_GEANT4@) +if(@DD4HEP_USE_GEANT4@) CHECK_PACKAGE_LIBS( DD4hep DD4hepCore DDSegmentation DD4hepRec DD4hepPlugins DD4hepG4 ) #--- if geant 4 was built with CLHEP we need to export this to client packages - if( @GEANT4_WITH_CLHEP@) - set(GEANT4_WITH_CLHEP 1 ) + if( @GEANT4_USE_CLHEP@) + set(GEANT4_USE_CLHEP 1 ) endif() else() diff --git a/cmake/thisdd4hep.sh b/cmake/thisdd4hep.sh index 12bbc741d13112a4bf4a91ca7f3804992eccce8d..adb14da5db1822b339beba8138e79025d68fb19f 100644 --- a/cmake/thisdd4hep.sh +++ b/cmake/thisdd4hep.sh @@ -22,7 +22,7 @@ fi #----------- source the ROOT environment first source @ROOT_ROOT@/bin/thisroot.sh -if [ @DD4HEP_WITH_GEANT4@ ] +if [ @DD4HEP_USE_GEANT4@ ] then export G4INSTALL=@Geant4_ROOT@ export G4ENV_INIT=@Geant4_ROOT@/bin/geant4.sh @@ -32,7 +32,7 @@ then #---- if geant4 was built with external CLHEP we have to extend the dynamic search path - if [ @GEANT4_WITH_CLHEP@ ] ; then + if [ @GEANT4_USE_CLHEP@ ] ; then if [ @USE_DYLD@ ] then export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:@CLHEP_LIBRARY_PATH@ diff --git a/doc/build.sh b/doc/build.sh index 4570fe22f1adfd3ad5ef526dc5d5156d8d99a23c..e552f8aa107247c56ed8cd767f8b7a8c8575b4dc 100644 --- a/doc/build.sh +++ b/doc/build.sh @@ -37,7 +37,7 @@ then echo "`pwd`"; mkdir ${BUILD_DIR}; cd ${BUILD_DIR}; - cmake -DCMAKE_BUILD_TYPE=Debug -DDD4HEP_WITH_GEANT4=OFF -DDD4HEP_USE_PYROOT=OFF ${BUILD_DIR}/DD4hep; + cmake -DCMAKE_BUILD_TYPE=Debug -DDD4HEP_USE_GEANT4=OFF -DDD4HEP_USE_PYROOT=OFF ${BUILD_DIR}/DD4hep; make -j 5; . thisdd4hep.sh; export LD_LIBRARY_PATH=${BUILD_DIR}/lib:${BUILD_DIR}/../DD4hep/examples/CLICSiD/lib:$LD_LIBRARY_PATH; diff --git a/doc/cmake.cmds b/doc/cmake.cmds index c80469a5ce9aace4b96730872f32176135af4946..42db771fcd8c3383e485d576b909a7aadbe7ee5e 100644 --- a/doc/cmake.cmds +++ b/doc/cmake.cmds @@ -1,12 +1,12 @@ # # ++++ Build DD4hep (simplest) # -cmake -DCMAKE_BUILD_TYPE=Debug -DDD4HEP_WITH_GEANT4=OFF -DDD4HEP_USE_PYROOT=OFF ../DD4hep +cmake -DCMAKE_BUILD_TYPE=Debug -DDD4HEP_USE_GEANT4=OFF -DDD4HEP_USE_PYROOT=OFF ../DD4hep # # ++++ Build DD4hep with XERCES # cmake -DCMAKE_BUILD_TYPE=Debug \ --DDD4HEP_WITH_GEANT4=OFF -DDD4HEP_USE_PYROOT=OFF \ +-DDD4HEP_USE_GEANT4=OFF -DDD4HEP_USE_PYROOT=OFF \ -DDD4HEP_USE_XERCESC=ON -DXERCESC_ROOT_DIR=${XERCESCSYS} \ ../DD4hep # @@ -14,7 +14,7 @@ cmake -DCMAKE_BUILD_TYPE=Debug \ # ++++ Build DD4hep with XERCES and GEANT4 # cmake -DCMAKE_BUILD_TYPE=Debug \ --DDD4HEP_WITH_GEANT4=ON -DGeant4_ROOT_DIR=${G4SYS} -DCLHEP_ROOT_DIR=${CLHEPSYS} \ +-DDD4HEP_USE_GEANT4=ON -DGeant4_ROOT_DIR=${G4SYS} -DCLHEP_ROOT_DIR=${CLHEPSYS} \ -DDD4HEP_USE_XERCESC=ON -DXERCESC_ROOT_DIR=${XERCESCSYS} \ -DDD4HEP_USE_PYROOT=OFF \ ../DD4hep @@ -23,7 +23,7 @@ cmake -DCMAKE_BUILD_TYPE=Debug \ # ++++ Build DD4hep with GEANT4 (no Xerces) # cmake -DCMAKE_BUILD_TYPE=Debug \ --DDD4HEP_WITH_GEANT4=ON -DGeant4_ROOT_DIR=${G4SYS} \ +-DDD4HEP_USE_GEANT4=ON -DGeant4_ROOT_DIR=${G4SYS} \ -DCLHEP_ROOT_DIR=${CLHEPSYS} -DDD4HEP_USE_PYROOT=OFF \ ../DD4hep # diff --git a/examples/ILDExDet/CMakeLists.txt b/examples/ILDExDet/CMakeLists.txt index d4245ba8b2ca9c0b0cc8968de3b8d1720b193913..4cea5323638c358e89fef9c7bc65ff9f0ab10458 100644 --- a/examples/ILDExDet/CMakeLists.txt +++ b/examples/ILDExDet/CMakeLists.txt @@ -43,7 +43,7 @@ set( ROOT_COMPONENT_LIBRARIES Geom Reflex) -if(DD4HEP_WITH_GEAR) +if(DD4HEP_USE_GEAR) find_package( GEAR REQUIRED COMPONENTS ) @@ -53,7 +53,7 @@ if(DD4HEP_WITH_GEAR) endforeach(lp) #message( STATUS " *** pathes : ${External_LIBRARY_DIRS} " ) - add_definitions("-D DD4HEP_WITH_GEAR") + add_definitions("-D DD4HEP_USE_GEAR") endif() diff --git a/examples/ILDExDet/src/ILDExSIT_geo.cpp b/examples/ILDExDet/src/ILDExSIT_geo.cpp index b5ef4189170f81b69177d3ff0e1966e299986114..52a04be4b3b206ca3b6de5a9196e77c49b14681c 100644 --- a/examples/ILDExDet/src/ILDExSIT_geo.cpp +++ b/examples/ILDExDet/src/ILDExSIT_geo.cpp @@ -9,7 +9,7 @@ #include "DD4hep/DetFactoryHelper.h" -#ifdef DD4HEP_WITH_GEAR +#ifdef DD4HEP_USE_GEAR #include "DDRec/DDGear.h" #include "gearimpl/ZPlanarParametersImpl.h" #endif @@ -30,7 +30,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { PlacedVolume pv; -#ifdef DD4HEP_WITH_GEAR +#ifdef DD4HEP_USE_GEAR //--------------- gear: create gear::ZPlanarParameters and add them as Extension gear::ZPlanarParametersImpl* gearZPlanar = new gear::ZPlanarParametersImpl( gear::ZPlanarParameters::HYBRID , 0.0, 0.0, 0.0, 0.0, 0.0 ) ; // ZPlanarParametersImpl( int type, double shellInnerRadius, double shellOuterRadius, double shellHalfLength, double shellGap, double shellRadLength ) ; @@ -136,7 +136,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { } -#ifdef DD4HEP_WITH_GEAR +#ifdef DD4HEP_USE_GEAR //----------------- gear --------------------------------------------- double ladderRadLength = suppmat->GetMaterial()->GetRadLen() /dd4hep::mm ; double sensitiveRadLength = sensmat->GetMaterial()->GetRadLen() /dd4hep::mm ; diff --git a/examples/ILDExDet/src/ILDExTPC_geo.cpp b/examples/ILDExDet/src/ILDExTPC_geo.cpp index 353b3ba7278636137c015d8dc391fc84c648e74f..041b7135e1839cd7d1ecf87971c7dec976956ef0 100644 --- a/examples/ILDExDet/src/ILDExTPC_geo.cpp +++ b/examples/ILDExDet/src/ILDExTPC_geo.cpp @@ -19,7 +19,7 @@ #include "TPCData.h" -#ifdef DD4HEP_WITH_GEAR +#ifdef DD4HEP_USE_GEAR #include "DDRec/DDGear.h" #include "gearimpl/TPCParametersImpl.h" #include "gearimpl/FixedPadSizeDiskLayout.h" @@ -256,7 +256,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { }//subdetectors tpc_vol.setAttributes(lcdd,x_det.regionStr(),x_det.limitsStr(),x_det.visStr()); -#ifdef DD4HEP_WITH_GEAR +#ifdef DD4HEP_USE_GEAR //--------------- create gear::TPCParameters and add them as Extension // GearTPCParameters* gearTPC = new GearTPCParameters( g_driftlength , gear::PadRowLayout2D::POLAR ) ; gear::TPCParametersImpl* gearTPC = new gear::TPCParametersImpl( g_driftlength , gear::PadRowLayout2D::POLAR ) ; diff --git a/examples/ILDExDet/src/ILDExVXD_geo.cpp b/examples/ILDExDet/src/ILDExVXD_geo.cpp index 1240eff0a49b5657f3a612bcab0f777f0fda2287..485593b67bd27a0e7845d27648a5b26591bcdbcf 100644 --- a/examples/ILDExDet/src/ILDExVXD_geo.cpp +++ b/examples/ILDExDet/src/ILDExVXD_geo.cpp @@ -9,7 +9,7 @@ #include "DD4hep/DetFactoryHelper.h" #include "VXDData.h" -#ifdef DD4HEP_WITH_GEAR +#ifdef DD4HEP_USE_GEAR #include "DDRec/DDGear.h" #include "gearimpl/ZPlanarParametersImpl.h" #endif @@ -43,7 +43,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { vxd_data->id = x_det.id(); -#ifdef DD4HEP_WITH_GEAR +#ifdef DD4HEP_USE_GEAR //--------------- gear: create gear::ZPlanarParameters and add them as Extension gear::ZPlanarParametersImpl* gearZPlanar = new gear::ZPlanarParametersImpl( gear::ZPlanarParameters::CCD , 0.0, 0.0, 0.0, 0.0, 0.0 ) ; // ZPlanarParametersImpl( int type, double shellInnerRadius, double shellOuterRadius, double shellHalfLength, double shellGap, double shellRadLength ) ; @@ -254,7 +254,7 @@ static Ref_t create_element(LCDD& lcdd, xml_h e, SensitiveDetector sens) { } vxd.setVisAttributes(lcdd, x_det.visStr(),laddervol); -#ifdef DD4HEP_WITH_GEAR +#ifdef DD4HEP_USE_GEAR //----------------- gear --------------------------------------------- double ladderRadLength = suppmat->GetMaterial()->GetRadLen() /dd4hep::mm ; double sensitiveRadLength = sensmat->GetMaterial()->GetRadLen() /dd4hep::mm ; diff --git a/examples/noviceN04/README b/examples/noviceN04/README index 85a4256eeb29945b78a9e004de1922eff0bf6fe3..31ef6506d51db23bce20118e42e41cc84095d6b3 100644 --- a/examples/noviceN04/README +++ b/examples/noviceN04/README @@ -19,7 +19,7 @@ Run: geoDisplay ../compact/N04.xml -#simulate w/ ILD example (needs DD4HEP_WITH_GEANT4 ) +#simulate w/ ILD example (needs DD4HEP_USE_GEANT4 ) ILDExSimu file:../compact/N04.xml file:../compact/geant4.xml ../run1.mac