Skip to content

Commit

Permalink
Update Snakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
khushi-singla-21 authored Oct 30, 2024
1 parent 1f857c2 commit 1a90f08
Showing 1 changed file with 30 additions and 55 deletions.
85 changes: 30 additions & 55 deletions benchmarks/tracking_performances_dis/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,71 +55,61 @@ exec env DETECTOR_CONFIG={wildcards.DETECTOR_CONFIG} \
"""

# Process the files -- either from the campaign or local running -- through the analysis script
rule trk_dis_analysis:
rule dis_analysis:
input:
script="benchmarks/tracking_performances_dis/analysis/trk_dis_analysis.cxx",
script_compiled="benchmarks/tracking_performances_dis/analysis/trk_dis_analysis_cxx.so",
script_trk="benchmarks/tracking_performances_dis/analysis/trk_dis_analysis.cxx",
script_trk_compiled="benchmarks/tracking_performances_dis/analysis/trk_dis_analysis_cxx.so",
script_vtx="benchmarks/tracking_performances_dis/analysis/vtx_dis_analysis.cxx",
script_vtx_compiled="benchmarks/tracking_performances_dis/analysis/vtx_dis_analysis_cxx.so",
data="sim_output/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_beamEffects_xAngle=-0.025_hiDiv_{INDEX}.edm4eic.root",
output:
config="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/config.json",
hists="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/hists.root",
config_trk="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/config.json",
hists_trk="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/hists.root",
config_vtx="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/config.json",
hists_vtx="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/hists.root",
wildcard_constraints:
PREFIX= ".*",
EBEAM="\d+",
PBEAM="\d+",
MINQ2="\d+",
MINQ2="\d+",
INDEX="\d+",
shell:
"""
cat > {output.config} <<EOF
cat > {output.config_trk} <<EOF
{{
"rec_file": "{input.data}",
"detector": "{wildcards.DETECTOR_CONFIG}",
"ebeam": {wildcards.EBEAM},
"pbeam": {wildcards.PBEAM},
"Min_Q2": {wildcards.MINQ2},
"output_prefix": "$(dirname "{output.hists}")/hists"
"output_prefix": "$(dirname "{output.hists_trk}")/hists"
}}
EOF
root -l -b -q '{input.script}+("{output.config}")'
"""
root -l -b -q '{input.script_trk}+("{output.config_trk}")'
rule vtx_dis_analysis:
input:
script="benchmarks/tracking_performances_dis/analysis/vtx_dis_analysis.cxx",
script_compiled="benchmarks/tracking_performances_dis/analysis/vtx_dis_analysis_cxx.so",
data="sim_output/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_beamEffects_xAngle=-0.025_hiDiv_{INDEX}.edm4eic.root",
output:
config="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/config.json",
hists="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/hists.root",
wildcard_constraints:
PREFIX= ".*",
EBEAM="\d+",
PBEAM="\d+",
MINQ2="\d+",
INDEX="\d+",
shell:
"""
cat > {output.config} <<EOF
cat > {output.config_vtx} <<EOF
{{
"rec_file": "{input.data}",
"detector": "{wildcards.DETECTOR_CONFIG}",
"ebeam": {wildcards.EBEAM},
"pbeam": {wildcards.PBEAM},
"Min_Q2": {wildcards.MINQ2},
"output_prefix": "$(dirname "{output.hists}")/hists"
"output_prefix": "$(dirname "{output.hists_vtx}")/hists"
}}
EOF
root -l -b -q '{input.script}+("{output.config}")'
root -l -b -q '{input.script_vtx}+("{output.config_vtx}")'
"""

#Merge all the files produced in the previous step
rule trk_dis_combine:
rule dis_combine:
input:
lambda wildcards: [f"results/tracking_performances_dis/{wildcards.DETECTOR_CONFIG}/{wildcards.PREFIX}pythia8NCDIS_{wildcards.EBEAM}x{wildcards.PBEAM}_minQ2={wildcards.MINQ2}_{ix}/hists.root" for ix in range(1,int(wildcards.NUM_FILES)+1)],
lambda wildcards: [f"results/vertexing_performances_dis/{wildcards.DETECTOR_CONFIG}/{wildcards.PREFIX}pythia8NCDIS_{wildcards.EBEAM}x{wildcards.PBEAM}_minQ2={wildcards.MINQ2}_{ix}/hists.root" for ix in range(1,int(wildcards.NUM_FILES)+1)],
output:
config="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/config.json",
hists="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/hists.root",
config_trk="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/config.json",
hists_trk="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/hists.root",
config_vtx="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/config.json",
hists_vtx="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/hists.root",
wildcard_constraints:
PREFIX= ".*",
EBEAM="\d+",
Expand All @@ -128,46 +118,31 @@ rule trk_dis_combine:
NUM_FILES="\d+",
shell:
"""
cat > {output.config} <<EOF
cat > {output.config_trk} <<EOF
{{
"hists_file": "{output.hists}",
"hists_file": "{output.hists_trk}",
"detector": "{wildcards.DETECTOR_CONFIG}",
"ebeam": {wildcards.EBEAM},
"pbeam": {wildcards.PBEAM},
"Min_Q2": {wildcards.MINQ2},
"nfiles": {wildcards.NUM_FILES},
"output_prefix": "$(dirname "{output.hists}")/plots"
"output_prefix": "$(dirname "{output.hists_trk}")/plots"
}}
EOF
hadd {output.hists} {input}
"""
hadd {output.hists_trk} {input}
rule vtx_dis_combine:
input:
lambda wildcards: [f"results/vertexing_performances_dis/{wildcards.DETECTOR_CONFIG}/{wildcards.PREFIX}pythia8NCDIS_{wildcards.EBEAM}x{wildcards.PBEAM}_minQ2={wildcards.MINQ2}_{ix}/hists.root" for ix in range(1,int(wildcards.NUM_FILES)+1)],
output:
config="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/config.json",
hists="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/hists.root",
wildcard_constraints:
PREFIX= ".*",
EBEAM="\d+",
PBEAM="\d+",
MINQ2="\d+",
NUM_FILES="\d+",
shell:
"""
cat > {output.config} <<EOF
cat > {output.config_vtx} <<EOF
{{
"hists_file": "{output.hists}",
"hists_file": "{output.hists_vtx}",
"detector": "{wildcards.DETECTOR_CONFIG}",
"ebeam": {wildcards.EBEAM},
"pbeam": {wildcards.PBEAM},
"Min_Q2": {wildcards.MINQ2},
"nfiles": {wildcards.NUM_FILES},
"output_prefix": "$(dirname "{output.hists}")/plots"
"output_prefix": "$(dirname "{output.hists_vtx}")/plots"
}}
EOF
hadd {output.hists} {input}
hadd {output.hists_vtx} {input}
"""

#Process the merged file through the plotting script
Expand Down

0 comments on commit 1a90f08

Please sign in to comment.