diff --git a/DDDigi/CMakeLists.txt b/DDDigi/CMakeLists.txt index cc08ec210e03aaa5a2b66eb8ef7c1f9bcb3b1554..35e7513a95c2d4fd92920f6ac636998ea60ebeef 100644 --- a/DDDigi/CMakeLists.txt +++ b/DDDigi/CMakeLists.txt @@ -53,13 +53,30 @@ dd4hep_add_plugin(DDDigiPlugins USES DD4hep::DDDigi ) +#--------------------------- Plugin library to read input from DDG4 -------------- +if (DD4HEP_USE_GEANT4) + dd4hep_add_dictionary(G__DDDigi_DDG4_IO + SOURCES ../DDCore/include/ROOT/Warnings.h ddg4/IO.cpp + LINKDEF ../DDCore/include/ROOT/LinkDef.h + USES DD4hep::DDG4 + ) + + dd4hep_add_plugin(DDDigi_DDG4_IO + SOURCES ddg4/*.cpp + GENERATED G__DDDigi_DDG4_IO.cxx + USES DD4hep::DDDigi + ) +else() + dd4hep_print( "|++> Geant4 not used. DDDigi will not be able to read DDG4 output.") +endif() + #---Package installation procedure(s) ---------------------------------------------- -set_target_properties(DDDigi DDDigiPlugins PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) +set_target_properties(DDDigi DDDigiPlugins DDDigi_DDG4_IO PROPERTIES VERSION ${DD4hep_VERSION} SOVERSION ${DD4hep_SOVERSION}) file(GLOB DDigi_python python/*.py python/*.C) install(FILES ${DDigi_python} DESTINATION ${DD4HEP_PYTHON_INSTALL_DIR}) -install(TARGETS DDDigi DDDigiPlugins EXPORT DD4hep +install(TARGETS DDDigi DDDigiPlugins DDDigi_DDG4_IO EXPORT DD4hep ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) diff --git a/DDDigi/plugins/DigiDDG4Input.cpp b/DDDigi/ddg4/DigiDDG4Input.cpp similarity index 100% rename from DDDigi/plugins/DigiDDG4Input.cpp rename to DDDigi/ddg4/DigiDDG4Input.cpp diff --git a/DDDigi/ddg4/IO.cpp b/DDDigi/ddg4/IO.cpp new file mode 100644 index 0000000000000000000000000000000000000000..982035b8187c5d91056da04bcab815402843fc5f --- /dev/null +++ b/DDDigi/ddg4/IO.cpp @@ -0,0 +1,21 @@ +//========================================================================== +// AIDA Detector description implementation +//-------------------------------------------------------------------------- +// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) +// All rights reserved. +// +// For the licensing terms see $DD4hepINSTALL/LICENSE. +// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. +// +// \author Markus Frank +// \date 2016-03-10 +// \version 1.0 +// +//========================================================================== + +/// Define this to build a standalonle dictionary: +#define __DDG4_STANDALONE_DICTIONARIES__ + +// C/C++ include files +#include <DDG4/DDG4Dict.h> + diff --git a/DDDigi/python/dddigi.py b/DDDigi/python/dddigi.py index 28d83b23743f3aed7ffa3b447429b53d4bd1195f..0702a86db43c938e45798702b52d5eaaf604d724 100644 --- a/DDDigi/python/dddigi.py +++ b/DDDigi/python/dddigi.py @@ -40,10 +40,10 @@ def loadDDDigi(): if result < 0: raise Exception('DDDigi.py: Failed to load the DDDigi library libDDDigiPlugins: ' + gSystem.GetErrorStr()) logger.info('DDDigi.py: Successfully loaded DDDigi plugin library libDDDigiPlugins!') - result = gSystem.Load("libDDG4Plugins") + result = gSystem.Load("libDDDigi_DDG4_IO") if result < 0: - raise Exception('DDDigi.py: Failed to load the DDG4 library libDDG4Plugins: ' + gSystem.GetErrorStr()) - logger.info('DDDigi.py: Successfully loaded DDG4 plugin library libDDG4Plugins!') + raise Exception('DDDigi.py: Failed to load the DDG4 IO library libDDDigi_DDG4_IO: ' + gSystem.GetErrorStr()) + logger.info('DDDigi.py: Successfully loaded DDG4 IO plugin library libDDDigi_DDG4_IO!') from ROOT import dd4hep as module return module diff --git a/DDDigi/src/DigiData.cpp b/DDDigi/src/DigiData.cpp index 2f76d9c135dd3e89dbb6dce573daf3c9fa13234e..bf569485255da9d9836ac9094d0bacaf9925efd5 100644 --- a/DDDigi/src/DigiData.cpp +++ b/DDDigi/src/DigiData.cpp @@ -114,7 +114,12 @@ std::size_t dd4hep::digi::ParticleMapping::merge(ParticleMapping&& updates) { } void dd4hep::digi::ParticleMapping::push(Key::key_type k, Particle&& part) { - auto ret = this->emplace(k, std::move(part)).second; +#if defined(__GNUC__) && (__GNUC__ < 10) + /// Lower compiler version have a bad implementation of std::any + bool ret = false; +#else + bool ret = this->emplace(k, std::move(part)).second; +#endif if ( !ret ) { Key key(k); except("ParticleMapping","Error in particle map. Duplicate ID: mask:%04X Number:%d", diff --git a/DDEve/DDEve/DDG4IO.C b/DDEve/DDEve/DDG4IO.C index d1ead06ce50f1501271ce8667e95a491e5a95d84..4620b60c8936781d42a04a54db68f979ad7dd41e 100644 --- a/DDEve/DDEve/DDG4IO.C +++ b/DDEve/DDEve/DDG4IO.C @@ -29,8 +29,8 @@ #endif // C/C++ include files -#include "DDG4/DDG4Dict.h" -#include "DDEve/DDEveEventData.h" +#include <DDG4/DDG4Dict.h> +#include <DDEve/DDEveEventData.h> namespace { class DDG4IO {}; } @@ -48,8 +48,8 @@ namespace dd4hep { namespace sim { #include <typeinfo> // ROOT include files -#include "TROOT.h" -#include "TClass.h" +#include <TROOT.h> +#include <TClass.h> namespace { template <typename T> T* _fill(dd4hep::sim::Geant4HitData* ptr, dd4hep::DDEveHit* target) { @@ -119,7 +119,7 @@ namespace { } -#include "DD4hep/Factories.h" +#include <DD4hep/Factories.h> DECLARE_CONSTRUCTOR(DD4hep_DDEve_DDG4HitAccess,_convertHit) DECLARE_CONSTRUCTOR(DD4hep_DDEve_DDG4ParticleAccess,_convertParticle) #endif diff --git a/DDG4/include/DDG4/DDG4Dict.h b/DDG4/include/DDG4/DDG4Dict.h index 68f15ef1a9988f1d1f9168ae746f64d01e5f81ef..4b5d3084ac08adcc089bb5184ef44b5809aa09c8 100644 --- a/DDG4/include/DDG4/DDG4Dict.h +++ b/DDG4/include/DDG4/DDG4Dict.h @@ -81,13 +81,11 @@ namespace { class DDG4Dict {}; } #pragma link C++ function operator!=( const std::map<int,dd4hep::sim::Geant4Particle*>::iterator&, const std::map<int,dd4hep::sim::Geant4Particle*>::iterator& ); #endif -//#pragma link C++ class type_info; - /// Dictionaires for basic Hit data structures #pragma link C++ class dd4hep::sim::Geant4HitData+; namespace dd4hep { namespace sim { typedef Geant4HitData* Geant4HitData_ptr_t; }} -#pragma link C++ typedef Geant4HitData_ptr_t; +#pragma link C++ typedef dd4hep::sim::Geant4HitData_ptr_t; #pragma link C++ class std::vector<dd4hep::sim::Geant4HitData_ptr_t>+; #pragma link C++ class std::vector<dd4hep::sim::Geant4HitData*>+; #pragma link C++ class dd4hep::sim::Geant4HitData::Contribution+;