diff --git a/DDCore/src/StandardPlugins.cpp b/DDCore/src/StandardPlugins.cpp new file mode 100644 index 0000000000000000000000000000000000000000..aa8b0af376a6de3cb5b249527cfd900ab40baf3e --- /dev/null +++ b/DDCore/src/StandardPlugins.cpp @@ -0,0 +1,50 @@ +// $Id:$ +//==================================================================== +// AIDA Detector description implementation for LCD +//-------------------------------------------------------------------- +// +// Standard plugins necessary for nearly everything. +// +// Author : M.Frank +// +//==================================================================== + +// Framework include files +#include "DD4hep/Factories.h" +#include "DD4hep/LCDD.h" +// ROOT includes +#include "TGeoManager.h" +#include "TGeoVolume.h" + +using namespace std; +using namespace DD4hep::Geometry; + +static long display(LCDD& /* lcdd */,int argc,char** argv) { + TGeoManager* mgr = gGeoManager; + const char* opt = "ogl"; + if ( argc > 0 ) { + opt = argv[0]; + } + if ( mgr ) { + mgr->SetVisLevel(4); + mgr->SetVisOption(1); + TGeoVolume* vol = mgr->GetTopVolume(); + if ( vol ) { + vol->Draw(opt); + return 1; + } + } + return 0; +} +DECLARE_APPLY(DD4hepGeometryDisplay,display); + +static long load_compact(LCDD& lcdd,int argc,char** argv) { + for(size_t j=0; j<argc; ++j) { + string input = argv[j]; + cout << "Processing compact input file : " << input << endl; + lcdd.fromCompact(input); + } + return 1; +} +DECLARE_APPLY(DD4hepCompactLoader,load_compact); + diff --git a/cmake/DD4hep.cmake b/cmake/DD4hep.cmake new file mode 100644 index 0000000000000000000000000000000000000000..4b101c9103d46c91997929c3c7e4a29febf1cc43 --- /dev/null +++ b/cmake/DD4hep.cmake @@ -0,0 +1,33 @@ +#--------------------------------------------------------------------------------------------------- +# dd4hep_generate_rootmap(library) +# +# Create the .rootmap file needed by the plug-in system. +#--------------------------------------------------------------------------------------------------- +function(dd4hep_generate_rootmap library) + find_package(ROOT QUIET) + set(rootmapfile ${CMAKE_SHARED_MODULE_PREFIX}${library}.rootmap) + + set(libname ${CMAKE_SHARED_MODULE_PREFIX}${library}${CMAKE_SHARED_MODULE_SUFFIX}) + add_custom_command(OUTPUT ${rootmapfile} + COMMAND cd ${LIBRARY_OUTPUT_PATH} && genmap + ${ROOT_genmap_CMD} -i ${libname} -o ${rootmapfile} + DEPENDS ${library}) + add_custom_target(${library}Rootmap ALL DEPENDS ${rootmapfile}) + # Notify the project level target + #gaudi_merge_files_append(Rootmap ${library}Rootmap ${CMAKE_CURRENT_BINARY_DIR}/${library}.rootmap) +endfunction() + +#--------------------------------------------------------------------------------------------------- +# dd4hep_install_library(library) +# +# Install library +#--------------------------------------------------------------------------------------------------- +function(dd4hep_install_library library) + set(installfile ${library}.install) + set(libname ${CMAKE_SHARED_MODULE_PREFIX}${library}${CMAKE_SHARED_MODULE_SUFFIX}) + add_custom_command(OUTPUT ${rootmapfile} + COMMAND echo + ${library} ${LIBRARY_OUTPUT_DIR} + DEPENDS ${library}) + add_custom_target(${library}Install ALL DEPENDS ${installfile}) +endfunction()