Skip to content

Commit

Permalink
updated tau snakefile and config.yml to do multiple processes simulta…
Browse files Browse the repository at this point in the history
…neously
  • Loading branch information
sebouh137 committed Oct 23, 2024
1 parent aa20ee9 commit 956ac17
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
14 changes: 9 additions & 5 deletions benchmarks/insert_tau/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,29 @@ root -l -b -q '{input.script}({params.NEVENTS_GEN},"{output.GEN_FILE}", "tau-",
rule insert_tau_simulate:
input:
GEN_FILE="sim_output/insert_tau/tau-_{P}GeV.hepmc"
warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root"
params:
PHYSICS_LIST="FTFP_BERT"
output:
SIM_FILE="sim_output/insert_tau/{DETECTOR_CONFIG}_sim_tau-_{P}GeV.edm4hep.root"
SIM_FILE="sim_output/insert_tau/{DETECTOR_CONFIG}_sim_tau-_{P}GeV_{INDEX}.edm4hep.root"
shell:
"""
NEVENTS_SIM=1000
# Running simulation
npsim \
--compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \
--numberOfEvents $NEVENTS_SIM \
--skipNEvents $(( $NEVENTS_SIM * {wildcards.INDEX} )) \
--physicsList {params.PHYSICS_LIST} \
--inputFiles {input.GEN_FILE} \
--outputFile {output.SIM_FILE}
"""

rule insert_tau_recon:
input:
SIM_FILE="sim_output/insert_tau/{DETECTOR_CONFIG}_sim_tau-_{P}GeV.edm4hep.root"
SIM_FILE="sim_output/insert_tau/{DETECTOR_CONFIG}_sim_tau-_{P}GeV_{INDEX}.edm4hep.root"
output:
REC_FILE="sim_output/insert_tau/{DETECTOR_CONFIG}_rec_tau-_{P}GeV.edm4hep.root"
REC_FILE="sim_output/insert_tau/{DETECTOR_CONFIG}_rec_tau-_{P}GeV_{INDEX}.edm4hep.root"
shell:
"""
NEVENTS_REC=1000
Expand All @@ -44,9 +46,11 @@ eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Pdd4hep:xml_fil

rule insert_tau_analysis:
input:
expand("sim_output/insert_tau/{DETECTOR_CONFIG}_rec_tau-_{P}GeV.edm4hep.root",
expand("sim_output/insert_tau/{DETECTOR_CONFIG}_rec_tau-_{P}GeV.edm4hep_{INDEX}.root",
P=[20,30, 40,50,60, 80, 100],
DETECTOR_CONFIG=["{DETECTOR_CONFIG}"]),
DETECTOR_CONFIG=["{DETECTOR_CONFIG}"],
INDEX=range(5),
),
script="benchmarks/insert_tau/analysis/tau_plots.py",
output:
results_dir=directory("results/{DETECTOR_CONFIG}/insert_tau"),
Expand Down
22 changes: 14 additions & 8 deletions benchmarks/insert_tau/config.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
sim:insert_muon:
sim:insert_tau:
stage: simulate
extends: .det_benchmark
needs: ["common:detector"]
parallel:
matrix:
- P: 20
- P: 30
- P: 40
- P: 50
- P: 60
- P: 80
- P: 100
timeout: 1 hours
script:
- snakemake --cores 1 sim_output/insert_muon/epic_craterlake_sim_mu-_${P}GeV.edm4hep.root
- snakemake $SNAKEMAKE_FLAGS --cores 5 sim_output/insert_tau/epic_craterlake_sim_tau-_${P}GeV_{0,1,2,3,4}.edm4hep.root
retry:
max: 2
when:
- runner_system_failure

bench:insert_muon:
bench:insert_tau:
stage: benchmarks
extends: .det_benchmark
needs: ["sim:insert_muon"]
needs: ["sim:insert_tau"]
script:
- snakemake --cores 1 results/epic_craterlake/insert_muon
- snakemake $SNAKEMAKE_FLAGS --cores 1 results/epic_craterlake/insert_tau

collect_results:insert_muon:
collect_results:insert_tau:
stage: collect
needs: ["bench:insert_muon"]
needs: ["bench:insert_tau"]
script:
- ls -al
- mv results{,_save}/ # move results directory out of the way to preserve it
- snakemake --cores 1 --delete-all-output results/epic_craterlake/insert_muon
- snakemake $SNAKEMAKE_FLAGS --cores 1 --delete-all-output results/epic_craterlake/insert_tau
- mv results{_save,}/

0 comments on commit 956ac17

Please sign in to comment.