From 527788e248fba7c9be0ffd6f9a35490140617a86 Mon Sep 17 00:00:00 2001
From: Whitney Armstrong <warmstrong@anl.gov>
Date: Thu, 27 May 2021 18:14:28 +0000
Subject: [PATCH] Added ACTS root script

---
 .gitlab-ci.yml        |  8 ++++++++
 scripts/test_ACTS.cxx | 48 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)
 create mode 100644 scripts/test_ACTS.cxx

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 33bbab6c..fcbe7189 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -67,6 +67,7 @@ common:detector:
     - mkdir -p results
     - mkdir -p config
     - mkdir -p doc
+    - mkdir -p geo
     - print_env.sh
 
 compile:
@@ -143,6 +144,13 @@ overlap_check:
     - echo "$(cat doc/overlap_check.out | grep ovlp | wc -l) overlaps..."
     - if [[ "$(cat doc/overlap_check.out | grep ovlp | wc -l)" -gt "0" ]] ; then echo "Overlaps exist!" && false ; fi
 
+tracking_geometry_debug:
+  stage: test
+  needs: 
+    - ["common:detector"]
+  script:
+    - root -b -q "scripts/test_ACTS.cxx+(\"${DETECTOR_PATH}/athena.xml\")" || true | tee geo/tracking_geometry_debug.out 
+
 detector:config_testing:
   stage: test
   needs: 
diff --git a/scripts/test_ACTS.cxx b/scripts/test_ACTS.cxx
new file mode 100644
index 00000000..cbb6bc6c
--- /dev/null
+++ b/scripts/test_ACTS.cxx
@@ -0,0 +1,48 @@
+R__LOAD_LIBRARY(libDDCore.so)
+R__LOAD_LIBRARY(libActsPluginDD4hep.so)
+R__LOAD_LIBRARY(libDDG4.so)
+R__LOAD_LIBRARY(libDDG4IO.so)
+#include "DD4hep/Detector.h"
+#include "DD4hep/DetElement.h"
+#include "DD4hep/Objects.h"
+#include "DD4hep/Detector.h"
+#include "DDG4/Geant4Data.h"
+#include "DDRec/CellIDPositionConverter.h"
+#include "DDRec/SurfaceManager.h"
+#include "DDRec/Surface.h"
+
+#include "TCanvas.h"
+#include "TChain.h"
+
+#include "Acts/Geometry/TrackingGeometry.hpp"
+#include "Acts/Geometry/TrackingVolume.hpp"
+#include "Acts/Plugins/DD4hep/ConvertDD4hepDetector.hpp"
+
+/** Example loading ACTs.
+ *
+ *
+ */
+void test_ACTS(const char* compact = "athena.xml"){
+
+  using namespace ROOT::Math;
+  // -------------------------
+  // Get the DD4hep instance
+  // Load the compact XML file
+  // Initialize the position converter tool
+  dd4hep::Detector& detector = dd4hep::Detector::getInstance();
+  detector.fromCompact(compact);
+  dd4hep::rec::CellIDPositionConverter cellid_converter(detector);
+
+  //std::unique_ptr<const Acts::TrackingGeometry> 
+  auto acts_tracking_geometry  = Acts::convertDD4hepDetector (detector.world(),Acts::Logging::Level::VERBOSE);
+
+  if(acts_tracking_geometry) {
+    if(acts_tracking_geometry->highestTrackingVolume()) {
+      std::cout << " volume name \n ";
+      std::cout << acts_tracking_geometry->highestTrackingVolume()->volumeName() << std::endl;
+    } else {
+      std::cout << "derp\n";
+    }
+  }
+
+}
-- 
GitLab