diff --git a/CMakeLists.txt b/CMakeLists.txt index 977ae725de128a4855652fba4e891e581c8b8844..969d7718568514172804df80339b2515ff01a26a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,8 +59,8 @@ set(CMAKE_CXX_EXTENSIONS OFF) option(DD4HEP_USE_XERCESC "Enable 'Detector Builders' based on XercesC" 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) -option(BUILD_TESTING "Enable and build tests" ON) +option(DD4HEP_USE_LCIO "Build lcio extensions" OFF) +option(BUILD_TESTING "Enable and build tests" ON) option(CMAKE_MACOSX_RPATH "Build with rpath on macos" ON) ##################### @@ -123,10 +123,13 @@ add_subdirectory(DDParsers) add_subdirectory(DDCore) add_subdirectory(DDRec) add_subdirectory(DDDetectors) -add_subdirectory(DDG4) add_subdirectory(DDCond) add_subdirectory(DDAlign) add_subdirectory(DDEve) +if ( DD4HEP_USE_GEANT4 ) + add_subdirectory(DDG4) +endif() + dd4hep_enable_tests( DDTest ) add_subdirectory(UtilityApps) @@ -142,11 +145,11 @@ endif() ######################### # Configure and install # ######################### -configure_file(cmake/thisdd4hep.csh bin/thisdd4hep.csh @ONLY) -configure_file(cmake/thisdd4hep.sh bin/thisdd4hep.sh @ONLY) +configure_file(cmake/thisdd4hep.csh bin/thisdd4hep.csh @ONLY) +configure_file(cmake/thisdd4hep.sh bin/thisdd4hep.sh @ONLY) configure_file(cmake/thisdd4hep_only.csh bin/thisdd4hep_only.csh @ONLY) -configure_file(cmake/thisdd4hep_only.sh bin/thisdd4hep_only.sh @ONLY) -configure_file(cmake/run_test.sh bin/run_test.sh @ONLY) +configure_file(cmake/thisdd4hep_only.sh bin/thisdd4hep_only.sh @ONLY) +configure_file(cmake/run_test.sh bin/run_test.sh @ONLY) install(FILES ${CMAKE_BINARY_DIR}/bin/thisdd4hep.csh ${CMAKE_BINARY_DIR}/bin/thisdd4hep.sh DESTINATION bin ) install(FILES ${CMAKE_BINARY_DIR}/bin/thisdd4hep_only.csh ${CMAKE_BINARY_DIR}/bin/thisdd4hep_only.sh DESTINATION bin ) @@ -173,7 +176,7 @@ if(APPLE) SET ( ENV{DD4HEP_LIBRARY_PATH} $ENV{DYLD_LIBRARY_PATH} ) else() SET ( ENV{DD4HEP_LIBRARY_PATH} ${LD_LIBRARY_PATH} ) - SET ( DD4HEP_LIBRARY_PATH ${LD_LIBRARY_PATH} ) + SET ( DD4HEP_LIBRARY_PATH ${LD_LIBRARY_PATH} ) endif() ####################### diff --git a/DDCore/src/plugins/VisDensityProcessor.cpp b/DDCore/src/plugins/VisDensityProcessor.cpp index 3e43ccad23906b8d5c3f65012b656bdb9b5eb381..6679d181571df88650476145dad796661c7fc354 100644 --- a/DDCore/src/plugins/VisDensityProcessor.cpp +++ b/DDCore/src/plugins/VisDensityProcessor.cpp @@ -29,7 +29,7 @@ namespace dd4hep { public: Detector& description; std::string name; - VisAttr vis; + VisAttr minVis; double minDensity = 5e0; size_t numInactive = 0; bool show = false; @@ -76,27 +76,27 @@ VisDensityProcessor::VisDensityProcessor(Detector& desc) : description(desc), na /// Default destructor VisDensityProcessor::~VisDensityProcessor() { - if ( show && vis.isValid() ) { - printout(ALWAYS,name,"++ %8ld vis-attrs applied: %s", numInactive, vis.name()); + if ( show && minVis.isValid() ) { + printout(ALWAYS,name,"++ %8ld vis-attrs applied: %s", numInactive, minVis.name()); } } /// Print properties void VisDensityProcessor::_show() { - if ( show && vis.isValid() ) { + if ( show && minVis.isValid() ) { printout(ALWAYS,name, "++ SETUP Minimal material density: %.4f [g/cm3] Vis: %s", - minDensity,vis.name()); + minDensity,minVis.name()); } } /// Callback to output PlacedVolume information of an single Placement int VisDensityProcessor::operator()(PlacedVolume pv, int /* level */) { - Volume vol = pv.volume(); + Volume vol = pv.volume(); Material mat = vol.material(); - if ( vol.visAttributes().ptr() != vis.ptr() ) { + if ( vol.visAttributes().ptr() != minVis.ptr() ) { if ( mat.density() <= minDensity ) { - vol.setVisAttributes(vis); + vol.setVisAttributes(minVis); } ++numInactive; } @@ -110,7 +110,12 @@ static void* create_object(Detector& description, int argc, char** argv) { if ( argv[i] ) { if ( ::strncmp(argv[i],"-vis",6) == 0 ) { VisAttr vis = description.visAttributes(argv[++i]); - if ( vis.isValid() ) proc->vis = vis; + if ( vis.isValid() ) proc->minVis = vis; + continue; + } + else if ( ::strncmp(argv[i],"-min-vis",6) == 0 ) { + VisAttr vis = description.visAttributes(argv[++i]); + if ( vis.isValid() ) proc->minVis = vis; continue; } else if ( ::strncmp(argv[i],"-min-density",6) == 0 ) { @@ -130,6 +135,7 @@ static void* create_object(Detector& description, int argc, char** argv) { cout << "Usage: DD4hep_VisDensityProcessor -arg [-arg] \n" " -vis <name> Set the visualization attribute for inactive materials\n" + " -min-vis <name> Set the visualization attribute for inactive materials\n" " -min-density <number> Minimal density to show the volume. \n" " -show Print setup to output device (stdout) \n" "\tArguments given: " << arguments(argc,argv) << endl << flush; @@ -143,4 +149,3 @@ static void* create_object(Detector& description, int argc, char** argv) { // first argument is the type from the xml file DECLARE_DD4HEP_CONSTRUCTOR(DD4hep_VisDensityProcessor,create_object) - diff --git a/DDTest/CMakeLists.txt b/DDTest/CMakeLists.txt index 52859d728fe6560667bb1986aee52f7429fe84e2..2acc49aa3ed01386f6a647ddf8575f61f3a45a46 100644 --- a/DDTest/CMakeLists.txt +++ b/DDTest/CMakeLists.txt @@ -8,11 +8,18 @@ # For the list of contributors see $DD4hepINSTALL/doc/CREDITS. # #================================================================================= -dd4hep_package( DDTest - USES DDCore DDRec - OPTIONAL DDG4 - INCLUDE_DIRS include - INSTALL_INCLUDES include/DD4hep ) +if (DD4HEP_USE_GEANT4) + dd4hep_package( DDTest + USES DDCore DDRec + OPTIONAL DDG4 + INCLUDE_DIRS include + INSTALL_INCLUDES include/DD4hep ) +else() + dd4hep_package( DDTest + USES DDCore DDRec + INCLUDE_DIRS include + INSTALL_INCLUDES include/DD4hep ) +endif() dd4hep_add_test_reg ( test_example BUILD_EXEC REGEX_FAIL "TEST_FAILED" ) dd4hep_add_test_reg ( test_units BUILD_EXEC REGEX_FAIL "TEST_FAILED" @@ -29,6 +36,6 @@ dd4hep_add_test_reg ( test_cellDimensionsRPhi2 BUILD_EXEC REGEX_FAIL "TEST_FAILE dd4hep_add_test_reg ( test_segmentationHandles BUILD_EXEC REGEX_FAIL "TEST_FAILED" ) if (DD4HEP_USE_GEANT4) - dd4hep_add_test_reg ( test_EventReaders BUILD_EXEC REGEX_FAIL "TEST_FAILED" + dd4hep_add_test_reg ( test_EventReaders BUILD_EXEC REGEX_FAIL "TEST_FAILED" EXEC_ARGS ${CMAKE_CURRENT_SOURCE_DIR} ) endif()