Skip to content

Commit

Permalink
backwards_ecal: graceful handling of missing epic library
Browse files Browse the repository at this point in the history
  • Loading branch information
veprbl committed Nov 6, 2024
1 parent 8cab87e commit d505553
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion benchmarks/backwards_ecal/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,21 @@ def get_spack_package_hash(package_name):
print(e)
return ""

@functools.cache
def find_epic_libraries():
# if library is not found (not avaliable) we return an empty list to let DAG still evaluate
libs = []
lib = ctypes.util.find_library("epic")
if lib is not None:
libs.append(os.environ["DETECTOR_PATH"] + "/../../lib/" + lib)
return libs


rule backwards_ecal_sim:
input:
steering_file=ancient("EPIC/EVGEN/SINGLE/{PARTICLE}/{ENERGY}/{PHASE_SPACE}/{PARTICLE}_{ENERGY}_{PHASE_SPACE}.steer"),
warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root",
geometry_lib=os.environ["DETECTOR_PATH"] + "/../../lib/" + ctypes.util.find_library("epic"),
geometry_lib=find_epic_libraries(),
output:
"sim_output/backwards_ecal/{DETECTOR_CONFIG}/{PARTICLE}/{ENERGY}/{PHASE_SPACE}/{PARTICLE}_{ENERGY}_{PHASE_SPACE}.{INDEX}.edm4hep.root",
log:
Expand Down

0 comments on commit d505553

Please sign in to comment.