Warning, /tutorial-developing-benchmarks/files/Snakefile is written in an unsupported language. File is not indexed.
0001 import os
0002 from snakemake.remote.HTTP import RemoteProvider as HTTPRemoteProvider
0003
0004 # Set environment mode (local or eicweb)
0005 ENV_MODE = os.getenv("ENV_MODE", "local") # Defaults to "local" if not set
0006 # Output directory based on environment
0007 OUTPUT_DIR = "../../sim_output/" if ENV_MODE == "eicweb" else "sim_output/"
0008 # Benchmark directory based on environment
0009 BENCH_DIR = "benchmarks/your_benchmark/" if ENV_MODE == "eicweb" else "./"
0010
0011 rule your_benchmark_campaign_reco_get:
0012 output:
0013 f"{OUTPUT_DIR}rho_10x100_uChannel_Q2of0to10_hiDiv.{% raw %}{{INDEX}}{% endraw %}.eicrecon.tree.edm4eic.root",
0014 shell: """
0015 xrdcp root://dtn-eic.jlab.org//work/eic2/EPIC/RECO/24.07.0/epic_craterlake/EXCLUSIVE/UCHANNEL_RHO/10x100/rho_10x100_uChannel_Q2of0to10_hiDiv.{wildcards.INDEX}.eicrecon.tree.edm4eic.root {output}
0016 """
0017
0018 rule your_benchmark_analysis:
0019 input:
0020 script=f"{BENCH_DIR}analysis/uchannelrho.cxx",
0021 data=f"{OUTPUT_DIR}rho_10x100_uChannel_Q2of0to10_hiDiv.{% raw %}{{INDEX}}{% endraw %}.eicrecon.tree.edm4eic.root",
0022 output:
0023 plots=f"{OUTPUT_DIR}campaign_24.07.0_{% raw %}{{INDEX}}{% endraw %}.eicrecon.tree.edm4eic/plots.root",
0024 shell:
0025 """
0026 mkdir -p $(dirname "{output.plots}")
0027 root -l -b -q '{input.script}+("{input.data}","{output.plots}")'
0028 """
0029
0030 rule your_benchmark_combine:
0031 input:
0032 lambda wildcards: expand(
0033 f"{OUTPUT_DIR}campaign_24.07.0_{% raw %}{{INDEX:04d}}{% endraw %}.eicrecon.tree.edm4eic/plots.root",
0034 INDEX=range(int(wildcards.N)),
0035 ),
0036 wildcard_constraints:
0037 N="\d+",
0038 output:
0039 f"{OUTPUT_DIR}campaign_24.07.0_combined_{% raw %}{{N}}{% endraw %}files.eicrecon.tree.edm4eic.plots.root",
0040 shell:
0041 """
0042 hadd {output} {input}
0043 """
0044
0045 rule your_benchmark_plots:
0046 input:
0047 script=f"{BENCH_DIR}macros/plot_rho_physics_benchmark.C",
0048 plots=f"{OUTPUT_DIR}campaign_24.07.0_combined_{% raw %}{{N}}{% endraw %}files.eicrecon.tree.edm4eic.plots.root",
0049 output:
0050 f"{OUTPUT_DIR}campaign_24.07.0_combined_{% raw %}{{N}}{% endraw %}files.eicrecon.tree.edm4eic.plots_figures/benchmark_rho_mass.pdf",
0051 shell:
0052 """
0053 if [ ! -d "{input.plots}_figures" ]; then
0054 mkdir "{input.plots}_figures"
0055 echo "{input.plots}_figures directory created successfully."
0056 else
0057 echo "{input.plots}_figures directory already exists."
0058 fi
0059 root -l -b -q '{input.script}("{input.plots}")'
0060 """