From 1e46eaaf3fc69ac27cadae8646d19f21c0114514 Mon Sep 17 00:00:00 2001
From: Tadej Novak <tadej.novak@cern.ch>
Date: Sun, 27 Nov 2022 10:57:30 +0100
Subject: [PATCH] Add CA to legacy pre/postInclude resolving to simulation
 skeletons

---
 .../SimuJobTransforms/share/skeleton.EVGENtoHIT_ISF.py      | 6 ++++++
 .../SimuJobTransforms/share/skeleton.EVGENtoHIT_MC12.py     | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_ISF.py b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_ISF.py
index b1d4d303d80a..c43f5ece176b 100644
--- a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_ISF.py
+++ b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_ISF.py
@@ -115,6 +115,9 @@ if hasattr(runArgs, "preExec"):
 ## Pre-include
 if hasattr(runArgs, "preInclude"):
     for fragment in runArgs.preInclude:
+        if '/' not in fragment:
+            atlasG4log.warning('Trying to use CA-based preInclude, trying to fallback to legacy equivalent')
+            fragment = f"{fragment.replace('.', '/')}.py"
         include(fragment)
 
 ## Include common skeleton after the preExec/preInclude
@@ -280,6 +283,9 @@ if athenaCommonFlags.PoolHitsOutput():
 ## Post-include
 if hasattr(runArgs, "postInclude"):
     for fragment in runArgs.postInclude:
+        if '/' not in fragment:
+            atlasG4log.warning('Trying to use CA-based postInclude, trying to fallback to legacy equivalent')
+            fragment = f"{fragment.replace('.', '/')}.py"
         include(fragment)
 
 if hasattr(runArgs, "outputEVNT_TRFile"):
diff --git a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_MC12.py b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_MC12.py
index 9b328a67c764..e942e90aca67 100644
--- a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_MC12.py
+++ b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_MC12.py
@@ -105,6 +105,9 @@ if hasattr(runArgs, "preExec"):
 ## Pre-include
 if hasattr(runArgs, "preInclude"):
     for fragment in runArgs.preInclude:
+        if '/' not in fragment:
+            atlasG4log.warning('Trying to use CA-based preInclude, trying to fallback to legacy equivalent')
+            fragment = f"{fragment.replace('.', '/')}.py"
         include(fragment)
 
 ## Include common skeleton after the preExec/preInclude
@@ -301,6 +304,9 @@ if nThreads > 0:
 ## Post-include
 if hasattr(runArgs, "postInclude"):
     for fragment in runArgs.postInclude:
+        if '/' not in fragment:
+            atlasG4log.warning('Trying to use CA-based postInclude, trying to fallback to legacy equivalent')
+            fragment = f"{fragment.replace('.', '/')}.py"
         include(fragment)
 
 if hasattr(runArgs, "outputEVNT_TRFile"):
-- 
GitLab