From aa680e7b1638631936c6d79d114410432305a693 Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Thu, 14 Nov 2019 19:59:45 +0100 Subject: [PATCH] Clear element table on startup --- DDCore/CMakeLists.txt | 2 +- DDCore/src/DetectorImp.cpp | 6 ++-- DDCore/src/Plugins.cpp | 12 ++++++-- examples/ClientTests/CMakeLists.txt | 2 +- examples/ClientTests/compact/CheckShape.xml | 29 +++---------------- examples/OpticalSurfaces/compact/OpNovice.xml | 17 +++-------- .../compact/ReadMaterialProperties.xml | 16 ++-------- 7 files changed, 25 insertions(+), 59 deletions(-) diff --git a/DDCore/CMakeLists.txt b/DDCore/CMakeLists.txt index 2a3ac3366..dc2026d94 100644 --- a/DDCore/CMakeLists.txt +++ b/DDCore/CMakeLists.txt @@ -76,7 +76,7 @@ target_link_libraries(DDCore PUBLIC DD4hep::DDParsers ROOT::Core ROOT::Rint ROOT::Tree ROOT::Physics ROOT::Geom ROOT::GenVector - ${XML_LIBRARIES} + ${XML_LIBRARIES} ${CMAKE_DL_LIBS} ) if(${CMAKE_VERSION} VERSION_GREATER 3.7.99) diff --git a/DDCore/src/DetectorImp.cpp b/DDCore/src/DetectorImp.cpp index 663782df7..f4156e445 100644 --- a/DDCore/src/DetectorImp.cpp +++ b/DDCore/src/DetectorImp.cpp @@ -174,13 +174,13 @@ DetectorImp::DetectorImp(const string& name) m_manager = new TGeoManager(name.c_str(), "Detector Geometry"); { gGeoManager = m_manager; -#if 0 //FIXME: eventually this should be set to 1 - needs fixes in examples ... +#if 1 //FIXME: eventually this should be set to 1 - needs fixes in examples ... TGeoElementTable* table = m_manager->GetElementTable(); table->TGeoElementTable::~TGeoElementTable(); new(table) TGeoElementTable(); // This will initialize the table without filling: - table->AddElement("VACUUM","VACUUM", 0, 0, 0.0); - table->Print(); + table->AddElement("VACUUM","VACUUM", 1, 1, 1e-15); + // table->Print(); #endif } if ( 0 == gGeoIdentity ) diff --git a/DDCore/src/Plugins.cpp b/DDCore/src/Plugins.cpp index 6326df2ef..d1c04044e 100644 --- a/DDCore/src/Plugins.cpp +++ b/DDCore/src/Plugins.cpp @@ -36,6 +36,10 @@ bool PluginService::setDebug(bool new_value) { return old_value; } +#if defined(__linux) && !defined(__APPLE__) +#define DD4HEP_PARSERS_NO_ROOT +#endif + #include "DD4hep/Printout.h" #if !defined(DD4HEP_PARSERS_NO_ROOT) #include "TSystem.h" @@ -94,9 +98,11 @@ namespace { { void* handle = 0; const char* plugin_name = ::getenv("DD4HEP_PLUGINMGR"); - if ( 0 == plugin_name ) { - plugin_name = "libDD4hepGaudiPluginMgr"; - } +#if defined(__linux) && !defined(__APPLE__) + if ( 0 == plugin_name ) plugin_name = "libDD4hepGaudiPluginMgr.so"; +#else + if ( 0 == plugin_name ) plugin_name = "libDD4hepGaudiPluginMgr"; +#endif #if defined(DD4HEP_PARSERS_NO_ROOT) handle = ::dlopen(plugin_name, RTLD_LAZY | RTLD_GLOBAL); #else diff --git a/examples/ClientTests/CMakeLists.txt b/examples/ClientTests/CMakeLists.txt index 226a71130..0c8393fc8 100644 --- a/examples/ClientTests/CMakeLists.txt +++ b/examples/ClientTests/CMakeLists.txt @@ -124,7 +124,7 @@ dd4hep_add_test_reg( ClientTests_DumpElements EXEC_ARGS geoPluginRun -input file:${ClientTestsEx_INSTALL}/compact/MiniTel.xml -volmgr -destroy -plugin DD4hep_ElementTable -type xml - REGEX_PASS "formula=\"UUB\" name=\"UUB\"" + REGEX_PASS "formula=\"Zr\" name=\"Zr\"" REGEX_FAIL "Exception" REGEX_FAIL "FAILED" ) diff --git a/examples/ClientTests/compact/CheckShape.xml b/examples/ClientTests/compact/CheckShape.xml index eb9130685..89176c114 100644 --- a/examples/ClientTests/compact/CheckShape.xml +++ b/examples/ClientTests/compact/CheckShape.xml @@ -12,32 +12,11 @@ </info> <steer open="false" close="false"/> - <materials> - <element Z="7" formula="N" name="N" > - <atom type="A" unit="g/mol" value="14.0068" /> - </element> - <element Z="8" formula="O" name="O" > - <atom type="A" unit="g/mol" value="15.9994" /> - </element> - <element Z="18" formula="Ar" name="Ar" > - <atom type="A" unit="g/mol" value="39.9477" /> - </element> + <includes> + <gdmlFile ref="${DD4hepINSTALL}/DDDetectors/compact/elements.xml"/> + <gdmlFile ref="${DD4hepINSTALL}/DDDetectors/compact/materials.xml"/> + </includes> - <material name="Air"> - <D type="density" unit="g/cm3" value="0.0012"/> - <fraction n="0.754" ref="N"/> - <fraction n="0.234" ref="O"/> - <fraction n="0.012" ref="Ar"/> - </material> - <!-- We model vakuum just as very thin air --> - <material name="Vacuum"> - <D type="density" unit="g/cm3" value="0.0000000001" /> - <fraction n="0.754" ref="N"/> - <fraction n="0.234" ref="O"/> - <fraction n="0.012" ref="Ar"/> - </material> - </materials> - <define> <constant name="world_side" value="300*cm"/> <constant name="world_x" value="world_side"/> diff --git a/examples/OpticalSurfaces/compact/OpNovice.xml b/examples/OpticalSurfaces/compact/OpNovice.xml index e12e5dbe2..9e84df55a 100644 --- a/examples/OpticalSurfaces/compact/OpNovice.xml +++ b/examples/OpticalSurfaces/compact/OpNovice.xml @@ -292,20 +292,11 @@ </ignore> </properties> - <materials> - <element Z="1" formula="H" name="H" > - <atom type="A" unit="g/mol" value="1.00794" /> - </element> - <element Z="8" formula="O" name="O" > - <atom type="A" unit="g/mol" value="15.9994" /> - </element> - <element Z="7" formula="N" name="N" > - <atom type="A" unit="g/mol" value="14.0068" /> - </element> - <element Z="18" formula="Ar" name="Ar" > - <atom type="A" unit="g/mol" value="39.9477" /> - </element> + <includes> + <gdmlFile ref="${DD4hepINSTALL}/DDDetectors/compact/elements.xml"/> + </includes> + <materials> <material name="Air"> <D type="density" unit="g/cm3" value="0.0012"/> <fraction n="0.754" ref="N"/> diff --git a/examples/OpticalSurfaces/compact/ReadMaterialProperties.xml b/examples/OpticalSurfaces/compact/ReadMaterialProperties.xml index 19d91f024..27a958969 100644 --- a/examples/OpticalSurfaces/compact/ReadMaterialProperties.xml +++ b/examples/OpticalSurfaces/compact/ReadMaterialProperties.xml @@ -193,20 +193,10 @@ </ignore> </properties> + <includes> + <gdmlFile ref="${DD4hepINSTALL}/DDDetectors/compact/elements.xml"/> + </includes> <materials> - <element Z="1" formula="H" name="H" > - <atom type="A" unit="g/mol" value="1.00794" /> - </element> - <element Z="8" formula="O" name="O" > - <atom type="A" unit="g/mol" value="15.9994" /> - </element> - <element Z="7" formula="N" name="N" > - <atom type="A" unit="g/mol" value="14.0068" /> - </element> - <element Z="18" formula="Ar" name="Ar" > - <atom type="A" unit="g/mol" value="39.9477" /> - </element> - <material name="Air"> <D type="density" unit="g/cm3" value="0.0012"/> <fraction n="0.754" ref="N"/> -- GitLab