diff --git a/benchmarks/backwards_ecal/Snakefile b/benchmarks/backwards_ecal/Snakefile index 5ac3effeea014ee1ee3b94f510b9b1d6cf534757..c19db356d41047876f1ce83e991001f63152c556 100644 --- a/benchmarks/backwards_ecal/Snakefile +++ b/benchmarks/backwards_ecal/Snakefile @@ -77,12 +77,64 @@ rule backwards_ecal_local_sim_list: fp.write("\n".join(input)) +if False: + rule backwards_ecal_campaign_sim_list: + output: + "listing/backwards_ecal/{CAMPAIGN}/{DETECTOR_CONFIG}/{PARTICLE}/{ENERGY}/{PHASE_SPACE}.lst", + params: + search_path=lambda wildcards: f"EPIC/RECO/{wildcards.CAMPAIGN}/epic_craterlake/SINGLE/{wildcards.PARTICLE}/{wildcards.ENERGY}/{wildcards.PHASE_SPACE}/", + shell: """ + xrdfs root://dtn-eic.jlab.org/ ls /work/eic2/{params.search_path} \ + | awk '{{ print "root://dtn-eic.jlab.org/"$1; }}' \ + | sort \ + > {output} + if [ ! -s {output} ]; then + echo "Got an empty file listing for path \"\"" + exit 1 + fi + """ +else: + checkpoint backwards_ecal_campaign_sim_list_checkpoint: + output: + "listing/backwards_ecal/{CAMPAIGN}/{DETECTOR_CONFIG}/{PARTICLE}/{ENERGY}/{PHASE_SPACE}.lst.orig", + params: + search_path=lambda wildcards: f"EPIC/RECO/{wildcards.CAMPAIGN}/epic_craterlake/SINGLE/{wildcards.PARTICLE}/{wildcards.ENERGY}/{wildcards.PHASE_SPACE}/", + shell: """ + xrdfs root://dtn-eic.jlab.org/ ls /work/eic2/{params.search_path} \ + | sed -e 's#^/work/eic2/##' \ + | sort \ + > {output} + if [ ! -s {output} ]; then + echo "Got an empty file listing for path \"\"" + exit 1 + fi + """ + + def get_backwards_ecal_campaign_sim_list(wildcards): + with checkpoints.backwards_ecal_campaign_sim_list_checkpoint.get(**wildcards).output[0].open() as fp: + return [line.rstrip() for line in fp.readlines()] + + rule backwards_ecal_campaign_sim_list: + input: + # depend on paths from the file list + get_backwards_ecal_campaign_sim_list, + orig_list="listing/backwards_ecal/{CAMPAIGN}/{DETECTOR_CONFIG}/{PARTICLE}/{ENERGY}/{PHASE_SPACE}.lst.orig", + output: + "listing/backwards_ecal/{CAMPAIGN}/{DETECTOR_CONFIG}/{PARTICLE}/{ENERGY}/{PHASE_SPACE}.lst", + shell: """ + cp {input.orig_list} {output} + """ + + +ruleorder: backwards_ecal_local_sim_list > backwards_ecal_campaign_sim_list + + DETECTOR_CONFIG=os.environ["DETECTOR_CONFIG"] rule backwards_ecal: input: expand( - "listing/backwards_ecal/local/" + DETECTOR_CONFIG + "/{PARTICLE}/{ENERGY}/{PHASE_SPACE}.lst", + "listing/backwards_ecal/{{CAMPAIGN}}/" + DETECTOR_CONFIG + "/{PARTICLE}/{ENERGY}/{PHASE_SPACE}.lst", PARTICLE=["pi-", "e-"], ENERGY=[ "100MeV", @@ -99,14 +151,14 @@ rule backwards_ecal: matplotlibrc=".matplotlibrc", script="benchmarks/backwards_ecal/backwards_ecal.py", output: - directory("results/backwards_ecal") + directory("results/backwards_ecal/{CAMPAIGN}/") shell: """ env \ MATPLOTLIBRC={input.matplotlibrc} \ DETECTOR_CONFIG=""" + DETECTOR_CONFIG + """ \ PLOT_TITLE=""" + DETECTOR_CONFIG + """ \ -INPUT_PATH_FORMAT=listing/backwards_ecal/local/""" + DETECTOR_CONFIG + """/{{particle}}/{{energy}}/130to177deg.lst \ +INPUT_PATH_FORMAT=listing/backwards_ecal/{wildcards.CAMPAIGN}/""" + DETECTOR_CONFIG + """/{{particle}}/{{energy}}/130to177deg.lst \ OUTPUT_DIR={output} \ python {input.script} """ diff --git a/benchmarks/backwards_ecal/config.yml b/benchmarks/backwards_ecal/config.yml index 8f2967f686c9c122255757ea9158246ca32122ca..75d8f46410bfe0ad58f0e17289b391696f361430 100644 --- a/benchmarks/backwards_ecal/config.yml +++ b/benchmarks/backwards_ecal/config.yml @@ -26,7 +26,7 @@ bench:backwards_ecal: script: - export PYTHONUSERBASE=$LOCAL_DATA_PATH/deps - pip install -r benchmarks/backwards_ecal/requirements.txt - - snakemake $SNAKEMAKE_FLAGS --cores 1 backwards_ecal + - snakemake $SNAKEMAKE_FLAGS --cores 1 results/backwards_ecal/local collect_results:backwards_ecal: extends: .det_benchmark @@ -36,5 +36,5 @@ collect_results:backwards_ecal: script: - ls -lrht - mv results{,_save}/ # move results directory out of the way to preserve it - - snakemake $SNAKEMAKE_FLAGS --cores 1 --delete-all-output backwards_ecal + - snakemake $SNAKEMAKE_FLAGS --cores 1 --delete-all-output results/backwards_ecal/local - mv results{_save,}/