From 2029e3275e1dfec28ba79d390cd3e79d443068f6 Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Fri, 22 Dec 2023 12:57:32 -0600
Subject: [PATCH] fix: load ActsGeoSvc from Jug::Reco if available

---
 .../far_forward/options/far_forward_reconstruction.py |  7 ++++++-
 .../track_finding/options/track_reconstruction.py     | 11 ++++++++++-
 .../track_fitting/options/track_reconstruction.py     | 11 ++++++++++-
 benchmarks/tracking/options/track_reconstruction.py   | 11 ++++++++++-
 4 files changed, 36 insertions(+), 4 deletions(-)

diff --git a/benchmarks/far_forward/options/far_forward_reconstruction.py b/benchmarks/far_forward/options/far_forward_reconstruction.py
index 81a5fba9..ec334370 100644
--- a/benchmarks/far_forward/options/far_forward_reconstruction.py
+++ b/benchmarks/far_forward/options/far_forward_reconstruction.py
@@ -1,6 +1,10 @@
 from Gaudi.Configuration import *
 
 from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc
+try:
+    from Configurables import Jug__Reco__ActsGeoSvc as ActsGeoSvc
+except:
+    from Configurables import ActsGeoSvc
 from GaudiKernel.SystemOfUnits import MeV, GeV, mm, cm, mrad
 
 detector_name = str(os.environ.get("DETECTOR_CONFIG", "epic"))
@@ -13,6 +17,7 @@ output_rec = str(os.environ["JUGGLER_REC_FILE"])
 n_events = int(os.environ["JUGGLER_N_EVENTS"])
 
 geo_service = GeoSvc("GeoSvc", detectors=[compact_path], OutputLevel=WARNING)
+acts_geo_service = ActsGeoSvc("ActsGeoSvc", OutputLevel=WARNING)
 podioevent = EICDataSvc("EventDataSvc", inputs=input_sims, OutputLevel=WARNING)
 
 from Configurables import PodioInput
@@ -153,7 +158,7 @@ ApplicationMgr(
     TopAlg = algorithms,
     EvtSel = 'NONE',
     EvtMax = n_events,
-    ExtSvc = [podioevent, geo_service],
+    ExtSvc = [podioevent, geo_service, acts_geo_service],
     OutputLevel=WARNING
  )
 
diff --git a/benchmarks/track_finding/options/track_reconstruction.py b/benchmarks/track_finding/options/track_reconstruction.py
index e9c4f8ed..a736d593 100644
--- a/benchmarks/track_finding/options/track_reconstruction.py
+++ b/benchmarks/track_finding/options/track_reconstruction.py
@@ -3,6 +3,10 @@ import os
 from Gaudi.Configuration import *
 
 from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc
+try:
+    from Configurables import Jug__Reco__ActsGeoSvc as ActsGeoSvc
+except:
+    from Configurables import ActsGeoSvc
 from GaudiKernel import SystemOfUnits as units
 
 detector_path = str(os.environ.get("DETECTOR_PATH", "."))
@@ -24,6 +28,11 @@ geo_service = GeoSvc(
     materials="calibrations/materials-map.cbor",
     OutputLevel=WARNING,
 )
+acts_geo_service = ActsGeoSvc(
+    "ActsGeoSvc",
+    materials="calibrations/materials-map.cbor",
+    OutputLevel=WARNING,
+)
 podioevent = EICDataSvc("EventDataSvc", inputs=[input_sim_file], OutputLevel=WARNING)
 
 from Configurables import PodioInput
@@ -257,6 +266,6 @@ ApplicationMgr(
     TopAlg=algorithms,
     EvtSel="NONE",
     EvtMax=n_events,
-    ExtSvc=[podioevent, geo_service],
+    ExtSvc=[podioevent, geo_service, acts_geo_service],
     OutputLevel=WARNING,
 )
diff --git a/benchmarks/track_fitting/options/track_reconstruction.py b/benchmarks/track_fitting/options/track_reconstruction.py
index c6272357..db28668b 100644
--- a/benchmarks/track_fitting/options/track_reconstruction.py
+++ b/benchmarks/track_fitting/options/track_reconstruction.py
@@ -3,6 +3,10 @@ import os
 from Gaudi.Configuration import *
 
 from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc
+try:
+    from Configurables import Jug__Reco__ActsGeoSvc as ActsGeoSvc
+except:
+    from Configurables import ActsGeoSvc
 from GaudiKernel import SystemOfUnits as units
 
 detector_path = str(os.environ.get("DETECTOR_PATH", "."))
@@ -24,6 +28,11 @@ geo_service = GeoSvc(
     materials="calibrations/materials-map.cbor",
     OutputLevel=WARNING,
 )
+acts_geo_service = ActsGeoSvc(
+    "ActsGeoSvc",
+    materials="calibrations/materials-map.cbor",
+    OutputLevel=WARNING,
+)
 podioevent = EICDataSvc("EventDataSvc", inputs=[input_sim_file], OutputLevel=WARNING)
 
 from Configurables import PodioInput
@@ -243,6 +252,6 @@ ApplicationMgr(
     TopAlg=algorithms,
     EvtSel="NONE",
     EvtMax=n_events,
-    ExtSvc=[podioevent, geo_service],
+    ExtSvc=[podioevent, geo_service, acts_geo_service],
     OutputLevel=WARNING,
 )
diff --git a/benchmarks/tracking/options/track_reconstruction.py b/benchmarks/tracking/options/track_reconstruction.py
index c68084f4..1a7ab5de 100644
--- a/benchmarks/tracking/options/track_reconstruction.py
+++ b/benchmarks/tracking/options/track_reconstruction.py
@@ -3,6 +3,10 @@ import os
 from Gaudi.Configuration import *
 
 from Configurables import ApplicationMgr, EICDataSvc, PodioOutput, GeoSvc
+try:
+    from Configurables import Jug__Reco__ActsGeoSvc as ActsGeoSvc
+except:
+    from Configurables import ActsGeoSvc
 from GaudiKernel import SystemOfUnits as units
 
 detector_path = str(os.environ.get("DETECTOR_PATH", "."))
@@ -24,6 +28,11 @@ geo_service = GeoSvc(
     materials="calibrations/materials-map.cbor",
     OutputLevel=WARNING,
 )
+acts_geo_service = ActsGeoSvc(
+    "ActsGeoSvc",
+    materials="calibrations/materials-map.cbor",
+    OutputLevel=WARNING,
+)
 podioevent = EICDataSvc("EventDataSvc", inputs=[input_sim_file], OutputLevel=WARNING)
 
 from Configurables import PodioInput
@@ -234,6 +243,6 @@ ApplicationMgr(
     TopAlg=algorithms,
     EvtSel="NONE",
     EvtMax=n_events,
-    ExtSvc=[podioevent, geo_service],
+    ExtSvc=[podioevent, geo_service, acts_geo_service],
     OutputLevel=WARNING,
 )
-- 
GitLab