From 37222dc7ce7b116389a9f9c9219bcea7ffc5fdf2 Mon Sep 17 00:00:00 2001
From: Pere Mato <Pere.Mato@cern.ch>
Date: Thu, 13 Dec 2012 14:28:44 +0000
Subject: [PATCH] Deleted DDGeant4 package that is now obsolete. Updated
 Simulation examples. Fixed few warnings

---
 CMakeLists.txt                                |   4 +-
 DDCore/CMakeLists.txt                         |   3 +-
 DDCore/src/XML/tinyxmlparser_inl.h            |   2 +-
 DDExamples/CLICSiD/CMakeLists.txt             |   2 +-
 DDExamples/CLICSiDSimu/CLICSiDSimu.cpp        |  58 +--
 DDExamples/CLICSiDSimu/CMakeLists.txt         |   9 +-
 .../include/VersatileDiskRowLayoutSeg.h       |   2 +-
 .../src/VersatileDiskRowLayoutSeg.cpp         |   2 +-
 DDExamples/ILDExSimu/CMakeLists.txt           |  11 +-
 DDExamples/ILDExSimu/ILDExSimu.cpp            |  18 +-
 .../include/DDG4/Geant4DetectorConstruction.h |  31 ++
 DDG4/src/Geant4DetectorConstruction.cpp       |  36 ++
 DDGeant4/AddCMakeFiles.patch                  | 330 ------------------
 DDGeant4/CMakeLists.txt                       |  39 ---
 DDGeant4/include/G4DetectorConstruction.h     |  27 --
 DDGeant4/src/G4DetectorConstruction.cpp       |  38 --
 16 files changed, 115 insertions(+), 497 deletions(-)
 create mode 100644 DDG4/include/DDG4/Geant4DetectorConstruction.h
 create mode 100644 DDG4/src/Geant4DetectorConstruction.cpp
 delete mode 100644 DDGeant4/AddCMakeFiles.patch
 delete mode 100644 DDGeant4/CMakeLists.txt
 delete mode 100644 DDGeant4/include/G4DetectorConstruction.h
 delete mode 100644 DDGeant4/src/G4DetectorConstruction.cpp

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bd2574afe..f1aa76595 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,8 +35,8 @@ add_subdirectory(DDExamples/ILDExDisplay)
 add_subdirectory(DDExamples/ILDExReco)
 add_subdirectory(DDExamples/ILDExTest)
 if(DD4HEP_WITH_GEANT4)
-#add_subdirectory(DDExamples/CLICSiDSimu)
-#  add_subdirectory(DDExamples/ILDExSimu)
+  add_subdirectory(DDExamples/CLICSiDSimu)
+  add_subdirectory(DDExamples/ILDExSimu)
 endif()
 
 #---Configuration-------------------------------------------------------------------
diff --git a/DDCore/CMakeLists.txt b/DDCore/CMakeLists.txt
index c12345980..bfe5575a3 100644
--- a/DDCore/CMakeLists.txt
+++ b/DDCore/CMakeLists.txt
@@ -22,10 +22,9 @@ if(DD4HEP_USE_XERCESC)
   file(GLOB xmlsources src/XML/*.cpp src/compact/*.cpp)
   list(APPEND sources ${xmlsources})
   add_definitions(-DDD4HEP_USE_XERCESC)
-  set(libraries ${libraries} Reflex)
 endif()
 
 add_library(DD4hepCore SHARED ${sources})
-target_link_libraries(DD4hepCore ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} Geom ${libraries})
+target_link_libraries(DD4hepCore ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} Geom Reflex ${libraries})
 
 
diff --git a/DDCore/src/XML/tinyxmlparser_inl.h b/DDCore/src/XML/tinyxmlparser_inl.h
index df0d4358c..30e031eff 100644
--- a/DDCore/src/XML/tinyxmlparser_inl.h
+++ b/DDCore/src/XML/tinyxmlparser_inl.h
@@ -362,7 +362,7 @@ const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding )
 	}
 	else
 	{
-		while ( *p && IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' )
+		while ( ( *p && IsWhiteSpace( *p ) ) || *p == '\n' || *p =='\r' )
 			++p;
 	}
 
diff --git a/DDExamples/CLICSiD/CMakeLists.txt b/DDExamples/CLICSiD/CMakeLists.txt
index a481bf1bb..386006aca 100644
--- a/DDExamples/CLICSiD/CMakeLists.txt
+++ b/DDExamples/CLICSiD/CMakeLists.txt
@@ -9,6 +9,6 @@ if(DD4HEP_USE_XERCESC)
   add_definitions(-DDD4HEP_USE_XERCESC)
   file(GLOB sources src/*.cpp)
   add_library(CLICSiD SHARED ${sources})
-  target_link_libraries(CLICSiD DD4hepCore ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${libraries})
+  target_link_libraries(CLICSiD DD4hepCore ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES})
 endif()
 
diff --git a/DDExamples/CLICSiDSimu/CLICSiDSimu.cpp b/DDExamples/CLICSiDSimu/CLICSiDSimu.cpp
index 99ed54ade..f47134a8a 100644
--- a/DDExamples/CLICSiDSimu/CLICSiDSimu.cpp
+++ b/DDExamples/CLICSiDSimu/CLICSiDSimu.cpp
@@ -1,9 +1,9 @@
-#define G4UI_USE
-#define G4VIS_USE
-#define G4INTY_USE_XT 
-#define G4VIS_USE_OPENGL 
-#define G4UI_USE_TCSH 
-#define G4VIS_USE_OPENGLX
+//#define G4UI_USE
+//#define G4VIS_USE
+//#define G4INTY_USE_XT
+//#define G4VIS_USE_OPENGL
+//#define G4UI_USE_TCSH
+//#define G4VIS_USE_OPENGLX
 
 #include "G4PVPlacement.hh"
 #include "G4RunManager.hh"
@@ -28,55 +28,19 @@
 #include "SteppingVerbose.h"
 
 
-#include "G4VUserDetectorConstruction.hh"
-namespace DD4hep {
-  namespace Geometry {    class LCDD;  }
-
-  class DetectorConstruction : public G4VUserDetectorConstruction  {
-  public:
-    
-    DetectorConstruction(Geometry::LCDD& lcdd);
-    virtual ~DetectorConstruction() {    }
-    G4VPhysicalVolume* Construct();
-  private:
-    Geometry::LCDD&    m_lcdd;
-    G4VPhysicalVolume* m_world;
-  }; 
-}
-
 #include "DD4hep/LCDD.h"
-#include "TGeoManager.h"
-#include "DDG4/Geant4Converter.h"
-#include "G4GDMLParser.hh"
+#include "DDG4/Geant4DetectorConstruction.h"
+
 
 using namespace std;
-using namespace DD4hep;
 using namespace DD4hep::Geometry;
+using namespace DD4hep::Simulation;
 
-DD4hep::DetectorConstruction::DetectorConstruction(Geometry::LCDD& lcdd) 
-  : m_lcdd(lcdd), m_world(0)
-{
-}
-
-G4VPhysicalVolume* DD4hep::DetectorConstruction::Construct() {
-  typedef Simulation::Geant4Converter Geant4Converter;
-  TGeoNode* top = gGeoManager->GetTopNode();
-  Geant4Converter& conv = Geant4Converter::instance();
-  DetElement world = m_lcdd.world();
-  conv.create(world);
-  Geant4Converter::G4GeometryInfo& info = conv.data();
-  m_world = info.g4Placements[top];
-  if ( ::getenv("DUMP_GDML") ) {
-    G4GDMLParser parser;
-    parser.Write("detector.gdml",m_world);
-  }
-  return m_world;
-}
 
 int main(int argc,char** argv)   {
   // Choose the Random engine
   CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
-  Geometry::LCDD& lcdd = LCDD::getInstance();
+  LCDD& lcdd = LCDD::getInstance();
   
   for(int i=1; i<argc-1;++i) {
     // We need to construct the geometry at this level already
@@ -90,7 +54,7 @@ int main(int argc,char** argv)   {
   G4RunManager* runManager = new G4RunManager;
 
   // Get the detector constructed
-  DD4hep::DetectorConstruction* detector = new DD4hep::DetectorConstruction(lcdd);
+  Geant4DetectorConstruction* detector = new Geant4DetectorConstruction(lcdd);
 
   runManager->SetUserInitialization(detector);
   
diff --git a/DDExamples/CLICSiDSimu/CMakeLists.txt b/DDExamples/CLICSiDSimu/CMakeLists.txt
index d515f7047..daf48f561 100644
--- a/DDExamples/CLICSiDSimu/CMakeLists.txt
+++ b/DDExamples/CLICSiDSimu/CMakeLists.txt
@@ -7,8 +7,15 @@ if(NOT Geant4_clhep_FOUND)
   set(Geant4_LIBRARIES ${Geant4_LIBRARIES} ${CLHEP_LIBRARIES})
 endif()
 
+
+
+if(Geant4_gdml_FOUND)
+  add_definitions(-DGEANT4_HAS_GDML)
+endif()
+
 if(DD4HEP_USE_XERCESC)
   add_definitions(-DDD4HEP_USE_XERCESC)
+  set(libraries CLICSiD ${XERCESC_LIBRARIES})
 endif()
 
 include_directories( ${CMAKE_SOURCE_DIR}/DDCore/include
@@ -20,5 +27,5 @@ include_directories( ${CMAKE_SOURCE_DIR}/DDCore/include
 
 file(GLOB sources src/*.cpp)
 add_executable(CLICSiDSimu CLICSiDSimu.cpp ${sources})
-target_link_libraries(CLICSiDSimu DD4hepCore DD4hepG4 CLICSiD ${XERCESC_LIBRARIES} ${Geant4_LIBRARIES})
+target_link_libraries(CLICSiDSimu DD4hepCore DD4hepG4 ${libraries} ${Geant4_LIBRARIES})
 
diff --git a/DDExamples/ILDExDet/include/VersatileDiskRowLayoutSeg.h b/DDExamples/ILDExDet/include/VersatileDiskRowLayoutSeg.h
index 3e3a62008..8c59de8f3 100644
--- a/DDExamples/ILDExDet/include/VersatileDiskRowLayoutSeg.h
+++ b/DDExamples/ILDExDet/include/VersatileDiskRowLayoutSeg.h
@@ -28,7 +28,7 @@ namespace DD4hep {
     struct VersatileDiskRowLayoutData{
       VersatileDiskRowLayoutData();
       void addRow(int nPads, double padPitch, double rowHeight, double offset);
-      int setRMin(int rmin);
+      void setRMin(int rmin);
       std::vector<Row> _rows ;
       double _rMin;
       int _nPads;
diff --git a/DDExamples/ILDExDet/src/VersatileDiskRowLayoutSeg.cpp b/DDExamples/ILDExDet/src/VersatileDiskRowLayoutSeg.cpp
index d9b9d75dc..7adc5e0c7 100644
--- a/DDExamples/ILDExDet/src/VersatileDiskRowLayoutSeg.cpp
+++ b/DDExamples/ILDExDet/src/VersatileDiskRowLayoutSeg.cpp
@@ -40,7 +40,7 @@ void VersatileDiskRowLayoutData::addRow(int nPads, double padPitch, double rowHe
   _nPads+=nPads;
 }
     
-int  VersatileDiskRowLayoutData::setRMin(int rmin)
+void VersatileDiskRowLayoutData::setRMin(int rmin)
 {
   _rMin=rmin;
 }
diff --git a/DDExamples/ILDExSimu/CMakeLists.txt b/DDExamples/ILDExSimu/CMakeLists.txt
index 1e7fb603a..8c8e5659c 100644
--- a/DDExamples/ILDExSimu/CMakeLists.txt
+++ b/DDExamples/ILDExSimu/CMakeLists.txt
@@ -1,9 +1,16 @@
 cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)
 
 find_package(Geant4 REQUIRED)
+#---Handle the case CLHEP is not included in Geant4------------------------------
+if(NOT Geant4_clhep_FOUND)
+  find_package(CLHEP REQUIRED)
+  set(Geant4_INCLUDE_DIRS ${Geant4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS})
+  set(Geant4_LIBRARIES ${Geant4_LIBRARIES} ${CLHEP_LIBRARIES})
+endif()
+
 
 include_directories( ${CMAKE_SOURCE_DIR}/DDCore/include
-                     ${CMAKE_SOURCE_DIR}/DDGeant4/include
+                     ${CMAKE_SOURCE_DIR}/DDG4/include
                      ${CMAKE_CURRENT_SOURCE_DIR}/include
                      ${ROOT_INCLUDE_DIR}
                      ${Geant4_INCLUDE_DIRS}
@@ -11,5 +18,5 @@ include_directories( ${CMAKE_SOURCE_DIR}/DDCore/include
 
 file(GLOB sources src/*.cpp)
 add_executable(ILDExSimu ILDExSimu.cpp ${sources})
-target_link_libraries(ILDExSimu DD4hepCore DD4hepGeant4 ILDEx ${Geant4_LIBRARIES})
+target_link_libraries(ILDExSimu DD4hepCore DD4hepG4 ILDEx ${Geant4_LIBRARIES})
 
diff --git a/DDExamples/ILDExSimu/ILDExSimu.cpp b/DDExamples/ILDExSimu/ILDExSimu.cpp
index 1ddc9f8cd..cc315fff6 100644
--- a/DDExamples/ILDExSimu/ILDExSimu.cpp
+++ b/DDExamples/ILDExSimu/ILDExSimu.cpp
@@ -16,10 +16,13 @@
 #include "ILDExEventAction.h"
 #include "ILDExSteppingAction.h"
 #include "ILDExSteppingVerbose.h"
-//#include "G4VisExecutive.h"
-#include "G4DetectorConstruction.h"
 #include "G4UIExecutive.hh"
 
+#include "DDG4/Geant4DetectorConstruction.h"
+#include "DD4hep/LCDD.h"
+
+using namespace DD4hep::Geometry;
+using namespace DD4hep::Simulation;
 
 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 
@@ -30,6 +33,12 @@ int main(int argc,char** argv)
   //
   CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
   
+  LCDD& lcdd = LCDD::getInstance();
+  for(int i=1; i<argc-1;++i) {
+    // We need to construct the geometry at this level already
+    lcdd.fromCompact(argv[i]);
+  }
+
   // User Verbose output class
   //
   G4VSteppingVerbose::SetInstance(new ILDExSteppingVerbose);
@@ -38,10 +47,9 @@ int main(int argc,char** argv)
   //
   G4RunManager * runManager = new G4RunManager;
   
-  
   // Get the detector constructed
   //
-  DD4hep::G4DetectorConstruction* detector = new DD4hep::G4DetectorConstruction(argv[1]);
+  Geant4DetectorConstruction* detector = new Geant4DetectorConstruction(lcdd);
   runManager->SetUserInitialization(detector);
   
   //
@@ -51,7 +59,7 @@ int main(int argc,char** argv)
   // Set user action classes
   //
   G4VUserPrimaryGeneratorAction* gen_action = 
-  new ILDExPrimaryGeneratorAction(detector->GetLCDD());
+  new ILDExPrimaryGeneratorAction(lcdd);
   runManager->SetUserAction(gen_action);
   //
   ILDExRunAction* run_action = new ILDExRunAction;  
diff --git a/DDG4/include/DDG4/Geant4DetectorConstruction.h b/DDG4/include/DDG4/Geant4DetectorConstruction.h
new file mode 100644
index 000000000..79e6ed045
--- /dev/null
+++ b/DDG4/include/DDG4/Geant4DetectorConstruction.h
@@ -0,0 +1,31 @@
+//====================================================================
+//  AIDA Detector description implementation
+//--------------------------------------------------------------------
+//
+//  Author     : M.Frank
+//
+//====================================================================
+#ifndef DD4HEP_GEANT4DETECTORCONSTRUCTION_H
+#define DD4HEP_GEANT4DETECTORCONSTRUCTION_H
+
+#include "G4VUserDetectorConstruction.hh"
+
+namespace DD4hep {
+
+  namespace Geometry { class LCDD; }
+  namespace Simulation {
+    
+    class Geant4DetectorConstruction : public G4VUserDetectorConstruction  {
+    public:
+      
+      Geant4DetectorConstruction(Geometry::LCDD& lcdd);
+      virtual ~Geant4DetectorConstruction() {}
+      G4VPhysicalVolume* Construct();
+    private:
+      Geometry::LCDD&    m_lcdd;
+      G4VPhysicalVolume* m_world;
+    };
+  }
+}
+
+#endif
diff --git a/DDG4/src/Geant4DetectorConstruction.cpp b/DDG4/src/Geant4DetectorConstruction.cpp
new file mode 100644
index 000000000..ca6180d62
--- /dev/null
+++ b/DDG4/src/Geant4DetectorConstruction.cpp
@@ -0,0 +1,36 @@
+#include "DDG4/Geant4DetectorConstruction.h"
+#include "DDG4/Geant4Converter.h"
+#include "DD4hep/LCDD.h"
+#include "TGeoManager.h"
+#include "G4PVPlacement.hh"
+
+#ifdef GEANT4_HAS_GDML
+#include "G4GDMLParser.hh"
+#endif
+
+using namespace std;
+using namespace DD4hep;
+using namespace DD4hep::Geometry;
+
+
+DD4hep::Simulation::Geant4DetectorConstruction::Geant4DetectorConstruction(Geometry::LCDD& lcdd)
+: m_lcdd(lcdd), m_world(0)
+{
+}
+
+G4VPhysicalVolume* DD4hep::Simulation::Geant4DetectorConstruction::Construct() {
+  typedef Simulation::Geant4Converter Geant4Converter;
+  TGeoNode* top = gGeoManager->GetTopNode();
+  Geant4Converter& conv = Geant4Converter::instance();
+  DetElement world = m_lcdd.world();
+  conv.create(world);
+  Geant4Converter::G4GeometryInfo& info = conv.data();
+  m_world = info.g4Placements[top];
+#ifdef GEANT4_HAS_GDML
+  if ( ::getenv("DUMP_GDML") ) {
+    G4GDMLParser parser;
+    parser.Write("detector.gdml",m_world);
+  }
+#endif
+  return m_world;
+}
diff --git a/DDGeant4/AddCMakeFiles.patch b/DDGeant4/AddCMakeFiles.patch
deleted file mode 100644
index 2d92f1081..000000000
--- a/DDGeant4/AddCMakeFiles.patch
+++ /dev/null
@@ -1,330 +0,0 @@
-Index: cmake/FindROOT.cmake
-===================================================================
---- cmake/FindROOT.cmake	(revision 0)
-+++ cmake/FindROOT.cmake	(revision 0)
-@@ -0,0 +1,101 @@
-+# - Finds ROOT instalation
-+# This module sets up ROOT information 
-+# It defines:
-+# ROOT_FOUND          If the ROOT is found
-+# ROOT_INCLUDE_DIR    PATH to the include directory
-+# ROOT_LIBRARIES      Most common libraries
-+# ROOT_LIBRARY_DIR    PATH to the library directory 
-+
-+
-+find_program(ROOT_CONFIG_EXECUTABLE root-config
-+  PATHS $ENV{ROOTSYS}/bin)
-+
-+if(ROOT_CONFIG_EXECUTABLE)
-+  execute_process(
-+    COMMAND ${ROOT_CONFIG_EXECUTABLE} --prefix 
-+    OUTPUT_VARIABLE ROOTSYS 
-+    OUTPUT_STRIP_TRAILING_WHITESPACE)
-+
-+  execute_process(
-+    COMMAND ${ROOT_CONFIG_EXECUTABLE} --version 
-+    OUTPUT_VARIABLE ROOT_VERSION
-+    OUTPUT_STRIP_TRAILING_WHITESPACE)
-+
-+  execute_process(
-+    COMMAND ${ROOT_CONFIG_EXECUTABLE} --incdir
-+    OUTPUT_VARIABLE ROOT_INCLUDE_DIR
-+    OUTPUT_STRIP_TRAILING_WHITESPACE)
-+
-+  execute_process(
-+    COMMAND ${ROOT_CONFIG_EXECUTABLE} --libs
-+    OUTPUT_VARIABLE ROOT_LIBRARIES
-+    OUTPUT_STRIP_TRAILING_WHITESPACE)
-+
-+endif()
-+
-+#set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lThread -lMinuit -lHtml -lVMC -lEG -lGeom -lTreePlayer -lXMLIO -lProof)
-+#set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lProofPlayer -lMLP -lSpectrum -lEve -lRGL -lGed -lXMLParser -lPhysics)
-+set(ROOT_LIBRARY_DIR ${ROOTSYS}/lib)
-+set(ROOT_LIBRARIES -L${ROOT_LIBRARY_DIR} Core Cint)
-+
-+include(FindPackageHandleStandardArgs) 
-+find_package_handle_standard_args(ROOT DEFAULT_MSG ROOT_CONFIG_EXECUTABLE)
-+
-+# Make variables changeble to the advanced user
-+mark_as_advanced(ROOT_CONFIG_EXECUTABLE)
-+
-+if(ROOT_FOUND AND NOT ROOT_FIND_QUIETLY)
-+  message(STATUS "Found ROOT ${ROOT_VERSION} in ${ROOTSYS}")
-+endif()
-+
-+
-+
-+include(CMakeParseArguments)
-+find_program(ROOTCINT_EXECUTABLE rootcint PATHS $ENV{ROOTSYS}/bin)
-+
-+#----------------------------------------------------------------------------
-+# function ROOT_GENERATE_DICTIONARY( dictionary   
-+#                                    header1 header2 ... 
-+#                                    LINKDEF linkdef1 ... 
-+#                                    OPTIONS opt1...)
-+function(ROOT_GENERATE_DICTIONARY dictionary)
-+  CMAKE_PARSE_ARGUMENTS(ARG "" "" "LINKDEF;OPTIONS" "" ${ARGN})
-+  #---Get the list of header files-------------------------
-+  set(headerfiles)
-+  foreach(fp ${ARG_UNPARSED_ARGUMENTS})
-+    file(GLOB files ${fp})
-+    if(files)
-+      foreach(f ${files})
-+        if(NOT f MATCHES LinkDef)
-+          set(headerfiles ${headerfiles} ${f})
-+        endif()
-+      endforeach()
-+    else()
-+      set(headerfiles ${headerfiles} ${fp})
-+    endif()
-+  endforeach()
-+  #---Get the list of include directories------------------
-+  get_directory_property(incdirs INCLUDE_DIRECTORIES)
-+  set(includedirs) 
-+  foreach( d ${incdirs})    
-+   set(includedirs ${includedirs} -I${d})
-+  endforeach()
-+  #---Get LinkDef.h file------------------------------------
-+  set(linkdefs)
-+  foreach( f ${ARG_LINKDEF})
-+    if( IS_ABSOLUTE ${f})
-+      set(linkdefs ${linkdefs} ${f})
-+    else() 
-+      if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/inc/${f})
-+        set(linkdefs ${linkdefs} ${CMAKE_CURRENT_SOURCE_DIR}/inc/${f})
-+      else()
-+        set(linkdefs ${linkdefs} ${CMAKE_CURRENT_SOURCE_DIR}/${f})
-+      endif()
-+    endif()
-+  endforeach()
-+  #---call rootcint------------------------------------------
-+  add_custom_command(OUTPUT ${dictionary}.cxx ${dictionary}.h
-+                     COMMAND ${ROOTCINT_EXECUTABLE} -cint -f  ${dictionary}.cxx 
-+                                          -c ${ARG_OPTIONS} ${includedirs} ${headerfiles} ${linkdefs} 
-+                     DEPENDS ${headerfiles} ${linkdefs})
-+endfunction()
-Index: cmake/FindXercesC.cmake
-===================================================================
---- cmake/FindXercesC.cmake	(revision 0)
-+++ cmake/FindXercesC.cmake	(revision 0)
-@@ -0,0 +1,79 @@
-+# - Find Xerces-C
-+# This module tries to find the Xerces-C library and headers.
-+# Once done this will define
-+#
-+#   XERCESC_FOUND - system has Xerces-C headers and libraries
-+#   XERCESC_INCLUDE_DIRS - the include directories needed for Xerces-C
-+#   XERCESC_LIBRARIES - the libraries needed to use Xerces-C
-+#
-+# Variables used by this module, which can change the default behaviour and
-+# need to be set before calling find_package:
-+#
-+#   XERCESC_ROOT_DIR            Root directory to Xerces-C installation. Will
-+#                               be used ahead of CMake default path.
-+#
-+# The following advanced variables may be used if the module has difficulty
-+# locating Xerces-C or you need fine control over what is used.
-+#
-+#   XERCESC_INCLUDE_DIR
-+#
-+#   XERCESC_LIBRARY
-+#
-+# Copyright (c) 2009, Ben Morgan, <Ben.Morgan@warwick.ac.uk>
-+#
-+# Redistribution and use is allowed according to the terms of the BSD license.
-+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-+
-+
-+
-+# Look for the header - preferentially searching below XERCESC_ROOT_DIR
-+find_path(
-+    XERCESC_INCLUDE_DIR 
-+    NAMES xercesc/util/XercesVersion.hpp
-+    PATHS ${XERCESC_ROOT_DIR}
-+    PATH_SUFFIXES include
-+    NO_DEFAULT_PATH
-+)
-+
-+# If we didn't find it there, fall back to some standard search paths
-+find_path(
-+    XERCESC_INCLUDE_DIR
-+    NAMES xercesc/util/XercesVersion.hpp
-+)
-+
-+# Look for the library, preferentially searching below XERCESC_ROOT_DIR
-+find_library(
-+    XERCESC_LIBRARY
-+    NAMES xerces-c xerces-c_3
-+    PATHS ${XERCESC_ROOT_DIR}
-+    PATH_SUFFIXES lib64 lib32 lib
-+    NO_DEFAULT_PATH
-+)
-+
-+find_library(
-+    XERCESC_LIBRARY
-+    NAMES xerces-c xerces-c_3
-+)
-+
-+
-+include(FindPackageHandleStandardArgs)
-+find_package_handle_standard_args(
-+    XercesC
-+    DEFAULT_MSG
-+    XERCESC_LIBRARY
-+    XERCESC_INCLUDE_DIR
-+)
-+
-+if (XERCESC_FOUND)
-+    set(XERCESC_LIBRARIES ${XERCESC_LIBRARY})
-+    set(XERCESC_INCLUDE_DIRS ${XERCESC_INCLUDE_DIR})
-+else (XERCESC_FOUND)
-+    set(XERCESC_LIBRARIES)
-+    set(XERCESC_INCLUDE_DIRS)
-+endif (XERCESC_FOUND)
-+
-+
-+mark_as_advanced(
-+    XERCESC_LIBRARY 
-+    XERCESC_INCLUDE_DIR
-+)
-Index: CMakeLists.txt
-===================================================================
---- CMakeLists.txt	(revision 0)
-+++ CMakeLists.txt	(revision 0)
-@@ -0,0 +1,31 @@
-+cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)
-+
-+project(VGM)
-+
-+#---Options-------------------------------------------------------------------------
-+option(VGM_WITH_Geant4GM "Build Geant4GM subpackage" ON)
-+option(VGM_WITH_RootGM   "Build RootGM subpackage" ON)
-+option(VGM_WITH_XmlVGM   "Build XmlVGM subpackage" ON)
-+
-+#---CMake Module Path---------------------------------------------------------------
-+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) 
-+
-+#---Find required packages----------------------------------------------------------
-+if(VGM_WITH_Geant4GM)
-+  find_package(Geant4 REQUIRED)
-+  if(NOT Geant4_clhep_FOUND OR DEFINED CLHEP_ROOT_DIR)
-+    find_package(CLHEP REQUIRED)
-+    set(Geant4_INCLUDE_DIR ${Geant4_INCLUDE_DIR} ${CLHEP_INCLUDE_DIRS})
-+    set(Geant4_LIBRARIES ${Geant4_LIBRARIES} ${CLHEP_LIBRARIES})
-+  endif()
-+endif()
-+if(VGM_WITH_RootGM)
-+  find_package(ROOT REQUIRED)
-+endif()
-+if(VGM_WITH_XmlVGM)
-+  find_package(XercesC REQUIRED)
-+endif()
-+
-+#---Add required packages----------------------------------------------------------
-+add_subdirectory(packages)
-+
-Index: packages/BaseVGM/CMakeLists.txt
-===================================================================
---- packages/BaseVGM/CMakeLists.txt	(revision 0)
-+++ packages/BaseVGM/CMakeLists.txt	(revision 0)
-@@ -0,0 +1,9 @@
-+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
-+
-+#---Add library---------------------------------------------------------------------
-+file(GLOB sources source/*/*.cxx)
-+add_library(BaseVGM ${sources})
-+
-+#----Installation-----------------------------------------------------------------
-+install(DIRECTORY include/ DESTINATION include  PATTERN ".svn" EXCLUDE)
-+install(TARGETS BaseVGM DESTINATION lib)
-Index: packages/ClhepVGM/CMakeLists.txt
-===================================================================
---- packages/ClhepVGM/CMakeLists.txt	(revision 0)
-+++ packages/ClhepVGM/CMakeLists.txt	(revision 0)
-@@ -0,0 +1,10 @@
-+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
-+
-+#---Add Library-------------------------------------------------------------------
-+file(GLOB sources source/*.cxx)
-+add_library(ClhepVGM ${sources})
-+target_link_libraries(ClhepVGM ${Geant4_LIBRARIES})
-+
-+#----Installation-----------------------------------------------------------------
-+install(DIRECTORY include/ DESTINATION include  PATTERN ".svn" EXCLUDE)
-+install(TARGETS ClhepVGM DESTINATION lib)
-Index: packages/Geant4GM/CMakeLists.txt
-===================================================================
---- packages/Geant4GM/CMakeLists.txt	(revision 0)
-+++ packages/Geant4GM/CMakeLists.txt	(revision 0)
-@@ -0,0 +1,10 @@
-+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
-+
-+#---Add library-------------------------------------------------------------------
-+file(GLOB sources source/*/*.cxx)
-+add_library(Geant4GM ${sources})
-+target_link_libraries(Geant4GM BaseVGM ClhepVGM)
-+
-+#----Installation-----------------------------------------------------------------
-+install(DIRECTORY include/ DESTINATION include  PATTERN ".svn" EXCLUDE)
-+install(TARGETS Geant4GM DESTINATION lib)
-Index: packages/RootGM/CMakeLists.txt
-===================================================================
---- packages/RootGM/CMakeLists.txt	(revision 0)
-+++ packages/RootGM/CMakeLists.txt	(revision 0)
-@@ -0,0 +1,10 @@
-+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
-+
-+#---Add library-------------------------------------------------------------------
-+file(GLOB sources source/*/*.cxx)
-+add_library(RootGM ${sources})
-+target_link_libraries(RootGM BaseVGM ${ROOT_LIBRARIES} Geom)
-+
-+#----Installation-----------------------------------------------------------------
-+install(DIRECTORY include/ DESTINATION include  PATTERN ".svn" EXCLUDE)
-+install(TARGETS RootGM DESTINATION lib)
-Index: packages/XmlVGM/CMakeLists.txt
-===================================================================
---- packages/XmlVGM/CMakeLists.txt	(revision 0)
-+++ packages/XmlVGM/CMakeLists.txt	(revision 0)
-@@ -0,0 +1,10 @@
-+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
-+
-+#---Add library-------------------------------------------------------------------
-+file(GLOB sources source/*.cxx)
-+add_library(XmlVGM ${sources})
-+target_link_libraries(XmlVGM BaseVGM ClhepVGM ${XERCESC_LIBRARIES} )
-+
-+#----Installation-----------------------------------------------------------------
-+install(DIRECTORY include/ DESTINATION include  PATTERN ".svn" EXCLUDE)
-+install(TARGETS XmlVGM DESTINATION lib)
-Index: packages/CMakeLists.txt
-===================================================================
---- packages/CMakeLists.txt	(revision 0)
-+++ packages/CMakeLists.txt	(revision 0)
-@@ -0,0 +1,25 @@
-+#---Common environment-------------------------------------------------------------
-+include_directories( VGM/include 
-+                     ClhepVGM/include 
-+                     BaseVGM/include 
-+                     ${ROOT_INCLUDE_DIR} 
-+                     ${Geant4_INCLUDE_DIR}
-+                     ${XERCESC_INCLUDE_DIR})
-+
-+#---Add required packages----------------------------------------------------------
-+add_subdirectory(ClhepVGM)
-+add_subdirectory(BaseVGM)
-+if(VGM_WITH_Geant4GM)
-+  add_subdirectory(Geant4GM)
-+endif()
-+if(VGM_WITH_RootGM)
-+  add_subdirectory(RootGM)
-+endif()
-+if(VGM_WITH_XmlVGM)
-+  add_subdirectory(XmlVGM)
-+endif()
-+
-+#----Installation-----------------------------------------------------------------
-+install(DIRECTORY VGM/include/ DESTINATION include  PATTERN ".svn" EXCLUDE)
-+
-+
diff --git a/DDGeant4/CMakeLists.txt b/DDGeant4/CMakeLists.txt
deleted file mode 100644
index 9ff04a321..000000000
--- a/DDGeant4/CMakeLists.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-#---Build the VGM Libraries-------------------------------------------------------
-include(ExternalProject)
-ExternalProject_Add( 
-    VGM
-    PREFIX VGM
-    SVN_REPOSITORY https://vgm.svn.sourceforge.net/svnroot/vgm/tags/v3-05/vgm
-    UPDATE_COMMAND ""
-    PATCH_COMMAND patch -p0 -i ${CMAKE_CURRENT_SOURCE_DIR}/AddCMakeFiles.patch
-	  INSTALL_DIR ${CMAKE_BINARY_DIR}
-    CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> 
-               -DVGM_WITH_XmlVGM:BOOL=OFF 
-               -DGeant4_DIR=${Geant4_DIR} 
-               -DGeant4_ROOT_DIR=${Geant4_ROOT_DIR}
-               -DCLHEP_ROOT_DIR=${CLHEP_ROOT_DIR} 
-               -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH} )
-
-set(VGM_LIBRARIES -L${CMAKE_BINARY_DIR}/lib -lRootGM -lGeant4GM -lBaseVGM -lClhepVGM)
-set(VGM_INCLUDE_DIR ${CMAKE_BINARY_DIR}/include)
-
-#---Find Geant4-------------------------------------------------------------------
-find_package(Geant4 REQUIRED)
-if(NOT Geant4_clhep_FOUND)
-  find_package(CLHEP REQUIRED)
-  set(Geant4_INCLUDE_DIRS ${Geant4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS})
-  set(Geant4_LIBRARIES ${Geant4_LIBRARIES} ${CLHEP_LIBRARIES})
-endif()
-
-#---Includedirs-------------------------------------------------------------------
-include_directories(${CMAKE_SOURCE_DIR}/DDCore/include
-                    ${CMAKE_CURRENT_SOURCE_DIR}/include 
-                    ${ROOT_INCLUDE_DIR}
-                    ${Geant4_INCLUDE_DIRS}
-                    ${VGM_INCLUDE_DIR})
-
-#---Add Library-------------------------------------------------------------------
-file(GLOB sources src/*.cpp)
-add_library(DD4hepGeant4 SHARED ${sources})
-target_link_libraries(DD4hepGeant4 DD4hepCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${VGM_LIBRARIES})
-add_dependencies(DD4hepGeant4 VGM)
diff --git a/DDGeant4/include/G4DetectorConstruction.h b/DDGeant4/include/G4DetectorConstruction.h
deleted file mode 100644
index 4c61a99a5..000000000
--- a/DDGeant4/include/G4DetectorConstruction.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef DD4hep_G4DetectorConstruction_h
-#define DD4Hep_G4DetectorConstruction_h 1
-
-#include "G4VUserDetectorConstruction.hh"
-
-class G4VPhysicalVolume;
-
-namespace DD4hep {
-  namespace Geometry {
-    class LCDD;
-  }
-  class G4DetectorConstruction : public G4VUserDetectorConstruction
-  {
-  public:
-    
-    G4DetectorConstruction(const std::string&);
-    ~G4DetectorConstruction();
-    G4VPhysicalVolume* Construct();
-    Geometry::LCDD& GetLCDD() { return m_lcdd;}
-  private:
-    Geometry::LCDD& m_lcdd;
-    std::string m_compactfile;
-  };
-  
-}
-#endif
-
diff --git a/DDGeant4/src/G4DetectorConstruction.cpp b/DDGeant4/src/G4DetectorConstruction.cpp
deleted file mode 100644
index 96c1fa783..000000000
--- a/DDGeant4/src/G4DetectorConstruction.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-#include "G4DetectorConstruction.h"
-#include "DD4hep/LCDD.h"
-
-// VGM demo
-#include "Geant4GM/volumes/Factory.h"
-#include "RootGM/volumes/Factory.h"
-#include "TGeoManager.h"
-#include "G4Material.hh"
-
-
-using namespace DD4hep;
-using namespace DD4hep::Geometry;
-
-G4DetectorConstruction::G4DetectorConstruction(const std::string& xmlfile) : m_lcdd(LCDD::getInstance()), m_compactfile(xmlfile) {
-  // We need to construct the geometry at this level already
-  m_lcdd.fromCompact(m_compactfile);
-}
-
-G4DetectorConstruction::~G4DetectorConstruction() {}
-
-G4VPhysicalVolume* G4DetectorConstruction::Construct() {
-  
-  // Import geometry from Root to VGM
-  RootGM::Factory rtFactory;
-  rtFactory.SetDebug(0);
-  rtFactory.Import(gGeoManager->GetTopNode());
-  
-  // Export VGM geometry to Geant4
-  //
-  Geant4GM::Factory g4Factory;
-  g4Factory.SetDebug(0);
-  rtFactory.Export(&g4Factory);
-  G4VPhysicalVolume* world = g4Factory.World();
-  
-  G4cout << *(G4Material::GetMaterialTable()) << G4endl;
-
-  return world;
-}
-- 
GitLab