Back to home page

EIC code displayed by LXR

 
 

    


Warning, /physics_benchmarks/Snakefile is written in an unsupported language. File is not indexed.

0001 import functools
0002 import os
0003 from snakemake.logging import logger
0004 
0005 
0006 @functools.cache
0007 def get_spack_package_hash(package_name):
0008     import json
0009     try:
0010         ver_info = json.loads(subprocess.check_output(["spack", "find", "--json", package_name]))
0011         return ver_info[0]["package_hash"]
0012     except FileNotFoundError as e:
0013         logger.warning("Spack is not installed")
0014         return ""
0015     except subprocess.CalledProcessError as e:
0016         print(e)
0017         return ""
0018 
0019 
0020 @functools.cache
0021 def find_epic_libraries():
0022     import ctypes.util
0023     # if library is not found (not avaliable) we return an empty list to let DAG still evaluate
0024     libs = []
0025     lib = ctypes.util.find_library("epic")
0026     if lib is not None:
0027         libs.append(os.environ["DETECTOR_PATH"] + "/../../lib/" + lib)
0028     return libs
0029 
0030 
0031 ROOT_BUILD_DIR = os.getenv("ROOT_BUILD_DIR", None)
0032 
0033 if ROOT_BUILD_DIR is not None:
0034     ROOT_BUILD_DIR_PREFIX = f"{ROOT_BUILD_DIR.rstrip('/')}/{os.getcwd().lstrip('/')}/"
0035 else:
0036     ROOT_BUILD_DIR_PREFIX = ""
0037 
0038 
0039 rule compile_analysis:
0040     input:
0041         "{path}/{filename}.cxx",
0042     output:
0043         ROOT_BUILD_DIR_PREFIX + "{path}/{filename}_cxx.d",
0044         ROOT_BUILD_DIR_PREFIX + "{path}/{filename}_cxx.so",
0045         ROOT_BUILD_DIR_PREFIX + "{path}/{filename}_cxx_ACLiC_dict_rdict.pcm",
0046     shell:
0047         """
0048 root -l -b -q -e '.L {input}+'
0049 """
0050 
0051 
0052 rule fetch_epic:
0053     output:
0054         filepath="EPIC/{PATH}"
0055     cache: True
0056     shell: """
0057 xrdcp root://dtn-eic.jlab.org//volatile/eic/{output.filepath} {output.filepath}
0058 """
0059 
0060 
0061 rule warmup_run:
0062     output:
0063         "warmup/{DETECTOR_CONFIG}.edm4hep.root",
0064     message: "Ensuring that calibrations/fieldmaps are available for {wildcards.DETECTOR_CONFIG}"
0065     shell: """
0066 ddsim \
0067   --runType batch \
0068   --numberOfEvents 1 \
0069   --compactFile "$DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml" \
0070   --outputFile "{output}" \
0071   --enableGun
0072 """
0073 
0074 include: "benchmarks/Exclusive-Diffraction-Tagging/demp/Snakefile"
0075 include: "benchmarks/Exclusive-Diffraction-Tagging/diffractive_vm/Snakefile"
0076 include: "benchmarks/Exclusive-Diffraction-Tagging/semi_coherent/Snakefile"
0077 include: "benchmarks/Jets-HF/jets/Snakefile"
0078 include: "benchmarks/Inclusive/dis/Snakefile"