Skip to content
Snippets Groups Projects
Commit ef5512da authored by Dmitry Kalinkin's avatar Dmitry Kalinkin
Browse files

backwards_ecal: add support for campaign processing

parent a49302a2
Branches
No related tags found
No related merge requests found
......@@ -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}
"""
......@@ -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,}/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment