From f7acf5fb06eb7cca21c3885f31e78d23078a5d34 Mon Sep 17 00:00:00 2001
From: Frank Gaede <frank.gaede@desy.de>
Date: Wed, 15 May 2013 08:30:34 +0000
Subject: [PATCH]  - changed to use standard way of finding geant4 with CMake: 
   -D Geant4_DIR=_path_to_Geant4Config.cmake    (this script provies also the
 dependencies used to build geant4)

---
 DDCore/include/DD4hep/Objects.h       |   1 +
 DDExamples/CLICSiDSimu/CMakeLists.txt |  11 +-
 DDExamples/ILDExSimu/CMakeLists.txt   |  12 +-
 DDG4/CMakeLists.txt                   |  13 +-
 DDG4/src/Geant4CalorimeterSD.cpp      |   4 +-
 DDG4/src/Geant4Setup.cpp              |   2 +-
 DDG4/src/Geant4Steppers.cpp           |  26 +--
 DDG4/src/Geant4TrackerCombineSD.cpp   |   2 +-
 DDG4/src/Geant4TrackerSD.cpp          |   2 +-
 ReadMe.txt                            |   2 +-
 cmake/FindCLHEP.cmake                 | 258 --------------------------
 cmake/FindGeant4.cmake                | 217 ----------------------
 cmake/thisdd4hep.sh                   |   4 +-
 13 files changed, 42 insertions(+), 512 deletions(-)
 delete mode 100644 cmake/FindCLHEP.cmake
 delete mode 100644 cmake/FindGeant4.cmake

diff --git a/DDCore/include/DD4hep/Objects.h b/DDCore/include/DD4hep/Objects.h
index 7d42fc6ce..a01742b8c 100644
--- a/DDCore/include/DD4hep/Objects.h
+++ b/DDCore/include/DD4hep/Objects.h
@@ -33,6 +33,7 @@ class TGeoIdentity;
 // C/C++ include files
 #include <set>
 #include <limits>
+#include <vector>
 
 #define _USE_MATH_DEFINES
 #include <cmath>
diff --git a/DDExamples/CLICSiDSimu/CMakeLists.txt b/DDExamples/CLICSiDSimu/CMakeLists.txt
index 0048b1163..9e3a60d76 100644
--- a/DDExamples/CLICSiDSimu/CMakeLists.txt
+++ b/DDExamples/CLICSiDSimu/CMakeLists.txt
@@ -1,11 +1,12 @@
 cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)
 
 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()
+#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()
+find_package(Geant4 REQUIRED)
 
 
 
diff --git a/DDExamples/ILDExSimu/CMakeLists.txt b/DDExamples/ILDExSimu/CMakeLists.txt
index 05836d38d..f5fc20735 100644
--- a/DDExamples/ILDExSimu/CMakeLists.txt
+++ b/DDExamples/ILDExSimu/CMakeLists.txt
@@ -1,12 +1,12 @@
 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()
+##---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()
 
 find_package(LCIO REQUIRED) 
 
diff --git a/DDG4/CMakeLists.txt b/DDG4/CMakeLists.txt
index 47c2f2722..dfdc2993d 100644
--- a/DDG4/CMakeLists.txt
+++ b/DDG4/CMakeLists.txt
@@ -1,10 +1,13 @@
 #---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()
+#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(${Geant4_USE_FILE})   # this also takes care of geant 4 definitions and include dirs
+
 
 include(DD4hep_XML_setup)
 
diff --git a/DDG4/src/Geant4CalorimeterSD.cpp b/DDG4/src/Geant4CalorimeterSD.cpp
index 8b90d5058..8e2bb0850 100644
--- a/DDG4/src/Geant4CalorimeterSD.cpp
+++ b/DDG4/src/Geant4CalorimeterSD.cpp
@@ -44,7 +44,7 @@ namespace DD4hep {  namespace Simulation {
   typedef Geant4GenericSD<Calorimeter> Geant4Calorimeter;
 }}    // End namespace DD4hep::Simulation
 
-DECLARE_GEANT4SENSITIVEDETECTOR(Geant4Calorimeter);
+DECLARE_GEANT4SENSITIVEDETECTOR(Geant4Calorimeter)
 
 /*
  *   DD4hep::Simulation namespace declaration
@@ -98,4 +98,4 @@ namespace DD4hep {  namespace Simulation {
   typedef Geant4GenericSD<OpticalCalorimeter> Geant4OpticalCalorimeter;
 }}    // End namespace DD4hep::Simulation
 
-DECLARE_GEANT4SENSITIVEDETECTOR(Geant4OpticalCalorimeter);
+DECLARE_GEANT4SENSITIVEDETECTOR(Geant4OpticalCalorimeter)
diff --git a/DDG4/src/Geant4Setup.cpp b/DDG4/src/Geant4Setup.cpp
index e7735ef5c..83550456d 100644
--- a/DDG4/src/Geant4Setup.cpp
+++ b/DDG4/src/Geant4Setup.cpp
@@ -90,4 +90,4 @@ static long setup_fields(lcdd_t& lcdd, const Geant4Converter& cnv, const map<str
   }
   return 1;
 }
-DECLARE_GEANT4_SETUP(Geant4FieldSetup,setup_fields);
+DECLARE_GEANT4_SETUP(Geant4FieldSetup,setup_fields)
diff --git a/DDG4/src/Geant4Steppers.cpp b/DDG4/src/Geant4Steppers.cpp
index 9bcb4c62c..0a3c593fc 100644
--- a/DDG4/src/Geant4Steppers.cpp
+++ b/DDG4/src/Geant4Steppers.cpp
@@ -17,12 +17,12 @@
 #include "G4ClassicalRK4.hh"
 #include "G4ConstRK4.hh"
 
-DECLARE_GEANT4_STEPPER(ImplicitEuler);
-DECLARE_GEANT4_STEPPER(ExplicitEuler);
-DECLARE_GEANT4_STEPPER(SimpleRunge);
-DECLARE_GEANT4_STEPPER(SimpleHeum);
-DECLARE_GEANT4_MAGSTEPPER(ConstRK4);
-DECLARE_GEANT4_STEPPER(ClassicalRK4);
+DECLARE_GEANT4_STEPPER(ImplicitEuler)
+DECLARE_GEANT4_STEPPER(ExplicitEuler)
+DECLARE_GEANT4_STEPPER(SimpleRunge)
+DECLARE_GEANT4_STEPPER(SimpleHeum)
+DECLARE_GEANT4_MAGSTEPPER(ConstRK4)
+DECLARE_GEANT4_STEPPER(ClassicalRK4)
 
 
 // Geant 4 include files
@@ -32,11 +32,11 @@ DECLARE_GEANT4_STEPPER(ClassicalRK4);
 #include "G4HelixSimpleRunge.hh"
 #include "G4HelixHeum.hh"
 
-DECLARE_GEANT4_MAGSTEPPER(HelixImplicitEuler);
-DECLARE_GEANT4_MAGSTEPPER(HelixExplicitEuler);
-DECLARE_GEANT4_MAGSTEPPER(HelixMixedStepper);
-DECLARE_GEANT4_MAGSTEPPER(HelixSimpleRunge);
-DECLARE_GEANT4_MAGSTEPPER(HelixHeum);
+DECLARE_GEANT4_MAGSTEPPER(HelixImplicitEuler)
+DECLARE_GEANT4_MAGSTEPPER(HelixExplicitEuler)
+DECLARE_GEANT4_MAGSTEPPER(HelixMixedStepper)
+DECLARE_GEANT4_MAGSTEPPER(HelixSimpleRunge)
+DECLARE_GEANT4_MAGSTEPPER(HelixHeum)
 
 
 // Geant 4 include files
@@ -46,7 +46,7 @@ DECLARE_GEANT4_MAGSTEPPER(HelixHeum);
 #include "G4KM_OpticalEqRhs.hh"
 #include "G4KM_NucleonEqRhs.hh"
 //Virtual: DECLARE_GEANT4_MAGMOTION(Mag_EqRhs);
-DECLARE_GEANT4_MAGMOTION(Mag_SpinEqRhs);
-DECLARE_GEANT4_MAGMOTION(Mag_UsualEqRhs);
+DECLARE_GEANT4_MAGMOTION(Mag_SpinEqRhs)
+DECLARE_GEANT4_MAGMOTION(Mag_UsualEqRhs)
 //DECLARE_GEANT4_MAGMOTION(KM_OpticalEqRhs);
 //DECLARE_GEANT4_MAGMOTION(KM_NucleonEqRhs);
diff --git a/DDG4/src/Geant4TrackerCombineSD.cpp b/DDG4/src/Geant4TrackerCombineSD.cpp
index 254225719..d380c41cb 100644
--- a/DDG4/src/Geant4TrackerCombineSD.cpp
+++ b/DDG4/src/Geant4TrackerCombineSD.cpp
@@ -110,4 +110,4 @@ namespace DD4hep {  namespace Simulation {
     typedef Geant4GenericSD<TrackerCombine> Geant4TrackerCombine;
 }}    // End namespace DD4hep::Simulation
 
-DECLARE_GEANT4SENSITIVEDETECTOR(Geant4TrackerCombine);
+DECLARE_GEANT4SENSITIVEDETECTOR(Geant4TrackerCombine)
diff --git a/DDG4/src/Geant4TrackerSD.cpp b/DDG4/src/Geant4TrackerSD.cpp
index 828897fc8..99ed7f886 100644
--- a/DDG4/src/Geant4TrackerSD.cpp
+++ b/DDG4/src/Geant4TrackerSD.cpp
@@ -64,4 +64,4 @@ namespace DD4hep {  namespace Simulation {
   typedef Geant4GenericSD<Tracker> Geant4Tracker;
 }}    // End namespace DD4hep::Simulation
 
-DECLARE_GEANT4SENSITIVEDETECTOR(Geant4Tracker);
+DECLARE_GEANT4SENSITIVEDETECTOR(Geant4Tracker)
diff --git a/ReadMe.txt b/ReadMe.txt
index 864d2f01c..dc0237ab2 100644
--- a/ReadMe.txt
+++ b/ReadMe.txt
@@ -26,7 +26,7 @@ on the C++ XercesC parser, and another one based on Python and using the PyROOT
 simulation. The conversion is currently based on the Virtual Geometry Modeler (VGM) package that is
 build internally when required.
   The option DD4HEP_WITH_GEANT4:BOOL controls the building or not of this package that has the dependency
-to Geant4. The Geant4 installation needs to be located using the variable -DGeant4_ROOT_DIR=<G4 installation>
+to Geant4. The Geant4 installation needs to be located using the variable -DGeant4_DIR=<path to Geant4Config.cmake>
 
 - DDExamples
 
diff --git a/cmake/FindCLHEP.cmake b/cmake/FindCLHEP.cmake
deleted file mode 100644
index 5ca94a565..000000000
--- a/cmake/FindCLHEP.cmake
+++ /dev/null
@@ -1,258 +0,0 @@
-# - Try to find the CLHEP High Energy Physics library and headers
-# Usage of this module is as follows
-#
-# == Using any header-only components of CLHEP: ==
-#
-#     find_package( CLHEP 2.0.4.2 )
-#     if(CLHEP_FOUND)
-#         include_directories(${CLHEP_INCLUDE_DIRS})
-#         add_executable(foo foo.cc)
-#     endif()
-#
-# == Using the binary CLHEP library ==
-#
-#     find_package( CLHEP 2.0.4.2 )
-#     if(CLHEP_FOUND)
-#         include_directories(${CLHEP_INCLUDE_DIRS})
-#         add_executable(foo foo.cc)
-#         target_link_libraries(foo ${CLHEP_LIBRARIES})
-#     endif()
-#
-# You can provide a minimum version number that should be used.
-# If you provide this version number and specify the REQUIRED attribute,
-# this module will fail if it can't find a CLHEP of the specified version
-# or higher. If you further specify the EXACT attribute, then this module 
-# will fail if it can't find a CLHEP with a version eaxctly as specified.
-#
-# ===========================================================================
-# Variables used by this module which can be used to change the default
-# behaviour, and hence need to be set before calling find_package:
-#
-#  CLHEP_ROOT_DIR        The preferred installation prefix for searching for 
-#                        CLHEP. Set this if the module has problems finding 
-#                        the proper CLHEP installation.
-#
-# If you don't supply CLHEP_ROOT_DIR, the module will search on the standard
-# system paths. On UNIX, the module will also try to find the clhep-config
-# program in the PATH, and if found will use the prefix supplied by this
-# program as a HINT on where to find the CLHEP headers and libraries.
-#
-# You can re-run CMake with a different version of CLHEP_ROOT_DIR to 
-# force a new search for CLHEP using the new version of CLHEP_ROOT_DIR.
-#
-# ============================================================================
-# Variables set by this module:
-#
-#  CLHEP_FOUND           System has CLHEP.
-#
-#  CLHEP_INCLUDE_DIRS    CLHEP include directories: not cached.
-#
-#  CLHEP_LIBRARIES       Link to these to use the CLHEP library: not cached.
-#
-# ===========================================================================
-# If CLHEP is installed in a non-standard way, e.g. a non GNU-style install
-# of <prefix>/{lib,include}, then this module may fail to locate the headers
-# and libraries as needed. In this case, the following cached variables can
-# be editted to point to the correct locations.
-#
-#  CLHEP_INCLUDE_DIR    The path to the CLHEP include directory: cached
-#
-#  CLHEP_LIBRARY        The path to the CLHEP library: cached
-# 
-# You should not need to set these in the vast majority of cases
-#
-
-#============================================================================
-# Copyright (C) 2010,2011 Ben Morgan <Ben.Morgan@warwick.ac.uk>
-# Copyright (C) 2010,2011 University of Warwick
-# All rights reserved.
-# 
-# Redistribution and use in source and binary forms, with or without 
-# modification, are permitted provided that the following conditions are met:
-#
-# * Redistributions of source code must retain the above copyright notice, 
-#   this list of conditions and the following disclaimer.
-#
-# * Redistributions in binary form must reproduce the above copyright notice, 
-#   this list of conditions and the following disclaimer in the documentation 
-#   and/or other materials provided with the distribution.
-#
-# * Neither the name of the University of Warwick nor the names of its 
-#   contributors may be used to endorse or promote products derived from 
-#   this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
-# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
-# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
-# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-#============================================================================
-
-
-#----------------------------------------------------------------------------
-# Enable re-search if known CLHEP_ROOT_DIR changes?
-#
-if(NOT "${CLHEP_ROOT_DIR}" STREQUAL "${CLHEP_INTERNAL_ROOT_DIR}")
-    if(CLHEP_INTERNAL_ROOT_DIR AND NOT CLHEP_FIND_QUIETLY)
-        message(STATUS "CLHEP_ROOT_DIR Changed, Rechecking for CLHEP")
-    endif()
-
-    set(CLHEP_INTERNAL_ROOT_DIR ${CLHEP_ROOT_DIR} 
-        CACHE INTERNAL "Last value supplied for where to locate CLHEP")
-    set(CLHEP_INCLUDE_DIR CLHEP_INCLUDE_DIR-NOTFOUND)
-    set(CLHEP_LIBRARY CLHEP_LIBRARY-NOTFOUND)
-    set(CLHEP_CONFIG_EXECUTABLE CLHEP_CONFIG_EXECUTABLE-NOTFOUND)
-    set(CLHEP_LIBRARIES )
-    set(CLHEP_INCLUDE_DIRS )
-    set(CLHEP_FOUND FALSE)
-endif()
-
-#----------------------------------------------------------------------------
-# - If we already found CLHEP, be quiet
-#
-if(CLHEP_INCLUDE_DIR AND CLHEP_LIBRARY)
-    set(CLHEP_FIND_QUIETLY TRUE)
-endif()
-
-#----------------------------------------------------------------------------
-# Set up HINTS on where to look for CLHEP
-# If we're on UNIX, see if we can find clhep-config and use its --prefix
-# as an extra hint.
-#
-set(_clhep_root_hints ${CLHEP_ROOT_DIR})
-
-if(UNIX)
-    # Try and find clhep-config in the user's path, but hint at the bin
-    # directory under CLHEP_ROOT_DIR because we'd ideally like to pick up
-    # the config program that matches the libraries/headers.
-    # We only use it as a fallback though.
-    find_program(CLHEP_CONFIG_EXECUTABLE clhep-config
-        HINTS ${_clhep_root_hints}/bin
-        DOC "Path to CLHEP's clhep-config program")
-    mark_as_advanced(CLHEP_CONFIG_EXECUTABLE)
-
-    if(CLHEP_CONFIG_EXECUTABLE)
-        execute_process(COMMAND ${CLHEP_CONFIG_EXECUTABLE} --prefix
-            OUTPUT_VARIABLE _clhep_config_prefix
-            OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-        list(APPEND _clhep_root_hints ${_clhep_config_prefix})
-    endif()
-elseif(WIN32 AND NOT UNIX)
-    # Do we need to set suitable defaults?
-endif()
-
-
-#----------------------------------------------------------------------------
-# Find the CLHEP headers
-# Use Units/defs.h as locator as this is pretty consistent through versions
-find_path(CLHEP_INCLUDE_DIR CLHEP/Units/defs.h
-    HINTS ${_clhep_root_hints}
-    PATH_SUFFIXES include
-    DOC "Path to the CLHEP headers" 
-)
-
-#----------------------------------------------------------------------------
-# Find the CLHEP library
-# Prefer lib64 if available.
-find_library(CLHEP_LIBRARY CLHEP
-    HINTS ${_clhep_root_hints}
-    PATH_SUFFIXES lib64 lib
-    DOC "Path to the CLHEP library"
-)
-
-
-#----------------------------------------------------------------------------
-# Extract the CLHEP version from defs.h
-# Versions COMPATIBLE if RequestedVersion > FoundVersion
-# Also check if versions exact
-
-if(CLHEP_INCLUDE_DIR)
-    set(CLHEP_VERSION 0)
-    file(READ "${CLHEP_INCLUDE_DIR}/CLHEP/Units/defs.h" _CLHEP_DEFS_CONTENTS)
-    string(REGEX REPLACE ".*#define PACKAGE_VERSION \"([0-9.]+).*" "\\1"
-        CLHEP_VERSION "${_CLHEP_DEFS_CONTENTS}")
-
-    if(NOT CLHEP_FIND_QUIETLY)
-        message(STATUS "Found CLHEP Version ${CLHEP_VERSION}")
-    endif()
-  
-    if(CLHEP_FIND_VERSION)
-        set(CLHEP_VERSIONING_TESTS CLHEP_VERSION_COMPATIBLE)
-
-        if("${CLHEP_VERSION}" VERSION_LESS "${CLHEP_FIND_VERSION}")
-            set(CLHEP_VERSION_COMPATIBLE FALSE)
-        else()
-            set(CLHEP_VERSION_COMPATIBLE TRUE)
-
-            if(CLHEP_FIND_VERSION_EXACT)
-                if("${CLHEP_VERSION}" VERSION_EQUAL "${CLHEP_FIND_VERSION}")
-                    set(CLHEP_VERSION_EXACT TRUE)
-                endif()
-                    list(APPEND CLHEP_VERSIONING_TESTS CLHEP_VERSION_EXACT)
-            endif()
-        endif()
-    endif()
-endif()
-
-#----------------------------------------------------------------------------
-# Construct an error message for FPHSA
-#
-set(CLHEP_DEFAULT_MSG "Could NOT find CLHEP:\n")
-
-if(NOT CLHEP_INCLUDE_DIR)
-    set(CLHEP_DEFAULT_MSG "${CLHEP_DEFAULT_MSG}CLHEP Header Path Not Found\n")
-endif()
-
-if(NOT CLHEP_LIBRARY)
-    set(CLHEP_DEFAULT_MSG "${CLHEP_DEFAULT_MSG}CLHEP Library Not Found\n")
-endif()
-
-if(CLHEP_FIND_VERSION)
-    if(NOT CLHEP_VERSION_COMPATIBLE)
-        set(CLHEP_DEFAULT_MSG "${CLHEP_DEFAULT_MSG}Incompatible versions, ${CLHEP_VERSION}(found) < ${CLHEP_FIND_VERSION}(required)\n")
-    endif()
-
-    if(CLHEP_FIND_VERSION_EXACT)
-        if(NOT CLHEP_VERSION_EXACT)
-            set(CLHEP_DEFAULT_MSG "${CLHEP_DEFAULT_MSG}Non-exact versions, ${CLHEP_VERSION}(found) != ${CLHEP_FIND_VERSION}(required)\n")
-        endif()
-    endif()
-endif()
-
-
-
-
-#----------------------------------------------------------------------------
-# Handle the QUIETLY and REQUIRED arguments, setting CLHEP_FOUND to TRUE if
-# all listed variables are TRUE
-#
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(CLHEP 
-    "${CLHEP_DEFAULT_MSG}"
-    CLHEP_LIBRARY
-    CLHEP_INCLUDE_DIR
-    ${CLHEP_VERSIONING_TESTS}
-    )
-
-
-#----------------------------------------------------------------------------
-# If we found CLHEP, set the needed non-cache variables
-#
-if(CLHEP_FOUND)
-    set(CLHEP_LIBRARIES ${CLHEP_LIBRARY})
-    set(CLHEP_INCLUDE_DIRS ${CLHEP_INCLUDE_DIR})
-endif()
-
-#----------------------------------------------------------------------------
-# Mark cache variables that can be adjusted as advanced
-#
-mark_as_advanced(CLHEP_INCLUDE_DIR CLHEP_LIBRARY)
-
diff --git a/cmake/FindGeant4.cmake b/cmake/FindGeant4.cmake
deleted file mode 100644
index c81cd9048..000000000
--- a/cmake/FindGeant4.cmake
+++ /dev/null
@@ -1,217 +0,0 @@
-# - Try to find the Geant4 library and headers
-# Usage of this module is as follows
-#
-# == Using installation of Geant4: ==
-#
-#     find_package(Geant4 9.5)
-#     if(Geant4_FOUND)
-#         include_directories(${Geant4_INCLUDE_DIRS})
-#         add_executable(foo foo.cc)
-#         target_link_libraries(foo ${Geant4_LIBRARIES})
-#     endif()
-#
-# You can provide a minimum version number that should be used.
-# If you provide this version number and specify the REQUIRED attribute,
-# this module will fail if it can't find a Geant4 of the specified version
-# or higher. If you further specify the EXACT attribute, then this module 
-# will fail if it can't find a Geant4 with a version eaxctly as specified.
-#
-# ===========================================================================
-# Variables used by this module which can be used to change the default
-# behaviour, and hence need to be set before calling find_package:
-#
-#  Geant4_ROOT_DIR       The preferred installation prefix for searching for 
-#                        Geant4. Set this if the module has problems finding 
-#                        the proper Geant4 installation.
-#
-# If you don't supply Geant4_ROOT_DIR, the module will search on the standard
-# system paths. On UNIX, the module will also try to find the clhep-config
-# program in the PATH, and if found will use the prefix supplied by this
-# program as a HINT on where to find the CLHEP headers and libraries.
-#
-# ============================================================================
-# Variables set by this module:
-#
-#  Geant4_FOUND           System has Geant4.
-#  Geant4_INCLUDE_DIRS    Geant4 include directories: not cached.
-#  Geant4_LIBRARIES       Link to these to use the Geant4 library: not cached.
-#
-# Additional components
-#  Geant4_<component>_FOUND
-#  Geant4_<component>_LIBRARY
-# ===========================================================================
-
-
-#----------------------------------------------------------------------------
-# Enable re-search if known Geant4_ROOT_DIR changes?
-#
-if(NOT "${Geant4_ROOT_DIR}" STREQUAL "${Geant4_INTERNAL_ROOT_DIR}")
-    if(Geant4_INTERNAL_ROOT_DIR AND NOT Geant4_FIND_QUIETLY)
-        message(STATUS "Geant4_ROOT_DIR Changed, Rechecking for Geant4")
-    endif()
-
-    set(Geant4_INTERNAL_ROOT_DIR ${Geant4_ROOT_DIR} 
-        CACHE INTERNAL "Last value supplied for where to locate Geant4")
-    set(Geant4_INCLUDE_DIR Geant4_INCLUDE_DIR-NOTFOUND)
-    set(Geant4_LIBRARY Geant4_LIBRARY-NOTFOUND)
-    set(Geant4_LIBRARIES )
-    set(Geant4_INCLUDE_DIRS )
-    set(Geant4_FOUND FALSE)
-endif()
-
-#----------------------------------------------------------------------------
-# - If we already found Geant4, be quiet
-#
-if(Geant4_INCLUDE_DIR AND Geant4_LIBRARY)
-    set(Geant4_FIND_QUIETLY TRUE)
-endif()
-
-#----------------------------------------------------------------------------
-# Set up HINTS on where to look for CLHEP
-# If we're on UNIX, see if we can find clhep-config and use its --prefix
-# as an extra hint.
-#
-set(_Geant4_root_hints ${Geant4_ROOT_DIR} ${Geant4_ROOT_DIR}/.. )
-
-#----------------------------------------------------------------------------
-# Find the Geant4 headers
-# Use G4Version.hh as locator
-find_path(Geant4_INCLUDE_DIR G4Version.hh 
-    HINTS ${_Geant4_root_hints}
-    PATH_SUFFIXES include share/include include/Geant4
-    DOC "Path to the Geant4 headers" 
-)
-
-#----------------------------------------------------------------------------
-# Find the CLHEP library
-# Prefer lib64 if available.
-find_library(Geant4_LIBRARY G4global
-    HINTS ${_Geant4_root_hints}
-    PATH_SUFFIXES lib64 lib
-    DOC "Path to the G4global library"
-)
-
-#----------------------------------------------------------------------------
-# Extract the Geant4 version from G4Version.hh
-# Versions COMPATIBLE if RequestedVersion > FoundVersion
-# Also check if versions exact
-
-if(Geant4_INCLUDE_DIR)
-    set(Geant4_VERSION 0)
-    file(READ "${Geant4_INCLUDE_DIR}/G4Version.hh" _Geant4_VERSION_CONTENTS)
-    string(REGEX REPLACE ".*#define G4VERSION_NUMBER  ([0-9.]+).*" "\\1"
-        Geant4_VERSION "${_Geant4_VERSION_CONTENTS}")
-    
-    if(NOT Geant4_FIND_QUIETLY)
-        message(STATUS "Found Geant4 Version ${Geant4_VERSION}")
-    endif()
-  
-    if(Geant4_FIND_VERSION)
-        set(Geant4_VERSIONING_TESTS Geant4_VERSION_COMPATIBLE)
-
-        if("${Geant4_VERSION}" VERSION_LESS "${Geant4_FIND_VERSION}")
-            set(Geant4_VERSION_COMPATIBLE FALSE)
-        else()
-            set(Geant4_VERSION_COMPATIBLE TRUE)
-
-            if(Geant4_FIND_VERSION_EXACT)
-                if("${Geant4_VERSION}" VERSION_EQUAL "${Geant4_FIND_VERSION}")
-                    set(Geant4_VERSION_EXACT TRUE)
-                endif()
-                    list(APPEND Geant4_VERSIONING_TESTS Geant4_VERSION_EXACT)
-            endif()
-        endif()
-    else()
-      set(Geant4_ANY_VERSION TRUE)
-      set(Geant4_VERSIONING_TESTS Geant4_ANY_VERSION)
-    endif()
-endif()
-
-#----------------------------------------------------------------------------
-# Construct an error message for FPHSA
-#
-set(Geant4_DEFAULT_MSG "Could NOT find Geant4:\n")
-
-if(NOT Geant4_INCLUDE_DIR)
-    set(Geant4_DEFAULT_MSG "${Geant4_DEFAULT_MSG}Geant4 Header Path Not Found\n")
-endif()
-
-if(Geant4_LIBRARY)
-    get_filename_component(Geant4_LIBRARY_DIR "${Geant4_LIBRARY}" PATH)
-else()
-    set(Geant4_DEFAULT_MSG "${Geant4_DEFAULT_MSG}Geant4 Library Not Found\n")
-endif()
-
-if(Geant4_FIND_VERSION)
-    if(NOT Geant4_VERSION_COMPATIBLE)
-        set(Geant4_DEFAULT_MSG "${Geant4_DEFAULT_MSG}Incompatible versions, ${Geant4_VERSION}(found) < ${Geant4_FIND_VERSION}(required)\n")
-    endif()
-
-    if(Geant4_FIND_VERSION_EXACT)
-        if(NOT Geant4_VERSION_EXACT)
-            set(Geant4_DEFAULT_MSG "${Geant4_DEFAULT_MSG}Non-exact versions, ${Geant4_VERSION}(found) != ${Geant4_FIND_VERSION}(required)\n")
-        endif()
-    endif()
-endif()
-
-
-#----------------------------------------------------------------------------
-# Handle the QUIETLY and REQUIRED arguments, setting Geant4_FOUND to TRUE if
-# all listed variables are TRUE
-#
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Geant4 
-    "${Geant4_DEFAULT_MSG}"
-    Geant4_LIBRARY
-    Geant4_INCLUDE_DIR
-    ${Geant4_VERSIONING_TESTS}
-    )
-    
-set(Geant4_FOUND GEANT_FOUND)  # The previous function sets only the uppercased name
-
-#----------------------------------------------------------------------------
-# If we found Geant4, set the needed non-cache variables
-#      G4persistency
-#
-if(Geant4_FOUND)
-    set(Geant4_LIBRARIES -L${Geant4_LIBRARY_DIR}     
-      G4vis_management
-      G4modeling
-      G4interfaces
-      G4analysis
-      G4error_propagation
-      G4readout
-      G4physicslists
-      G4run
-      G4event
-      G4tracking
-      G4parmodels
-      G4processes
-      G4digits_hits
-      G4track
-      G4particles
-      G4geometry
-      G4materials
-      G4graphics_reps
-      G4intercoms
-      G4global )
-    set(Geant4_INCLUDE_DIRS ${Geant4_INCLUDE_DIR})
-endif()
-
-#----------------------------------------------------------------------------
-# Mark cache variables that can be adjusted as advanced
-#
-mark_as_advanced(Geant4_INCLUDE_DIR Geant4_LIBRARY)
-
-#----------------------------------------------------------------------------
-# Components
-if(Geant4_FOUND)
-  find_library(Geant4_clhep_LIBRARY G4clhep PATHS ${Geant4_LIBRARY_DIR})
-  if(Geant4_clhep_LIBRARY)
-     set(Geant4_LIBRARIES ${Geant4_LIBRARIES} G4clhep)
-     set(Geant4_clhep_FOUND TRUE)
-  else()
-     set(Geant4_clhep_FOUND FALSE)  
-  endif()
-endif()
-
diff --git a/cmake/thisdd4hep.sh b/cmake/thisdd4hep.sh
index 5f25bdee6..05b55c088 100644
--- a/cmake/thisdd4hep.sh
+++ b/cmake/thisdd4hep.sh
@@ -25,9 +25,9 @@ fi
 
 #----LD_LIBRARY_PATH-----------------------------------------------------------------
 if [ -z "${LD_LIBRARY_PATH}" ]; then
-  LD_LIBRARY_PATH=@LIBRARY_OUTPUT_PATH@:@XERCESC_ROOT_DIR@/lib:@ROOT_LIBRARY_DIR@; export LD_LIBRARY_PATH       # Linux, ELF HP-UX
+  LD_LIBRARY_PATH=@LIBRARY_OUTPUT_PATH@:@XERCESC_ROOT_DIR@/lib:@ROOT_LIBRARY_DIR@:@Geant4_DIR@/..; export LD_LIBRARY_PATH       # Linux, ELF HP-UX
 else
-  LD_LIBRARY_PATH=@LIBRARY_OUTPUT_PATH@:@XERCESC_ROOT_DIR@/lib:@ROOT_LIBRARY_DIR@:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
+  LD_LIBRARY_PATH=@LIBRARY_OUTPUT_PATH@:@XERCESC_ROOT_DIR@/lib:@ROOT_LIBRARY_DIR@:@Geant4_DIR@/..:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
 fi
 
 #----DYLD_LIBRARY_PATH---------------------------------------------------------------
-- 
GitLab