From fc21c841d1a6e63334e152c31ce8c9e3608e3ae5 Mon Sep 17 00:00:00 2001 From: Paul Gessinger Date: Wed, 9 Oct 2024 15:28:56 +0200 Subject: [PATCH] fix: `material_recoding.py` conditional loading of GeoModel (#3703) The previous method of a nested `import` does not actually work. --- Examples/Scripts/Python/material_recording.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Examples/Scripts/Python/material_recording.py b/Examples/Scripts/Python/material_recording.py index ee8910e8ef4..9de5914d45a 100755 --- a/Examples/Scripts/Python/material_recording.py +++ b/Examples/Scripts/Python/material_recording.py @@ -18,6 +18,12 @@ import acts.examples.geant4.dd4hep from acts.examples.odd import getOpenDataDetector +try: + import acts.examples.geant4.geomodel +except ImportError: + # geomodel is optional for this script + pass + u = acts.UnitConstants _material_recording_executed = False @@ -114,8 +120,6 @@ def main(): acts.examples.geant4.GdmlDetectorConstructionFactory(args.input) ) elif args.input.endswith(".sqlite") or args.input.endswith(".db"): - import acts.examples.geant4.geomodel - geoModelTree = acts.geomodel.readFromDb(args.input) detectorConstructionFactory = ( acts.examples.geant4.geomodel.GeoModelDetectorConstructionFactory(