From 6bb689cc7548bd46d36ed2273873be003aaae71c Mon Sep 17 00:00:00 2001
From: Markus Frank <Markus.Frank@cern.ch>
Date: Fri, 5 Jul 2019 18:53:08 +0200
Subject: [PATCH] Add DDDigi example directory with test

---
 DDDigi/CMakeLists.txt                         |  1 -
 DDDigi/plugins/{dummy.cpp => Components.cpp}  |  0
 examples/CMakeLists.txt                       |  1 +
 examples/DDDigi/CMakeLists.txt                | 42 +++++++++++++++++++
 .../DDDigi/scripts}/TestFramework.py          |  0
 .../DDDigi/src}/DigiTestAction.cpp            |  0
 6 files changed, 43 insertions(+), 1 deletion(-)
 rename DDDigi/plugins/{dummy.cpp => Components.cpp} (100%)
 create mode 100644 examples/DDDigi/CMakeLists.txt
 rename {DDDigi/examples => examples/DDDigi/scripts}/TestFramework.py (100%)
 rename {DDDigi/plugins => examples/DDDigi/src}/DigiTestAction.cpp (100%)

diff --git a/DDDigi/CMakeLists.txt b/DDDigi/CMakeLists.txt
index 2da6aba78..b2bf08086 100644
--- a/DDDigi/CMakeLists.txt
+++ b/DDDigi/CMakeLists.txt
@@ -41,5 +41,4 @@ dd4hep_add_plugin(DDDigiPlugins
   )
 target_compile_definitions(DDDigiPlugins PUBLIC DD4HEP_USE_TBB)
 #---Package installation procedure(s) ----------------------------------------------
-#d4hep_install_dir(examples DESTINATION examples/DDDigi)
 dd4hep_install_files(FILES python/*.py python/*.C DESTINATION python)
diff --git a/DDDigi/plugins/dummy.cpp b/DDDigi/plugins/Components.cpp
similarity index 100%
rename from DDDigi/plugins/dummy.cpp
rename to DDDigi/plugins/Components.cpp
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index af7b425b4..3dcffb0d1 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -51,6 +51,7 @@ dd4hep_enable_tests (
   ClientTests
   Conditions
   DDG4
+  DDDigi
   Persistency
   SimpleDetector
   DDG4_MySensDet
diff --git a/examples/DDDigi/CMakeLists.txt b/examples/DDDigi/CMakeLists.txt
new file mode 100644
index 000000000..142e4d192
--- /dev/null
+++ b/examples/DDDigi/CMakeLists.txt
@@ -0,0 +1,42 @@
+#==========================================================================
+#  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.
+#
+#==========================================================================
+cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
+include ( ${DD4hep_DIR}/cmake/DD4hep.cmake )
+
+#-----------------------------------------------------------------------------------
+dd4hep_configure_output ()
+dd4hep_package ( DDDigi MAJOR 0 MINOR 0 PATCH 1
+  USES  [DD4hep REQUIRED COMPONENTS DDCore DDDigi]
+  )
+set(DDDigiexamples_INSTALL  ${CMAKE_INSTALL_PREFIX}/examples/DDDigi)
+#
+dd4hep_set_compiler_flags()
+#
+dd4hep_add_plugin( DDDigiExampleLib
+  SOURCES   src/*.cpp
+  USES      [ROOT   REQUIRED COMPONENTS Geom GenVector RIO]
+            [DD4hep REQUIRED COMPONENTS DDCore DDDigi]
+  )
+#
+dd4hep_install_dir(scripts DESTINATION ${DDDigiexamples_INSTALL})
+#
+dd4hep_configure_scripts (DDDigi DEFAULT_SETUP WITH_TESTS)
+#
+# Test HepMC input reader
+dd4hep_add_test_reg( DDDigi_framework
+  COMMAND    "${CMAKE_INSTALL_PREFIX}/bin/run_test_DDDigi.sh"
+  EXEC_ARGS  python ${DDDigiexamples_INSTALL}/scripts/TestFramework.py
+  REQUIRES   DDDigi
+  REGEX_PASS "All event processing threads Synchronized --- Done"
+  REGEX_FAIL "Error;ERROR;Exception"
+  )
+#
+
diff --git a/DDDigi/examples/TestFramework.py b/examples/DDDigi/scripts/TestFramework.py
similarity index 100%
rename from DDDigi/examples/TestFramework.py
rename to examples/DDDigi/scripts/TestFramework.py
diff --git a/DDDigi/plugins/DigiTestAction.cpp b/examples/DDDigi/src/DigiTestAction.cpp
similarity index 100%
rename from DDDigi/plugins/DigiTestAction.cpp
rename to examples/DDDigi/src/DigiTestAction.cpp
-- 
GitLab